mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-04 14:48:45 +00:00
Update README.md
This commit is contained in:
@@ -192,10 +192,10 @@ The Cog repository has the following structure:
|
|||||||
- `Plugins/CogWindow` - ImGui window management (Base Window, Layout)
|
- `Plugins/CogWindow` - ImGui window management (Base Window, Layout)
|
||||||
- `Plugins/CogDebug` - Debug functionalities (Log, Debug Draw, Plot, Metric, ...)
|
- `Plugins/CogDebug` - Debug functionalities (Log, Debug Draw, Plot, Metric, ...)
|
||||||
- `Plugins/CogImGui` - Integration of Imgui for Unreal, inspired by [UnrealImGui](https://github.com/segross/UnrealImGui)
|
- `Plugins/CogImGui` - Integration of Imgui for Unreal, inspired by [UnrealImGui](https://github.com/segross/UnrealImGui)
|
||||||
- `Plugins/CogInterface` - Interfaces implemented by actors to inspect them
|
- `Plugins/CogCommon` - Common headers
|
||||||
|
|
||||||
The reason for having multiple plugins is to ease the integration for projects that do not use the `Ability System Component` or `Enhanced Input`.
|
Cog has multiple plugins to ease the integration for projects that do not use the `Ability System Component` or `Enhanced Input`.
|
||||||
For the next step of the setup, it is assumed all the plugins are used.
|
For the setup next steps, it is assumed all the plugins are used.
|
||||||
|
|
||||||
1. Setup up module dependencies:
|
1. Setup up module dependencies:
|
||||||
|
|
||||||
@@ -239,6 +239,69 @@ public class CogSample : ModuleRules
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2. In the class of your choice (in the sample we use the GameState class) add a reference to the CogWindowManager.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
//ACogSampleGameState.h
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "CogCommon.h"
|
||||||
|
#include "GameFramework/GameStateBase.h"
|
||||||
|
#include "CogSampleGameState.generated.h"
|
||||||
|
|
||||||
|
class UCogWindowManager;
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class ACogSampleGameState : public AGameStateBase
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
[...]
|
||||||
|
|
||||||
|
// To make sure it doesn't get garbage collected.
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
|
||||||
|
|
||||||
|
#if ENABLE_COG
|
||||||
|
TObjectPtr<UCogWindowManager> CogWindowManager = nullptr;
|
||||||
|
#endif //ENABLE_COG
|
||||||
|
};
|
||||||
|
```
|
||||||
|
3. Instantiate the CogWindowManager and add some windows:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
void ACogSampleGameState::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
#if ENABLE_COG
|
||||||
|
CogWindowManager = NewObject<UCogWindowManager>(this);
|
||||||
|
CogWindowManagerRef = CogWindowManager;
|
||||||
|
CogWindowManager->CreateWindow<UCogEngineWindow_DebugSettings>("Engine.Debug Settings");
|
||||||
|
CogWindowManager->CreateWindow<UCogEngineWindow_ImGui>("Engine.ImGui");
|
||||||
|
[...]
|
||||||
|
#endif //ENABLE_COG
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Define which key will toggle the input from the game to Imgui:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
FCogImguiModule::Get().SetToggleInputKey(FCogImGuiKeyInfo(EKeys::Insert));
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Tick the CogWindowManager:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
void ACogSampleGameState::Tick(float DeltaSeconds)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaSeconds);
|
||||||
|
|
||||||
|
#if ENABLE_COG
|
||||||
|
CogWindowManager->Tick(DeltaSeconds);
|
||||||
|
#endif //ENABLE_COG
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user