summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorPatrick Dawson <pat@dw.is>2022-11-28 03:38:47 +0100
committerPatrick Dawson <pat@dw.is>2022-11-28 03:38:47 +0100
commit1aa49593815203841bfc598f8d2c74d18294b578 (patch)
tree5412f9ec23d45143dd2a3ee2df827283efec2b04 /platform/windows
parent4a82d71d7345d0dde4da2816fd489da1c303f580 (diff)
[Windows] Fix joypad crash
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 0b878feb7f..29482213d8 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -3919,6 +3919,8 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
WindowID main_window = _create_window(p_mode, p_vsync_mode, 0, Rect2i(window_position, p_resolution));
ERR_FAIL_COND_MSG(main_window == INVALID_WINDOW_ID, "Failed to create main window.");
+ joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd);
+
for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
if (p_flags & (1 << i)) {
window_set_flag(WindowFlags(i), true, main_window);
@@ -3958,8 +3960,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
_update_real_mouse_position(MAIN_WINDOW_ID);
- joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd);
-
r_error = OK;
static_cast<OS_Windows *>(OS::get_singleton())->set_main_window(windows[MAIN_WINDOW_ID].hWnd);