LeviLamina
Loading...
Searching...
No Matches
GameControllerMapper.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/InputDeviceMapper.h"
8#include "mc/deps/input/InputMode.h"
9#include "mc/deps/input/enums/DirectionId.h"
10
11// auto generated forward declare list
12// clang-format off
13class BindingFactory;
14class IGameController;
15class InputEventQueue;
16struct ControllerIDtoClientMap;
21struct InputMapping;
22// clang-format on
23
25public:
26 // GameControllerMapper inner types declare
27 // clang-format off
28 struct TriggerState;
29 struct DirectionAttributes;
30 struct ButtonAttributes;
31 struct GameControllerMappingData;
32 struct GamepadStickTurnData;
33 // clang-format on
34
35 // GameControllerMapper inner types define
36 struct TriggerState {};
37
39
41
43
45
46 using GameControllerButtonId = int;
47
48 using GamePadTriggerId = int;
49
50 using GamePadStickId = int;
51
52 using GamePadButtonToButtonIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::ButtonAttributes>;
53
54 using GamePadTriggerToButtonIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::TriggerState>;
55
56 using GamePadStickToDirectionIdMap = ::std::unordered_multimap<int, ::GameControllerMapper::DirectionAttributes>;
57
58 using GamePadStickToButtonIdMap = ::std::unordered_multimap<int, uint>;
59
60 using GamePadStickDirectionToButtonIdMap = ::std::unordered_multimap<::DirectionId, uint>;
61
62 using GamePadExclusiveButtonIdSet = ::std::set<uint>;
63
64 using GamePadStickEvents = ::std::unordered_map<int, ::GameControllerStickEvent>;
65
66public:
67 // member variables
68 // NOLINTBEGIN
69 ::ll::TypedStorage<8, 8, double> mLastTime;
70 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, double>> mLastTurnButtonTimeSeconds;
71 ::ll::TypedStorage<8, 24, ::std::vector<::GameControllerMapper::GamepadStickTurnData>> mStickTurnData;
72 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::GameControllerMapper::GameControllerMappingData>>
73 mPerIdMappings;
74 // NOLINTEND
75
76public:
77 // virtual functions
78 // NOLINTBEGIN
79 virtual void setMapping(
80 ::InputEventQueue& eventQueue,
81 ::BindingFactory const& bindingFactory,
82 ::InputMapping const& inputMapping,
83 int controllerId
84 ) /*override*/;
85
86 virtual void clearMapping(int controllerId) /*override*/;
87
88 virtual bool tick(
89 ::InputEventQueue& eventQueue,
90 ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& map
91 ) /*override*/;
92
93 virtual ::InputMode getInputMode() const /*override*/;
94
95 virtual void changeControllerId(int oldId, int newId) /*override*/;
96
97 virtual ::std::vector<::std::weak_ptr<::IGameController>> _getGameControllers() = 0;
98
99 virtual ::GameControllerInputMapping const& getGameControllerMapping(::InputMapping const&) = 0;
100
101 virtual ~GameControllerMapper() /*override*/;
102 // NOLINTEND
103
104public:
105 // member functions
106 // NOLINTBEGIN
107 MCAPI GameControllerMapper();
108
109 MCAPI void _enqueueButtonDownUpEvents(
110 ::InputEventQueue& eventQueue,
112 ::DirectionId direction
113 );
114
115 MCAPI void _handleButtonEvent(
116 ::InputEventQueue& eventQueue,
117 ::GameControllerButtonEvent const& buttonEvent,
118 int controllerId,
119 int alternateControllerId
120 );
121
122 MCAPI void
123 _handleConnectionStateChangedEvent(::InputEventQueue& eventQueue, bool controllerConnected, int controllerId);
124
125 MCAPI void
126 _handleStickEvent(::InputEventQueue& eventQueue, ::GameControllerStickEvent const& stickEvent, int controllerId);
127
128 MCAPI void _handleTriggerEvent(
129 ::InputEventQueue& eventQueue,
130 ::GameControllerTriggerEvent const& triggerEvent,
131 int controllerId
132 );
133
134 MCAPI void _reprocessPreviousStickEvents(
135 ::InputEventQueue& eventQueue,
136 int controllerId,
137 ::std::vector<int> const& handledEventStickIds
138 );
139
140 MCAPI void _tickTurn(::InputEventQueue& eventQueue);
141 // NOLINTEND
142
143public:
144 // constructor thunks
145 // NOLINTBEGIN
146 MCAPI void* $ctor();
147 // NOLINTEND
148
149public:
150 // destructor thunk
151 // NOLINTBEGIN
152 MCAPI void $dtor();
153 // NOLINTEND
154
155public:
156 // virtual function thunks
157 // NOLINTBEGIN
158 MCAPI void $setMapping(
159 ::InputEventQueue& eventQueue,
160 ::BindingFactory const& bindingFactory,
161 ::InputMapping const& inputMapping,
162 int controllerId
163 );
164
165 MCAPI void $clearMapping(int controllerId);
166
167 MCAPI bool
168 $tick(::InputEventQueue& eventQueue, ::Bedrock::NotNullNonOwnerPtr<::ControllerIDtoClientMap> const& map);
169
170 MCFOLD ::InputMode $getInputMode() const;
171
172 MCAPI void $changeControllerId(int oldId, int newId);
173 // NOLINTEND
174
175public:
176 // vftables
177 // NOLINTBEGIN
178 MCNAPI static void** $vftable();
179 // NOLINTEND
180};
Definition BindingFactory.h:5
Definition GameControllerMapper.h:5
static MCAPI void ** $vftable()
Definition IGameController.h:5
Definition InputDeviceMapper.h:5
Definition InputEventQueue.h:5
STL namespace.
Definition GameControllerButtonEvent.h:5
Definition GameControllerInputMapping.h:5
Definition GameControllerMapper.h:40
Definition GameControllerMapper.h:38
Definition GameControllerMapper.h:42
Definition GameControllerMapper.h:44
Definition GameControllerMapper.h:36
Definition GameControllerStickEvent.h:5
Definition GameControllerTriggerEvent.h:5
Definition InputMapping.h:5