mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
OSX prefers scroll be implemented this way.
This commit is contained in:
parent
6b7739660c
commit
9a23cf7b42
1 changed files with 7 additions and 3 deletions
|
@ -77,7 +77,8 @@ namespace entry
|
||||||
struct Context
|
struct Context
|
||||||
{
|
{
|
||||||
Context()
|
Context()
|
||||||
: m_scroll(0)
|
: m_scrollf(0.0f)
|
||||||
|
, m_scroll(0)
|
||||||
, m_exit(false)
|
, m_exit(false)
|
||||||
{
|
{
|
||||||
s_translateKey[27] = Key::Esc;
|
s_translateKey[27] = Key::Esc;
|
||||||
|
@ -292,9 +293,11 @@ namespace entry
|
||||||
|
|
||||||
case NSScrollWheel:
|
case NSScrollWheel:
|
||||||
{
|
{
|
||||||
|
m_scrollf += [event deltaY];
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
getMousePos(&x, &y);
|
getMousePos(&x, &y);
|
||||||
m_scroll += ([event deltaY] > 0.0f) ? 1 : -1;
|
m_scroll = (int32_t)m_scrollf;
|
||||||
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll);
|
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -443,8 +446,9 @@ namespace entry
|
||||||
bx::HandleAllocT<ENTRY_CONFIG_MAX_WINDOWS> m_windowAlloc;
|
bx::HandleAllocT<ENTRY_CONFIG_MAX_WINDOWS> m_windowAlloc;
|
||||||
NSWindow* m_window[ENTRY_CONFIG_MAX_WINDOWS];
|
NSWindow* m_window[ENTRY_CONFIG_MAX_WINDOWS];
|
||||||
|
|
||||||
|
float m_scrollf;
|
||||||
int32_t m_scroll;
|
int32_t m_scroll;
|
||||||
bool m_exit;
|
bool m_exit;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Context s_ctx;
|
static Context s_ctx;
|
||||||
|
|
Loading…
Reference in a new issue