Dragonfly  4.3
A text-based game engine
EventMouse.h
1 ///
2 /// A "mouse" event
3 ///
4 
5 #ifndef __EVENT_MOUSE_H__
6 #define __EVENT_MOUSE_H__
7 
8 #include "Event.h"
9 #include "Vector.h"
10 
11 namespace df {
12 
13 const std::string MOUSE_EVENT = "df::mouse";
14 
15 /// Set of mouse actions recognized by Dragonfly.
17  UNDEFINED_MOUSE_ACTION = -1,
18  CLICKED,
19  PRESSED,
20  MOVED,
21 };
22 
23 /// Set of mouse buttons recognized by Dragonfly.
24 namespace Mouse {
25 enum EventMouseButton {
26  UNDEFINED_MOUSE_BUTTON = -1,
27  LEFT,
28  RIGHT,
29  MIDDLE,
30 };
31 } // end of namespace Mouse
32 
33 class EventMouse : public Event {
34 
35  private:
36  EventMouseAction m_mouse_action; ///< Mouse action.
37  Mouse::EventMouseButton m_mouse_button; ///< Mouse button.
38  Vector m_mouse_xy; ///< Mouse (x,y) coordinates.
39 
40  public:
41  EventMouse();
42 
43  /// Set mouse event's action.
44  void setMouseAction(EventMouseAction new_mouse_action);
45 
46  /// Get mouse event's action.
47  EventMouseAction getMouseAction() const;
48 
49  /// Set mouse event's button.
50  void setMouseButton(Mouse::EventMouseButton new_mouse_button);
51 
52  /// Get mouse event's button.
53  Mouse::EventMouseButton getMouseButton() const;
54 
55  /// Set mouse event's position.
56  void setMousePosition(Vector new_mouse_xy);
57 
58  /// Get mouse event's position.
59  Vector getMousePosition() const;
60 };
61 
62 } // end of namespace df
63 #endif // __EVENT_MOUSE_H__
Mouse::EventMouseButton m_mouse_button
Mouse button.
Definition: EventMouse.h:37
Definition: Event.h:15
A 2-d bounding box.
Definition: Box.h:10
Vector m_mouse_xy
Mouse (x,y) coordinates.
Definition: EventMouse.h:38
Definition: EventMouse.h:33
EventMouseAction m_mouse_action
Mouse action.
Definition: EventMouse.h:36
EventMouseAction
Set of mouse actions recognized by Dragonfly.
Definition: EventMouse.h:16
Definition: Vector.h:10