From 0ff5fd19804bbade31f539e15797ff0336507e15 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sat, 28 Feb 2026 10:59:28 -0500 Subject: [PATCH] First step to a normal update/render loop. --- src/gui/fsm.cpp | 14 +++++++++++--- src/gui/fsm.hpp | 1 + src/main.cpp | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gui/fsm.cpp b/src/gui/fsm.cpp index 7604e73..cd3d231 100644 --- a/src/gui/fsm.cpp +++ b/src/gui/fsm.cpp @@ -399,20 +399,28 @@ namespace gui { } } + void FSM::update() { + if(in_state(State::BOSS_FIGHT)) { + $boss_fight->update(); + } else if(in_state(State::CUT_SCENE_PLAYING)) { + $boss_scene->update(); + } else { + // BUG: look at draw_gui for the update for here + } + } + void FSM::render() { $window.clear(); if(in_state(State::BOSS_FIGHT)) { - $boss_fight->update(); $boss_fight->render($window); // this clears any attack animations, like fire - System::clear_attack(); } else if(in_state(State::CUT_SCENE_PLAYING)) { - $boss_scene->update(); $boss_scene->render($window); } else { // this clears any attack animations, like fire System::clear_attack(); + // BUG: this is the render for this class, and where I add an update draw_gui(); } diff --git a/src/gui/fsm.hpp b/src/gui/fsm.hpp index f3f5c4e..cc69765 100644 --- a/src/gui/fsm.hpp +++ b/src/gui/fsm.hpp @@ -71,6 +71,7 @@ namespace gui { void mouse_action(guecs::Modifiers mods); void handle_keyboard_mouse(); void draw_gui(); + void update(); void render(); bool active(); void run_systems(); diff --git a/src/main.cpp b/src/main.cpp index 85fbc27..ea68351 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ int main(int argc, char* argv[]) { } while(main.active()) { + main.update(); main.render(); if(main.in_state(gui::State::BOSS_FIGHT)) {