projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
moved video frame synchronization to single location (screen update)
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index d9104aa1be04172a8d64bc8be39b3afd8c57fb46..2127242f376221be14192a8d893f689e8b3c71f2 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-289,9
+289,6
@@
void HandleMouseCursor()
void EventLoop(void)
{
void EventLoop(void)
{
- unsigned int sync_frame_delay = 0;
- unsigned int sync_frame_delay_value = GAME_FRAME_DELAY;
-
while (1)
{
if (PendingEvent())
while (1)
{
if (PendingEvent())
@@
-308,11
+305,11
@@
void EventLoop(void)
if (game_status == GAME_MODE_PLAYING)
HandleGameActions();
if (game_status == GAME_MODE_PLAYING)
HandleGameActions();
- /*
refresh window contents from drawing buffer, if needed
*/
+ /*
always copy backbuffer to visible screen for every video frame
*/
BackToFront();
BackToFront();
- if (game_status != GAME_MODE_PLAYING)
-
WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value
);
+ /* reset video frame delay to default (may change again while playing) */
+
SetVideoFrameDelay(GAME_FRAME_DELAY
);
if (game_status == GAME_MODE_QUIT)
return;
if (game_status == GAME_MODE_QUIT)
return;
@@
-1159,6
+1156,7
@@
static void HandleKeysSpecial(Key key)
void HandleKey(Key key, int key_status)
{
boolean anyTextGadgetActiveOrJustFinished = anyTextGadgetActive();
void HandleKey(Key key, int key_status)
{
boolean anyTextGadgetActiveOrJustFinished = anyTextGadgetActive();
+ static boolean ignore_repeated_key = FALSE;
static struct SetupKeyboardInfo ski;
static struct SetupShortcutInfo ssi;
static struct
static struct SetupKeyboardInfo ski;
static struct SetupShortcutInfo ssi;
static struct
@@
-1326,12
+1324,18
@@
void HandleKey(Key key, int key_status)
key_joystick_mapping = 0;
if (key_status == KEY_RELEASED)
key_joystick_mapping = 0;
if (key_status == KEY_RELEASED)
+ {
+ // reset flag to ignore repeated "key pressed" events after key release
+ ignore_repeated_key = FALSE;
+
return;
return;
+ }
if ((key == KSYM_F11 ||
((key == KSYM_Return ||
key == KSYM_KP_Enter) && (GetKeyModState() & KMOD_Alt))) &&
if ((key == KSYM_F11 ||
((key == KSYM_Return ||
key == KSYM_KP_Enter) && (GetKeyModState() & KMOD_Alt))) &&
- video.fullscreen_available)
+ video.fullscreen_available &&
+ !ignore_repeated_key)
{
setup.fullscreen = !setup.fullscreen;
{
setup.fullscreen = !setup.fullscreen;
@@
-1340,6
+1344,9
@@
void HandleKey(Key key, int key_status)
if (game_status == GAME_MODE_SETUP)
RedrawSetupScreenAfterFullscreenToggle();
if (game_status == GAME_MODE_SETUP)
RedrawSetupScreenAfterFullscreenToggle();
+ // set flag to ignore repeated "key pressed" events
+ ignore_repeated_key = TRUE;
+
return;
}
return;
}