summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorKyle Appelgate <[email protected]>2021-07-28 15:38:31 -0400
committerGitHub <[email protected]>2021-07-28 21:38:31 +0200
commitd8ca13f4c6efbf2511d7f212b0af2716320e3da9 (patch)
tree6daf98145c893bd32f08a34d16db8372085d1032 /src
parent8fecf45f4c8afe1858d08076223737c34a0f3d54 (diff)
downloadraylib-d8ca13f4c6efbf2511d7f212b0af2716320e3da9.tar.gz
raylib-d8ca13f4c6efbf2511d7f212b0af2716320e3da9.zip
fixed DisableCursor() on web by registering an empty mouse click event function in emscripten (#1900)
Diffstat (limited to 'src')
-rw-r--r--src/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index 03f60c6d..ea913dbb 100644
--- a/src/core.c
+++ b/src/core.c
@@ -622,6 +622,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
#endif
#if defined(PLATFORM_WEB)
+static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData);
static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData);
static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData);
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *e, void *userData);
@@ -823,6 +824,9 @@ void InitWindow(int width, int height, const char *title)
//emscripten_set_keypress_callback("#canvas", NULL, 1, EmscriptenKeyboardCallback);
//emscripten_set_keydown_callback("#canvas", NULL, 1, EmscriptenKeyboardCallback);
+ // Support mouse events
+ emscripten_set_click_callback("#canvas", NULL, 1, EmscriptenMouseCallback);
+
// Support touch events
emscripten_set_touchstart_callback("#canvas", NULL, 1, EmscriptenTouchCallback);
emscripten_set_touchend_callback("#canvas", NULL, 1, EmscriptenTouchCallback);
@@ -5315,6 +5319,13 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
#endif
#if defined(PLATFORM_WEB)
+// Register mouse input events
+static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
+{
+ // This is only for registering mouse click events with emscripten and doesn't need to do anything
+ return 0;
+}
+
// Register touch input events
static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
{