Reviewed multitouch example #1988

This commit is contained in:
raysan5 2021-10-22 11:53:47 +02:00
parent cbeb29d9d1
commit dd6e006d78
2 changed files with 15 additions and 31 deletions

View file

@ -3876,7 +3876,7 @@ static bool InitGraphicsDevice(int width, int height)
#if defined(PLATFORM_DESKTOP)
// NOTE: GLFW 3.4+ defers initialization of the Joystick subsystem on the first call to any Joystick related functions.
// Forcing this initialization here avoids doing it on `PollInputEvents` called by `EndDrawing` after first frame has been just drawn.
// Forcing this initialization here avoids doing it on PollInputEvents() called by EndDrawing() after first frame has been just drawn.
// The initialization will still happen and possible delays still occur, but before the window is shown, which is a nicer experience.
// REF: https://github.com/raysan5/raylib/issues/1554
if (MAX_GAMEPADS > 0) glfwSetJoystickCallback(NULL);
@ -4765,6 +4765,11 @@ void PollInputEvents(void)
// Register previous touch states
for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];
// Reset touch positions
// TODO: It resets on PLATFORM_WEB the mouse position and not filled again until a move-event,
// so, if mouse is not moved it returns a (0, 0) position... this behaviour should be reviewed!
//for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.position[i] = (Vector2){ 0, 0 };
#if defined(PLATFORM_DESKTOP)
// Check if gamepads are ready