From 4459ab3fb4698711f224f421d58e4f86384793d8 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Sat, 7 Aug 2021 12:05:47 -0500 Subject: [PATCH] sped up the application --- site/index.html | 1 + src/app.onyx | 4 ++++ src/config.onyx | 2 ++ src/main.onyx | 3 ++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/site/index.html b/site/index.html index 0d1d02b..dfefdad 100644 --- a/site/index.html +++ b/site/index.html @@ -1,3 +1,4 @@ + Wasm-32 Decompiler diff --git a/src/app.onyx b/src/app.onyx index 1baad43..244d0e0 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -293,6 +293,10 @@ handle_event :: (event: ^events.Event) { } } +needs_update :: () -> bool { + return ui.has_active_animation() || debug_log_y_offset != debug_log_y_offset_target; +} + update :: (dt: f32) { } diff --git a/src/config.onyx b/src/config.onyx index 1e642cb..d9c8cf4 100644 --- a/src/config.onyx +++ b/src/config.onyx @@ -4,6 +4,8 @@ package config use package immediate_mode { Color4 } +ONLY_UPDATE_ON_EVENTS :: true + color_scheme_file :: "/res/colors_light.json" Colors : struct { diff --git a/src/main.onyx b/src/main.onyx index 1500686..802b831 100644 --- a/src/main.onyx +++ b/src/main.onyx @@ -2,6 +2,7 @@ #private_file events :: package js_events #private_file config :: package config #private_file app :: package app +#private_file ui :: package ui main :: (args: [] cstr) { app.init(); @@ -21,7 +22,7 @@ main :: (args: [] cstr) { last_time = now; #if #defined(config.ONLY_UPDATE_ON_EVENTS) { - if poll_events() { + if poll_events() || app.needs_update() { app.update(dt); app.draw(); } -- 2.25.1