Dragonfly 4.20
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
11namespace df {
12
13const std::string MSE_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.
24namespace Mouse {
25enum Button {
26 UNDEFINED_MOUSE_BUTTON = -1,
27 LEFT,
28 RIGHT,
29 MIDDLE,
30};
31} // end of namespace Mouse
32
33class EventMouse : public Event {
34
35 private:
36 EventMouseAction m_mouse_action; ///< Mouse action.
37 Mouse::Button 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.
48
49 /// Set mouse event's button.
50 void setMouseButton(Mouse::Button new_mouse_button);
51
52 /// Get mouse event's button.
53 Mouse::Button getMouseButton() const;
54
55 /// Set mouse event's position.
56 void setMousePosition(Vector new_mouse_xy);
57
58 /// Get mouse event's position.
60};
61
62} // end of namespace df
63#endif // __EVENT_MOUSE_H__
Definition: EventMouse.h:33
Vector getMousePosition() const
Get mouse event's position.
Mouse::Button getMouseButton() const
Get mouse event's button.
void setMouseAction(EventMouseAction new_mouse_action)
Set mouse event's action.
void setMousePosition(Vector new_mouse_xy)
Set mouse event's position.
EventMouseAction m_mouse_action
Mouse action.
Definition: EventMouse.h:36
Mouse::Button m_mouse_button
Mouse button.
Definition: EventMouse.h:37
Vector m_mouse_xy
Mouse (x,y) coordinates.
Definition: EventMouse.h:38
void setMouseButton(Mouse::Button new_mouse_button)
Set mouse event's button.
EventMouseAction getMouseAction() const
Get mouse event's action.
Definition: Event.h:15
Definition: Vector.h:12
An animation for a sprite.
Definition: Animation.h:15
EventMouseAction
Set of mouse actions recognized by Dragonfly.
Definition: EventMouse.h:16