First cut of pulling out the relevant parts of my original game to make a little framework.
This commit is contained in:
commit
6a0c9e8d46
177 changed files with 18197 additions and 0 deletions
73
src/gui/fsm.hpp
Normal file
73
src/gui/fsm.hpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#pragma once
|
||||
|
||||
#include "constants.hpp"
|
||||
#include "algos/simplefsm.hpp"
|
||||
#include "gui/debug_ui.hpp"
|
||||
#include "gui/main_ui.hpp"
|
||||
#include "gui/status_ui.hpp"
|
||||
#include "gui/loot_ui.hpp"
|
||||
#include "gui/map_view.hpp"
|
||||
#include "events.hpp"
|
||||
#include "gui/event_router.hpp"
|
||||
#include "gui/dnd_loot.hpp"
|
||||
#include "events.hpp"
|
||||
|
||||
namespace gui {
|
||||
enum class State {
|
||||
START=__LINE__,
|
||||
MOVING=__LINE__,
|
||||
IN_COMBAT=__LINE__,
|
||||
COMBAT_ROTATE=__LINE__,
|
||||
ATTACKING=__LINE__,
|
||||
ROTATING=__LINE__,
|
||||
LOOTING=__LINE__,
|
||||
IDLE=__LINE__,
|
||||
END=__LINE__,
|
||||
};
|
||||
|
||||
class FSM : public DeadSimpleFSM<State, game::Event> {
|
||||
public:
|
||||
sf::RenderWindow $window;
|
||||
bool $draw_stats = false;
|
||||
bool autowalking = false;
|
||||
bool $map_open = false;
|
||||
DebugUI $debug_ui;
|
||||
MainUI $main_ui;
|
||||
StatusUI $status_ui{STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT};
|
||||
MapViewUI $map_ui;
|
||||
LootUI $loot_ui;
|
||||
gui::routing::Router $router;
|
||||
DNDLoot $dnd_loot;
|
||||
|
||||
FSM();
|
||||
|
||||
void event(game::Event ev, std::any data={});
|
||||
void autowalk();
|
||||
void start_autowalk(double rot_speed);
|
||||
|
||||
void START(game::Event ev);
|
||||
void MOVING(game::Event ev);
|
||||
void ATTACKING(game::Event ev, std::any data);
|
||||
void MAPPING(game::Event ev);
|
||||
void ROTATING(game::Event ev);
|
||||
void IDLE(game::Event ev, std::any data);
|
||||
void IN_COMBAT(game::Event ev);
|
||||
void COMBAT_ROTATE(game::Event ev);
|
||||
void LOOTING(game::Event ev, std::any data);
|
||||
void END(game::Event ev);
|
||||
|
||||
void try_move(int dir, bool strafe);
|
||||
sf::Vector2f mouse_position();
|
||||
void mouse_action(guecs::Modifiers mods);
|
||||
void handle_keyboard_mouse();
|
||||
void draw_gui();
|
||||
void update();
|
||||
void render();
|
||||
bool active();
|
||||
void run_systems();
|
||||
void handle_world_events();
|
||||
void next_level();
|
||||
void debug_render();
|
||||
void take_screenshot();
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue