blob: 59c1244d35373d9f92163e5a1602a36cd2ec7d12 (
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.ori 2007-10-15 19:27:54.000000000 +0200
+++ tong.cpp 2007-10-15 19:36:51.000000000 +0200
@@ -54,6 +54,8 @@
#define MENUMOUSE_THRESHOLD 40
#define DEMO_TIME 8000
+#define MIN_TIME 45
+
bool drop_piece(Tetrad*, Tetrad*, Bucket*, Uint32&, bool&, bool&, Option*,
int&);
@@ -1979,6 +1981,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
if(Mix_PlayingMusic()) {
|