diff --git a/demos/calc.cpp b/demos/calc.cpp index 588f28b..03cf53c 100644 --- a/demos/calc.cpp +++ b/demos/calc.cpp @@ -7,9 +7,6 @@ #include #include -#define FSM_DEBUG 1 -#include "fsm.hpp" - constexpr const int WINDOW_WIDTH=300; constexpr const int WINDOW_HEIGHT=400; diff --git a/fsm.hpp b/fsm.hpp deleted file mode 100644 index 8729dd8..0000000 --- a/fsm.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - -#ifndef FSM_DEBUG -#define FSM_STATE(C, S, E, ...) case C::S: S(E, ##__VA_ARGS__); break -#else -#define FSM_STATE(C, S, E, ...) case C::S: fmt::println(">> " #C " " #S " event={}, state={}", int(E), int($state)); S(E, ##__VA_ARGS__); fmt::println("<< " #C " state={}", int($state)); break -#endif - -template -class DeadSimpleFSM { -protected: - // BUG: don't put this in your class because state() won't work - S $state = S::START; - -public: - template - void event(E event, Types... args); - - void state(S next_state) { - $state = next_state; - } - - bool in_state(S state) { - return $state == state; - } -};