2018-09-20 01:27:47 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2019-01-09 22:26:38 +00:00
|
|
|
void timeStart(Timer* self)
|
2018-09-20 01:27:47 +00:00
|
|
|
{
|
2019-01-09 22:26:38 +00:00
|
|
|
self->startTicks = SDL_GetTicks();
|
2018-09-20 01:27:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-09 22:26:38 +00:00
|
|
|
int getTicks(Timer* self)
|
2018-09-20 01:27:47 +00:00
|
|
|
{
|
2019-01-09 22:26:38 +00:00
|
|
|
if (self->startTicks)
|
|
|
|
return SDL_GetTicks() - self->startTicks;
|
2018-09-20 01:27:47 +00:00
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|