Karma Engine
Loading...
Searching...
No Matches
Engine.h
1#pragma once
2
3#include "krpch.h"
4
5#include "Object.h"
6#include "Core/KarmaTypes.h"
7
8#include "GameFramework/World.h"
9
10namespace Karma
11{
36 {
37 EWorldType::Type m_WorldType;
38
39 std::string m_ContextHandle;
40
41 class UGameViewportClient* m_GameViewport;
42
43 class UGameInstance* m_OwningGameInstance;
44
45
47 //UPROPERTY(transient)
48 //TArray<FNamedNetDriver> ActiveNetDrivers;
49
50
52 //int32 PIEInstance;
53
54
56 //FString PIEPrefix;
57
58
60 //ERHIFeatureLevel::Type PIEWorldFeatureLevel;
61
62
65
66
69
70
73
74
77
78
80 //std::string CustomDescription;
81
82
83 // If > 0, tick this world at a fixed rate in PIE
85 float PIEAccumulatedTickSeconds = 0.f;
86
87
89 //TSet<FObjectKey> GarbageObjectsToVerify;
90
91 /**************************************************************/
92
94 //TArray<TObjectPtr<UWorld>*>
96
97
98 void AddRef(UWorld*& WorldPtr)
99 {
100 WorldPtr = m_ThisCurrentWorld;
101 m_ExternalReferences.AddUnique(&WorldPtr);
102 }
103
104
106 void RemoveRef(UWorld*& WorldPtr)
107 {
108 m_ExternalReferences.Remove(&WorldPtr);
109 WorldPtr = nullptr;
110 }
111
112
115
116
118 //void AddReferencedObjects(FReferenceCollector& Collector, const UObject* ReferencingObject);
119
120
121 FORCEINLINE UWorld* World() const
122 {
123 return m_ThisCurrentWorld;
124 }
125
127 : m_WorldType(EWorldType::None)
128 //, m_ContextHandle(NAME_None)
129 //, TravelURL()
130 //, TravelType(0)
131 //, PendingNetGame(nullptr)
132 //, bShouldCommitPendingMapChange(0)
133 , m_GameViewport(nullptr)
134 , m_OwningGameInstance(nullptr)
135 //, PIEInstance(INDEX_NONE)
136 //, PIEWorldFeatureLevel(ERHIFeatureLevel::Num)
137 , m_RunAsDedicated(false)
140 , m_AudioDeviceID(INDEX_NONE)
141 , m_ThisCurrentWorld(nullptr)
142 { }
143
144 private:
145 UWorld* m_ThisCurrentWorld;
146 };
147
154 class KARMA_API KEngine: public UObject
155 {
156 DECLARE_KARMA_CLASS(KEngine, UObject)
157
158 class UGameInstance* m_GameInstance;
159
160 public:
161 /* Default constructor */
162 KEngine();
163
164 void Init(/*IEngineLoop* InEngineLoop*/);
165
167 virtual void Tick(float DeltaSeconds, bool bIdleMode);
168
170 void CleanupGameViewport();
171
172 FWorldContext& CreateNewWorldContext(EWorldType::Type WorldType);
173
175 virtual void WorldAdded(UWorld* World) {}
176
178 virtual void WorldDestroyed(UWorld* InWorld) {}
179
181 virtual class UGameInstance* GetCurrentGameInstance() const { return m_GameInstance; }
182
183 protected:
184 KarmaVector<FWorldContext*> m_WorldList;
185 };
186
188 extern KARMA_API KEngine* GEngine;
189}
This file contains the class UObject along with helper functions.
Karma's std::vector wrapper.
Definition KarmaTypes.h:128
Definition Engine.h:155
virtual void WorldDestroyed(UWorld *InWorld)
Definition Engine.h:178
virtual class UGameInstance * GetCurrentGameInstance() const
Definition Engine.h:181
virtual void WorldAdded(UWorld *World)
Definition Engine.h:175
Definition GameInstance.h:16
Definition GameViewportClient.h:24
The base class of all the game code relevant objects.
Definition Object.h:106
Definition World.h:108
Definition KarmaTypes.h:29
Type
Definition KarmaTypes.h:31
Definition Engine.h:36
void RemoveRef(UWorld *&WorldPtr)
Definition Engine.h:106
FORCEINLINE UWorld * World() const
Definition Engine.h:121
bool m_RunAsDedicated
Definition Engine.h:64
uint32_t m_AudioDeviceID
Definition Engine.h:76
bool m_bWaitingOnOnlineSubsystem
Definition Engine.h:68
bool m_bIsPrimaryPIEInstance
Definition Engine.h:72
void SetCurrentWorld(UWorld *World)
Definition Engine.cpp:10
float PIEFixedTickSeconds
Definition Engine.h:84
KarmaVector< UWorld ** > m_ExternalReferences
Definition Engine.h:95