UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IOSInputInterface.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#if !PLATFORM_TVOS
8#import <CoreMotion/CoreMotion.h>
9#endif
10#import <GameController/GameController.h>
11#include "Misc/CoreMisc.h"
12#include "Math/Quat.h"
13#include "Math/Vector.h"
14#include "Math/Color.h"
17
18
19#define KEYCODE_ENTER 1000
20#define KEYCODE_BACKSPACE 1001
21#define KEYCODE_ESCAPE 1002
22#define KEYCODE_TAB 1003
23#define KEYCODE_LEFT 1004
24#define KEYCODE_RIGHT 1005
25#define KEYCODE_DOWN 1006
26#define KEYCODE_UP 1007
27#define KEYCODE_LEFT_CONTROL 1008
28#define KEYCODE_LEFT_SHIFT 1009
29#define KEYCODE_LEFT_ALT 1010
30#define KEYCODE_LEFT_COMMAND 1011
31#define KEYCODE_CAPS_LOCK 1012
32#define KEYCODE_RIGHT_CONTROL 1013
33#define KEYCODE_RIGHT_SHIFT 1014
34#define KEYCODE_RIGHT_ALT 1015
35#define KEYCODE_RIGHT_COMMAND 1016
36#define KEYCODE_F1 1017
37#define KEYCODE_F2 1018
38#define KEYCODE_F3 1019
39#define KEYCODE_F4 1020
40#define KEYCODE_F5 1021
41#define KEYCODE_F6 1022
42#define KEYCODE_F7 1023
43#define KEYCODE_F8 1024
44#define KEYCODE_F9 1025
45#define KEYCODE_F10 1026
46#define KEYCODE_F11 1027
47#define KEYCODE_F12 1028
48#define KEYCODE_F13 1029
49#define KEYCODE_F14 1030
50#define KEYCODE_F15 1031
51#define KEYCODE_F16 1032
52#define KEYCODE_F17 1033
53#define KEYCODE_F18 1034
54#define KEYCODE_F19 1035
55#define KEYCODE_F20 1036
56
65
66struct TouchInput
67{
68 int Handle;
72 float Force;
73};
74
75enum class EIOSEventType : int32
76{
77 Invalid = 0,
78 LeftMouseDown = 1,
79 LeftMouseUp = 2,
81 RightMouseUp = 4,
82 KeyDown = 10,
83 KeyUp = 11,
84 MiddleMouseDown = 25,
85 MiddleMouseUp = 26,
86 ThumbDown = 50,
87 ThumbUp = 70,
88};
89
96
101{
102public:
103
106
107public:
108
110
115
119 virtual void SetForceFeedbackChannelValue(int32 ControllerId, FForceFeedbackChannelType ChannelType, float Value) override;
120 virtual void SetForceFeedbackChannelValues(int32 ControllerId, const FForceFeedbackValues &values) override;
121
123 static void QueueKeyInput(int32 Key, int32 Char);
124
126 void SetGamepadsBlockDeviceFeedback(bool bBlock) { bControllersBlockDeviceFeedback = bBlock; }
127
128 void EnableMotionData(bool bEnable);
129 bool IsMotionDataEnabled() const;
130
131 static void SetKeyboardInhibited(bool bInhibited) { bKeyboardInhibited = bInhibited; }
132 static bool IsKeyboardInhibited() { return bKeyboardInhibited; }
133
135
136protected:
137
138 //~ Begin Exec Interface
139 virtual bool Exec_Runtime(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar) override;
140 //~ End Exec Interface
141
142private:
143
145
146 // handle disconnect and connect events
147 void HandleMouseConnection(GCMouse* Mouse);
148 void HandleMouseDisconnect(GCMouse* Mouse);
149 void HandleKeyboardConnection(GCKeyboard* Keyboard);
150 void HandleKeyboardDisconnect(GCKeyboard* Keyboard);
151
160 void GetMovementData(FVector& Attitude, FVector& RotationRate, FVector& Gravity, FVector& Acceleration);
161
165 void CalibrateMotion(uint32 PlayerIndex);
166
167private:
168 void ProcessTouchesAndKeys(uint32 ControllerId, const TArray<TouchInput>& InTouchInputStack, const TArray<int32>& InKeyInputStack);
169 void ProcessDeferredEvents();
170 void ProcessEvent(const FDeferredIOSEvent& Event);
171
172 // can the remote be rotated to landscape
173 bool bAllowRemoteRotation;
174
175 // can the game handle multiple gamepads at the same time (siri remote is a gamepad) ?
176 bool bGameSupportsMultipleActiveControllers;
177
178 // bluetooth connected controllers will block force feedback.
179 bool bControllersBlockDeviceFeedback;
180
182 bool bPauseMotion;
183
184#if !PLATFORM_TVOS
186 CMMotionManager* MotionManager;
187
189 CMAttitude* ReferenceAttitude;
190#endif
191
193 float LastRoll;
194
196 float LastPitch;
197
199 bool bIsCalibrationRequested;
200
202 float CenterRoll;
203
205 float CenterPitch;
206
208 FVector FilteredAccelerometer;
209
211 float LastHapticValue;
212
213 int HapticFeedbackSupportLevel;
214
215 FCriticalSection EventsMutex;
216 TArray<FDeferredIOSEvent> DeferredEvents;
217 float MouseDeltaX;
218 float MouseDeltaY;
219 float ScrollDeltaY;
220 bool bHaveMouse;
221 static bool bKeyboardInhibited;
222
223 static FName InputClassName_DefaultMobileTouch;
224 static FString HardwareDeviceIdentifier_DefaultMobileTouch;
225};
TouchType
Definition AndroidInputInterface.h:85
EGLSurface EGLint const EGLint EGLnsecsANDROID * values
Definition AndroidOpenGLFunctions.h:11
PlayerIndex
Definition AppleControllerInterface.h:24
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
FForceFeedbackChannelType
Definition IInputInterface.h:17
EIOSEventType
Definition IOSInputInterface.h:76
TouchType
Definition IOSInputInterface.h:58
@ TouchBegan
Definition IOSInputInterface.h:59
@ FirstMove
Definition IOSInputInterface.h:63
@ TouchMoved
Definition IOSInputInterface.h:60
@ ForceChanged
Definition IOSInputInterface.h:62
@ TouchEnded
Definition IOSInputInterface.h:61
@ Char
Character type.
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition AppleControllerInterface.h:64
bool bAllowControllers
Definition AppleControllerInterface.h:153
Definition IOSInputInterface.h:101
void SetGamepadsAllowed(bool bAllowed)
Definition IOSInputInterface.h:125
void SetGamepadsBlockDeviceFeedback(bool bBlock)
Definition IOSInputInterface.h:126
virtual ~FIOSInputInterface()
Definition IOSInputInterface.h:109
static bool IsKeyboardInhibited()
Definition IOSInputInterface.h:132
virtual void SetForceFeedbackChannelValues(int32 ControllerId, const FForceFeedbackValues &values) override
Definition IOSInputInterface.cpp:916
void SendControllerEvents()
Definition IOSInputInterface.cpp:530
NSData * GetGamepadGlyphRawData(const FGamepadKeyNames::Type &ButtonKey, uint32 ControllerIndex)
Definition IOSInputInterface.cpp:927
virtual bool Exec_Runtime(UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar) override
Definition IOSInputInterface.cpp:836
static void QueueKeyInput(int32 Key, int32 Char)
Definition IOSInputInterface.cpp:690
static APPLICATIONCORE_API void QueueTouchInput(const TArray< TouchInput > &InTouchEvents)
Definition IOSInputInterface.cpp:683
virtual void SetForceFeedbackChannelValue(int32 ControllerId, FForceFeedbackChannelType ChannelType, float Value) override
Definition IOSInputInterface.cpp:851
void EnableMotionData(bool bEnable)
Definition IOSInputInterface.cpp:699
static void SetKeyboardInhibited(bool bInhibited)
Definition IOSInputInterface.h:131
bool IsMotionDataEnabled() const
Definition IOSInputInterface.cpp:716
static TSharedPtr< FIOSInputInterface > Get()
Definition NameTypes.h:617
Definition OutputDevice.h:133
Definition CoreMisc.h:28
Definition Array.h:670
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition World.h:918
Definition IOSInputInterface.h:91
uint32 charcode
Definition IOSInputInterface.h:94
uint32 keycode
Definition IOSInputInterface.h:93
EIOSEventType type
Definition IOSInputInterface.h:92
Definition IInputInterface.h:26
Definition AndroidInputInterface.h:145
FVector2D LastPosition
Definition AndroidInputInterface.h:149
float Force
Definition IOSInputInterface.h:72
TouchType Type
Definition AndroidInputInterface.h:148
int Handle
Definition IOSInputInterface.h:68
FVector2D Position
Definition AndroidInputInterface.h:150