Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EventManager.hxx
Go to the documentation of this file.
1 #ifndef EVENTMANAGER_HXX_
2 #define EVENTMANAGER_HXX_
3 
4 #include <SDL.h>
5 #include <set>
6 
7 #include <Point.hxx>
8 #include "../util/Singleton.hxx"
9 
10 class UIElement;
11 
12 class EventManager : public Singleton<EventManager>
13 {
14 public:
15  EventManager() = default;
16  ~EventManager() = default;
17 
18  void checkEvents(SDL_Event &event);
23  void unHighlightNodes();
24  void pickTileUnderCursor(Point mouseIsoCoords);
25 
26 private:
27  UIElement *m_lastHoveredElement = nullptr;
28 
30  bool m_placementAllowed = false;
31  bool m_panning = false;
32  bool m_tileInfoMode = false;
33  bool m_isPuttingTile = false;
34  bool m_cancelTileSelection = false;
35  Point m_pinchCenterCoords = {0, 0, 0, 0};
36  Point m_clickDownCoords = {0, 0, 0, 0};
37  std::vector<Point> m_nodesToPlace = {};
38  std::vector<Point> m_nodesToHighlight = {};
39  std::vector<Point> m_transparentBuildings;
40 };
41 
42 #endif
EventManager::m_cancelTileSelection
bool m_cancelTileSelection
determines if a right click should cancel tile selection
Definition: EventManager.hxx:34
EventManager::m_clickDownCoords
Point m_clickDownCoords
Definition: EventManager.hxx:36
EventManager::EventManager
EventManager()=default
EventManager::m_transparentBuildings
std::vector< Point > m_transparentBuildings
Definition: EventManager.hxx:39
EventManager::m_nodesToPlace
std::vector< Point > m_nodesToPlace
Definition: EventManager.hxx:37
EventManager::m_pinchCenterCoords
Point m_pinchCenterCoords
Definition: EventManager.hxx:35
EventManager::m_panning
bool m_panning
Definition: EventManager.hxx:31
EventManager::pickTileUnderCursor
void pickTileUnderCursor(Point mouseIsoCoords)
Definition: EventManager.cxx:45
EventManager::~EventManager
~EventManager()=default
EventManager::checkEvents
void checkEvents(SDL_Event &event)
Definition: EventManager.cxx:79
EventManager::m_placementAllowed
bool m_placementAllowed
remember if placement is allowed from mousemove to mousedown
Definition: EventManager.hxx:30
Singleton
Abstract Singleton implementation.
Definition: Singleton.hxx:8
EventManager::unHighlightNodes
void unHighlightNodes()
Unhighlight highlighted Nodes.
Definition: EventManager.cxx:28
Point
Definition: Point.hxx:7
EventManager
Definition: EventManager.hxx:12
EventManager::m_nodesToHighlight
std::vector< Point > m_nodesToHighlight
Definition: EventManager.hxx:38
EventManager::m_tileInfoMode
bool m_tileInfoMode
Definition: EventManager.hxx:32
EventManager::m_lastHoveredElement
UIElement * m_lastHoveredElement
Definition: EventManager.hxx:27
EventManager::m_isPuttingTile
bool m_isPuttingTile
determines if putting tile action is being performed
Definition: EventManager.hxx:33
Point.hxx