Leviathan  0.8.0.0
Leviathan game engine
Leviathan::GameWorldFactory Class Reference

Allows overwriting the used GameWorld class in the engine. By default creates a StandardWorld. More...

#include <GameWorldFactory.h>

Public Member Functions

DLLEXPORT GameWorldFactory ()
 
DLLEXPORT ~GameWorldFactory ()
 
virtual DLLEXPORT std::shared_ptr< GameWorldCreateNewWorld (int worldtype, const std::shared_ptr< PhysicsMaterialManager > &physicsMaterials, int overrideid=-1)
 Creates a new world that can be used. More...
 

Static Public Member Functions

static DLLEXPORT GameWorldFactoryGet ()
 

Static Protected Attributes

static DLLEXPORT GameWorldFactoryStaticInstance = nullptr
 Global instance. Overwrite this in child class constructors. More...
 

Detailed Description

Allows overwriting the used GameWorld class in the engine. By default creates a StandardWorld.

Definition at line 15 of file GameWorldFactory.h.

Constructor & Destructor Documentation

◆ GameWorldFactory()

DLLEXPORT GameWorldFactory::GameWorldFactory ( )

Definition at line 7 of file GameWorldFactory.cpp.

8 {
9  LEVIATHAN_ASSERT(StaticInstance == nullptr, "Multiple GameWorldFactories created");
10  StaticInstance = this;
11 }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:98
static DLLEXPORT GameWorldFactory * StaticInstance
Global instance. Overwrite this in child class constructors.

◆ ~GameWorldFactory()

DLLEXPORT GameWorldFactory::~GameWorldFactory ( )

Definition at line 13 of file GameWorldFactory.cpp.

14 {
15  StaticInstance = nullptr;
16 }
static DLLEXPORT GameWorldFactory * StaticInstance
Global instance. Overwrite this in child class constructors.

Member Function Documentation

◆ CreateNewWorld()

DLLEXPORT std::shared_ptr< GameWorld > GameWorldFactory::CreateNewWorld ( int  worldtype,
const std::shared_ptr< PhysicsMaterialManager > &  physicsMaterials,
int  overrideid = -1 
)
virtual

Creates a new world that can be used.

This method can be skipped in places where the actual GameWorld class that should be created is known

Parameters
worldtypeApplication specific type that can be used to pass the wanted type of world around

Definition at line 25 of file GameWorldFactory.cpp.

27 {
28  if(worldtype != 0)
29  LOG_WARNING("Standard GameWorldFactory: worldtype is not 0");
30 
31  return std::make_shared<StandardWorld>(physicsMaterials);
32 }
#define LOG_WARNING(x)
Definition: Define.h:89

◆ Get()

DLLEXPORT GameWorldFactory * GameWorldFactory::Get ( )
static

Definition at line 20 of file GameWorldFactory.cpp.

21 {
22  return StaticInstance;
23 }
static DLLEXPORT GameWorldFactory * StaticInstance
Global instance. Overwrite this in child class constructors.

Member Data Documentation

◆ StaticInstance

DLLEXPORT GameWorldFactory * GameWorldFactory::StaticInstance = nullptr
staticprotected

Global instance. Overwrite this in child class constructors.

Definition at line 33 of file GameWorldFactory.h.


The documentation for this class was generated from the following files: