KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Engine.h
Go to the documentation of this file.
1
10
11#pragma once
12
13#include "krpch.h"
14
15#include "Object.h"
16#include "Core/KarmaTypes.h"
17
18#include "GameFramework/World.h"
19
20namespace Karma
21{
45 {
46 EWorldType::Type m_WorldType;
47
48 std::string m_ContextHandle;
49
50 class UGameViewportClient* m_GameViewport;
51
52 class UGameInstance* m_OwningGameInstance;
53
54
56 //UPROPERTY(transient)
57 //TArray<FNamedNetDriver> ActiveNetDrivers;
58
59
61 //int32 PIEInstance;
62
63
65 //FString PIEPrefix;
66
67
69 //ERHIFeatureLevel::Type PIEWorldFeatureLevel;
70
71
74
75
78
79
82
83
86
87
89 //std::string CustomDescription;
90
91
92 // If > 0, tick this world at a fixed rate in PIE
94 float PIEAccumulatedTickSeconds = 0.f;
95
96
98 //TSet<FObjectKey> GarbageObjectsToVerify;
99
100 /**************************************************************/
101
103 //TArray<TObjectPtr<UWorld>*>
105
113 void AddRef(UWorld*& WorldPtr)
114 {
115 WorldPtr = m_ThisCurrentWorld;
116 m_ExternalReferences.AddUnique(&WorldPtr);
117 }
118
127 void RemoveRef(UWorld*& WorldPtr)
128 {
129 m_ExternalReferences.Remove(&WorldPtr);
130 WorldPtr = nullptr;
131 }
132
133
141
142
144 //void AddReferencedObjects(FReferenceCollector& Collector, const UObject* ReferencingObject);
145
153 {
154 return m_ThisCurrentWorld;
155 }
156
163 : m_WorldType(EWorldType::None)
164 //, m_ContextHandle(NAME_None)
165 //, TravelURL()
166 //, TravelType(0)
167 //, PendingNetGame(nullptr)
168 //, bShouldCommitPendingMapChange(0)
169 , m_GameViewport(nullptr)
170 , m_OwningGameInstance(nullptr)
171 //, PIEInstance(INDEX_NONE)
172 //, PIEWorldFeatureLevel(ERHIFeatureLevel::Num)
173 , m_RunAsDedicated(false)
176 , m_AudioDeviceID(INDEX_NONE)
177 , m_ThisCurrentWorld(nullptr)
178 { }
179
180 private:
181 UWorld* m_ThisCurrentWorld;
182 };
183
191 {
193
194 class UGameInstance* m_GameInstance;
195
196 public:
203 KEngine();
204
211 void Init(/*IEngineLoop* InEngineLoop*/);
212
221 virtual void Tick(float DeltaSeconds, bool bIdleMode);
222
229 void CleanupGameViewport();
230
240
247 virtual void WorldAdded(UWorld* World) {}
248
255 virtual void WorldDestroyed(UWorld* InWorld) {}
256
262 virtual class UGameInstance* GetCurrentGameInstance() const { return m_GameInstance; }
263
264 protected:
265 KarmaVector<FWorldContext*> m_WorldList;
266 };
267
269 extern KARMA_API KEngine* GEngine;
270}
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define FORCEINLINE
Typical inlining macro for clarity.
Definition Core.h:157
@ None
Events of the unknown category.
Definition Event.h:37
#define DECLARE_KARMA_CLASS(TClass, TSuperClass)
Karma's gamecode object class declaration.
Definition GFrameworkMacros.h:44
This file contains the types used in game logic.
This file contains the class UObject along with helper functions.
This file contains UWorld class and FActorSpawnParameters.
virtual void WorldDestroyed(UWorld *InWorld)
Definition Engine.h:255
void Init()
Set up UGameInstance for the constructor.
Definition Engine.cpp:21
KEngine()
Default constructor. Includes setting up UGameInstance.
Definition Engine.cpp:15
virtual class UGameInstance * GetCurrentGameInstance() const
Definition Engine.h:262
virtual void WorldAdded(UWorld *World)
Definition Engine.h:247
virtual void Tick(float DeltaSeconds, bool bIdleMode)
Update everything (UWorlds and subsequently all the AActors). Should be economic for processor and re...
Definition Engine.cpp:35
void CleanupGameViewport()
Definition Engine.cpp:67
FWorldContext & CreateNewWorldContext(EWorldType::Type WorldType)
Create a context for new world.
Definition Engine.cpp:58
A high-level manager object for an instance of the running game.
Definition GameInstance.h:28
A game viewport (FViewport) is a high-level abstract interface for the platform specific rendering,...
Definition GameViewportClient.h:33
UObject()
Definition Object.cpp:10
The World is the top level object representing a map or a sandbox in which Actors and Components will...
Definition World.h:150
Karma's std::vector wrapper.
Definition KarmaTypes.h:152
Specifies the goal/source of a UWorld object.
Definition KarmaTypes.h:45
Type
Definition KarmaTypes.h:47
A context for dealing with UWorlds at the engine level. As the engine brings up and destroys world,...
Definition Engine.h:45
void RemoveRef(UWorld *&WorldPtr)
Removes an external reference.
Definition Engine.h:127
void AddRef(UWorld *&WorldPtr)
Routine to add outside references to our UWorld. If our UWorld changes, routines outside of UWorldCon...
Definition Engine.h:113
FORCEINLINE UWorld * World() const
Getter for variable m_ThisCurrentWorld.
Definition Engine.h:152
bool m_RunAsDedicated
Definition Engine.h:73
uint32_t m_AudioDeviceID
Definition Engine.h:85
FWorldContext()
A usual constructor.
Definition Engine.h:162
bool m_bWaitingOnOnlineSubsystem
Definition Engine.h:77
bool m_bIsPrimaryPIEInstance
Definition Engine.h:81
void SetCurrentWorld(UWorld *World)
Set CurrentWorld and update external reference pointers to reflect this.
Definition Engine.cpp:10
float PIEFixedTickSeconds
Definition Engine.h:93
KarmaVector< UWorld ** > m_ExternalReferences
Definition Engine.h:104