try to make Character Editor less CPU hungry...

This commit is contained in:
ALONSO Laurent
2021-10-06 10:38:37 +02:00
committed by Celtic Minstrel
parent ce26cecd73
commit 0404bc7ba4

View File

@@ -180,20 +180,27 @@ void handle_events() {
cFramerateLimiter fps_limiter; cFramerateLimiter fps_limiter;
while(!All_Done) { while(!All_Done) {
bool need_redraw=false;
if(changed_display_mode) { if(changed_display_mode) {
need_redraw=true;
changed_display_mode = false; changed_display_mode = false;
adjust_window(mainPtr, mainView); adjust_window(mainPtr, mainView);
} }
#ifdef __APPLE__ #ifdef __APPLE__
if (menuChoiceId>=0) { if (menuChoiceId>=0) {
need_redraw=true;
handle_menu_choice(eMenu(menuChoiceId)); handle_menu_choice(eMenu(menuChoiceId));
menuChoiceId=-1; menuChoiceId=-1;
} }
#endif #endif
while(mainPtr.pollEvent(currentEvent)) handle_one_event(currentEvent); while(mainPtr.pollEvent(currentEvent)) {
need_redraw=true;
redraw_everything(); handle_one_event(currentEvent);
}
if (need_redraw)
redraw_everything();
// Prevent the loop from executing too fast. // Prevent the loop from executing too fast.
fps_limiter.frame_finished(); fps_limiter.frame_finished();