katbug/Timer.c
2019-02-04 13:24:24 -08:00

25 lines
399 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;
}