Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL/SDL.h>
- #include "timer.h"
- Uint32 timer_reset(g_timer *t) {
- t->ticks = 0;
- t->start_ticks = SDL_GetTicks();
- t->paused = 0;
- return t->start_ticks;
- }
- int timer_pause(g_timer *t) {
- t->paused = !(t->paused);
- t->ticks = SDL_GetTicks() - t->start_ticks;
- return t->paused;
- }
- Uint32 timer_ticks(g_timer *t) {
- if (!(t->paused))
- t->ticks = SDL_GetTicks() - t->start_ticks;
- return t->ticks;
- }
Advertisement
Add Comment
Please, Sign In to add comment