pull/271/merge
LaBodilsen 3 years ago committed by GitHub
commit 20468e51ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      olcPixelGameEngine.h

@ -195,7 +195,7 @@
Author
~~~~~~
David Barr, aka javidx9, ©OneLoneCoder 2018, 2019, 2020, 2021, 2022
David Barr, aka javidx9, ©OneLoneCoder 2018, 2019, 2020, 2021, 2022
*/
#pragma endregion
@ -5052,10 +5052,19 @@ namespace olc
// Windows Event Handler - this is statically connected to the windows event system
static LRESULT CALLBACK olc_WindowEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_MOUSEMOVE:
static BOOL bTrackMouseEventSet = FALSE;
switch (uMsg)
{
case WM_MOUSEMOVE:
{
if (!bTrackMouseEventSet)
{
bTrackMouseEventSet = TRUE;
TRACKMOUSEEVENT tme{ sizeof(TRACKMOUSEEVENT), TME_LEAVE, hWnd }; TrackMouseEvent(&tme);
ptrPGE->olc_UpdateMouseState(olc::Mouse::LEFT, wParam == MK_LBUTTON);
ptrPGE->olc_UpdateMouseState(olc::Mouse::RIGHT, wParam == MK_RBUTTON);
ptrPGE->olc_UpdateMouseState(olc::Mouse::MIDDLE, wParam == MK_MBUTTON);
}
// Thanks @ForAbby (Discord)
uint16_t x = lParam & 0xFFFF; uint16_t y = (lParam >> 16) & 0xFFFF;
int16_t ix = *(int16_t*)&x; int16_t iy = *(int16_t*)&y;
@ -5064,7 +5073,7 @@ namespace olc
}
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;
case WM_MOUSELEAVE: bTrackMouseEventSet = FALSE; ptrPGE->olc_UpdateMouseFocus(false); return 0;
case WM_SETFOCUS: ptrPGE->olc_UpdateKeyFocus(true); return 0;
case WM_KILLFOCUS: ptrPGE->olc_UpdateKeyFocus(false); return 0;
case WM_KEYDOWN: ptrPGE->olc_UpdateKeyState(mapKeys[wParam], true); return 0;

Loading…
Cancel
Save