Avoid cyclic iteration check, fixes #24969
This commit is contained in:
parent
c70c43c888
commit
0c9fd3c4b4
4 changed files with 19 additions and 2 deletions
|
@ -1789,6 +1789,10 @@ uint64_t Main::target_ticks = 0;
|
|||
uint32_t Main::frames = 0;
|
||||
uint32_t Main::frame = 0;
|
||||
bool Main::force_redraw_requested = false;
|
||||
bool Main::iterating = false;
|
||||
bool Main::is_iterating() {
|
||||
return iterating;
|
||||
}
|
||||
|
||||
// For performance metrics
|
||||
static uint64_t physics_process_max = 0;
|
||||
|
@ -1796,6 +1800,10 @@ static uint64_t idle_process_max = 0;
|
|||
|
||||
bool Main::iteration() {
|
||||
|
||||
ERR_FAIL_COND_V(iterating, false);
|
||||
|
||||
iterating = true;
|
||||
|
||||
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
|
||||
Engine::get_singleton()->_frame_ticks = ticks;
|
||||
main_timer_sync.set_cpu_ticks_usec(ticks);
|
||||
|
@ -1923,6 +1931,8 @@ bool Main::iteration() {
|
|||
frames = 0;
|
||||
}
|
||||
|
||||
iterating = false;
|
||||
|
||||
if (fixed_fps != -1)
|
||||
return exit;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ class Main {
|
|||
static uint32_t frames;
|
||||
static uint32_t frame;
|
||||
static bool force_redraw_requested;
|
||||
static bool iterating;
|
||||
|
||||
public:
|
||||
static bool is_project_manager();
|
||||
|
@ -58,6 +59,8 @@ public:
|
|||
static bool iteration();
|
||||
static void force_redraw();
|
||||
|
||||
static bool is_iterating();
|
||||
|
||||
static void cleanup();
|
||||
};
|
||||
|
||||
|
|
|
@ -304,7 +304,9 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
|
|||
if (OS_OSX::singleton->main_loop) {
|
||||
Main::force_redraw();
|
||||
//Event retrieval blocks until resize is over. Call Main::iteration() directly.
|
||||
Main::iteration();
|
||||
if (!Main::is_iterating()) { //avoid cyclic loop
|
||||
Main::iteration();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -783,7 +783,9 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_TIMER: {
|
||||
if (wParam == move_timer_id) {
|
||||
process_key_events();
|
||||
Main::iteration();
|
||||
if (!Main::is_iterating()) {
|
||||
Main::iteration();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue