projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed graphical responsiveness of gadgets (mainly in editor)
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index 7282236ff8609522682938faca0ad99c59dbf80b..7a03f33ffd88cb2f6be5d0e7dad8332332ecc55f 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-154,6
+154,9
@@
boolean NextValidEvent(Event *event)
void EventLoop(void)
{
void EventLoop(void)
{
+ static unsigned int sync_frame_delay = 0;
+ unsigned int sync_frame_delay_value = GAME_FRAME_DELAY;
+
while (1)
{
if (PendingEvent()) /* got event */
while (1)
{
if (PendingEvent()) /* got event */
@@
-205,6
+208,9
@@
void EventLoop(void)
HandleOtherEvents(&event);
break;
}
HandleOtherEvents(&event);
break;
}
+
+ if (DelayReached(&sync_frame_delay, sync_frame_delay_value))
+ BackToFront();
}
}
else
}
}
else
@@
-247,18
+253,14
@@
void EventLoop(void)
has its own synchronization and is CPU friendly, too */
if (game_status == GAME_MODE_PLAYING)
has its own synchronization and is CPU friendly, too */
if (game_status == GAME_MODE_PLAYING)
- {
HandleGameActions();
HandleGameActions();
- }
- else
- {
- if (!PendingEvent()) /* delay only if no pending events */
- Delay(10);
- }
/* refresh window contents from drawing buffer, if needed */
BackToFront();
/* refresh window contents from drawing buffer, if needed */
BackToFront();
+ if (game_status != GAME_MODE_PLAYING)
+ WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
+
if (game_status == GAME_MODE_QUIT)
return;
}
if (game_status == GAME_MODE_QUIT)
return;
}
@@
-1568,7
+1570,8
@@
void HandleKey(Key key, int key_status)
default:
if (key == KSYM_Escape)
{
default:
if (key == KSYM_Escape)
{
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
+
DrawMainMenu();
return;
DrawMainMenu();
return;