Improve keyboard/controller-based menu navigation by separating each row into its own structure.

This commit is contained in:
2023-10-01 01:11:53 -05:00
parent 03f2738ead
commit 60e46a83f2
4 changed files with 146 additions and 43 deletions
+13 -3
View File
@@ -2008,7 +2008,6 @@ namespace olc
// Construct the window
if (platform->CreateWindowPane({ 30,30 }, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
olc_UpdateWindowPos(30,30);
olc_UpdateWindowSize(vWindowSize.x, vWindowSize.y);
// Start the thread
@@ -5547,6 +5546,8 @@ namespace olc
olc_hWnd = CreateWindowEx(dwExStyle, olcT("OLC_PIXEL_GAME_ENGINE"), olcT(""), dwStyle,
vTopLeft.x, vTopLeft.y, width, height, NULL, NULL, GetModuleHandle(nullptr), this);
MoveWindow(olc_hWnd,vTopLeft.x,vTopLeft.y,width,height,false); //A hack to get the window's position updated in the correct spot (WM_MOVE reports the correct upper-left corner of the client area)
DragAcceptFiles(olc_hWnd, true);
// Create Keyboard Mapping
@@ -5642,7 +5643,13 @@ namespace olc
ptrPGE->olc_UpdateMouse(ix, iy);
return 0;
}
case WM_MOVE: ptrPGE->olc_UpdateWindowPos(lParam & 0xFFFF, (lParam >> 16) & 0xFFFF); return 0;
case WM_MOVE:
{
uint16_t x = lParam & 0xFFFF; uint16_t y = (lParam >> 16) & 0xFFFF;
int16_t ix = *(int16_t*)&x; int16_t iy = *(int16_t*)&y;
ptrPGE->olc_UpdateWindowPos(ix, iy);
return 0;
}
case WM_SIZE: ptrPGE->olc_UpdateWindowSize(lParam & 0xFFFF, (lParam >> 16) & 0xFFFF); return 0;
case WM_MOUSEWHEEL: ptrPGE->olc_UpdateMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam)); return 0;
case WM_MOUSELEAVE: ptrPGE->olc_UpdateMouseFocus(false); return 0;
@@ -6624,7 +6631,10 @@ namespace olc
{ emscripten_set_window_title(s.c_str()); return olc::OK; }
virtual olc::rcode StartSystemEventLoop() override
{ return olc::OK; }
{
ptrPGE->olc_UpdateWindowPos(EM_ASM_INT({return Module.canvas.getBoundingClientRect().left}),EM_ASM_INT({return Module.canvas.getBoundingClientRect().top}));
return olc::OK;
}
virtual olc::rcode HandleSystemEvent() override
{