Player Controller
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2
									
								
								Project/Gasa.sln.DotSettings.user
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Project/Gasa.sln.DotSettings.user
									
									
									
									
									
										Normal 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> | ||||
| @@ -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 | ||||
|   | ||||
| @@ -13,6 +13,8 @@ public class Gasa : ModuleRules | ||||
|     #region Engine | ||||
|         PrivateIncludePathModuleNames.AddRange(new string[] { | ||||
|             "Core", | ||||
|             "Engine", | ||||
|             "EnhancedInput", | ||||
|         }); | ||||
|         PrivateDependencyModuleNames.AddRange(new string[] { | ||||
|             "Core", | ||||
|   | ||||
							
								
								
									
										5
									
								
								Project/Source/Gasa/GasaCommon.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Project/Source/Gasa/GasaCommon.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| // #define private protected | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
|  | ||||
| class UInputMappingContext; | ||||
| @@ -1 +1,28 @@ | ||||
| #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); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user