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

#include <Game.hpp>

Inheritance diagram for Engine3DRadSpace.Game:
Collaboration diagram for Engine3DRadSpace.Game:

Public Member Functions

 Game (string title, uint width=800, uint height=600)
 Game (IntPtr handle)
void Run ()
void RunOneFrame ()
 Game (const std::string &title, size_t width=800, size_t height=600)
 Constructs an application instance.
 Game (Native::Window &&window)
 Constructs an application window from the specified window.
 Game (Game &)=delete
 Game (Game &&)=delete
Game & operator= (const Game &)=delete
Game & operator= (Game &&)=delete
IService * RequireService (const std::type_index &type)
 Requires a service of the given type. If the service is not found, it is attempted to be created.
void Run ()
void RunOneFrame ()
void Exit ()
 Exits the game.
bool WasInitialized () const noexcept override
 Was ::Initialized() called on this instance?
bool WasLoaded () const noexcept override
 Was ::Load() called on this instance?
bool IsEditor () const noexcept override
 Is this game instance an editor?
Math::Ray GetMouseRay (const Math::Vector2 &mousePosition, const Math::Matrix4x4 &view, const Math::Matrix4x4 &projection)
virtual void Initialize () override
 Initialization method.
virtual void Uninitialize () override
 Called before the object has the destructor called.
virtual void Load () override
 Loads object's assets.
virtual void Load (const std::filesystem::path &path) override
 Loads a scene from file.
virtual void Update () override
 Update function.
virtual void Draw3D () override
 Main draw function for 3D objects.
virtual void Draw2D () override
 Main drawing function for 2D elements.
void AppendScene (const std::filesystem::path &path) override
std::filesystem::path GetCurrentScene () const noexcept
 ~Game () override
Public Member Functions inherited from Engine3DRadSpace.InstIGame
 InstIGame (IntPtr handle)
void Exit ()
 Exits the game.
Ray GetMouseRay (Vector2 pos, in Matrix4x4 view, in Matrix4x4 projection)
void AppendScene (string path)
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()
Public Member Functions inherited from Engine3DRadSpace.IGame
void Exit ()
void AppendScene (string path)
template<Service S>
void AddService (S *service)
 Adds an service to this game. The service must be derived from IService.
IService * GetService (const std::type_index &type)
 Gets the service of the given type. If the service is not found, nullptr is returned.
template<Service S>
S * GetService (Tag< S > dummy)
 Gets the service of type S. If the service is not found, nullptr is returned.
template<Service S>
S * RequireService (Tag< S > dummy)
 Requires a service of type S. If the service is not found, it is attempted to be created.
std::unordered_map< std::type_index, IService * >::iterator begin ()
 Begin iterator for services in the game.
std::unordered_map< std::type_index, IService * >::iterator end ()
 End iterator for services in the game.
virtual ~IGame ()=default
Public Member Functions inherited from Engine3DRadSpace.IUpdateable
void Update ()
virtual ~IUpdateable ()=default
Public Member Functions inherited from Engine3DRadSpace.IDrawable3D
void Draw3D ()
virtual ~IDrawable3D ()=default
Public Member Functions inherited from Engine3DRadSpace.IDrawable2D
void Draw2D ()
virtual ~IDrawable2D ()=default
Public Member Functions inherited from Engine3DRadSpace.IInitializable
void Initialize ()
virtual ~IInitializable ()=default
Public Member Functions inherited from Engine3DRadSpace.ILoadable
void Load ()
void Load (string path)
virtual ~ILoadable ()=default

Public Attributes

std::unique_ptr< Native::Window > Window
std::unique_ptr< Graphics::IGraphicsDevice > Device
std::unique_ptr< Content::ContentManager > Content
std::unique_ptr< Graphics::SpriteBatch > SpriteBatch
std::unique_ptr< Graphics::Rendering::RenderingManager > RenderingManager
Math::Color ClearColor = Math::Colors::Black
Input::Keyboard & Keyboard
Input::Mouse & Mouse
std::unique_ptr< Physics::IPhysicsEngine > Physics
std::unique_ptr< Audio::IAudioEngine > Audio
std::unique_ptr< Graphics::Rendering::PostProcessCollection > PostProcesses
std::unique_ptr< Objects::CameraProvider > Cameras
std::unique_ptr< Objects::ObjectList > Objects
std::unique_ptr< Plugins::PluginManager > Plugins
double Draw_dt = 0
double Update_dt = 0

Protected Attributes

List< Tuple< int, object > > objects
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed
Protected Attributes inherited from Engine3DRadSpace.IGame
std::unordered_map< std::type_index, IService * > _services

Properties

SpriteBatch SpriteBatch [get]
IGraphicsDevice GraphicsDevice [get]
PostProcessCollection PostProcessCollection [get]
IPhysicsEngine PhysicsEngine [get]
RenderingManager RenderingManager [get]
ObjectList ObjectList [get]
ContentManager ContentManager [get]
CameraProvider CameraProvider [get]
Mouse Mouse [get]
Keyboard Keyboard [get]
float DrawDeltaTime [get]
float UpdateDeltaTime [get]
Properties inherited from Engine3DRadSpace.InstIGame
bool WasInitialized [get]
bool WasLoaded [get]
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]
Properties inherited from Engine3DRadSpace.IGame
bool WasInitialized [get]
bool WasLoaded [get]

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Protected Member Functions inherited from Engine3DRadSpace.IGame
 IGame ()=default
 IGame (const IGame &)=delete
IGame & operator= (const IGame &)=delete
 IGame (IGame &&) noexcept=default
IGame & operator= (IGame &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IUpdateable
 IUpdateable ()=default
 IUpdateable (const IUpdateable &) noexcept=default
IUpdateable & operator= (const IUpdateable &) noexcept=default
 IUpdateable (IUpdateable &&) noexcept=default
IUpdateable & operator= (IUpdateable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IDrawable3D
 IDrawable3D ()=default
 IDrawable3D (const IDrawable3D &)=default
IDrawable3D & operator= (const IDrawable3D &)=default
 IDrawable3D (IDrawable3D &&) noexcept=default
IDrawable3D & operator= (IDrawable3D &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IDrawable2D
 IDrawable2D ()=default
 IDrawable2D (const IDrawable2D &)=default
IDrawable2D & operator= (const IDrawable2D &)=default
 IDrawable2D (IDrawable2D &&) noexcept=default
IDrawable2D & operator= (IDrawable2D &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IInitializable
 IInitializable ()=default
 IInitializable (const IInitializable &) noexcept=default
IInitializable & operator= (const IInitializable &) noexcept=default
 IInitializable (IInitializable &&) noexcept=default
IInitializable & operator= (IInitializable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.ILoadable
 ILoadable ()=default
 ILoadable (const ILoadable &) noexcept=default
ILoadable & operator= (const ILoadable &) noexcept=default
 ILoadable (ILoadable &&) noexcept=default
ILoadable & operator= (ILoadable &&) noexcept=default

Constructor & Destructor Documentation

◆ Game() [1/6]

Engine3DRadSpace.Game.Game ( string title,
uint width = 800,
uint height = 600 )
inline

◆ Game() [2/6]

Engine3DRadSpace.Game.Game ( IntPtr handle)
inline

◆ Game() [3/6]

Game::Game ( const std::string & title,
size_t width = 800,
size_t height = 600 )

Constructs an application instance.

Parameters
titleTitle of the window
widthWidth of the window and backbuffer
heightHeight of the window and backbuffer

◆ Game() [4/6]

Game::Game ( Native::Window && window)
explicit

Constructs an application window from the specified window.

Parameters
windowWindow used to create the application instance. Ownership will be transferred to this.

Backbuffer size will be the same as Window.Size().

◆ Game() [5/6]

◆ Game() [6/6]

◆ ~Game()

Game::~Game ( )
override

Member Function Documentation

◆ AppendScene()

void Game::AppendScene ( const std::filesystem::path & path)
overridevirtual

◆ Draw2D()

void Game::Draw2D ( )
overridevirtual

Main drawing function for 2D elements.

Implements Engine3DRadSpace.IDrawable2D.

Reimplemented in EditorGame.

◆ Draw3D()

void Game::Draw3D ( )
overridevirtual

Main draw function for 3D objects.

Implements Engine3DRadSpace.IDrawable3D.

Reimplemented in EditorGame, and TriangleTest.

◆ Exit()

void Game::Exit ( )
virtual

Exits the game.

Implements Engine3DRadSpace.IGame.

◆ GetCurrentScene()

std::filesystem::path Game::GetCurrentScene ( ) const
noexcept

◆ GetMouseRay()

Ray Game::GetMouseRay ( const Math::Vector2 & mousePosition,
const Math::Matrix4x4 & view,
const Math::Matrix4x4 & projection )

◆ Initialize()

void Game::Initialize ( )
overridevirtual

Initialization method.

Implements Engine3DRadSpace.IInitializable.

Reimplemented in EditorGame, TestGame, and TriangleTest.

◆ IsEditor()

bool Game::IsEditor ( ) const
overridevirtualnoexcept

Is this game instance an editor?

Returns
True if this instance is an editor.

summary> Appends a scene to the game.

Parameters
pathPath to the scene to append.

Implements Engine3DRadSpace.IGame.

◆ Load() [1/2]

void Game::Load ( )
overridevirtual

Loads object's assets.

Implements Engine3DRadSpace.ILoadable.

Reimplemented in EditorGame, SkinmeshPreviewer, and TriangleTest.

◆ Load() [2/2]

void Game::Load ( const std::filesystem::path & path)
overridevirtual

Loads a scene from file.

Parameters
path3drsp file.

Implements Engine3DRadSpace.ILoadable.

◆ operator=() [1/2]

Game & Engine3DRadSpace.Game.operator= ( const Game & )
delete

◆ operator=() [2/2]

Game & Engine3DRadSpace.Game.operator= ( Game && )
delete

◆ RequireService()

IService * Game::RequireService ( const std::type_index & type)
virtual

Requires a service of the given type. If the service is not found, it is attempted to be created.

Parameters
typeType of the service to require.
Returns
Pointer to the service of the given type.

Reimplemented from Engine3DRadSpace.IGame.

◆ Run() [1/2]

void Game.Run ( )
inline

◆ Run() [2/2]

◆ RunOneFrame() [1/2]

void Game.RunOneFrame ( )
inline

◆ RunOneFrame() [2/2]

◆ Uninitialize()

void Game::Uninitialize ( )
overridevirtual

Called before the object has the destructor called.

Implements Engine3DRadSpace.IInitializable.

◆ Update()

void Game::Update ( )
overridevirtual

Update function.

Implements Engine3DRadSpace.IUpdateable.

Reimplemented in EditorGame, EmptyGame, MyGame, SkinmeshPreviewer, and TriangleTest.

◆ WasInitialized()

bool Game::WasInitialized ( ) const
overridevirtualnoexcept

Was ::Initialized() called on this instance?

Returns
Was ::Initialized() called on this instance.

Implements Engine3DRadSpace.IGame.

◆ WasLoaded()

bool Game::WasLoaded ( ) const
overridevirtualnoexcept

Was ::Load() called on this instance?

Returns
Was ::Load() called on this instance.

Implements Engine3DRadSpace.IGame.

Member Data Documentation

◆ Audio

std::unique_ptr<Audio::IAudioEngine> Engine3DRadSpace.Game.Audio

◆ Cameras

std::unique_ptr<Objects::CameraProvider> Engine3DRadSpace.Game.Cameras

◆ ClearColor

Math::Color Engine3DRadSpace.Game.ClearColor = Math::Colors::Black

◆ Content

std::unique_ptr<Content::ContentManager> Engine3DRadSpace.Game.Content

◆ Device

std::unique_ptr<Graphics::IGraphicsDevice> Engine3DRadSpace.Game.Device

◆ Draw_dt

double Engine3DRadSpace.Game.Draw_dt = 0

◆ Keyboard

◆ Mouse

◆ Objects

std::unique_ptr<Objects::ObjectList> Engine3DRadSpace.Game.Objects

◆ objects

List<Tuple<int, object> > Engine3DRadSpace.Game.objects
protected

◆ Physics

std::unique_ptr<Physics::IPhysicsEngine> Engine3DRadSpace.Game.Physics

◆ Plugins

std::unique_ptr<Plugins::PluginManager> Engine3DRadSpace.Game.Plugins

◆ PostProcesses

std::unique_ptr<Graphics::Rendering::PostProcessCollection> Engine3DRadSpace.Game.PostProcesses

◆ RenderingManager

◆ SpriteBatch

◆ Update_dt

double Engine3DRadSpace.Game.Update_dt = 0

◆ Window

std::unique_ptr<Native::Window> Engine3DRadSpace.Game.Window

Property Documentation

◆ CameraProvider

CameraProvider Engine3DRadSpace.Game.CameraProvider
get

◆ ContentManager

ContentManager Engine3DRadSpace.Game.ContentManager
get

◆ DrawDeltaTime

float Engine3DRadSpace.Game.DrawDeltaTime
get

◆ GraphicsDevice

IGraphicsDevice Engine3DRadSpace.Game.GraphicsDevice
get

◆ Keyboard

Keyboard Engine3DRadSpace.Game.Keyboard
get

◆ Mouse

Mouse Engine3DRadSpace.Game.Mouse
get

◆ ObjectList

ObjectList Engine3DRadSpace.Game.ObjectList
get

◆ PhysicsEngine

IPhysicsEngine Engine3DRadSpace.Game.PhysicsEngine
get

◆ PostProcessCollection

PostProcessCollection Engine3DRadSpace.Game.PostProcessCollection
get

◆ RenderingManager

RenderingManager Engine3DRadSpace.Game.RenderingManager
get

◆ SpriteBatch

SpriteBatch Engine3DRadSpace.Game.SpriteBatch
get

◆ UpdateDeltaTime

float Engine3DRadSpace.Game.UpdateDeltaTime
get

The documentation for this class was generated from the following files:
  • E:/3DRadSpace/3DRadSpace_CSharp/Game.cs
  • E:/3DRadSpace/Engine3DRadSpace/Games/Game.hpp
  • E:/3DRadSpace/Engine3DRadSpace/Games/Game.cpp