diff options
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/display_server_windows.cpp | 8 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 17 |
2 files changed, 10 insertions, 15 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index ca2b68371c..091bed36ea 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2079,7 +2079,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA mm->set_position(c); mm->set_global_position(c); Input::get_singleton()->set_mouse_position(c); - mm->set_speed(Vector2(0, 0)); + mm->set_velocity(Vector2(0, 0)); if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE) { mm->set_relative(Vector2(raw->data.mouse.lLastX, raw->data.mouse.lLastY)); @@ -2184,7 +2184,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } Input::get_singleton()->set_mouse_position(mm->get_position()); - mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); + mm->set_velocity(Input::get_singleton()->get_last_mouse_velocity()); if (old_invalid) { old_x = mm->get_position().x; @@ -2326,7 +2326,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } Input::get_singleton()->set_mouse_position(mm->get_position()); - mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); + mm->set_velocity(Input::get_singleton()->get_last_mouse_velocity()); if (old_invalid) { old_x = mm->get_position().x; @@ -2427,7 +2427,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } Input::get_singleton()->set_mouse_position(mm->get_position()); - mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); + mm->set_velocity(Input::get_singleton()->get_last_mouse_velocity()); if (old_invalid) { old_x = mm->get_position().x; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 8477746001..203e078cb4 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -184,12 +184,8 @@ void OS_Windows::initialize() { NetSocketPosix::make_default(); // We need to know how often the clock is updated - if (!QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second)) - ticks_per_second = 1000; - // If timeAtGameStart is 0 then we get the time since - // the start of the computer when we call GetGameTime() - ticks_start = 0; - ticks_start = get_ticks_usec(); + QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second); + QueryPerformanceCounter((LARGE_INTEGER *)&ticks_start); // set minimum resolution for periodic timers, otherwise Sleep(n) may wait at least as // long as the windows scheduler resolution (~16-30ms) even for calls like Sleep(1) @@ -369,8 +365,10 @@ uint64_t OS_Windows::get_ticks_usec() const { uint64_t ticks; // This is the number of clock ticks since start - if (!QueryPerformanceCounter((LARGE_INTEGER *)&ticks)) - ticks = (UINT64)timeGetTime(); + QueryPerformanceCounter((LARGE_INTEGER *)&ticks); + // Subtract the ticks at game start to get + // the ticks since the game started + ticks -= ticks_start; // Divide by frequency to get the time in seconds // original calculation shown below is subject to overflow @@ -390,9 +388,6 @@ uint64_t OS_Windows::get_ticks_usec() const { // seconds time += seconds * 1000000L; - // Subtract the time at game start to get - // the time since the game started - time -= ticks_start; return time; } |