Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
InputAggregatorInterface.cpp
Go to the documentation of this file.
1
2
6
7namespace Divide {
8namespace Input {
9
10MouseButton mouseButtonByName(const string& buttonName) {
11 if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Left")) {
13 } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Right")) {
15 } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Middle")) {
17 } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button3")) {
19 } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button4")) {
21 } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button5")) {
23 } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button6")) {
25 }
26
28}
29
30JoystickElement joystickElementByName(const string& elementName) {
31 JoystickElement ret = {};
32
33 if (Util::CompareIgnoreCase(elementName, "POV")) {
35 } else if (Util::CompareIgnoreCase(elementName, "AXIS")) {
37 } else if (Util::CompareIgnoreCase(elementName, "BALL")) {
39 }
40
42 return ret;
43 }
44
45 // Else, we have a button
47
48 vector<string> buttonElements = Util::Split<vector<string>, string>(elementName.c_str(), '_');
49 assert(buttonElements.size() == 2 && "Invalid joystick element name!");
50 assert(Util::CompareIgnoreCase(buttonElements[0], "BUTTON"));
51 ret._elementIndex = Util::ConvertData<U8, string>(buttonElements[1]);
52
53 return ret;
54}
55
56InputEvent::InputEvent(DisplayWindow* sourceWindow, const U8 deviceIndex) noexcept
57 : _deviceIndex(deviceIndex),
58 _sourceWindow(sourceWindow)
59{
60}
61
62MouseEvent::MouseEvent( DisplayWindow* sourceWindow, U8 deviceIndex ) noexcept
63 : InputEvent(sourceWindow, deviceIndex)
64{
65}
66
67MouseButtonEvent::MouseButtonEvent(DisplayWindow* sourceWindow, const U8 deviceIndex) noexcept
68 : MouseEvent(sourceWindow, deviceIndex)
69{
70}
71
72MouseMoveEvent::MouseMoveEvent(DisplayWindow* sourceWindow, const U8 deviceIndex, const bool wheelEvent) noexcept
73 : MouseEvent( sourceWindow, deviceIndex )
74 , _wheelEvent(wheelEvent)
75{
76}
77
78JoystickEvent::JoystickEvent(DisplayWindow* sourceWindow, const U8 deviceIndex) noexcept
79 : InputEvent(sourceWindow, deviceIndex)
80{
81}
82
83KeyEvent::KeyEvent(DisplayWindow* sourceWindow, const U8 deviceIndex) noexcept
84 : InputEvent(sourceWindow, deviceIndex)
85{
86}
87
88TextEvent::TextEvent(DisplayWindow* sourceWindow, const U8 deviceIndex, const char* text) noexcept
89 : InputEvent(sourceWindow, deviceIndex)
90 , _text(text)
91{
92}
93
94} //namespace Input
95} //namespace Divide
MouseButton mouseButtonByName(const string &buttonName)
JoystickElement joystickElementByName(const string &elementName)
bool CompareIgnoreCase(const char *a, const char *b) noexcept
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8
eastl::vector< Type > vector
Definition: Vector.h:42
InputEvent(DisplayWindow *sourceWindow, U8 deviceIndex) noexcept
JoystickElementType _type
Definition: Input.h:85
JoystickEvent(DisplayWindow *sourceWindow, U8 deviceIndex) noexcept
KeyEvent(DisplayWindow *sourceWindow, U8 deviceIndex) noexcept
MouseButtonEvent(DisplayWindow *sourceWindow, U8 deviceIndex) noexcept
MouseEvent(DisplayWindow *sourceWindow, U8 deviceIndex) noexcept
MouseMoveEvent(DisplayWindow *sourceWindow, U8 deviceIndex, bool wheelEvent) noexcept
TextEvent(DisplayWindow *sourceWindow, U8 deviceIndex, const char *text) noexcept