#include "gui/fsm.hpp" #include "textures.hpp" #include "sound.hpp" #include "autowalker.hpp" #include "ai.hpp" #include "animation.hpp" #include #include "shaders.hpp" #include "backend.hpp" #include "game_level.hpp" #include "boss/system.hpp" #include "gui/fsm_events.hpp" #include "events.hpp" #include "constants.hpp" #include "gui/event_router.hpp" void craft_weapon() { auto world = GameDB::current_world(); auto& the_belt = world->get_the(); ritual::Action action{1.0, 20, ritual::Kind::MAGICK, ritual::Element::FIRE, {"fake"}}; the_belt.equip(the_belt.next(), action); } int main(int, char*[]) { components::init(); sfml::Backend backend; guecs::init(&backend); ai::init("ai"); animation::init(); GameDB::init(); sf::RenderWindow window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Bossfight Testing Arena"); gui::routing::Router router; sound::mute(true); sound::play("ambient_1", true); GameDB::create_level(); craft_weapon(); auto main = boss::System::create_bossfight(); auto world = GameDB::current_world(); while(!main->in_state(boss::State::END)) { main->mouse_pos = window.mapPixelToCoords(router.position); while(const auto ev = window.pollEvent()) { auto gui_ev = router.process_event(ev); if(gui_ev == gui::Event::QUIT || main->event(gui_ev, {})) { return 0; } else { main->event(gui::Event::TICK, {}); } } while(world->has_event()) { auto [evt, entity, data] = world->recv(); // FIX YOUR DAMN EVENTS switch(evt) { case Events::GUI::ATTACK: main->event(gui::Event::ATTACK, data); break; default: fmt::println("GUI EVENT: {} entity={}", int(evt), entity); } } window.clear(); main->render(window); window.display(); } return 0; }