From 4505cf4bdc3f7b62d2ae95868820b72c4ad5b557 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Sat, 7 Aug 2021 16:28:43 -0500 Subject: [PATCH] cleaned up the speeding up --- src/app.onyx | 2 +- src/config.onyx | 4 ++-- src/main.onyx | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/app.onyx b/src/app.onyx index 244d0e0..3f43d3d 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -293,7 +293,7 @@ handle_event :: (event: ^events.Event) { } } -needs_update :: () -> bool { +needs_redraw :: () -> bool { return ui.has_active_animation() || debug_log_y_offset != debug_log_y_offset_target; } diff --git a/src/config.onyx b/src/config.onyx index d9c8cf4..8f11ac6 100644 --- a/src/config.onyx +++ b/src/config.onyx @@ -4,9 +4,9 @@ package config use package immediate_mode { Color4 } -ONLY_UPDATE_ON_EVENTS :: true +ONLY_REDRAW_ON_EVENTS :: true -color_scheme_file :: "/res/colors_light.json" +color_scheme_file :: "/res/colors_dark.json" Colors : struct { dark_background : Color4; diff --git a/src/main.onyx b/src/main.onyx index 802b831..33ec77c 100644 --- a/src/main.onyx +++ b/src/main.onyx @@ -21,11 +21,10 @@ main :: (args: [] cstr) { dt := cast(f32) (now - last_time) / 1000.0f; last_time = now; - #if #defined(config.ONLY_UPDATE_ON_EVENTS) { - if poll_events() || app.needs_update() { - app.update(dt); - app.draw(); - } + #if #defined(config.ONLY_REDRAW_ON_EVENTS) { + redraw := poll_events() || app.needs_redraw(); + app.update(dt); + if redraw do app.draw(); } else { poll_events(); -- 2.25.1