Unravel Engine C++ Reference
Loading...
Searching...
No Matches
to_string.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
coord.hpp
"
4
#include "
gamepad_axis.hpp
"
5
#include "
gamepad_button.hpp
"
6
#include "
key_state.hpp
"
7
#include "
mouse_action_map.hpp
"
8
#include "
mouse_button.hpp
"
9
#include "
point.hpp
"
10
#include <string>
11
12
namespace
input
13
{
14
15
inline
auto
to_string
(
axis_range
range
) ->
const
std::string&
16
{
17
switch
(
range
)
18
{
19
case
axis_range::full
:
20
{
21
static
const
std::string text =
"Full"
;
22
return
text;
23
}
24
case
axis_range::positive
:
25
{
26
static
const
std::string text =
"Positive"
;
27
return
text;
28
}
29
case
axis_range::negative
:
30
{
31
static
const
std::string text =
"Negative"
;
32
return
text;
33
}
34
default
:
35
{
36
static
const
std::string text =
"Unknown"
;
37
return
text;
38
}
39
}
40
}
41
42
inline
auto
to_string
(
input_type
type
) ->
const
std::string&
43
{
44
switch
(
type
)
45
{
46
case
input_type::axis
:
47
{
48
static
const
std::string text =
"Axis"
;
49
return
text;
50
}
51
case
input_type::button
:
52
{
53
static
const
std::string text =
"Button"
;
54
return
text;
55
}
56
case
input_type::key
:
57
{
58
static
const
std::string text =
"Key"
;
59
return
text;
60
}
61
default
:
62
{
63
static
const
std::string text =
"Unknown"
;
64
return
text;
65
}
66
}
67
}
68
69
inline
auto
to_string
(
const
coord
&
coord
) -> std::string
70
{
71
return
"("
+ std::to_string(
coord
.
x
) +
", "
+ std::to_string(
coord
.
y
) +
")"
;
72
}
73
74
inline
auto
to_string
(
const
gamepad_axis
axis
) -> std::string
75
{
76
switch
(
axis
)
77
{
78
case
gamepad_axis::left_x
:
79
return
"Left X"
;
80
case
gamepad_axis::left_y
:
81
return
"Left Y"
;
82
case
gamepad_axis::right_x
:
83
return
"Right X"
;
84
case
gamepad_axis::right_y
:
85
return
"Right Y"
;
86
case
gamepad_axis::left_trigger
:
87
return
"Left Trigger"
;
88
case
gamepad_axis::right_trigger
:
89
return
"Right Trigger"
;
90
default
:
91
return
"Unknown"
;
92
}
93
}
94
95
inline
auto
to_string
(
gamepad_button
button
) -> std::string
96
{
97
switch
(
button
)
98
{
99
case
gamepad_button::south
:
100
return
"South"
;
101
case
gamepad_button::east
:
102
return
"East"
;
103
case
gamepad_button::west
:
104
return
"West"
;
105
case
gamepad_button::north
:
106
return
"North"
;
107
case
gamepad_button::back
:
108
return
"Back"
;
109
case
gamepad_button::guide
:
110
return
"Guide"
;
111
case
gamepad_button::start
:
112
return
"Start"
;
113
case
gamepad_button::left_stick
:
114
return
"Left Stick"
;
115
case
gamepad_button::right_stick
:
116
return
"Right Stick"
;
117
case
gamepad_button::left_shoulder
:
118
return
"Left Shoulder"
;
119
case
gamepad_button::right_shoulder
:
120
return
"Right Shoulder"
;
121
case
gamepad_button::dpad_up
:
122
return
"DPad Up"
;
123
case
gamepad_button::dpad_down
:
124
return
"DPad Down"
;
125
case
gamepad_button::dpad_left
:
126
return
"DPad left"
;
127
case
gamepad_button::dpad_right
:
128
return
"DPad Right"
;
129
case
gamepad_button::misc1
:
130
return
"Misc 1"
;
131
case
gamepad_button::right_paddle1
:
132
return
"Right Paddle 1"
;
133
case
gamepad_button::left_paddle1
:
134
return
"Left Paddle 1"
;
135
case
gamepad_button::right_paddle2
:
136
return
"Right Paddle 2"
;
137
case
gamepad_button::left_paddle2
:
138
return
"Left Paddle 2"
;
139
case
gamepad_button::touchpad
:
140
return
"Touchpad"
;
141
case
gamepad_button::misc2
:
142
return
"Misc 2"
;
143
case
gamepad_button::misc3
:
144
return
"Misc 3"
;
145
case
gamepad_button::misc4
:
146
return
"Misc 4"
;
147
case
gamepad_button::misc5
:
148
return
"Misc 5"
;
149
case
gamepad_button::misc6
:
150
return
"Misc 6"
;
151
default
:
152
return
"Unknown"
;
153
}
154
}
155
156
inline
auto
get_description
(
gamepad_button
button
) -> std::string
157
{
158
switch
(
button
)
159
{
160
case
gamepad_button::south
:
161
return
"Bottom face button (e.g. Xbox A button, PS Cross button)"
;
162
case
gamepad_button::east
:
163
return
"Right face button (e.g. Xbox B button, PS Circle button)"
;
164
case
gamepad_button::west
:
165
return
"Left face button (e.g. Xbox X button, PS Square button)"
;
166
case
gamepad_button::north
:
167
return
"Top face button (e.g. Xbox Y button, PS Triangle button)"
;
168
case
gamepad_button::misc1
:
169
return
"Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button)"
;
170
case
gamepad_button::right_paddle1
:
171
return
"Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)"
;
172
case
gamepad_button::left_paddle1
:
173
return
"Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)"
;
174
case
gamepad_button::right_paddle2
:
175
return
"Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)"
;
176
case
gamepad_button::left_paddle2
:
177
return
"Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)"
;
178
case
gamepad_button::touchpad
:
179
return
"PS4/PS5 touchpad button"
;
180
default
:
181
return
""
;
182
}
183
}
184
185
inline
auto
to_string
(
const
key_state
state) -> std::string
186
{
187
switch
(state)
188
{
189
case
key_state::down
:
190
return
"Down"
;
191
case
key_state::up
:
192
return
"Up"
;
193
case
key_state::released
:
194
return
"Released"
;
195
case
key_state::pressed
:
196
return
"Pressed"
;
197
}
198
}
199
200
inline
auto
to_string
(
const
point
&
p
) -> std::string
201
{
202
return
"("
+ std::to_string(
p
.x) +
", "
+ std::to_string(
p
.y) +
")"
;
203
}
204
205
inline
auto
to_string
(
mouse_button
button
) -> std::string
206
{
207
switch
(
button
)
208
{
209
case
mouse_button::left_button
:
210
return
"Left"
;
211
case
mouse_button::right_button
:
212
return
"Right"
;
213
case
mouse_button::middle_button
:
214
return
"Middle"
;
215
case
mouse_button::button4
:
216
return
"Button 4"
;
217
case
mouse_button::button5
:
218
return
"Button 5"
;
219
case
mouse_button::button6
:
220
return
"Button 6"
;
221
case
mouse_button::button7
:
222
return
"Button 7"
;
223
case
mouse_button::button8
:
224
return
"Button 8"
;
225
case
mouse_button::button9
:
226
return
"Button 9"
;
227
case
mouse_button::button10
:
228
return
"Button 10"
;
229
case
mouse_button::button11
:
230
return
"Button 11"
;
231
case
mouse_button::button12
:
232
return
"Button 12"
;
233
case
mouse_button::button13
:
234
return
"Button 13"
;
235
case
mouse_button::button14
:
236
return
"Button 14"
;
237
case
mouse_button::button15
:
238
return
"Button 15"
;
239
case
mouse_button::button16
:
240
return
"Button 16"
;
241
default
:
242
return
"Unknown"
;
243
}
244
}
245
246
inline
auto
to_string
(
mouse_axis
axis
) ->
const
std::string&
247
{
248
switch
(
axis
)
249
{
250
case
mouse_axis::x
:
251
{
252
static
const
std::string text =
"X"
;
253
return
text;
254
}
255
case
mouse_axis::y
:
256
{
257
static
const
std::string text =
"Y"
;
258
return
text;
259
}
260
case
mouse_axis::scroll
:
261
{
262
static
const
std::string text =
"Scroll"
;
263
return
text;
264
}
265
default
:
266
{
267
static
const
std::string text =
"Unknown"
;
268
return
text;
269
}
270
}
271
}
272
273
}
// namespace input
type
manifold_type type
Definition
bullet_backend.cpp:87
coord.hpp
gamepad_axis.hpp
gamepad_button.hpp
key_state.hpp
mouse_action_map.hpp
mouse_button.hpp
input
Definition
action_id.hpp:5
input::key_state
key_state
Definition
key_state.hpp:6
input::key_state::released
@ released
input::key_state::up
@ up
input::key_state::pressed
@ pressed
input::key_state::down
@ down
input::mouse_button
mouse_button
Definition
mouse_button.hpp:6
input::mouse_button::button13
@ button13
input::mouse_button::button12
@ button12
input::mouse_button::button16
@ button16
input::mouse_button::button15
@ button15
input::mouse_button::button11
@ button11
input::mouse_button::button8
@ button8
input::mouse_button::middle_button
@ middle_button
input::mouse_button::right_button
@ right_button
input::mouse_button::button7
@ button7
input::mouse_button::left_button
@ left_button
input::mouse_button::button10
@ button10
input::mouse_button::button4
@ button4
input::mouse_button::button6
@ button6
input::mouse_button::button5
@ button5
input::mouse_button::button14
@ button14
input::mouse_button::button9
@ button9
input::axis_range
axis_range
Definition
axis_range.hpp:6
input::axis_range::negative
@ negative
input::axis_range::positive
@ positive
input::axis_range::full
@ full
input::gamepad_button
gamepad_button
Definition
gamepad_button.hpp:6
input::gamepad_button::right_paddle2
@ right_paddle2
input::gamepad_button::dpad_down
@ dpad_down
input::gamepad_button::misc3
@ misc3
input::gamepad_button::dpad_up
@ dpad_up
input::gamepad_button::east
@ east
input::gamepad_button::left_shoulder
@ left_shoulder
input::gamepad_button::misc6
@ misc6
input::gamepad_button::back
@ back
input::gamepad_button::misc2
@ misc2
input::gamepad_button::dpad_left
@ dpad_left
input::gamepad_button::left_paddle2
@ left_paddle2
input::gamepad_button::south
@ south
input::gamepad_button::misc5
@ misc5
input::gamepad_button::left_paddle1
@ left_paddle1
input::gamepad_button::north
@ north
input::gamepad_button::misc1
@ misc1
input::gamepad_button::right_stick
@ right_stick
input::gamepad_button::guide
@ guide
input::gamepad_button::dpad_right
@ dpad_right
input::gamepad_button::left_stick
@ left_stick
input::gamepad_button::misc4
@ misc4
input::gamepad_button::right_shoulder
@ right_shoulder
input::gamepad_button::touchpad
@ touchpad
input::gamepad_button::west
@ west
input::gamepad_button::right_paddle1
@ right_paddle1
input::gamepad_button::start
@ start
input::input_type
input_type
Definition
input_type.hpp:7
input::input_type::key
@ key
input::input_type::axis
@ axis
input::input_type::button
@ button
input::gamepad_axis
gamepad_axis
Definition
gamepad_axis.hpp:6
input::gamepad_axis::left_trigger
@ left_trigger
input::gamepad_axis::right_y
@ right_y
input::gamepad_axis::right_trigger
@ right_trigger
input::gamepad_axis::right_x
@ right_x
input::gamepad_axis::left_x
@ left_x
input::gamepad_axis::left_y
@ left_y
input::get_description
auto get_description(gamepad_button button) -> std::string
Definition
to_string.hpp:156
input::key_code::p
@ p
input::mouse_axis
mouse_axis
Definition
mouse_action_map.hpp:15
input::mouse_axis::scroll
@ scroll
input::mouse_axis::y
@ y
input::mouse_axis::x
@ x
input::to_string
auto to_string(axis_range range) -> const std::string &
Definition
to_string.hpp:15
point.hpp
input::coord
Definition
coord.hpp:6
input::coord::y
int y
Definition
coord.hpp:8
input::coord::x
int x
Definition
coord.hpp:7
input::point
Definition
point.hpp:6
range
Definition
basetypes.hpp:10
UnravelEngine
UnravelEngine
engine
engine
input
action_map
to_string.hpp
Generated by
1.12.0