mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-05 15:18:47 +00:00
Update README.md
This commit is contained in:
@@ -182,7 +182,7 @@ You must have Unreal 5.1 or greater and Visual Studio to launch the sample
|
|||||||
7. Once in Unreal, press Play (Alt+P)
|
7. Once in Unreal, press Play (Alt+P)
|
||||||
8. Press the `[Insert]` key or use the `Cog.ToggleInput` console command to open the Imgui Main Menu.
|
8. Press the `[Insert]` key or use the `Cog.ToggleInput` console command to open the Imgui Main Menu.
|
||||||
|
|
||||||
### Integrating Cog into your project
|
### Integrating Cog in your project
|
||||||
|
|
||||||
The Cog repository has the following structure:
|
The Cog repository has the following structure:
|
||||||
- `CogSample` - A Sample that demonstrate various Cog functionalities. The project was saved in Unreal 5.1
|
- `CogSample` - A Sample that demonstrate various Cog functionalities. The project was saved in Unreal 5.1
|
||||||
@@ -194,12 +194,12 @@ The Cog repository has the following structure:
|
|||||||
- `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/CogCommon` - Common headers
|
- `Plugins/CogCommon` - Common headers
|
||||||
|
|
||||||
Cog has multiple plugins 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 steps, 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:
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
|
// CogSample.Build.cs
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
public class CogSample : ModuleRules
|
public class CogSample : ModuleRules
|
||||||
@@ -239,12 +239,11 @@ 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.
|
2. In the class of your choice (in the sample we use the GameState class) add a reference to the CogWindowManager:
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
//ACogSampleGameState.h
|
// ACogSampleGameState.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogCommon.h"
|
#include "CogCommon.h"
|
||||||
@@ -272,6 +271,7 @@ class ACogSampleGameState : public AGameStateBase
|
|||||||
3. Instantiate the CogWindowManager and add some windows:
|
3. Instantiate the CogWindowManager and add some windows:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
// ACogSampleGameState.cpp
|
||||||
void ACogSampleGameState::BeginPlay()
|
void ACogSampleGameState::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
@@ -279,6 +279,8 @@ void ACogSampleGameState::BeginPlay()
|
|||||||
#if ENABLE_COG
|
#if ENABLE_COG
|
||||||
CogWindowManager = NewObject<UCogWindowManager>(this);
|
CogWindowManager = NewObject<UCogWindowManager>(this);
|
||||||
CogWindowManagerRef = CogWindowManager;
|
CogWindowManagerRef = CogWindowManager;
|
||||||
|
|
||||||
|
// Add some windows
|
||||||
CogWindowManager->CreateWindow<UCogEngineWindow_DebugSettings>("Engine.Debug Settings");
|
CogWindowManager->CreateWindow<UCogEngineWindow_DebugSettings>("Engine.Debug Settings");
|
||||||
CogWindowManager->CreateWindow<UCogEngineWindow_ImGui>("Engine.ImGui");
|
CogWindowManager->CreateWindow<UCogEngineWindow_ImGui>("Engine.ImGui");
|
||||||
[...]
|
[...]
|
||||||
@@ -290,12 +292,14 @@ void ACogSampleGameState::BeginPlay()
|
|||||||
3. Define which key will toggle the input from the game to Imgui:
|
3. Define which key will toggle the input from the game to Imgui:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
// ACogSampleGameState.cpp
|
||||||
FCogImguiModule::Get().SetToggleInputKey(FCogImGuiKeyInfo(EKeys::Insert));
|
FCogImguiModule::Get().SetToggleInputKey(FCogImGuiKeyInfo(EKeys::Insert));
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Tick the CogWindowManager:
|
4. Tick the CogWindowManager:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
// ACogSampleGameState.cpp
|
||||||
void ACogSampleGameState::Tick(float DeltaSeconds)
|
void ACogSampleGameState::Tick(float DeltaSeconds)
|
||||||
{
|
{
|
||||||
Super::Tick(DeltaSeconds);
|
Super::Tick(DeltaSeconds);
|
||||||
|
|||||||
Reference in New Issue
Block a user