Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Input on emscripten #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions oxygine/src/oxygine/core/oxygine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,6 @@ namespace oxygine
{
Input* input = &Input::instance;




Event ev(EVENT_SYSTEM);
ev.userData = &event;
_dispatcher->dispatchEvent(&ev);
Expand Down Expand Up @@ -682,13 +679,19 @@ namespace oxygine
getStageByWindow(event.window.windowID)->dispatchEvent(&ev);
} break;

#ifdef EMSCRIPTEN
_useTouchAPI = false;
#endif
case SDL_MOUSEMOTION:
if (!_useTouchAPI)
input->sendPointerMotionEvent(getStageByWindow(event.window.windowID), (float)event.motion.x, (float)event.motion.y, 1.0f, &input->_pointerMouse);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
#ifdef EMSCRIPTEN
_useTouchAPI = false;
#endif
if (!_useTouchAPI)
{
MouseButton b = MouseButton_Left;
Expand All @@ -698,7 +701,6 @@ namespace oxygine
case 2: b = MouseButton_Middle; break;
case 3: b = MouseButton_Right; break;
}

input->sendPointerButtonEvent(getStageByWindow(event.window.windowID), b, (float)event.button.x, (float)event.button.y, 1.0f,
event.type == SDL_MOUSEBUTTONDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP, &input->_pointerMouse);
}
Expand Down Expand Up @@ -752,7 +754,7 @@ namespace oxygine
#ifndef OXYGINE_EDITOR
key::update();
#endif

Point ds = getDisplaySize();
//logs::messageln("SDL_GL_GetDrawableSize: %d %d", ds.x, ds.y);

Expand Down