You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.6 KiB
68 lines
1.6 KiB
#pragma once
|
|
#include "levelmanager.hpp"
|
|
#include "constants.hpp"
|
|
#include <deque>
|
|
#include "textures.hpp"
|
|
#include "guecs.hpp"
|
|
#include "rituals.hpp"
|
|
#include "fsm.hpp"
|
|
|
|
namespace gui {
|
|
namespace ritual {
|
|
enum class State {
|
|
START=0,
|
|
OPENED=1,
|
|
CLOSED=2,
|
|
OPENING=3,
|
|
CLOSING=4,
|
|
CRAFTING=5
|
|
};
|
|
|
|
enum class Event {
|
|
STARTED=0,
|
|
TOGGLE=1,
|
|
TICK=2,
|
|
SELECT=3,
|
|
COMBINE=4
|
|
};
|
|
|
|
struct SelectedItem {
|
|
DinkyECS::Entity slot_id;
|
|
DinkyECS::Entity item_id;
|
|
};
|
|
|
|
class UI : public DeadSimpleFSM<State, Event> {
|
|
public:
|
|
sf::IntRect $ritual_closed_rect{{0,0},{380,720}};
|
|
sf::IntRect $ritual_open_rect{{380 * 2,0},{380,720}};
|
|
components::Animation $ritual_anim;
|
|
guecs::UI $gui;
|
|
GameLevel $level;
|
|
textures::SpriteTexture $ritual_ui;
|
|
::ritual::Blanket& $blanket;
|
|
::ritual::Engine $ritual_engine;
|
|
::ritual::CraftingState $craft_state;
|
|
|
|
UI(GameLevel level);
|
|
|
|
void event(Event ev, std::any data={});
|
|
void START(Event);
|
|
void OPENED(Event, std::any data={});
|
|
void CRAFTING(Event, std::any data={});
|
|
void CLOSED(Event);
|
|
void OPENING(Event);
|
|
void CLOSING(Event);
|
|
|
|
bool mouse(float x, float y, bool hover);
|
|
void render(sf::RenderWindow &window);
|
|
bool is_open();
|
|
void load_blanket();
|
|
void clear_blanket();
|
|
void select_item(SelectedItem pair);
|
|
void show_craft_result();
|
|
void clear_craft_result();
|
|
void show_craft_failure();
|
|
void run_crafting_engine();
|
|
};
|
|
}
|
|
}
|
|
|