1/**************************************************************************/
2/* input_enums.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef INPUT_ENUMS_H
32#define INPUT_ENUMS_H
33
34enum class HatDir {
35 UP = 0,
36 RIGHT = 1,
37 DOWN = 2,
38 LEFT = 3,
39 MAX = 4,
40};
41
42enum class HatMask {
43 CENTER = 0,
44 UP = 1,
45 RIGHT = 2,
46 DOWN = 4,
47 LEFT = 8,
48};
49
50enum class JoyAxis {
51 INVALID = -1,
52 LEFT_X = 0,
53 LEFT_Y = 1,
54 RIGHT_X = 2,
55 RIGHT_Y = 3,
56 TRIGGER_LEFT = 4,
57 TRIGGER_RIGHT = 5,
58 SDL_MAX = 6,
59 MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes.
60};
61
62enum class JoyButton {
63 INVALID = -1,
64 A = 0,
65 B = 1,
66 X = 2,
67 Y = 3,
68 BACK = 4,
69 GUIDE = 5,
70 START = 6,
71 LEFT_STICK = 7,
72 RIGHT_STICK = 8,
73 LEFT_SHOULDER = 9,
74 RIGHT_SHOULDER = 10,
75 DPAD_UP = 11,
76 DPAD_DOWN = 12,
77 DPAD_LEFT = 13,
78 DPAD_RIGHT = 14,
79 MISC1 = 15,
80 PADDLE1 = 16,
81 PADDLE2 = 17,
82 PADDLE3 = 18,
83 PADDLE4 = 19,
84 TOUCHPAD = 20,
85 SDL_MAX = 21,
86 MAX = 128, // Android supports up to 36 buttons. DirectInput supports up to 128 buttons.
87};
88
89enum class MIDIMessage {
90 NONE = 0,
91 NOTE_OFF = 0x8,
92 NOTE_ON = 0x9,
93 AFTERTOUCH = 0xA,
94 CONTROL_CHANGE = 0xB,
95 PROGRAM_CHANGE = 0xC,
96 CHANNEL_PRESSURE = 0xD,
97 PITCH_BEND = 0xE,
98 SYSTEM_EXCLUSIVE = 0xF0,
99 QUARTER_FRAME = 0xF1,
100 SONG_POSITION_POINTER = 0xF2,
101 SONG_SELECT = 0xF3,
102 TUNE_REQUEST = 0xF6,
103 TIMING_CLOCK = 0xF8,
104 START = 0xFA,
105 CONTINUE = 0xFB,
106 STOP = 0xFC,
107 ACTIVE_SENSING = 0xFE,
108 SYSTEM_RESET = 0xFF,
109};
110
111enum class MouseButton {
112 NONE = 0,
113 LEFT = 1,
114 RIGHT = 2,
115 MIDDLE = 3,
116 WHEEL_UP = 4,
117 WHEEL_DOWN = 5,
118 WHEEL_LEFT = 6,
119 WHEEL_RIGHT = 7,
120 MB_XBUTTON1 = 8, // "XBUTTON1" is a reserved word on Windows.
121 MB_XBUTTON2 = 9, // "XBUTTON2" is a reserved word on Windows.
122};
123
124enum class MouseButtonMask {
125 NONE = 0,
126 LEFT = (1 << (int(MouseButton::LEFT) - 1)),
127 RIGHT = (1 << (int(MouseButton::RIGHT) - 1)),
128 MIDDLE = (1 << (int(MouseButton::MIDDLE) - 1)),
129 MB_XBUTTON1 = (1 << (int(MouseButton::MB_XBUTTON1) - 1)),
130 MB_XBUTTON2 = (1 << (int(MouseButton::MB_XBUTTON2) - 1)),
131};
132
133inline MouseButtonMask mouse_button_to_mask(MouseButton button) {
134 return MouseButtonMask(1 << ((int)button - 1));
135}
136
137#endif // INPUT_ENUMS_H
138