3#include "mc/_HeaderOutputPredefine.h"
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"
33 enum class PressType :
int {
42 ::ll::TypedStorage<4, 4, uint> toButtonId;
43 ::ll::TypedStorage<1, 1, ::ScreenEventScope> scope;
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;
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;
84 virtual ~InputComponent() ;
86 virtual ::std::unique_ptr<::UIComponent> clone(::UIControl& cloneOwner)
const ;
88 virtual void reset() ;
90 virtual void onVisibilityChanged(
bool) ;
96 MCAPI
explicit InputComponent(::UIControl& owner);
98 MCAPI ::InputComponent::PressType
99 _detectDoubleClick(uint buttonId, ::ButtonState state, ::glm::vec2
const& pointerPosition,
bool isTTSTouchEnabled);
101 MCAPI
bool _getContentPanelHover(::glm::vec2
const& pointerPosition);
103 MCAPI
bool _sendButtonScreenEvent(
104 ::ScreenInputContext& context,
105 ::ScreenButtonMapping
const& buttonMapping,
107 ::glm::vec2
const& pointerPosition,
108 ::VisualTree& visualTree,
109 ::UIAnimationController& animationController,
110 ::InputMode inputMode
113 MCAPI
bool _sendHoverScreenEvent(
114 ::ScreenInputContext& context,
115 ::VisualTree& visualTree,
116 ::UIAnimationController& animationController,
117 ::glm::vec2
const& position,
121 MCAPI
bool _shouldHandleControllerDirection(::DirectionId deltaPosition, ::glm::vec2
const&);
123 MCAPI
bool _shouldHandleMapping(
124 ::ScreenButtonMapping
const& buttonMapping,
125 ::InputComponent::PressType interpretAsPressType,
128 ::glm::vec2
const& pointerPosition,
129 ::InputMode inputMode
132 MCAPI
bool _shouldHandlePressedMapping(
133 ::ScreenButtonMapping
const& buttonMapping,
135 ::ButtonState pointerPosition,
136 ::glm::vec2
const& inputMode,
140 MCAPI
void addButtonMapping(
143 ::ButtonMappingType mappingType,
144 ::ScreenEventScope scope,
145 bool buttonUpRightOfFirstRefusal,
148 bool alternateInputScope,
150 ::ButtonMappingInputModeCondition inputModeCondition,
151 bool ignoreInputScope
154 MCAPI
void addHoverButtonMapping(uint toButtonId, ::ScreenEventScope scope);
156 MCAPI
void addRemappingMapping(::ScreenEventScope scope);
158 MCAPI
bool canHandleDeselect(uint buttonId);
160 MCFOLD
void cleanUpAllButtonStates();
162 MCAPI
void cleanUpButtonState(
165 ::glm::vec2
const& pointerPosition,
167 bool isTTSTouchEnabled
170 MCFOLD
bool getAlwaysListensToInput()
const;
172 MCAPI
bool getGamepadDeflectionMode()
const;
174 MCFOLD
bool getInlineModal()
const;
176 MCFOLD
bool getModal()
const;
178 MCFOLD
bool getPreventsTouchControls()
const;
180 MCAPI ::ButtonHandleResult handleButtonEvent(
181 ::VisualTree& visualTree,
182 ::UIAnimationController& animationController,
183 ::ScreenInputContext& context,
186 ::glm::vec2
const& pointerPosition,
187 ::InputMode inputMode,
188 bool isTTSTouchEnabled
191 MCAPI
bool handleControllerDirection(
192 ::VisualTree& visualTree,
193 ::UIAnimationController& animationController,
194 ::ScreenInputContext& context,
195 ::DirectionId directionId,
196 ::glm::vec2
const& deltaPosition,
200 MCAPI
bool handleFocusLocation(
201 ::VisualTree& visualTree,
202 ::UIAnimationController& animationController,
203 ::ScreenInputContext& context,
204 ::glm::vec2
const& position,
208 MCAPI
void handleInputModeChange(
209 ::VisualTree& mVisualTree,
210 ::UIAnimationController& animationController,
211 ::ScreenInputContext& context,
212 ::InputMode newInputMode
215 MCAPI
bool handlePointerLocation(
216 ::VisualTree& visualTree,
217 ::UIAnimationController& animationController,
218 ::ScreenInputContext& context,
219 ::glm::vec2
const& position,
220 ::glm::vec2
const& deltaPosition,
224 MCAPI
bool isWithinClipRegion(::glm::vec2
const& pointerPosition)
const;
226 MCAPI
void setAlwaysHandleControllerDirection(
bool enabled);
228 MCAPI
void setAlwaysHandlePointer(
bool enabled);
230 MCFOLD
void setAlwaysListensToInput(
bool enabled);
232 MCFOLD
void setConsumeHoverEvents(
bool consumeHoverEvents);
234 MCAPI
void setGamepadDeflectionMode(
bool enabled);
236 MCAPI
void setHoverEnabled(
bool hoverEnabled);
238 MCAPI
void setIgnoreHoverChange(
bool ignoreHoverChange);
240 MCAPI
void setInlineModal(
bool inlineModal);
242 MCAPI
void setModal(
bool modal);
244 MCAPI
void setPreventsTouchControls(
bool enabled);
250 MCAPI
void* $ctor(::UIControl& owner);
262 MCAPI ::std::unique_ptr<::UIComponent> $clone(::UIControl& cloneOwner)
const;
264 MCFOLD
void $reset();
266 MCAPI
void $onVisibilityChanged(
bool);
Definition ScreenInputContext.h:5
Definition UIAnimationController.h:5
Definition UIComponent.h:5
Definition VisualTree.h:5