hyperkaos/Timer.c

27 lines
401 B
C

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "Timer.h"
Timer* newTimer()
{
Timer* self = (Timer*)malloc(sizeof(Timer));
self->startTicks = 0;
return self;
}
void timeStart(Timer* self)
{
self->startTicks = SDL_GetTicks();
}
int getTicks(Timer* self)
{
if (self->startTicks)
return SDL_GetTicks() - self->startTicks;
else return 0;
}