mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Cleanup.
This commit is contained in:
parent
42c9dafd03
commit
cd2d643522
1 changed files with 34 additions and 12 deletions
|
@ -268,8 +268,11 @@ namespace entry
|
|||
{
|
||||
const SDL_MouseMotionEvent& mev = event.motion;
|
||||
WindowHandle handle = findHandle(mev.windowID);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
m_eventQueue.postMouseEvent(handle, mev.x, mev.y, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
|
@ -277,8 +280,11 @@ namespace entry
|
|||
{
|
||||
const SDL_MouseButtonEvent& mev = event.button;
|
||||
WindowHandle handle = findHandle(mev.windowID);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
m_eventQueue.postMouseEvent(handle, mev.x, mev.y, 0, MouseButton::Left, mev.type == SDL_MOUSEBUTTONDOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
|
@ -286,10 +292,13 @@ namespace entry
|
|||
{
|
||||
const SDL_KeyboardEvent& kev = event.key;
|
||||
WindowHandle handle = findHandle(kev.windowID);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
uint8_t modifiers = translateKeyModifiers(kev.keysym.mod);
|
||||
Key::Enum key = translateKey(kev.keysym.scancode);
|
||||
m_eventQueue.postKeyEvent(handle, key, modifiers, kev.state == SDL_PRESSED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
|
@ -367,17 +376,23 @@ namespace entry
|
|||
case SDL_USER_WINDOW_DESTROY:
|
||||
{
|
||||
WindowHandle handle = getWindowHandle(uev);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
m_eventQueue.postWindowEvent(handle);
|
||||
SDL_DestroyWindow(m_window[handle.idx]);
|
||||
m_window[handle.idx] = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_USER_WINDOW_SET_TITLE:
|
||||
{
|
||||
WindowHandle handle = getWindowHandle(uev);
|
||||
Msg* msg = (Msg*)uev.data2;
|
||||
if (isValid(handle) )
|
||||
{
|
||||
SDL_SetWindowTitle(m_window[handle.idx], msg->m_title.c_str());
|
||||
}
|
||||
delete msg;
|
||||
}
|
||||
break;
|
||||
|
@ -395,16 +410,23 @@ namespace entry
|
|||
{
|
||||
WindowHandle handle = getWindowHandle(uev);
|
||||
Msg* msg = (Msg*)uev.data2;
|
||||
if (isValid(handle) )
|
||||
{
|
||||
setWindowSize(handle, msg->m_width, msg->m_height);
|
||||
}
|
||||
delete msg;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_USER_WINDOW_TOGGLE_FRAME:
|
||||
{
|
||||
WindowHandle handle = getWindowHandle(uev);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
m_flags[handle.idx] ^= ENTRY_WINDOW_FLAG_FRAME;
|
||||
SDL_SetWindowBordered(m_window[handle.idx], (SDL_bool)!!(m_flags[handle.idx] & ENTRY_WINDOW_FLAG_FRAME) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_USER_WINDOW_MOUSE_LOCK:
|
||||
|
|
Loading…
Reference in a new issue