mirror of
https://github.com/brmlab/ledbar.git
synced 2025-06-09 21:34:00 +02:00
Factor out #define FPS, sleep -> wait
This commit is contained in:
parent
ea6ebd7d2c
commit
86890d1a4d
1 changed files with 6 additions and 5 deletions
|
@ -34,6 +34,7 @@
|
|||
#define RESY 600
|
||||
#define BPP 32
|
||||
#define BOXES 10
|
||||
#define FPS 40
|
||||
|
||||
SDL_Rect rects[BOXES];
|
||||
|
||||
|
@ -271,7 +272,7 @@ int main(int argc, char* argv[])
|
|||
int t = 0;
|
||||
int size;
|
||||
int lastUpdate = 0;
|
||||
int sleep;
|
||||
int wait;
|
||||
FILE* fp;
|
||||
|
||||
if (argc == 1) fp = 0;
|
||||
|
@ -318,11 +319,11 @@ int main(int argc, char* argv[])
|
|||
break;
|
||||
}
|
||||
}
|
||||
sleep = 25 - (SDL_GetTicks() - lastUpdate);
|
||||
if (sleep > 0) {
|
||||
SDL_Delay(sleep);
|
||||
wait = 1000/FPS - (SDL_GetTicks() - lastUpdate);
|
||||
if (wait > 0) {
|
||||
SDL_Delay(wait);
|
||||
}
|
||||
lastUpdate += 25;
|
||||
lastUpdate += 1000/FPS;
|
||||
}
|
||||
SDL_Quit();
|
||||
if (fp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue