Player Controller

This commit is contained in:
Edward R. Gonzalez 2024-04-12 16:30:01 -04:00
parent 9fcb7329a3
commit 6d799a498f
8 changed files with 46 additions and 4 deletions

View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/OverridingFunctionStyle/@EntryValue">Override</s:String></wpf:ResourceDictionary>

View File

@ -9,13 +9,13 @@ class GASA_API AGasaCharacter : public ACharacter
{
GENERATED_BODY()
public:
AGasaCharacter();
#pragma region Combat
UPROPERTY(EditAnywhere, Category="Combat")
TObjectPtr<USkeletalMeshComponent> Weapon;
#pragma endregion Combat
AGasaCharacter();
#pragma region Actor
void BeginPlay() override;
#pragma endregion Actor

View File

@ -13,6 +13,8 @@ public class Gasa : ModuleRules
#region Engine
PrivateIncludePathModuleNames.AddRange(new string[] {
"Core",
"Engine",
"EnhancedInput",
});
PrivateDependencyModuleNames.AddRange(new string[] {
"Core",

View File

@ -0,0 +1,5 @@
// #define private protected
#include "CoreMinimal.h"
class UInputMappingContext;

View File

@ -1 +1,28 @@
#include "GasaPlayerController.h"
#include "GasaPlayerController.h"
#include "Engine/LocalPlayer.h"
#include "EnhancedInputSubsystems.h"
AGasaPlayerController::AGasaPlayerController()
{
bReplicates = true;
}
void AGasaPlayerController::BeginPlay()
{
Super::BeginPlay();
check(IMC);
UEnhancedInputLocalPlayerSubsystem*
EILP_Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
check(EILP_Subsystem);
EILP_Subsystem->AddMappingContext(IMC, 0);
{
bShowMouseCursor = true;
DefaultMouseCursor = EMouseCursor::Default;
FInputModeGameAndUI MouseMode;
MouseMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
MouseMode.SetHideCursorDuringCapture(false);
SetInputMode(MouseMode);
}
}

View File

@ -1,12 +1,18 @@
#pragma once
#include "GasaCommon.h"
#include "GasaPlayerController.generated.h"
UCLASS(Blueprintable)
class GASA_API AGasaPlayerController : public APlayerController
{
GENERATED_BODY()
public:
TObjectPtr<UInputMappingContext> IMC;
AGasaPlayerController();
void BeginPlay() override;
};