This fixes a bug that can happen due to bad initialization of a delay
counter (to limit the maximum time spent on handling events), causing
it to reach the maximum delay while the screen refresh is also waiting
for the video delay. Resetting the counter right after screen update
fixes this potential problem.
{ 282, 210, MARKER_AXIS_Y, "righty", },
};
{ 282, 210, MARKER_AXIS_Y, "righty", },
};
- unsigned int event_frame_delay = 0;
- unsigned int event_frame_delay_value = GAME_FRAME_DELAY;
-
- ResetDelayCounter(&event_frame_delay);
-
if (!bitmaps_initialized)
{
controller = LoadCustomImage("joystick/controller.png");
if (!bitmaps_initialized)
{
controller = LoadCustomImage("joystick/controller.png");
screen_initialized = TRUE;
screen_initialized = TRUE;
+ unsigned int event_frame_delay = 0;
+ unsigned int event_frame_delay_value = GAME_FRAME_DELAY;
+
+ // reset frame delay counter directly after updating screen
+ ResetDelayCounter(&event_frame_delay);
+
while (NextValidEvent(&event))
{
switch (event.type)
while (NextValidEvent(&event))
{
switch (event.type)