DNDLoot works now, just had to fix a problem with the constructor.

master
Zed A. Shaw 6 days ago
parent 82ee8f68f7
commit 9468990f76
  1. 5
      gui/dnd_loot.cpp
  2. 14
      gui/dnd_loot.hpp
  3. 1
      gui/fsm.cpp
  4. 1
      main.cpp

@ -1,11 +1,10 @@
#define FSM_DEBUG 1
#include "gui/guecstra.hpp"
#include "gui/dnd_loot.hpp"
#include "gui/uisystems.hpp"
namespace gui {
DNDLoot::DNDLoot(StatusUI status_ui, LootUI loot_ui, sf::RenderWindow &window, routing::Router& router) :
DNDLoot::DNDLoot(StatusUI& status_ui, LootUI& loot_ui, sf::RenderWindow &window, routing::Router& router) :
$status_ui(status_ui),
$loot_ui(loot_ui),
$window(window),
@ -24,7 +23,7 @@ namespace gui {
dbc::log(fmt::format("event received with data but state={} is not handled", int($state)));
}
return in_state(DNDState::END);
return !in_state(DNDState::END);
}
void DNDLoot::START(Event ev) {

@ -7,11 +7,11 @@
namespace gui {
enum class DNDState {
START=0,
LOOTING=1,
LOOT_GRAB=2,
INV_GRAB=3,
END=4
START=100,
LOOTING=101,
LOOT_GRAB=102,
INV_GRAB=103,
END=104
};
class DNDLoot : public DeadSimpleFSM<DNDState, Event> {
@ -22,8 +22,8 @@ namespace gui {
sf::RenderWindow& $window;
routing::Router& $router;
DNDLoot(StatusUI status_ui,
LootUI loot_ui, sf::RenderWindow& window,
DNDLoot(StatusUI& status_ui,
LootUI& loot_ui, sf::RenderWindow& window,
routing::Router& router);
bool event(Event ev, std::any data={});

@ -1,4 +1,3 @@
#define FSM_DEBUG 1
#include "gui/fsm.hpp"
#include <iostream>
#include <chrono>

@ -43,7 +43,6 @@ int main(int argc, char* argv[]) {
main.handle_keyboard_mouse();
}
} else{
dbc::log("NOT IN STATE");
main.event(gui::Event::TICK);
}

Loading…
Cancel
Save