Fixed "custom frame_control" example for PLATFORM_WEB (#2379)
After a lot of head-scratching I realized that PollInputEvents must always be called as late as possible! When SUPPORT_CUSTOM_FRAME_CONTROL is disabled, EndDrawing already calls PollInputEvents last. It seems that the following pull request was on to something: https://github.com/raysan5/raylib/pull/1573
This commit is contained in:
parent
cda1324e87
commit
b6bb9169c1
|
|
@ -54,8 +54,6 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
|
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_UP)) targetFPS += 20;
|
if (IsKeyPressed(KEY_UP)) targetFPS += 20;
|
||||||
|
|
@ -113,6 +111,8 @@ int main(void)
|
||||||
else deltaTime = updateDrawTime; // Framerate could be variable
|
else deltaTime = updateDrawTime; // Framerate could be variable
|
||||||
|
|
||||||
previousTime = currentTime;
|
previousTime = currentTime;
|
||||||
|
|
||||||
|
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user