3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace::GameFactory Class Reference

Factory class for Game instances. Sets services, GraphicsDevice, AudioEngine, PhysicsEngine, etc... More...

#include <GameFactory.hpp>

Public Types

typedef std::unique_ptr< Graphics::IGraphicsDevice >(* FnCreateGraphicsDevice) (void *hwnd, size_t x, size_t y)

Public Member Functions

 GameFactory ()
 Constructs an GameFactory instance.
 GameFactory (const GameFactory &)=delete
 GameFactory (GameFactory &&)=delete
GameFactory & operator= (const GameFactory &)=delete
GameFactory & operator= (GameFactory &&)=delete
void Begin (const std::string &title, size_t width, size_t height)
 Begin Game instance creation.
void Begin (Native::Window &&window)
 Begin Game instance creation.
void AddService (std::unique_ptr< IService > &&service)
 Adds an service to the game instance.
std::unique_ptr< Game > CreateGame ()
 Creates the game application instance. Must be called after Begin().

Static Public Member Functions

static std::unique_ptr< Graphics::IGraphicsDevice > CreateGraphicsDevice (const std::string &name, void *hwnd, size_t x, size_t y)
 Creates a Graphics device.
static void RegisterDevice (const std::string &name, FnCreateGraphicsDevice fn)
 Registers a new graphics device type for this factory class.
static void SetFallbackGraphicsDeviceCtor (FnCreateGraphicsDevice fn)
 Sets the fallback graphics device constructor. This is used if no named backend is specified or if the named backend is not found.

Detailed Description

Factory class for Game instances. Sets services, GraphicsDevice, AudioEngine, PhysicsEngine, etc...

A Game instance can still be constructed without this, but it will fallback to provided defaults.

Member Typedef Documentation

◆ FnCreateGraphicsDevice

typedef std::unique_ptr< Graphics::IGraphicsDevice >(* Engine3DRadSpace::GameFactory::FnCreateGraphicsDevice) (void *hwnd, size_t x, size_t y)

Constructor & Destructor Documentation

◆ GameFactory() [1/3]

GameFactory::GameFactory ( )

Constructs an GameFactory instance.

◆ GameFactory() [2/3]

Engine3DRadSpace::GameFactory::GameFactory ( const GameFactory & )
delete

◆ GameFactory() [3/3]

Engine3DRadSpace::GameFactory::GameFactory ( GameFactory && )
delete

Member Function Documentation

◆ AddService()

void GameFactory::AddService ( std::unique_ptr< IService > && service)

Adds an service to the game instance.

Parameters
service

◆ Begin() [1/2]

void GameFactory::Begin ( const std::string & title,
size_t width,
size_t height )

Begin Game instance creation.

Parameters
titleTitle of the window.
widthWidth of the window.
heightHeight of the window.

◆ Begin() [2/2]

void GameFactory::Begin ( Native::Window && window)

Begin Game instance creation.

Parameters
windowWindow instance to use for the game. The game instance will own the window.

◆ CreateGame()

std::unique_ptr< Game > GameFactory::CreateGame ( )

Creates the game application instance. Must be called after Begin().

Returns
a new Game instance

◆ CreateGraphicsDevice()

std::unique_ptr< Graphics::IGraphicsDevice > GameFactory::CreateGraphicsDevice ( const std::string & name,
void * hwnd,
size_t x,
size_t y )
static

Creates a Graphics device.

Parameters
nameNamed backend. If empty, first element in _deviceCtors is called.
Returns

◆ operator=() [1/2]

GameFactory & Engine3DRadSpace::GameFactory::operator= ( const GameFactory & )
delete

◆ operator=() [2/2]

GameFactory & Engine3DRadSpace::GameFactory::operator= ( GameFactory && )
delete

◆ RegisterDevice()

void GameFactory::RegisterDevice ( const std::string & name,
FnCreateGraphicsDevice fn )
static

Registers a new graphics device type for this factory class.

Parameters
nameString name representation
fnFunction pointer to a function that creates a new concrete instance of IGraphicsDevice

◆ SetFallbackGraphicsDeviceCtor()

void GameFactory::SetFallbackGraphicsDeviceCtor ( FnCreateGraphicsDevice fn)
static

Sets the fallback graphics device constructor. This is used if no named backend is specified or if the named backend is not found.

Parameters
fnFunction pointer to the graphics device constructor.

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