blob: 8ce66ebf1d31b41765737463e68eb07bbf9394ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--- tong.cpp.orig
+++ tong.cpp
@@ -64,6 +64,8 @@
#define DEMO_TIME 8000
+#define MIN_TIME 45
+
#define GP2X_BUTTON_UP 0
#define GP2X_BUTTON_UPLEFT 1
#define GP2X_BUTTON_LEFT 2
@@ -1854,6 +1856,13 @@
SDL_Flip(screen);
lastlastupdate=lastupdate;
lastupdate=SDL_GetTicks();
+
+ // limit to 1000/MIN_TIME fps
+ if (lastupdate-lastlastupdate < MIN_TIME) {
+ SDL_Delay(MIN_TIME - (lastupdate - lastlastupdate));
+ }
+ lastupdate = SDL_GetTicks();
+
} //main game loop
Mix_FreeMusic(music);
|