LeviLamina
Loading...
Searching...
No Matches
InputComponent.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/controls/ButtonHandleResult.h"
7#include "mc/client/gui/controls/ButtonMappingInputModeCondition.h"
8#include "mc/client/gui/controls/ButtonMappingType.h"
9#include "mc/client/gui/controls/UIComponent.h"
10#include "mc/client/gui/screens/ScreenEventScope.h"
11#include "mc/deps/input/InputMode.h"
12#include "mc/deps/input/enums/ButtonState.h"
13#include "mc/deps/input/enums/DirectionId.h"
14
15// auto generated forward declare list
16// clang-format off
19class UIControl;
20class VisualTree;
22// clang-format on
23
24class InputComponent : public ::UIComponent {
25public:
26 // InputComponent inner types declare
27 // clang-format off
29 struct PressStats;
30 // clang-format on
31
32 // InputComponent inner types define
33 enum class PressType : int {
34 Single = 0,
35 Double = 1,
36 };
37
39 public:
40 // member variables
41 // NOLINTBEGIN
42 ::ll::TypedStorage<4, 4, uint> toButtonId;
43 ::ll::TypedStorage<1, 1, ::ScreenEventScope> scope;
44 // NOLINTEND
45 };
46
47 struct PressStats {
48 public:
49 // member variables
50 // NOLINTBEGIN
51 ::ll::TypedStorage<4, 4, int> pressCount;
52 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> lastPressTime;
53 ::ll::TypedStorage<4, 8, ::glm::vec2> position;
54 // NOLINTEND
55 };
56
57public:
58 // member variables
59 // NOLINTBEGIN
60 ::ll::TypedStorage<8, 24, ::std::vector<::ScreenButtonMapping>> mButtonMappings;
61 ::ll::TypedStorage<8, 24, ::std::vector<::InputComponent::ScreenHoverButtonMapping>> mHoverButtonMappings;
62 ::ll::TypedStorage<1, 1, ::ScreenEventScope> mRemappingMappingScope;
63 ::ll::TypedStorage<1, 1, bool> mAlwaysHandlePointer;
64 ::ll::TypedStorage<1, 1, bool> mAlwaysHandleControllerDirection;
65 ::ll::TypedStorage<1, 1, bool> mHasRemappingMapping;
66 ::ll::TypedStorage<1, 1, bool> mAlwaysListensToInput;
67 ::ll::TypedStorage<1, 1, bool> mModal;
68 ::ll::TypedStorage<1, 1, bool> mInlineModal;
69 ::ll::TypedStorage<1, 1, bool> mIgnoreHoverChange;
70 ::ll::TypedStorage<1, 1, bool> mHoverEnabled;
71 ::ll::TypedStorage<1, 1, bool> mConsumeHoverEvents;
72 ::ll::TypedStorage<1, 1, bool> mPreventsTouchControl;
73 ::ll::TypedStorage<1, 1, bool> mGamepadDeflectionMode;
74 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint, ::InputComponent::PressStats>> mPressStats;
75 // NOLINTEND
76
77public:
78 // prevent constructor by default
79 InputComponent();
80
81public:
82 // virtual functions
83 // NOLINTBEGIN
84 virtual ~InputComponent() /*override*/;
85
86 virtual ::std::unique_ptr<::UIComponent> clone(::UIControl& cloneOwner) const /*override*/;
87
88 virtual void reset() /*override*/;
89
90 virtual void onVisibilityChanged(bool) /*override*/;
91 // NOLINTEND
92
93public:
94 // member functions
95 // NOLINTBEGIN
96 MCAPI explicit InputComponent(::UIControl& owner);
97
98 MCAPI ::InputComponent::PressType
99 _detectDoubleClick(uint buttonId, ::ButtonState state, ::glm::vec2 const& pointerPosition, bool isTTSTouchEnabled);
100
101 MCAPI bool _getContentPanelHover(::glm::vec2 const& pointerPosition);
102
103 MCAPI bool _sendButtonScreenEvent(
104 ::ScreenInputContext& context,
105 ::ScreenButtonMapping const& buttonMapping,
106 ::ButtonState state,
107 ::glm::vec2 const& pointerPosition,
108 ::VisualTree& visualTree,
109 ::UIAnimationController& animationController,
110 ::InputMode inputMode
111 );
112
113 MCAPI bool _sendHoverScreenEvent(
114 ::ScreenInputContext& context,
115 ::VisualTree& visualTree,
116 ::UIAnimationController& animationController,
117 ::glm::vec2 const& position,
118 bool alreadyHandled
119 );
120
121 MCAPI bool _shouldHandleControllerDirection(::DirectionId deltaPosition, ::glm::vec2 const&);
122
123 MCAPI bool _shouldHandleMapping(
124 ::ScreenButtonMapping const& buttonMapping,
125 ::InputComponent::PressType interpretAsPressType,
126 uint buttonId,
127 ::ButtonState state,
128 ::glm::vec2 const& pointerPosition,
129 ::InputMode inputMode
130 );
131
132 MCAPI bool _shouldHandlePressedMapping(
133 ::ScreenButtonMapping const& buttonMapping,
134 uint state,
135 ::ButtonState pointerPosition,
136 ::glm::vec2 const& inputMode,
137 ::InputMode
138 );
139
140 MCAPI void addButtonMapping(
141 uint fromButtonId,
142 uint toButtonId,
143 ::ButtonMappingType mappingType,
144 ::ScreenEventScope scope,
145 bool buttonUpRightOfFirstRefusal,
146 bool handleSelect,
147 bool handleDeselect,
148 bool alternateInputScope,
149 bool consumeEvent,
150 ::ButtonMappingInputModeCondition inputModeCondition,
151 bool ignoreInputScope
152 );
153
154 MCAPI void addHoverButtonMapping(uint toButtonId, ::ScreenEventScope scope);
155
156 MCAPI void addRemappingMapping(::ScreenEventScope scope);
157
158 MCAPI bool canHandleDeselect(uint buttonId);
159
160 MCFOLD void cleanUpAllButtonStates();
161
162 MCAPI void cleanUpButtonState(
163 uint buttonId,
164 ::ButtonState state,
165 ::glm::vec2 const& pointerPosition,
166 ::InputMode,
167 bool isTTSTouchEnabled
168 );
169
170 MCFOLD bool getAlwaysListensToInput() const;
171
172 MCAPI bool getGamepadDeflectionMode() const;
173
174 MCFOLD bool getInlineModal() const;
175
176 MCFOLD bool getModal() const;
177
178 MCFOLD bool getPreventsTouchControls() const;
179
180 MCAPI ::ButtonHandleResult handleButtonEvent(
181 ::VisualTree& visualTree,
182 ::UIAnimationController& animationController,
183 ::ScreenInputContext& context,
184 uint buttonId,
185 ::ButtonState state,
186 ::glm::vec2 const& pointerPosition,
187 ::InputMode inputMode,
188 bool isTTSTouchEnabled
189 );
190
191 MCAPI bool handleControllerDirection(
192 ::VisualTree& visualTree,
193 ::UIAnimationController& animationController,
194 ::ScreenInputContext& context,
195 ::DirectionId directionId,
196 ::glm::vec2 const& deltaPosition,
197 bool alreadyHandled
198 );
199
200 MCAPI bool handleFocusLocation(
201 ::VisualTree& visualTree,
202 ::UIAnimationController& animationController,
203 ::ScreenInputContext& context,
204 ::glm::vec2 const& position,
205 bool alreadyHandled
206 );
207
208 MCAPI void handleInputModeChange(
209 ::VisualTree& mVisualTree,
210 ::UIAnimationController& animationController,
211 ::ScreenInputContext& context,
212 ::InputMode newInputMode
213 );
214
215 MCAPI bool handlePointerLocation(
216 ::VisualTree& visualTree,
217 ::UIAnimationController& animationController,
218 ::ScreenInputContext& context,
219 ::glm::vec2 const& position,
220 ::glm::vec2 const& deltaPosition,
221 bool alreadyHandled
222 );
223
224 MCAPI bool isWithinClipRegion(::glm::vec2 const& pointerPosition) const;
225
226 MCAPI void setAlwaysHandleControllerDirection(bool enabled);
227
228 MCAPI void setAlwaysHandlePointer(bool enabled);
229
230 MCFOLD void setAlwaysListensToInput(bool enabled);
231
232 MCFOLD void setConsumeHoverEvents(bool consumeHoverEvents);
233
234 MCAPI void setGamepadDeflectionMode(bool enabled);
235
236 MCAPI void setHoverEnabled(bool hoverEnabled);
237
238 MCAPI void setIgnoreHoverChange(bool ignoreHoverChange);
239
240 MCAPI void setInlineModal(bool inlineModal);
241
242 MCAPI void setModal(bool modal);
243
244 MCAPI void setPreventsTouchControls(bool enabled);
245 // NOLINTEND
246
247public:
248 // constructor thunks
249 // NOLINTBEGIN
250 MCAPI void* $ctor(::UIControl& owner);
251 // NOLINTEND
252
253public:
254 // destructor thunk
255 // NOLINTBEGIN
256 MCAPI void $dtor();
257 // NOLINTEND
258
259public:
260 // virtual function thunks
261 // NOLINTBEGIN
262 MCAPI ::std::unique_ptr<::UIComponent> $clone(::UIControl& cloneOwner) const;
263
264 MCFOLD void $reset();
265
266 MCAPI void $onVisibilityChanged(bool);
267 // NOLINTEND
268
269public:
270 // vftables
271 // NOLINTBEGIN
272 MCNAPI static void** $vftable();
273 // NOLINTEND
274};
Definition InputComponent.h:5
static MCAPI void ** $vftable()
Definition ScreenInputContext.h:5
Definition UIAnimationController.h:5
Definition UIComponent.h:5
Definition UIControl.h:5
Definition VisualTree.h:5
Definition InputComponent.h:18
Definition InputComponent.h:16
Definition ScreenButtonMapping.h:5