diff options
author | 2015-03-17 11:08:12 +0100 | |
---|---|---|
committer | 2015-03-17 11:08:12 +0100 | |
commit | c14b7008256da37f3c1a947276eb47f1a37e7d26 (patch) | |
tree | 42aeb6cb4c0a4e067cce837fde9e7dd08c87a716 /3rdparty/bgfx/examples/common/entry/entry_sdl.cpp | |
parent | 1fa8cffd2705b0f7d4ac96c63e5d3546eb923ad6 (diff) |
Sync with latest (nw)
Diffstat (limited to '3rdparty/bgfx/examples/common/entry/entry_sdl.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/common/entry/entry_sdl.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp index c279f0fd2a6..b9564339c11 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -211,6 +211,9 @@ namespace entry : m_width(ENTRY_DEFAULT_WIDTH) , m_height(ENTRY_DEFAULT_HEIGHT) , m_aspectRatio(16.0f/9.0f) + , m_mx(0) + , m_my(0) + , m_mz(0) , m_mouseLock(false) , m_fullscreen(false) { @@ -376,10 +379,13 @@ namespace entry case SDL_MOUSEMOTION: { const SDL_MouseMotionEvent& mev = event.motion; + m_mx = mev.x; + m_my = mev.y; + WindowHandle handle = findHandle(mev.windowID); if (isValid(handle) ) { - m_eventQueue.postMouseEvent(handle, mev.x, mev.y, 0); + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_mz); } } break; @@ -411,6 +417,30 @@ namespace entry } break; + case SDL_MOUSEWHEEL: + { + const SDL_MouseWheelEvent& mev = event.wheel; + m_mz += mev.y; + + WindowHandle handle = findHandle(mev.windowID); + if (isValid(handle) ) + { + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_mz); + } + } + break; + + case SDL_TEXTINPUT: + { + const SDL_TextInputEvent& tev = event.text; + WindowHandle handle = findHandle(tev.windowID); + if (isValid(handle) ) + { + m_eventQueue.postCharEvent(handle, 1, (const uint8_t*)tev.text); + } + } + break; + case SDL_KEYDOWN: { const SDL_KeyboardEvent& kev = event.key; @@ -745,6 +775,7 @@ namespace entry int32_t m_mx; int32_t m_my; + int32_t m_mz; bool m_mouseLock; bool m_fullscreen; }; |