Guest User

Untitled

a guest
Jul 2nd, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <SDL/SDL.h>
  2. #include "timer.h"
  3.  
  4. Uint32 timer_reset(g_timer *t) {
  5.     t->ticks = 0;
  6.     t->start_ticks = SDL_GetTicks();
  7.     t->paused = 0;
  8.  
  9.     return t->start_ticks;
  10. }
  11.  
  12. int timer_pause(g_timer *t) {
  13.     t->paused = !(t->paused);
  14.     t->ticks = SDL_GetTicks() - t->start_ticks;
  15.     return t->paused;
  16. }
  17.  
  18. Uint32 timer_ticks(g_timer *t) {
  19.     if (!(t->paused))
  20.         t->ticks = SDL_GetTicks() - t->start_ticks;
  21.    
  22.     return t->ticks;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment