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;
21struct InputMapping;
22// clang-format on
23
25public:
26 // GameControllerMapper inner types declare
27 // clang-format off
28 struct TriggerState;
30 struct ButtonAttributes;
33 // clang-format on
34
35 // GameControllerMapper inner types define
36 struct TriggerState {
37 public:
38 // member variables
39 // NOLINTBEGIN
40 ::ll::TypedStorage<4, 4, uint> id;
41 ::ll::TypedStorage<1, 1, ::ButtonState> currentState;
42 ::ll::TypedStorage<4, 4, float> triggerThreshold;
43 // NOLINTEND
44 };
45
46 struct DirectionAttributes {
47 public:
48 // member variables
49 // NOLINTBEGIN
50 ::ll::TypedStorage<1, 1, ::DirectionId> id;
51 ::ll::TypedStorage<4, 4, int> xAxis;
52 ::ll::TypedStorage<4, 4, int> yAxis;
53 ::ll::TypedStorage<1, 1, bool> raiseTurnEvents;
54 // NOLINTEND
55 };
56
57 struct ButtonAttributes {
58 public:
59 // member variables
60 // NOLINTBEGIN
61 ::ll::TypedStorage<4, 4, uint> nameId;
62 ::ll::TypedStorage<4, 4, float> repeatInterval;
63 // NOLINTEND
64 };
65
67 public:
68 // member variables
69 // NOLINTBEGIN
70 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, ::GameControllerMapper::ButtonAttributes>>
71 mGamePadButtonToButtonIdMap;
72 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, ::GameControllerMapper::TriggerState>>
73 mTriggerToButtonIdMap;
74 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, ::GameControllerMapper::DirectionAttributes>>
75 mStickToDirectionIdMap;
76 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<int, uint>> mStickToButtonIdMap;
77 ::ll::TypedStorage<8, 64, ::std::unordered_multimap<::DirectionId, uint>> mStickDirectionToButtonIdMap;
78 ::ll::TypedStorage<8, 16, ::std::set<uint>> mExclusiveButtonIdSet;
79 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::GameControllerStickEvent>> mPreviousStickEvents;
80 ::ll::TypedStorage<1, 1, bool> mMappingChanged;
81 // NOLINTEND
82 };
83
85 public:
86 // member variables
87 // NOLINTBEGIN
88 ::ll::TypedStorage<1, 1, bool> turnStickActive;
89 ::ll::TypedStorage<4, 8, ::glm::vec2> lastTurnStickPos;
90 ::ll::TypedStorage<4, 4, int> controllerId;
91 // NOLINTEND
92 };
93
94 using GameControllerButtonId = int;
95
96 using GamePadTriggerId = int;
97
98 using GamePadStickId = int;
99
100 using GamePadButtonToButtonIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::ButtonAttributes>;
101
102 using GamePadTriggerToButtonIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::TriggerState>;
103
104 using GamePadStickToDirectionIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::DirectionAttributes>;
105
106 using GamePadStickToButtonIdMap = ::std::unordered_multimap<int, uint>;
107
108 using GamePadStickDirectionToButtonIdMap = ::std::unordered_multimap<::DirectionId, uint>;
109
110 using GamePadExclusiveButtonIdSet = ::std::set<uint>;
111
112 using GamePadStickEvents = ::std::unordered_map<int, ::GameControllerStickEvent>;
113
114public:
115 // member variables
116 // NOLINTBEGIN
117 ::ll::TypedStorage<8, 8, double> mLastTime;
118 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, double>> mLastTurnButtonTimeSeconds;
119 ::ll::TypedStorage<8, 24, ::std::vector<::GameControllerMapper::GamepadStickTurnData>> mStickTurnData;
120 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::GameControllerMapper::GameControllerMappingData>>
121 mPerIdMappings;
122 // NOLINTEND
123
124public:
125 // virtual functions
126 // NOLINTBEGIN
127 virtual void setMapping(
128 ::InputEventQueue& eventQueue,
129 ::BindingFactory const& bindingFactory,
130 ::InputMapping const& inputMapping,
131 int controllerId
132 ) /*override*/;
133
134 virtual void clearMapping(int controllerId) /*override*/;
135
136 virtual bool tick(
137 ::InputEventQueue& eventQueue,
138 ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& map
139 ) /*override*/;
140
141 virtual ::InputMode getInputMode() const /*override*/;
142
143 virtual void changeControllerId(int oldId, int newId) /*override*/;
144
145 virtual ::std::vector<::std::weak_ptr<::IGameController>> _getGameControllers() = 0;
146
147 virtual ::GameControllerInputMapping const& getGameControllerMapping(::InputMapping const& inputMapping) = 0;
148 // NOLINTEND
149
150public:
151 // member functions
152 // NOLINTBEGIN
153 MCAPI GameControllerMapper();
154
155 MCAPI void _enqueueButtonDownUpEvents(
156 ::InputEventQueue& eventQueue,
157 ::GameControllerMapper::GamepadStickTurnData& turnData,
158 ::DirectionId direction
159 );
160
161 MCAPI void _handleButtonEvent(
162 ::InputEventQueue& eventQueue,
163 ::GameControllerButtonEvent const& buttonEvent,
164 int controllerId,
165 int alternateControllerId
166 );
167
168 MCAPI void
169 _handleStickEvent(::InputEventQueue& eventQueue, ::GameControllerStickEvent const& stickEvent, int controllerId);
170 // NOLINTEND
171
172public:
173 // constructor thunks
174 // NOLINTBEGIN
175 MCAPI void* $ctor();
176 // NOLINTEND
177
178public:
179 // virtual function thunks
180 // NOLINTBEGIN
181 MCAPI void $setMapping(
182 ::InputEventQueue& eventQueue,
183 ::BindingFactory const& bindingFactory,
184 ::InputMapping const& inputMapping,
185 int controllerId
186 );
187
188 MCAPI void $clearMapping(int controllerId);
189
190 MCAPI bool
191 $tick(::InputEventQueue& eventQueue, ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& map);
192
193 MCFOLD ::InputMode $getInputMode() const;
194
195 MCAPI void $changeControllerId(int oldId, int newId);
196 // NOLINTEND
197
198public:
199 // vftables
200 // NOLINTBEGIN
201 MCNAPI static void** $vftable();
202 // NOLINTEND
203};
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:5
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 InputMapping.h:5