Progress on testing Cog
This commit is contained in:
		
							
								
								
									
										7
									
								
								Project/Source/Surgo/SuCommon.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Project/Source/Surgo/SuCommon.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| // This is a low-cost header filled mostly with defines or forwards. | ||||
| // Do not fill this with a bunch of actual definitions. | ||||
|  | ||||
| #include "CogCommon.h" | ||||
|  | ||||
| // Cog Forwards | ||||
| class UCogWindowManager; | ||||
							
								
								
									
										34
									
								
								Project/Source/Surgo/SuGameState.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Project/Source/Surgo/SuGameState.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| #include "SuGameState.h" | ||||
|  | ||||
| #include "CogAll.h" | ||||
| #include "CogWindowManager.h" | ||||
|  | ||||
| ASuGameState::ASuGameState() | ||||
| { | ||||
| 	// Enable ticking | ||||
|     PrimaryActorTick.bCanEverTick = true; | ||||
|     PrimaryActorTick.SetTickFunctionEnable(true); | ||||
|     PrimaryActorTick.bStartWithTickEnabled = true; | ||||
| } | ||||
|  | ||||
| #pragma region GameState | ||||
| void ASuGameState::BeginPlay() | ||||
| { | ||||
| #if ENABLE_COG | ||||
|     CogWindowManager = NewObject<UCogWindowManager>(this); | ||||
|     CogWindowManagerRef = CogWindowManager; | ||||
|  | ||||
|     // Add all the built-in windows | ||||
|     Cog::AddAllWindows(*CogWindowManager); | ||||
| #endif //ENABLE_COG | ||||
| } | ||||
|  | ||||
| void ASuGameState::Tick(float DeltaSeconds) | ||||
| { | ||||
| 	Super::Tick(DeltaSeconds); | ||||
|  | ||||
| #if ENABLE_COG | ||||
|     CogWindowManager->Tick(DeltaSeconds); | ||||
| #endif //ENABLE_COG | ||||
| } | ||||
| #pragma endregion GameState | ||||
							
								
								
									
										32
									
								
								Project/Source/Surgo/SuGameState.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Project/Source/Surgo/SuGameState.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "GameFramework/GameState.h" | ||||
|  | ||||
| #include "SuCommon.h" | ||||
|  | ||||
| #include "SuGameState.generated.h" | ||||
|  | ||||
|  | ||||
| UCLASS(BlueprintType) | ||||
| class SURGO_API ASuGameState : public AGameState | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| 	ASuGameState(); | ||||
| 	 | ||||
|     // To make sure it doesn't get garbage collected. | ||||
|     UPROPERTY() | ||||
|     TObjectPtr<UObject> CogWindowManagerRef = nullptr; | ||||
| 	 | ||||
| #if ENABLE_COG | ||||
| 	TObjectPtr<UCogWindowManager> CogWindowManager = nullptr; | ||||
| #endif // ENABLE_COG | ||||
|  | ||||
| #pragma region GameState | ||||
| 	void BeginPlay() override; | ||||
|  | ||||
| 	void Tick(float DeltaSeconds) override; | ||||
| #pragma endregion GameState | ||||
| }; | ||||
| @@ -3,6 +3,8 @@ using System.Collections.Generic; | ||||
|  | ||||
| using ModuleRules = UnrealBuildTool.ModuleRules; | ||||
| using ReadOnlyTargetRules = UnrealBuildTool.ReadOnlyTargetRules; | ||||
| using TargetRules = UnrealBuildTool.TargetRules; | ||||
| using UnrealTargetConfiguration = UnrealBuildTool.UnrealTargetConfiguration; | ||||
|  | ||||
| public class Surgo : ModuleRules | ||||
| { | ||||
| @@ -14,9 +16,43 @@ public class Surgo : ModuleRules | ||||
|         }); | ||||
|         PrivateDependencyModuleNames.AddRange(new string[] { | ||||
|             "Core", | ||||
|              | ||||
|             "AIModule", | ||||
|             "CoreUObject",  | ||||
|             "Engine",  | ||||
|             "EnhancedInput", | ||||
|             "GameplayAbilities", | ||||
|             "GameplayTags", | ||||
|             "GameplayTasks", | ||||
|             "InputCore",  | ||||
|             "NetCore", | ||||
|             "Niagara", | ||||
|         }); | ||||
|     #endregion Engine | ||||
|      | ||||
|     #region Plugins | ||||
| 		if (Target.Configuration != UnrealTargetConfiguration.Shipping && Target.Type != TargetRules.TargetType.Server) | ||||
|         { | ||||
| 	        PrivateIncludePathModuleNames.AddRange( new string[] | ||||
| 	        { | ||||
| 		        "CogCommon", | ||||
| 	        }); | ||||
|             PrivateDependencyModuleNames.AddRange(new string[] | ||||
|             { | ||||
| 	            // "UE_ImGui", | ||||
| 	            "CogCommon", | ||||
|                 "CogAbility", | ||||
|                 "CogAI", | ||||
|                 "CogAll", | ||||
|                 "CogDebug", | ||||
|                 "CogEngine", | ||||
|                 "CogImgui", | ||||
|                 "CogInput", | ||||
|                 "CogWindow", | ||||
|             }); | ||||
|         } | ||||
|     #endregion Plugins | ||||
|      | ||||
| 		PublicIncludePathModuleNames.Add("Surgo"); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user