Fix web client not compiling on really old emscripten versions such as 1.38.21

This commit is contained in:
UnknownShadow200 2020-06-25 23:45:56 +10:00
parent 8fd37cd31e
commit b8794585e4

View File

@ -3256,6 +3256,12 @@ static EM_BOOL OnKeyPress(int type, const EmscriptenKeyboardEvent* ev, void* dat
return true;
}
/* Really old emscripten versions (e.g. 1.38.21) don't have this defined */
/* Can't just use "#window", newer versions switched to const int instead */
#ifndef EMSCRIPTEN_EVENT_TARGET_WINDOW
#define EMSCRIPTEN_EVENT_TARGET_WINDOW "#window"
#endif
static void HookEvents(void) {
emscripten_set_wheel_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, OnMouseWheel);
emscripten_set_mousedown_callback("#canvas", NULL, 0, OnMouseButton);