Skip to content
LeviMC
English
AutoLightDark
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
64 // NOLINTEND
65
66 public:
67 // destructor thunk
68 // NOLINTBEGIN
69 MCNAPI 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
251 ::BindingFactoryMap& bindingFactoryMap,
252 ::InputMappingFactoryMap& mappingFactoryMap,
253 ::InputMode startingInputMode,
254 ::Bedrock::NotNullNonOwnerPtr<::Input::Debug::ISplitscreenRedirect> const& debugSplitscreenInputRedirect
255 );
256
257 MCNAPI void
258 _handleMappingChange(::InputMapping const* newMapping, ::InputMapping const* oldMapping, int controllerId);
259
260 MCNAPI void changeControllerId(int oldId, int newId);
261
262 MCNAPI void clearInvalidDownKeys(int controllerId);
263
264 MCNAPI ::InputMode getCurrentInputMode(int controllerId) const;
265
266 MCNAPI void initNewControllerIdOwner(int controllerId, ::InputMode initialInputMode);
267
268 MCNAPI void popInputMapping(int controllerId);
269
270 MCNAPI void pushInputMapping(::std::string const& mappingName, int controllerId);
271
272 MCNAPI void refreshInputMapping(int controllerId);
273
274 MCNAPI void registerAddClientHandler(::std::function<void(::IMinecraftGame*, int, bool)> handler);
275
276 MCNAPI void registerAnyInputHandler(::std::function<void(::IClientInstance&)> handler);
277
278 MCAPI void registerButtonDownHandler(
279 ::std::string buttonName,
280 ::std::function<void(::FocusImpact, ::IClientInstance&)> handler,
281 bool suspendable
282 );
283
284 MCAPI void registerButtonUpHandler(
285 ::std::string buttonName,
286 ::std::function<void(::FocusImpact, ::IClientInstance&)> handler,
287 bool suspendable
288 );
289
290 MCNAPI void registerChangeUserHandler(::std::function<void(::IMinecraftGame*, int, bool)> handler);
291
293 ::std::function<void(::ClearPointerLocationWithIdEventData const&, ::IClientInstance&)> handler
294 );
295
296 MCNAPI void registerClearPointerLocationsHandler(::std::function<void(::IClientInstance&)> handler);
297
298 MCNAPI void
300
301 MCNAPI void
302 registerControllerConnectionStateChangeHandler(::std::function<void(::IClientInstance&, bool, int)> handler);
303
304 MCNAPI void registerInputModeHandler(::std::function<void(::InputMode, ::IClientInstance&)> handler);
305
307 ::std::function<void(::NumberOfEnabledControlOptionsEventData const&, ::IClientInstance&)> handler
308 );
309
311 ::std::function<void(::OverlappingControlsEventData const&, ::IClientInstance&)> handler
312 );
313
315 ::std::function<void(::PointerLocationEventData const&, ::FocusImpact, ::IClientInstance&)> handler
316 );
317
319 ::std::function<void(::PointerLocationWithIdEventData const&, ::IClientInstance&)> handler
320 );
321
322 MCNAPI void registerPotentialOverlappingControlsHandler(::std::function<void(::IClientInstance&)> handler);
323
325 ::std::function<void(int, ::RawInputType, ::ButtonState, bool, ::IClientInstance&)> handler
326 );
327
328 MCNAPI void
329 registerTextCharHandler(::std::function<void(::std::string const&, ::FocusImpact, ::IClientInstance&)> handler);
330
332 ::std::function<void(::TouchPadTouchEventData const&, ::FocusImpact, ::IClientInstance&)> handler
333 );
334
335 MCNAPI void releaseButtonsAndSticks(::std::string const& currentMappingName, int controllerId);
336
337 MCNAPI void render(::InputRenderContext& renderContext) const;
338
339 MCAPI void tick(
340 ::IMinecraftGame* mcGame,
341 ::IClientInstance& primaryClientInstance,
342 ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& controllerClientMap,
343 bool allowMultipleClients
344 );
345
346 MCNAPI void updateInputMapping(::std::string const& mappingName, int controllerId);
347
348 MCAPI ~InputHandler();
349 // NOLINTEND
350
351public:
352 // constructor thunks
353 // NOLINTBEGIN
354 MCNAPI void* $ctor(
355 ::BindingFactoryMap& bindingFactoryMap,
356 ::InputMappingFactoryMap& mappingFactoryMap,
357 ::InputMode startingInputMode,
358 ::Bedrock::NotNullNonOwnerPtr<::Input::Debug::ISplitscreenRedirect> const& debugSplitscreenInputRedirect
359 );
360 // NOLINTEND
361
362public:
363 // destructor thunk
364 // NOLINTBEGIN
365 MCAPI void $dtor();
366 // NOLINTEND
367};
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
MCAPI void render(::InputRenderContext &renderContext) const
MCAPI void registerAnyInputHandler(::std::function< void(::IClientInstance &)> handler)
MCAPI void refreshInputMapping(int controllerId)
MCAPI void registerAddClientHandler(::std::function< void(::IMinecraftGame *, int, bool)> handler)
MCAPI void pushInputMapping(::std::string const &mappingName, int controllerId)
MCAPI void registerPotentialOverlappingControlsHandler(::std::function< void(::IClientInstance &)> handler)
MCAPI void * $ctor(::BindingFactoryMap &bindingFactoryMap, ::InputMappingFactoryMap &mappingFactoryMap, ::InputMode startingInputMode, ::Bedrock::NotNullNonOwnerPtr<::Input::Debug::ISplitscreenRedirect > const &debugSplitscreenInputRedirect)
MCAPI void registerClearPointerLocationWithIdHandler(::std::function< void(::ClearPointerLocationWithIdEventData const &, ::IClientInstance &)> handler)
MCAPI void updateInputMapping(::std::string const &mappingName, int controllerId)
MCAPI void popInputMapping(int controllerId)
MCAPI void registerOverlappingControlsHandler(::std::function< void(::OverlappingControlsEventData const &, ::IClientInstance &)> handler)
MCAPI void registerRawInputHandler(::std::function< void(int, ::RawInputType, ::ButtonState, bool, ::IClientInstance &)> handler)
MCAPI::InputMode getCurrentInputMode(int controllerId) const
MCAPI void registerTextCharHandler(::std::function< void(::std::string const &, ::FocusImpact, ::IClientInstance &)> handler)
MCAPI void registerPointerLocationWithIdHandler(::std::function< void(::PointerLocationWithIdEventData const &, ::IClientInstance &)> handler)
MCAPI void changeControllerId(int oldId, int newId)
MCAPI void registerNumberOfEnabledControlOptionsHandler(::std::function< void(::NumberOfEnabledControlOptionsEventData const &, ::IClientInstance &)> handler)
MCAPI void registerInputModeHandler(::std::function< void(::InputMode, ::IClientInstance &)> handler)
MCAPI void registerControllerConnectionStateChangeHandler(::std::function< void(::IClientInstance &, bool, int)> handler)
MCAPI void registerPointerLocationHandler(::std::function< void(::PointerLocationEventData const &, ::FocusImpact, ::IClientInstance &)> handler)
MCAPI void releaseButtonsAndSticks(::std::string const &currentMappingName, int controllerId)
MCAPI void registerTouchPadTouchHandler(::std::function< void(::TouchPadTouchEventData const &, ::FocusImpact, ::IClientInstance &)> handler)
MCAPI void registerChangeUserHandler(::std::function< void(::IMinecraftGame *, int, bool)> handler)
MCAPI void initNewControllerIdOwner(int controllerId, ::InputMode initialInputMode)
MCAPI InputHandler(::BindingFactoryMap &bindingFactoryMap, ::InputMappingFactoryMap &mappingFactoryMap, ::InputMode startingInputMode, ::Bedrock::NotNullNonOwnerPtr<::Input::Debug::ISplitscreenRedirect > const &debugSplitscreenInputRedirect)
MCAPI void clearInvalidDownKeys(int controllerId)
MCAPI void _handleMappingChange(::InputMapping const *newMapping, ::InputMapping const *oldMapping, int controllerId)
MCAPI void registerClearPointerLocationsHandler(::std::function< void(::IClientInstance &)> handler)
MCAPI void registerControlOptionHandler(::std::function< void(::ControlOptionEventData const &, ::IClientInstance &)> handler)
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