Add comments

This commit is contained in:
casavaca 2024-01-13 00:11:45 -08:00
parent e23ad1c8f8
commit 21e98a7eb5
No known key found for this signature in database
GPG Key ID: 916401545D431B19

View File

@ -1635,6 +1635,10 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
else if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) CORE.Input.Touch.currentTouchState[i] = 0; else if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) CORE.Input.Touch.currentTouchState[i] = 0;
} }
// Update mouse position if we detect a single touch.
// This is essential for raylib to work on touchscreen.
// Otherwise, mouse position will always be 0,0, so that
// things such as raygui and examples/shapes/shapes_lines_bezier.c won't work
if (CORE.Input.Touch.pointCount == 1) { if (CORE.Input.Touch.pointCount == 1) {
CORE.Input.Mouse.currentPosition.x = CORE.Input.Touch.position[0].x; CORE.Input.Mouse.currentPosition.x = CORE.Input.Touch.position[0].x;
CORE.Input.Mouse.currentPosition.y = CORE.Input.Touch.position[0].y; CORE.Input.Mouse.currentPosition.y = CORE.Input.Touch.position[0].y;