mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Added mouse scroll support to entry_sdl.
This commit is contained in:
parent
f3c300980d
commit
acd4dedfe1
1 changed files with 21 additions and 1 deletions
|
@ -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,19 @@ 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_KEYDOWN:
|
||||
{
|
||||
const SDL_KeyboardEvent& kev = event.key;
|
||||
|
@ -745,6 +764,7 @@ namespace entry
|
|||
|
||||
int32_t m_mx;
|
||||
int32_t m_my;
|
||||
int32_t m_mz;
|
||||
bool m_mouseLock;
|
||||
bool m_fullscreen;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue