Potato Engine
Loading...
Searching...
No Matches
GameInstance.hpp File Reference
#include <functional>
#include <type_traits>
#include "PlayerController.hpp"
#include "Core/EngineSubsystem.hpp"

Go to the source code of this file.

Classes

class  GameInstance
 Singleton with various game properties and functions. This class also manages game subobjects. More...

Macros

#define SET_DEFAULT_SUBCLASS(def, set)
 Registers classes as the default subobject for its class.

Macro Definition Documentation

◆ SET_DEFAULT_SUBCLASS

#define SET_DEFAULT_SUBCLASS ( def,
set )
Value:
static struct __##set##_DEFAULT_SUBCLASS_REGISTER { \
__##set##_DEFAULT_SUBCLASS_REGISTER() { \
__DEFAULT_INSTANTIATORS::get_##def() = []() -> def* { return new set(); }; \
} \
} __##set##_DEFAULT_SUBCLASS_REGISTER_i;

Registers classes as the default subobject for its class.

Default subobjects are managed by the engine, but custom overrides can be made by inheriting from the base.

Remarks
Call this macro at the top of the source file to set as default
Warning
Trying to set multiple classes as the default for a subclass is undefined behaviour, as the macro utilizes static struct instantiation which is prone to the static initialization order fiasco

Definition at line 24 of file GameInstance.hpp.