LeviLamina
Loading...
Searching...
No Matches
GameControllerMapper.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/NonOwnerPointer.h"
7#include "mc/deps/input/InputDeviceMapper.h"
8#include "mc/deps/input/InputMode.h"
9#include "mc/deps/input/enums/ButtonState.h"
10#include "mc/deps/input/enums/DirectionId.h"
11
12// auto generated forward declare list
13// clang-format off
14class BindingFactory;
15class IGameController;
16class InputEventQueue;
22struct InputMapping;
23// clang-format on
24
26public:
27 // GameControllerMapper inner types declare
28 // clang-format off
29 struct TriggerState;
31 struct ButtonAttributes;
34 // clang-format on
35
36 // GameControllerMapper inner types define
37 struct TriggerState {
38 public:
39 // member variables
40 // NOLINTBEGIN
41 ::ll::TypedStorage<4, 4, uint> id;
42 ::ll::TypedStorage<1, 1, ::ButtonState> currentState;
43 ::ll::TypedStorage<4, 4, float> triggerThreshold;
44 // NOLINTEND
45 };
46
47 struct DirectionAttributes {
48 public:
49 // member variables
50 // NOLINTBEGIN
51 ::ll::TypedStorage<1, 1, ::DirectionId> id;
52 ::ll::TypedStorage<4, 4, int> xAxis;
53 ::ll::TypedStorage<4, 4, int> yAxis;
54 ::ll::TypedStorage<1, 1, bool> raiseTurnEvents;
55 // NOLINTEND
56 };
57
58 struct ButtonAttributes {
59 public:
60 // member variables
61 // NOLINTBEGIN
62 ::ll::TypedStorage<4, 4, uint> nameId;
63 ::ll::TypedStorage<4, 4, float> repeatInterval;
64 // NOLINTEND
65 };
66
68 public:
69 // member variables
70 // NOLINTBEGIN
71 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, ::GameControllerMapper::ButtonAttributes>>
72 mGamePadButtonToButtonIdMap;
73 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, ::GameControllerMapper::TriggerState>>
74 mTriggerToButtonIdMap;
75 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, ::GameControllerMapper::DirectionAttributes>>
76 mStickToDirectionIdMap;
77 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, uint>> mStickToButtonIdMap;
78 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<::DirectionId, uint>> mStickDirectionToButtonIdMap;
79 ::ll::TypedStorage<8, 16, ::std::set<uint>> mExclusiveButtonIdSet;
80 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::GameControllerStickEvent>> mPreviousStickEvents;
81 ::ll::TypedStorage<1, 1, bool> mMappingChanged;
82 // NOLINTEND
83
84 public:
85 // prevent constructor by default
86 GameControllerMappingData& operator=(GameControllerMappingData const&);
87 GameControllerMappingData(GameControllerMappingData const&);
88
89 public:
90 // member functions
91 // NOLINTBEGIN
92 MCAPI GameControllerMappingData();
93
94 MCAPI GameControllerMappingData(::GameControllerMapper::GameControllerMappingData&&);
95
96 MCAPI ::GameControllerMapper::GameControllerMappingData&
97 operator=(::GameControllerMapper::GameControllerMappingData&&);
98
99 MCAPI ~GameControllerMappingData();
100 // NOLINTEND
101
102 public:
103 // constructor thunks
104 // NOLINTBEGIN
105 MCAPI void* $ctor();
106
107 MCAPI void* $ctor(::GameControllerMapper::GameControllerMappingData&&);
108 // NOLINTEND
109
110 public:
111 // destructor thunk
112 // NOLINTBEGIN
113 MCAPI void $dtor();
114 // NOLINTEND
115 };
116
117 struct GamepadStickTurnData {
118 public:
119 // member variables
120 // NOLINTBEGIN
121 ::ll::TypedStorage<1, 1, bool> turnStickActive;
122 ::ll::TypedStorage<4, 8, ::glm::vec2> lastTurnStickPos;
123 ::ll::TypedStorage<4, 4, int> controllerId;
124 // NOLINTEND
125 };
126
127 using GameControllerButtonId = int;
128
129 using GamePadTriggerId = int;
130
131 using GamePadStickId = int;
132
133 using GamePadButtonToButtonIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::ButtonAttributes>;
134
135 using GamePadTriggerToButtonIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::TriggerState>;
136
137 using GamePadStickToDirectionIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::DirectionAttributes>;
138
139 using GamePadStickToButtonIdMap = ::std::unordered_multimap<int, uint>;
140
141 using GamePadStickDirectionToButtonIdMap = ::std::unordered_multimap<::DirectionId, uint>;
142
143 using GamePadExclusiveButtonIdSet = ::std::set<uint>;
144
145 using GamePadStickEvents = ::std::unordered_map<int, ::GameControllerStickEvent>;
146
147public:
148 // member variables
149 // NOLINTBEGIN
150 ::ll::TypedStorage<8, 8, double> mLastTime;
151 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, double>> mLastTurnButtonTimeSeconds;
152 ::ll::TypedStorage<8, 24, ::std::vector<::GameControllerMapper::GamepadStickTurnData>> mStickTurnData;
153 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::GameControllerMapper::GameControllerMappingData>>
154 mPerIdMappings;
155 // NOLINTEND
156
157public:
158 // virtual functions
159 // NOLINTBEGIN
160 virtual void setMapping(
161 ::InputEventQueue& eventQueue,
162 ::BindingFactory const& bindingFactory,
163 ::InputMapping const& inputMapping,
164 int controllerId
165 ) /*override*/;
166
167 virtual void clearMapping(int controllerId) /*override*/;
168
169 virtual bool tick(
170 ::InputEventQueue& eventQueue,
171 ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& map
172 ) /*override*/;
173
174 virtual ::InputMode getInputMode() const /*override*/;
175
176 virtual void changeControllerId(int oldId, int newId) /*override*/;
177
178 virtual ::std::vector<::std::weak_ptr<::IGameController>> _getGameControllers() = 0;
179
180 virtual ::GameControllerInputMapping const& getGameControllerMapping(::InputMapping const& inputMapping) = 0;
181
182 virtual ~GameControllerMapper() /*override*/;
183 // NOLINTEND
184
185public:
186 // member functions
187 // NOLINTBEGIN
188 MCAPI GameControllerMapper();
189
190 MCAPI void _enqueueButtonDownUpEvents(
191 ::InputEventQueue& eventQueue,
192 ::GameControllerMapper::GamepadStickTurnData& turnData,
193 ::DirectionId direction
194 );
195
196 MCAPI void _handleButtonEvent(
197 ::InputEventQueue& eventQueue,
198 ::GameControllerButtonEvent const& buttonEvent,
199 int controllerId,
200 int alternateControllerId
201 );
202
203 MCAPI void
204 _handleConnectionStateChangedEvent(::InputEventQueue& eventQueue, bool controllerConnected, int controllerId);
205
206 MCAPI void
207 _handleStickEvent(::InputEventQueue& eventQueue, ::GameControllerStickEvent const& stickEvent, int controllerId);
208
209 MCAPI void _handleTriggerEvent(
210 ::InputEventQueue& eventQueue,
211 ::GameControllerTriggerEvent const& triggerEvent,
212 int controllerId
213 );
214
215 MCAPI void _reprocessPreviousStickEvents(
216 ::InputEventQueue& eventQueue,
217 int controllerId,
218 ::std::vector<int> const& handledEventStickIds
219 );
220
221 MCAPI void _tickTurn(::InputEventQueue& eventQueue);
222 // NOLINTEND
223
224public:
225 // constructor thunks
226 // NOLINTBEGIN
227 MCAPI void* $ctor();
228 // NOLINTEND
229
230public:
231 // destructor thunk
232 // NOLINTBEGIN
233 MCAPI void $dtor();
234 // NOLINTEND
235
236public:
237 // virtual function thunks
238 // NOLINTBEGIN
239 MCAPI void $setMapping(
240 ::InputEventQueue& eventQueue,
241 ::BindingFactory const& bindingFactory,
242 ::InputMapping const& inputMapping,
243 int controllerId
244 );
245
246 MCAPI void $clearMapping(int controllerId);
247
248 MCAPI bool
249 $tick(::InputEventQueue& eventQueue, ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& map);
250
251 MCFOLD ::InputMode $getInputMode() const;
252
253 MCAPI void $changeControllerId(int oldId, int newId);
254 // NOLINTEND
255
256public:
257 // vftables
258 // NOLINTBEGIN
259 MCNAPI static void** $vftable();
260 // NOLINTEND
261};
Definition BindingFactory.h:5
Definition GameControllerMapper.h:5
static MCAPI void ** $vftable()
Definition IGameController.h:5
Definition InputDeviceMapper.h:5
Definition InputEventQueue.h:5
Definition ControllerIDtoClientMap.h:13
Definition GameControllerButtonEvent.h:5
Definition GameControllerInputMapping.h:5
Definition GameControllerMapper.h:21
Definition GameControllerMapper.h:19
Definition GameControllerMapper.h:23
Definition GameControllerMapper.h:25
Definition GameControllerMapper.h:17
Definition GameControllerStickEvent.h:5
Definition GameControllerTriggerEvent.h:5
Definition InputMapping.h:5