Emergency 20 Dokumentation  4.2.0
FireSimulationPreviewInputHandler.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
15 
16 
17 //[-------------------------------------------------------]
18 //[ Forward declarations ]
19 //[-------------------------------------------------------]
20 namespace qsf
21 {
22  class KeyboardEvent;
23  class MouseButtonEvent;
24  class Entity;
25  class EntitySelectionRectangle;
26 }
27 
28 
29 //[-------------------------------------------------------]
30 //[ Namespace ]
31 //[-------------------------------------------------------]
32 namespace em5
33 {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Classes ]
38  //[-------------------------------------------------------]
44  {
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public methods ]
49  //[-------------------------------------------------------]
50  public:
56 
62 
67  void update();
68 
69 
70  //[-------------------------------------------------------]
71  //[ Protected virtual qsf::InputHandler methods ]
72  //[-------------------------------------------------------]
73  protected:
74  virtual void updateInputHandler(const qsf::Time& timePassed) override;
75 
76 
77  //[-------------------------------------------------------]
78  //[ Protected virtual qsf::InputListener methods ]
79  //[-------------------------------------------------------]
80  protected:
81  virtual void eventReceived(const qsf::InputEvent& inputEvent, Response& response) override;
82 
83 
84  //[-------------------------------------------------------]
85  //[ Private methods ]
86  //[-------------------------------------------------------]
87  private:
88  qsf::Entity* getEntityForSelection(const qsf::Component& component) const;
89  void processKeyboardEvent(const qsf::KeyboardEvent& keyboardEvent);
90  void processMouseButtonEvent(const qsf::MouseButtonEvent& mouseButtonEvent);
91 
92  void onLeftDown(const qsf::MouseButtonEvent& mouseButtonEvent);
93  void onLeftUp(const qsf::MouseButtonEvent& mouseButtonEvent);
94  void onLeftClick(const qsf::MouseButtonEvent& mouseButtonEvent);
95  void onRightDown(const qsf::MouseButtonEvent& mouseButtonEvent);
96  void onRightUp(const qsf::MouseButtonEvent& mouseButtonEvent);
97  void onRightClick(const qsf::MouseButtonEvent& mouseButtonEvent);
98 
99  qsf::Entity* pickEntityAtWindowPosition(int positionX, int positionY, glm::vec3* outHitPosition = nullptr) const;
100 
101 
102  //[-------------------------------------------------------]
103  //[ Private data ]
104  //[-------------------------------------------------------]
105  private:
106  qsf::EntitySelectionRectangle* mSelectionRectangle;
107  bool mRightMouseButtonDown;
108  glm::vec2 mRightMouseButtonDragStart;
109  bool mRightMouseButtonWasDragged;
110  qsf::MessageProxy mMessageProxy;
111 
112 
113  };
114 
115 
116 //[-------------------------------------------------------]
117 //[ Namespace ]
118 //[-------------------------------------------------------]
119 } // em5
Definition: ActionPriority.h:13
void update()
Update method that gets regularly called.
Pixel space selection rectangle for selecting entities.
Definition: EntitySelectionRectangle.h:41
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
Input handler base class.
Definition: InputHandler.h:40
unsigned int uint32
Definition: PlatformTypes.h:181
EMERGENCY 5 fire simulation input handler class.
Definition: FireSimulationPreviewInputHandler.h:43
virtual void eventReceived(const qsf::InputEvent &inputEvent, Response &response) override
React to input events.
FireSimulationPreviewInputHandler(uint32 id)
Constructor.
Input event base class.
Definition: InputEvent.h:40
virtual ~FireSimulationPreviewInputHandler()
Destructor.
Message listener proxy class.
Definition: MessageProxy.h:47
virtual void updateInputHandler(const qsf::Time &timePassed) override
Update the input handler.
Definition: PickupPersonByParamedicAction.h:21
Mouse button event class.
Definition: MouseButtonEvent.h:46
Keyboard event class.
Definition: KeyboardEvent.h:44
Definition: InputListener.h:51
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32