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