Implemented an initial cut at the event router. Its job is to take the random events from SFML and translate them into nice clean orderly events to the Gui::FSM.
This commit is contained in:
parent
5c47a0151c
commit
0674908e49
8 changed files with 184 additions and 6 deletions
33
event_router.hpp
Normal file
33
event_router.hpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
#include "events.hpp"
|
||||
#include "simplefsm.hpp"
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
namespace routing {
|
||||
enum class State {
|
||||
START,
|
||||
IDLE,
|
||||
MOUSE_ACTIVE,
|
||||
MOUSE_MOVING,
|
||||
};
|
||||
|
||||
enum class Event {
|
||||
STARTED=0,
|
||||
MOUSE_DOWN=1,
|
||||
MOUSE_UP=2,
|
||||
MOUSE_MOVE=3,
|
||||
KEY_PRESS=4
|
||||
};
|
||||
|
||||
class Router : public DeadSimpleFSM<State, Event> {
|
||||
public:
|
||||
void event(Event ev);
|
||||
|
||||
void START(Event ev);
|
||||
void IDLE(Event ev);
|
||||
void MOUSE_ACTIVE(Event ev);
|
||||
void MOUSE_MOVING(Event ev);
|
||||
|
||||
void process_window(sf::RenderWindow& window);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue