| 1 |
Description: Sleep between handling events |
| 2 |
These can't accour that often and without a sleep we use way too much CPU. |
| 3 |
Forwarded: no |
| 4 |
Author: Evgeni Golov <[email protected]> |
| 5 |
Last-Update: 2012-05-01 |
| 6 |
|
| 7 |
Index: blocks-of-the-undead-1.0/TetrisAttack/src/CTetrisGame.cpp |
| 8 |
=================================================================== |
| 9 |
--- blocks-of-the-undead-1.0.orig/TetrisAttack/src/CTetrisGame.cpp 2005-01-17 05:49:02.000000000 +0100 |
| 10 |
+++ blocks-of-the-undead-1.0/TetrisAttack/src/CTetrisGame.cpp 2012-05-01 20:13:20.321936666 +0200 |
| 11 |
@@ -1,3 +1,4 @@ |
| 12 |
+#include <unistd.h> |
| 13 |
#include "tetris.h" |
| 14 |
|
| 15 |
CTetrisGame::CTetrisGame(int screenX, int screenY, int bitDepth, bool fullscreen, CTetrisTheme *theme, const list<CVector> &fieldOffsets) |
| 16 |
@@ -159,6 +160,7 @@ |
| 17 |
while (!done && SDL_PollEvent(&event)) |
| 18 |
{ |
| 19 |
handleEvent(event); |
| 20 |
+ usleep(200); |
| 21 |
} |
| 22 |
|
| 23 |
switch(state) |
| 24 |
@@ -281,6 +283,7 @@ |
| 25 |
ct = 0; |
| 26 |
(static_cast<CText*> (*(sprites.begin())))->setText(ss.str()); |
| 27 |
}*/ |
| 28 |
+ usleep(3000); |
| 29 |
} |
| 30 |
|
| 31 |
return true; |