Aura Player Controller Input Setup
This commit is contained in:
@ -8,7 +8,7 @@ public class Aura : ModuleRules
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" });
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
||||
|
@ -2,4 +2,28 @@
|
||||
|
||||
|
||||
#include "Player/AuraPlayerController.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
|
||||
AAuraPlayerController::AAuraPlayerController()
|
||||
{
|
||||
bReplicates = true;
|
||||
}
|
||||
|
||||
void AAuraPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
check(AuraContext);
|
||||
|
||||
UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
|
||||
check(Subsystem);
|
||||
Subsystem->AddMappingContext(AuraContext, 0);
|
||||
|
||||
bShowMouseCursor = true;
|
||||
DefaultMouseCursor = EMouseCursor::Default;
|
||||
|
||||
FInputModeGameAndUI InputModeData;
|
||||
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||
InputModeData.SetHideCursorDuringCapture(false);
|
||||
SetInputMode(InputModeData);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "AuraPlayerController.generated.h"
|
||||
|
||||
class UInputMappingContext;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -13,5 +15,14 @@ UCLASS()
|
||||
class AURA_API AAuraPlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
||||
public:
|
||||
AAuraPlayerController();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, Category="Input")
|
||||
TObjectPtr<UInputMappingContext> AuraContext;
|
||||
};
|
||||
|
Reference in New Issue
Block a user