LeviLamina
Loading...
Searching...
No Matches
InputHandler.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/InputBindingMode.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#include "mc/deps/input/enums/FocusImpact.h"
12#include "mc/deps/input/enums/RawInputType.h"
13
14// auto generated forward declare list
15// clang-format off
18class ButtonRepeater;
19class IClientInstance;
20class IMinecraftGame;
22class InputEventQueue;
24struct ButtonEventData;
28struct InputMapping;
34// clang-format on
35
36class InputHandler {
37public:
38 // InputHandler inner types declare
39 // clang-format off
40 struct InputHandlerState;
41 // clang-format on
42
43 // InputHandler inner types define
44 struct InputHandlerState {
45 public:
46 // member variables
47 // NOLINTBEGIN
48 ::ll::TypedStorage<4, 4, ::InputMode> mCurrentInputMode;
49 ::ll::TypedStorage<4, 4, ::InputBindingMode> mCurrentBindingMode;
50 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mInputMappingStack;
51 ::ll::TypedStorage<8, 64, ::std::unordered_set<uint>> mButtonsDown;
52 ::ll::TypedStorage<8, 64, ::std::unordered_set<int>> mTriggeredChordsSources;
53 ::ll::TypedStorage<4, 4, int> mCurrentChordSource;
54 ::ll::TypedStorage<1, 1, bool> mSuspendInput;
55 ::ll::TypedStorage<1, 1, bool> mSuspendDirectionalInput;
56 ::ll::TypedStorage<1, 1, bool> mDisableInput;
57 // NOLINTEND
58
59 public:
60 // prevent constructor by default
61 InputHandlerState& operator=(InputHandlerState const&);
62 InputHandlerState(InputHandlerState const&);
63
64 public:
65 // member functions
66 // NOLINTBEGIN
67 MCAPI InputHandlerState();
68
69 MCAPI ::InputHandler::InputHandlerState& operator=(::InputHandler::InputHandlerState&&);
70
71 MCAPI ~InputHandlerState();
72 // NOLINTEND
73
74 public:
75 // constructor thunks
76 // NOLINTBEGIN
77 MCAPI void* $ctor();
78 // NOLINTEND
79
80 public:
81 // destructor thunk
82 // NOLINTBEGIN
83 MCAPI void $dtor();
84 // NOLINTEND
85 };
86
87 using InputModeHandler = ::std::function<void(::InputMode, ::IClientInstance&)>;
88
89 using ButtonPressHandler = ::std::function<void(::FocusImpact, ::IClientInstance&)>;
90
91 using TextCharHandler = ::std::function<void(::std::string const&, ::FocusImpact, ::IClientInstance&)>;
92
93 using CaretLocationHandler = ::std::function<void(int, ::FocusImpact, ::IClientInstance&)>;
94
95 using PointerLocationHandler =
96 ::std::function<void(::PointerLocationEventData const&, ::FocusImpact, ::IClientInstance&)>;
97
98 using PointerLocationWithIdHandler =
99 ::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)>;
100
101 using ClearPointerLocationWithIdHandler =
102 ::std::function<void(::ClearPointerLocationWithIdEventData const&, ::IClientInstance&)>;
103
104 using ClearPointerLocationsHandler = ::std::function<void(::IClientInstance&)>;
105
106 using DirectionHandler = ::std::function<void(float, float, ::FocusImpact, ::IClientInstance&)>;
107
108 using TurnHandler = ::std::function<void(float, float, ::FocusImpact, ::IClientInstance&)>;
109
110 using VectorHandler = ::std::function<void(short, float, float, float, ::FocusImpact, ::IClientInstance&)>;
111
112 using AnyInputHandler = ::std::function<void(::IClientInstance&)>;
113
114 using RawInputHandler = ::std::function<void(int, ::RawInputType, ::ButtonState, bool, ::IClientInstance&)>;
115
116 using AddClientHandler = ::std::function<void(::IMinecraftGame*, int, bool)>;
117
118 using ChangeUserHandler = ::std::function<void(::IMinecraftGame*, int, bool)>;
119
120 using ControllerConnectionStateChangeHandler = ::std::function<void(::IClientInstance&, bool, int)>;
121
122 using TouchPadTouchHandler =
123 ::std::function<void(::TouchPadTouchEventData const&, ::FocusImpact, ::IClientInstance&)>;
124
125 using ControlOptionHandler = ::std::function<void(::ControlOptionEventData const&, ::IClientInstance&)>;
126
127 using NumberOfEnabledControlOptionsHandler =
128 ::std::function<void(::NumberOfEnabledControlOptionsEventData const&, ::IClientInstance&)>;
129
130 using OverlappingControlsHandler = ::std::function<void(::OverlappingControlsEventData const&, ::IClientInstance&)>;
131
132 using PotentialOverlappingControlsHandler = ::std::function<void(::IClientInstance&)>;
133
134 using InputModeHandlers = ::std::vector<::std::function<void(::InputMode, ::IClientInstance&)>>;
135
136 using ButtonHandlerMap =
137 ::std::multimap<uint, ::std::pair<bool, ::std::function<void(::FocusImpact, ::IClientInstance&)>>>;
138
139 using TextCharHandlers =
140 ::std::vector<::std::function<void(::std::string const&, ::FocusImpact, ::IClientInstance&)>>;
141
142 using CaretLocationHandlers = ::std::vector<::std::function<void(int, ::FocusImpact, ::IClientInstance&)>>;
143
144 using PointerLocationHandlers =
145 ::std::vector<::std::function<void(::PointerLocationEventData const&, ::FocusImpact, ::IClientInstance&)>>;
146
147 using PointerLocationWithIdHandlers =
148 ::std::vector<::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)>>;
149
150 using ClearPointerLocationWithIdHandlers =
151 ::std::vector<::std::function<void(::ClearPointerLocationWithIdEventData const&, ::IClientInstance&)>>;
152
153 using ClearPointerLocationsHandlers = ::std::vector<::std::function<void(::IClientInstance&)>>;
154
155 using DirectionHandlerMap =
156 ::std::multimap<::DirectionId, ::std::function<void(float, float, ::FocusImpact, ::IClientInstance&)>>;
157
158 using VectorHandlers =
159 ::std::vector<::std::function<void(short, float, float, float, ::FocusImpact, ::IClientInstance&)>>;
160
161 using TouchPadHandlers =
162 ::std::vector<::std::function<void(::TouchPadTouchEventData const&, ::FocusImpact, ::IClientInstance&)>>;
163
164 using PointerLocationWithIdHandlersMap =
165 ::std::map<uint, ::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)>>;
166
167 using ControlOptionHandlers =
168 ::std::vector<::std::function<void(::ControlOptionEventData const&, ::IClientInstance&)>>;
169
170 using NumberOfEnabledControlOptionsHandlers =
171 ::std::vector<::std::function<void(::NumberOfEnabledControlOptionsEventData const&, ::IClientInstance&)>>;
172
173 using OverlappingControlsHandlers =
174 ::std::vector<::std::function<void(::OverlappingControlsEventData const&, ::IClientInstance&)>>;
175
176 using PotentialOverlappingControlsHandlers = ::std::vector<::std::function<void(::IClientInstance&)>>;
177
178public:
179 // member variables
180 // NOLINTBEGIN
181 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::InputMode, ::IClientInstance&)>>> mInputModeHandlers;
182 ::ll::TypedStorage<
183 8,
184 16,
185 ::std::multimap<uint, ::std::pair<bool, ::std::function<void(::FocusImpact, ::IClientInstance&)>>>>
186 mButtonDownHandlerMap;
187 ::ll::TypedStorage<
188 8,
189 16,
190 ::std::multimap<uint, ::std::pair<bool, ::std::function<void(::FocusImpact, ::IClientInstance&)>>>>
191 mButtonUpHandlerMap;
192 ::ll::TypedStorage<
193 8,
194 24,
195 ::std::vector<::std::function<void(::std::string const&, ::FocusImpact, ::IClientInstance&)>>>
196 mTextCharHandlers;
197 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(int, ::FocusImpact, ::IClientInstance&)>>>
198 mCaretLocationHandlers;
199 ::ll::TypedStorage<
200 8,
201 24,
202 ::std::vector<::std::function<void(::PointerLocationEventData const&, ::FocusImpact, ::IClientInstance&)>>>
203 mPointerLocationHandlers;
204 ::ll::TypedStorage<
205 8,
206 24,
207 ::std::vector<::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)>>>
208 mPointerLocationWithIdHandlers;
209 ::ll::TypedStorage<
210 8,
211 24,
212 ::std::vector<::std::function<void(::ClearPointerLocationWithIdEventData const&, ::IClientInstance&)>>>
213 mClearPointerLocationWithIdHandlers;
214 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::IClientInstance&)>>> mClearPointerLocationsHandlers;
215 ::ll::TypedStorage<
216 8,
217 16,
218 ::std::multimap<::DirectionId, ::std::function<void(float, float, ::FocusImpact, ::IClientInstance&)>>>
219 mDirectionHandlerMap;
220 ::ll::TypedStorage<8, 64, ::std::function<void(::IClientInstance&)>> mAnyInputHandler;
221 ::ll::TypedStorage<8, 64, ::std::function<void(int, ::RawInputType, ::ButtonState, bool, ::IClientInstance&)>>
222 mRawInputHandler;
223 ::ll::TypedStorage<8, 64, ::std::function<void(::IMinecraftGame*, int, bool)>> mAddClientHandler;
224 ::ll::TypedStorage<8, 64, ::std::function<void(::IMinecraftGame*, int, bool)>> mChangeUserHandler;
225 ::ll::TypedStorage<8, 64, ::std::function<void(::IClientInstance&, bool, int)>>
226 mControllerConnectionStateChangeHandler;
227 ::ll::TypedStorage<
228 8,
229 24,
230 ::std::vector<::std::function<void(::TouchPadTouchEventData const&, ::FocusImpact, ::IClientInstance&)>>>
231 mTouchPadHandlers;
232 ::ll::TypedStorage<
233 8,
234 16,
235 ::std::map<uint, ::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)>>>
236 mCustomZoneHandlers;
237 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::ControlOptionEventData const&, ::IClientInstance&)>>>
238 mControlOptionHandlers;
239 ::ll::TypedStorage<
240 8,
241 24,
242 ::std::vector<::std::function<void(::NumberOfEnabledControlOptionsEventData const&, ::IClientInstance&)>>>
243 mNumberOfEnabledControlOptionsHandlers;
244 ::ll::TypedStorage<
245 8,
246 24,
247 ::std::vector<::std::function<void(::OverlappingControlsEventData const&, ::IClientInstance&)>>>
248 mOverlappingControlsHandlers;
249 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::IClientInstance&)>>>
250 mPotentialOverlappingControlsHandlers;
251 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::InputEventQueue>> mInputEventQueue;
252 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ButtonChordTracker>> mChordTracker;
253 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ButtonRepeater>> mButtonRepeater;
254 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::InputDeviceMapper>>> mInputDeviceMappers;
255 ::ll::TypedStorage<8, 8, ::BindingFactoryMap&> mBindingFactoryMap;
256 ::ll::TypedStorage<8, 8, ::InputMappingFactoryMap&> mInputMappingFactoryMap;
257 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::InputHandler::InputHandlerState>> mPerIdState;
258 ::ll::TypedStorage<4, 4, int> mPrimaryGameControllerId;
259 // NOLINTEND
260
261public:
262 // prevent constructor by default
263 InputHandler& operator=(InputHandler const&);
264 InputHandler(InputHandler const&);
265 InputHandler();
266
267public:
268 // member functions
269 // NOLINTBEGIN
270 MCAPI InputHandler(
271 ::BindingFactoryMap& bindingFactoryMap,
272 ::InputMappingFactoryMap& mappingFactoryMap,
273 ::InputMode startingInputMode
274 );
275
276 MCAPI void _handleButtonEvent(
277 ::ButtonEventData const& button,
278 ::FocusImpact focusImpact,
279 ::IClientInstance& client,
280 int controllerId
281 );
282
283 MCAPI void
284 _handleMappingChange(::InputMapping const* newMapping, ::InputMapping const* oldMapping, int controllerId);
285
286 MCAPI void changeControllerId(int oldId, int newId);
287
288 MCAPI void clearInputMapping(int controllerId);
289
290 MCAPI ::std::string const& getCurrentInputMapping(int controllerId) const;
291
292 MCAPI ::InputMode getCurrentInputMode(int controllerId) const;
293
294 MCAPI void popInputMapping(int controllerId);
295
296 MCAPI void pushInputMapping(::std::string const& mappingName, int controllerId);
297
298 MCAPI void registerButtonDownHandler(
299 ::std::string buttonName,
300 ::std::function<void(::FocusImpact, ::IClientInstance&)> handler,
301 bool suspendable
302 );
303
304 MCAPI void registerButtonUpHandler(
305 ::std::string buttonName,
306 ::std::function<void(::FocusImpact, ::IClientInstance&)> handler,
307 bool suspendable
308 );
309
310 MCAPI void registerCaretLocationHandler(::std::function<void(int, ::FocusImpact, ::IClientInstance&)> handler);
311
312 MCAPI void registerClearPointerLocationWithIdHandler(
313 ::std::function<void(::ClearPointerLocationWithIdEventData const&, ::IClientInstance&)> handler
314 );
315
316 MCAPI void registerClearPointerLocationsHandler(::std::function<void(::IClientInstance&)> handler);
317
318 MCAPI void
319 registerControlOptionHandler(::std::function<void(::ControlOptionEventData const&, ::IClientInstance&)> handler);
320
321 MCAPI void registerDirectionHandler(
322 ::DirectionId directionId,
323 ::std::function<void(float, float, ::FocusImpact, ::IClientInstance&)> handler
324 );
325
326 MCAPI void registerInputModeHandler(::std::function<void(::InputMode, ::IClientInstance&)> handler);
327
328 MCAPI void registerNumberOfEnabledControlOptionsHandler(
329 ::std::function<void(::NumberOfEnabledControlOptionsEventData const&, ::IClientInstance&)> handler
330 );
331
332 MCAPI void registerOverlappingControlsHandler(
333 ::std::function<void(::OverlappingControlsEventData const&, ::IClientInstance&)> handler
334 );
335
336 MCAPI void registerPointerLocationHandler(
337 ::std::function<void(::PointerLocationEventData const&, ::FocusImpact, ::IClientInstance&)> handler
338 );
339
340 MCAPI void registerPointerLocationWithIdHandler(
341 ::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)> handler
342 );
343
344 MCAPI void registerPotentialOverlappingControlsHandler(::std::function<void(::IClientInstance&)> handler);
345
346 MCAPI void
347 registerTextCharHandler(::std::function<void(::std::string const&, ::FocusImpact, ::IClientInstance&)> handler);
348
349 MCAPI void registerTouchPadTouchHandler(
350 ::std::function<void(::TouchPadTouchEventData const&, ::FocusImpact, ::IClientInstance&)> handler
351 );
352
353 MCAPI void releaseButtonsAndSticks(::std::string const& currentMappingName, int controllerId);
354
355 MCAPI void tick(
356 ::IMinecraftGame* mcGame,
357 ::IClientInstance& primaryClientInstance,
358 ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& controllerClientMap,
359 bool allowMultipleClients
360 );
361
362 MCAPI void updateInputMapping(::std::string const& mappingName, int controllerId);
363
364 MCAPI ~InputHandler();
365 // NOLINTEND
366
367public:
368 // constructor thunks
369 // NOLINTBEGIN
370 MCAPI void* $ctor(
371 ::BindingFactoryMap& bindingFactoryMap,
372 ::InputMappingFactoryMap& mappingFactoryMap,
373 ::InputMode startingInputMode
374 );
375 // NOLINTEND
376
377public:
378 // destructor thunk
379 // NOLINTBEGIN
380 MCAPI void $dtor();
381 // NOLINTEND
382};
Definition BindingFactoryMap.h:5
Definition ButtonChordTracker.h:5
Definition ButtonRepeater.h:5
Definition IClientInstance.h:5
Definition IMinecraftGame.h:5
Definition InputDeviceMapper.h:5
Definition InputEventQueue.h:5
Definition InputHandler.h:5
Definition InputMappingFactoryMap.h:5
Definition ButtonEventData.h:8
Definition ClearPointerLocationWithIdEventData.h:5
Definition ControlOptionEventData.h:5
Definition ControllerIDtoClientMap.h:13
Definition InputHandler.h:13
Definition InputMapping.h:5
Definition NumberOfEnabledControlOptionsEventData.h:5
Definition OverlappingControlsEventData.h:5
Definition PointerLocationEventData.h:8
Definition PointerLocationWithIdEventData.h:5
Definition TouchPadTouchEventData.h:5