1
0
Fork 0

Add: 2D map scrolling on win32

pull/13172/head
Eri the Switch 2024-12-13 21:45:07 +03:00 committed by Eri the Switch
parent 69ee8a8480
commit 3a39b54601
No known key found for this signature in database
GPG Key ID: 49A787572A82FE58
1 changed files with 17 additions and 0 deletions

View File

@ -402,6 +402,8 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
static uint32_t keycode = 0;
static bool console = false;
const float SCROLL_BUILTIN_MULTIPLIER = 14.0f / WHEEL_DELTA;
VideoDriver_Win32Base *video_driver = (VideoDriver_Win32Base *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (msg) {
@ -704,6 +706,9 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#if !defined(WM_MOUSEWHEEL)
# define WM_MOUSEWHEEL 0x020A
#endif /* WM_MOUSEWHEEL */
#if !defined(WM_MOUSEHWHEEL)
# define WM_MOUSEHWHEEL 0x020E
#endif /* WM_MOUSEHWHEEL */
#if !defined(GET_WHEEL_DELTA_WPARAM)
# define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD(wparam))
#endif /* GET_WHEEL_DELTA_WPARAM */
@ -716,6 +721,18 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} else if (delta > 0) {
_cursor.wheel--;
}
_cursor.v_wheel -= static_cast<float>(delta) * SCROLL_BUILTIN_MULTIPLIER * _settings_client.gui.scrollwheel_multiplier;
_cursor.wheel_moved = true;
HandleMouseEvents();
return 0;
}
case WM_MOUSEHWHEEL: {
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
_cursor.h_wheel += static_cast<float>(delta) * SCROLL_BUILTIN_MULTIPLIER * _settings_client.gui.scrollwheel_multiplier;
_cursor.wheel_moved = true;
HandleMouseEvents();
return 0;
}