From f48511147a5bef9a9ef991fc5dde5254793f1fae Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Fri, 24 Jan 2014 21:49:15 -0800 Subject: [PATCH] Fixed SDL entry mouse messages. --- examples/common/entry/entry_sdl.cpp | 11 +++++++---- include/bgfxplatform.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/common/entry/entry_sdl.cpp b/examples/common/entry/entry_sdl.cpp index cb1d994b..28856072 100644 --- a/examples/common/entry/entry_sdl.cpp +++ b/examples/common/entry/entry_sdl.cpp @@ -186,15 +186,16 @@ namespace entry case SDL_MOUSEMOTION: { const SDL_MouseMotionEvent& mev = event.motion; - int32_t mx = mev.xrel; - int32_t my = mev.yrel; - - m_eventQueue.postMouseEvent(mx, my); + m_eventQueue.postMouseEvent(mev.x, mev.y); } break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: + { + const SDL_MouseButtonEvent& mev = event.button; + m_eventQueue.postMouseEvent(mev.x, mev.y, MouseButton::Left, mev.type == SDL_MOUSEBUTTONDOWN); + } break; case SDL_KEYDOWN: @@ -269,6 +270,7 @@ namespace entry void setMousePos(int32_t _mx, int32_t _my) { + BX_UNUSED(_mx, _my); } void setMouseLock(bool _lock) @@ -371,6 +373,7 @@ namespace entry int main(int _argc, const char* _argv[]) { + BX_UNUSED(_argc, _argv); using namespace entry; s_ctx.run(); return 0; diff --git a/include/bgfxplatform.h b/include/bgfxplatform.h index 16769fec..255152e5 100755 --- a/include/bgfxplatform.h +++ b/include/bgfxplatform.h @@ -106,7 +106,7 @@ namespace bgfx { SDL_SysWMinfo wmi; SDL_VERSION(&wmi.version); - if (-1 == SDL_GetWindowWMInfo(_window, &wmi) ) + if (!SDL_GetWindowWMInfo(_window, &wmi) ) { return false; }