Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "SDL.h"
- static int oldtime;
- static int newtime;
- int timer (int interval)
- {
- return (oldtime/interval) != (newtime/interval);
- }
- int main(int argc, char *argv[])
- {
- ...
- for (;;)
- {
- oldtime = newtime;
- newtime = SDL_GetTicks ();
- if (timer (1000))
- {
- fputs ("1000\n", stdout);
- }
- if (timer (2000))
- {
- fputs ("2000\n", stdout);
- }
- if (timer (3000))
- {
- fputs ("3000\n", stdout);
- }
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement