diff --git a/boss/fight.cpp b/boss/fight.cpp index ea539a1..832dd2e 100644 --- a/boss/fight.cpp +++ b/boss/fight.cpp @@ -186,6 +186,10 @@ namespace boss { $ui.render(); } + void Fight::update() { + $ui.update(); + } + bool Fight::handle_mouse(game::Event ev) { using enum game::Event; $mouse_pos = $window->mapPixelToCoords($router.position); diff --git a/boss/fight.hpp b/boss/fight.hpp index 6485db3..1c1b03f 100644 --- a/boss/fight.hpp +++ b/boss/fight.hpp @@ -46,6 +46,7 @@ namespace boss { void ANIMATE(game::Event ev, std::any data); void END(game::Event ev, std::any data); void render(sf::RenderWindow& window); + void update(); bool handle_world_events(); void run_systems(); diff --git a/boss/ui.cpp b/boss/ui.cpp index 52dd706..70298eb 100644 --- a/boss/ui.cpp +++ b/boss/ui.cpp @@ -82,13 +82,17 @@ namespace boss { $actions.render(*$window); $combat_ui.render(*$window); - $arena.play_animations(); $arena.render($view_texture); $view_texture.display(); $window->draw($view_sprite); } + void UI::update() { + $arena.tick(); + $arena.play_animations(); + } + bool UI::mouse(float x, float y, Modifiers mods) { // BUG: arena is getting the _window_ coordinates, not the rendertexture return $combat_ui.mouse(x, y, mods) diff --git a/boss/ui.hpp b/boss/ui.hpp index 6c5d895..b5997e5 100644 --- a/boss/ui.hpp +++ b/boss/ui.hpp @@ -32,6 +32,7 @@ namespace boss { void init(); void set_window(sf::RenderWindow* window); void render(); + void update(); bool mouse(float x, float y, guecs::Modifiers mods); void status(const std::wstring& msg, const std::wstring &button_msg); void move_actor(const std::string& actor, const std::string& cell_name); diff --git a/tools/arena.cpp b/tools/arena.cpp index 14d598d..6ac0df4 100644 --- a/tools/arena.cpp +++ b/tools/arena.cpp @@ -50,8 +50,7 @@ int main(int, char*[]) { dbc::check(main->$world == world, "GameDB::current_world doesn't match boss fight world."); while(!main->in_state(boss::State::END)) { - dbc::log("IDIOT! make this an update."); - main->$ui.$arena.tick(); + main->update(); main->render(window); if(main->handle_keyboard_mouse() || main->handle_world_events())