Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bkaradzic/bgfx
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Mar 16, 2015
2 parents 4c9a0ec + 93ee7f1 commit 68810fb
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 73 deletions.
4 changes: 2 additions & 2 deletions examples/common/entry/entry_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ void toggleFullscreen(WindowHandle _handle)

if (!s_ctx.m_fullscreen)
{
[NSMenu setMenuBarVisible: false];
s_ctx.m_style &= ~NSTitledWindowMask;
dispatch_async(dispatch_get_main_queue()
, ^{
[NSMenu setMenuBarVisible: false];
[window setStyleMask: s_ctx.m_style];
[window setFrame:screenRect display:YES];
});
Expand All @@ -596,10 +596,10 @@ void toggleFullscreen(WindowHandle _handle)
}
else
{
[NSMenu setMenuBarVisible: true];
s_ctx.m_style |= NSTitledWindowMask;
dispatch_async(dispatch_get_main_queue()
, ^{
[NSMenu setMenuBarVisible: true];
[window setStyleMask: s_ctx.m_style];
[window setFrame:s_ctx.m_windowFrame display:YES];
});
Expand Down
22 changes: 21 additions & 1 deletion examples/common/entry/entry_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -745,6 +764,7 @@ namespace entry

int32_t m_mx;
int32_t m_my;
int32_t m_mz;
bool m_mouseLock;
bool m_fullscreen;
};
Expand Down
Loading

0 comments on commit 68810fb

Please sign in to comment.