First step to a normal update/render loop.

This commit is contained in:
Zed A. Shaw 2026-02-28 10:59:28 -05:00
parent 46c6fce47e
commit 0ff5fd1980
3 changed files with 13 additions and 3 deletions

View file

@ -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();
}

View file

@ -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();

View file

@ -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)) {