diff --git a/Project/Binaries/Win64/UnrealEditor-Gasa.dll b/Project/Binaries/Win64/UnrealEditor-Gasa.dll index d6e19fb..ad02e51 100644 Binary files a/Project/Binaries/Win64/UnrealEditor-Gasa.dll and b/Project/Binaries/Win64/UnrealEditor-Gasa.dll differ diff --git a/Project/Binaries/Win64/UnrealEditor-Gasa.pdb b/Project/Binaries/Win64/UnrealEditor-Gasa.pdb index 71d7084..69dec06 100644 Binary files a/Project/Binaries/Win64/UnrealEditor-Gasa.pdb and b/Project/Binaries/Win64/UnrealEditor-Gasa.pdb differ diff --git a/Project/Saved/Config/ConsoleHistory.ini b/Project/Saved/Config/ConsoleHistory.ini new file mode 100644 index 0000000..e6d7a75 --- /dev/null +++ b/Project/Saved/Config/ConsoleHistory.ini @@ -0,0 +1,3 @@ +[ConsoleHistory] +History=Cog.ToggleInput + diff --git a/Project/Saved/ImGui/imgui.ini b/Project/Saved/ImGui/imgui.ini new file mode 100644 index 0000000..f366cf0 --- /dev/null +++ b/Project/Saved/ImGui/imgui.ini @@ -0,0 +1,29 @@ +[Window][DockSpaceViewport_11111111] +Pos=0,0 +Size=1614,1271 +Collapsed=0 + +[Window][Debug##Default] +Pos=60,60 +Size=400,400 +Collapsed=0 + +[Window][Inspector##Inspector] +Pos=910,136 +Size=641,1061 +Collapsed=1 + +[Table][0x7E0CA29E,2] +Column 0 Weight=1.0000 +Column 1 Weight=1.0000 + +[Docking][Data] +DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,0 Size=1614,1271 CentralNode=1 + +[Cog][Windows] +0xD0F6B9F9 + +[Cog][Widgets] +0x348EE4A5 0 +0x63A19979 0 + diff --git a/Project/Source/Gasa/Character/GasaCharacter.cpp b/Project/Source/Gasa/Character/GasaCharacter.cpp index 2b3ad80..12d2f35 100644 --- a/Project/Source/Gasa/Character/GasaCharacter.cpp +++ b/Project/Source/Gasa/Character/GasaCharacter.cpp @@ -1,12 +1,14 @@ #include "GasaCharacter.h" #include "Camera/CameraComponent.h" +#include "Components/CapsuleComponent.h" #include "GameFramework/CharacterMovementComponent.h" #include "GameFramework/SpringArmComponent.h" +#include "Kismet/KismetSystemLibrary.h" -void AGasaCharacter::SetHighlight(EHighlight desired) +void AGasaCharacter::SetHighlight(EHighlight Desired) { - + HighlightState = Desired; } AGasaCharacter::AGasaCharacter() @@ -48,3 +50,29 @@ void AGasaCharacter::BeginPlay() { Super::BeginPlay(); } + +void AGasaCharacter::Tick(float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + + switch (HighlightState) + { + case EHighlight::Disabled: + break; + case EHighlight::Enabled: + { + UCapsuleComponent* Capsule = GetCapsuleComponent(); + + UKismetSystemLibrary::DrawDebugCapsule(this + , Capsule->GetComponentLocation() + , Capsule->GetScaledCapsuleHalfHeight() + , Capsule->GetScaledCapsuleRadius() + , Capsule->GetComponentRotation() + , FLinearColor(0.8, 0.32, 0.05f, 1.f) + , 0.f + , 1.f + ); + } + break; + } +} diff --git a/Project/Source/Gasa/Character/GasaCharacter.h b/Project/Source/Gasa/Character/GasaCharacter.h index d5ba1ea..5d89bf7 100644 --- a/Project/Source/Gasa/Character/GasaCharacter.h +++ b/Project/Source/Gasa/Character/GasaCharacter.h @@ -5,6 +5,13 @@ #include "GasaCharacter.generated.h" +UENUM(BlueprintType) +enum class EHighlight : uint8 +{ + Disabled, + Enabled, +}; + UCLASS(Abstract) class GASA_API AGasaCharacter : public ACharacter { @@ -25,10 +32,11 @@ public: // This will be implemented in the base until it needs to be lifted into an abstraction. #pragma region Highlighting - void SetHighlight( EHighlight desired ); + EHighlight HighlightState; + void SetHighlight( EHighlight Desired ); UFUNCTION(BlueprintCallable) - FORCEINLINE void Highlight() { SetHighlight(EHighlight::Disabled); }; + FORCEINLINE void Highlight() { SetHighlight(EHighlight::Enabled); }; UFUNCTION(BlueprintCallable) FORCEINLINE void Dehighlight() { SetHighlight(EHighlight::Disabled); }; @@ -38,5 +46,7 @@ public: #pragma region Actor void BeginPlay() override; + + void Tick(float DeltaSeconds) override; #pragma endregion Actor }; diff --git a/Project/Source/Gasa/Character/PlayerCharacter.cpp b/Project/Source/Gasa/Character/PlayerCharacter.cpp index 89a2f20..dd0c3bb 100644 --- a/Project/Source/Gasa/Character/PlayerCharacter.cpp +++ b/Project/Source/Gasa/Character/PlayerCharacter.cpp @@ -1 +1,6 @@ -#include "PlayerCharacter.h" \ No newline at end of file +#include "PlayerCharacter.h" + +APlayerCharacter::APlayerCharacter() +{ + PrimaryActorTick.bCanEverTick = true; +} diff --git a/Project/Source/Gasa/Character/PlayerCharacter.h b/Project/Source/Gasa/Character/PlayerCharacter.h index 3c9dcb0..d55880e 100644 --- a/Project/Source/Gasa/Character/PlayerCharacter.h +++ b/Project/Source/Gasa/Character/PlayerCharacter.h @@ -10,5 +10,5 @@ class GASA_API APlayerCharacter : public AGasaCharacter GENERATED_BODY() public: - + APlayerCharacter(); }; diff --git a/Project/Source/Gasa/Gasa.Build.cs b/Project/Source/Gasa/Gasa.Build.cs index 8745e41..8a24d65 100644 --- a/Project/Source/Gasa/Gasa.Build.cs +++ b/Project/Source/Gasa/Gasa.Build.cs @@ -10,6 +10,8 @@ public class Gasa : ModuleRules { public Gasa(ReadOnlyTargetRules Target) : base(Target) { + bUseUnity = false; + #region Engine PrivateIncludePathModuleNames.AddRange(new string[] { "Core", @@ -29,12 +31,18 @@ public class Gasa : ModuleRules "InputCore", "NetCore", "Niagara", + "UMG", }); #endregion Engine #region Plugins if (Target.Configuration != UnrealTargetConfiguration.Shipping && Target.Type != TargetRules.TargetType.Server) { + PrivateDefinitions.AddRange(new string[] + { + "ENABLE_COG=true", + }); + PrivateIncludePathModuleNames.AddRange( new string[] { "CogCommon", diff --git a/Project/Source/Gasa/GasaCommon.h b/Project/Source/Gasa/GasaCommon.h index 9421e76..5083ae5 100644 --- a/Project/Source/Gasa/GasaCommon.h +++ b/Project/Source/Gasa/GasaCommon.h @@ -2,15 +2,21 @@ #include "CoreMinimal.h" // #define private protected -UENUM(BlueprintType) -enum class EHighlight -{ - Disabled, - Enabled, -}; +#include "CogCommon.h" +#pragma region Engine Forwards class UCameraComponent; class UInputAction; struct FInputActionValue; class UInputMappingContext; class USpringArmComponent; +#pragma endregion Engine Forwards + +#pragma region Engine Plugin Forwards +class UCogWindowManager; +#pragma endregion Engine Plugin Forwards + +#pragma region Gasa Forwards +class AGasaCharacter; +#pragma endregion Gasa Forwards + diff --git a/Project/Source/Gasa/GasaGameState.cpp b/Project/Source/Gasa/GasaGameState.cpp new file mode 100644 index 0000000..f8b1a60 --- /dev/null +++ b/Project/Source/Gasa/GasaGameState.cpp @@ -0,0 +1,34 @@ +#include "GasaGameState.h" + +#include "CogAll.h" +#include "CogWindowManager.h" + +AGasaGameState::AGasaGameState() +{ + // Enable ticking + PrimaryActorTick.bCanEverTick = true; + PrimaryActorTick.SetTickFunctionEnable(true); + PrimaryActorTick.bStartWithTickEnabled = true; +} + +#pragma region GameState +void AGasaGameState::BeginPlay() +{ +#if ENABLE_COG + CogWindowManager = NewObject(this); + CogWindowManagerRef = CogWindowManager; + + // Add all the built-in windows + Cog::AddAllWindows(*CogWindowManager); +#endif //ENABLE_COG +} + +void AGasaGameState::Tick(float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + +#if ENABLE_COG + CogWindowManager->Tick(DeltaSeconds); +#endif //ENABLE_COG +} +#pragma endregion GameState diff --git a/Project/Source/Gasa/GasaGameState.h b/Project/Source/Gasa/GasaGameState.h new file mode 100644 index 0000000..9ca5d73 --- /dev/null +++ b/Project/Source/Gasa/GasaGameState.h @@ -0,0 +1,30 @@ +#pragma once + +#include "GameFramework/GameState.h" +#include "GasaCommon.h" + +#include "GasaGameState.generated.h" + +UCLASS(Blueprintable) +class GASA_API AGasaGameState : public AGameState +{ + GENERATED_BODY() +public: +#pragma region Cog + // To make sure it doesn't get garbage collected. + UPROPERTY() + TObjectPtr CogWindowManagerRef = nullptr; + +#if ENABLE_COG + TObjectPtr CogWindowManager = nullptr; +#endif // ENABLE_COG +#pragma endregion Cog + + AGasaGameState(); + +#pragma region GameState + void BeginPlay() override; + + void Tick(float DeltaSeconds) override; +#pragma endregion GameState +}; \ No newline at end of file diff --git a/Project/Source/Gasa/GasaPlayerController.cpp b/Project/Source/Gasa/GasaPlayerController.cpp index ed99d83..ae36fa9 100644 --- a/Project/Source/Gasa/GasaPlayerController.cpp +++ b/Project/Source/Gasa/GasaPlayerController.cpp @@ -3,6 +3,7 @@ #include "Engine/LocalPlayer.h" #include "EnhancedInputComponent.h" #include "EnhancedInputSubsystems.h" +#include "Character/GasaCharacter.h" AGasaPlayerController::AGasaPlayerController() { @@ -53,6 +54,44 @@ void AGasaPlayerController::Move(FInputActionValue const& ActionValue) } #pragma region PlayerController +void AGasaPlayerController::PlayerTick(float DeltaTime) +{ + Super::PlayerTick(DeltaTime); + + // Cursor Trace + for (int32 do_once = 0; do_once != 1; ++ do_once) + { + FHitResult CursorHit; + GetHitResultUnderCursor(ECC_Pawn, false, CursorHit); + if (! CursorHit.bBlockingHit) + break; + + HoverPrev = HoverCurr; + HoverCurr = Cast(CursorHit.GetActor()); + if (HoverPrev == nullptr) + { + // We didn't have a prev to de-highlight so we just need to highlight newly detected character. + if (HoverCurr) + HoverCurr->Highlight(); + + // No matter what we need to not go to the next case as there is no previous. + break; + } + //else Previous is valid... + + // We are no longer hovering the previous with no new character, we just need to de-highlight previous. + if ( HoverCurr == nullptr ) + HoverPrev->Dehighlight(); + + // We had a prev and curr change between frames. They both don't match; we need to switch highlighting. + else if ( HoverPrev != HoverCurr ) + { + HoverPrev->Dehighlight(); + HoverCurr->Highlight(); + } + } +} + void AGasaPlayerController::SetupInputComponent() { Super::SetupInputComponent(); diff --git a/Project/Source/Gasa/GasaPlayerController.h b/Project/Source/Gasa/GasaPlayerController.h index 176ff77..fd7c367 100644 --- a/Project/Source/Gasa/GasaPlayerController.h +++ b/Project/Source/Gasa/GasaPlayerController.h @@ -13,6 +13,12 @@ class GASA_API AGasaPlayerController : public APlayerController public: #pragma region Input + UPROPERTY(VisibleAnywhere, BlueprintReadOnly) + AGasaCharacter* HoverPrev; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly) + AGasaCharacter* HoverCurr; + UPROPERTY(EditAnywhere, Category="Input") TObjectPtr IMC; @@ -25,6 +31,8 @@ public: void Move(FInputActionValue const& ActionValue); #pragma region PlayerController + void PlayerTick(float DeltaTime) override; + void SetupInputComponent() override; #pragma endregion PlayerController diff --git a/Project/Source/Gasa/GasaViewport.cpp b/Project/Source/Gasa/GasaViewport.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Project/Source/Gasa/GasaViewport.h b/Project/Source/Gasa/GasaViewport.h new file mode 100644 index 0000000..5ea731d --- /dev/null +++ b/Project/Source/Gasa/GasaViewport.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Blueprint/GameViewportSubsystem.h" + +#include "GasaViewport.generated.h" + +UCLASS() +class GASA_API UGasaViewportSubsystem : public UGameViewportSubsystem +{ + GENERATED_BODY() +public: + // UGasaViewportSubsystem(); + + +}; diff --git a/Project/Source/GasaEditor.Target.cs b/Project/Source/GasaEditor.Target.cs index da91bbb..216313a 100644 --- a/Project/Source/GasaEditor.Target.cs +++ b/Project/Source/GasaEditor.Target.cs @@ -11,6 +11,8 @@ public class GasaEditorTarget : TargetRules DefaultBuildSettings = BuildSettingsVersion.Latest; + bUseUnityBuild = false; + ExtraModuleNames.Add("Gasa"); ExtraModuleNames.Add("GasaEditor"); } diff --git a/scripts/build_project.ps1 b/scripts/build_project.ps1 new file mode 100644 index 0000000..a36f340 --- /dev/null +++ b/scripts/build_project.ps1 @@ -0,0 +1,98 @@ +Clear-Host + +$path_scripts = $PSScriptRoot +$path_helpers = join-path $path_scripts 'helpers' +$path_root = split-path -Parent -Path $path_scripts +$path_ue = join-path '../../Surgo' 'UE' +$path_project = join-path $path_root 'Project' + +$feditor_log = '-log' + +$fubt_project = '-project' +$fubt_projectfiles = '-projectfiles' +$fubt_game = '-game' +$fubt_engine = '-engine' +$fubt_progress = '-progress' + +$ue_editor = join-path $path_ue Engine\Binaries\Win64\UnrealEditor.exe +$UAT = join-path $path_ue 'Engine\Build\BatchFiles\RunUAT.bat' +$UBT = join-path $path_ue 'Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe' + +$uproject = join-path $path_project 'Gasa.uproject' + + +$UAT_BuildCookRun = 'BuildCookRun' +$UAT_BuildGame = 'BuildGame' +$UAT_BuildTarget = 'BuildTarget' + +$fUAT_unattended = '-unattended' +$fUAT_configuration = '-configuration' +$fUAT_no_tools = '-notools' +$fUAT_no_xge = '-NoXGE' +$fUAT_disable_unity = '-DisableUnity' +$fUAT_for_unity_builds = '-ForceUnity' + +$fUAT_client_config = '-clientconfig' + +$fUAT_target_platform = '-targetplatform' +$fUAT_server_target_platform = '-servertargetplatform' + +$fUAT_package_target = '-package' +$fUAT_skip_package_target = '-skippackage' +$fUAT_never_package_target = '-neverpackage' + +$fUAT_project = '-project' + +$fUAT_clean = '-clean' +$fUAT_build = '-build' + +$fUAT_editor = '-editor' + +$fUAT_cook = '-cook' +$fUAT_cook_on_the_fly_streaming = '-cookontheflystreaming' + +$fUAT_cook_all = '-CookAll' +$fUAT_cook_maps_only = '-CookMapsOnly' + +$fUAT_stage_prequisites = '-prereqs' +$fUAT_stage = '-stage' +$fUAT_run = '-run' + +$fUAT_rehydrate_assets = '-rehydrateassets' # Downloads assets that are only referenced virtually +$fUAT_archive = '-archive' +$fUAT_skip_cook = '-skipcook' +$fUAT_skip_cook_on_the_fly = '-skipcookonthefly' +$fUAT_skip_stage = '-skipstage' +$fUAT_generate_pak = '-pak' +$fUAT_pak_align_for_memory_mapping = '-PakAlignForMemoryMapping' + +$fUAT_map_to_run = '-map' +$fUAT_server_map_additional_params = '-AdditionalServerMapParams' + +$fUAT_distibute = '-distribute' +$fUAT_deploy = '-deploy' + +# Build-Cook-Run combo +$fUAT_bcr_server_target = '-dedicatedserver' +$fUAT_bcr_client_target = '-client' +$fUAT_run_just_server = '-noclient' +$fUAT_client_open_log = '-logwindow' +$fUAT_skip_server = '-skipserver' + +# Push-Location $path_ue +Push-Location $path_project + +$UAT_args = @() +$UAT_args += $UAT_BuildCookRun +$UAT_args += "$fUAT_project=$uproject" +$UAT_args += "$fUAT_target_platform=Win64" +$UAT_args += "$fUAT_client_config=Development" +$UAT_args += $fUAT_editor +$UAT_args += $fUAT_build +# $UAT_args += $fUAT_cook +# $UAT_args += $fUAT_cook_all +# $UAT_args += $fUAT_stage + +& $UAT $UAT_args + +Pop-Location