浏览代码

Make raylib/raygui work better on touchscreen (#3728)

* Fix that touch doesn't work for click/drag/raygui

* Add comments

* comments update
pull/3750/head
Hongyu Ouyang 1年前
committed by GitHub
父节点
当前提交
0a8165c0ac
找不到此签名对应的密钥 GPG 密钥 ID: B5690EEEBB952194
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. +7
    -0
      src/platforms/rcore_web.c

+ 7
- 0
src/platforms/rcore_web.c 查看文件

@ -1646,6 +1646,13 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
else if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) CORE.Input.Touch.currentTouchState[i] = 0;
}
// Update mouse position if we detect a single touch.
if (CORE.Input.Touch.pointCount == 1)
{
CORE.Input.Mouse.currentPosition.x = CORE.Input.Touch.position[0].x;
CORE.Input.Mouse.currentPosition.y = CORE.Input.Touch.position[0].y;
}
#if defined(SUPPORT_GESTURES_SYSTEM)
GestureEvent gestureEvent = {0};

正在加载...
取消
保存