Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Private Attributes
Fling::World Class Reference

The world holds all active levels in the game. More...

#include <World.h>

Inherits Fling::NonCopyable.

Public Member Functions

 World (entt::registry &t_Reg, Fling::Game *t_Game)
 
void Init ()
 Initializes the world. More...
 
void Shutdown ()
 Called just before destruction. More...
 
void Update (float t_DeltaTime)
 Tick all active levels in the world. More...
 
FORCEINLINE bool ShouldQuit () const
 Check if the world wants to exit the program. More...
 
template<class ... ARGS>
bool OutputLevelFile (const std::string &t_LevelToLoad)
 Based on all current entities in the registry serialize that data to a JSON file This will write out some core engine components along with the specified custom game components. More...
 
template<class ... ARGS>
bool LoadLevelFile (const std::string &t_LevelToLoad)
 Reset the current registry and load in new entities/components from a JSON file This will read in some core engine components along with the specified custom game components. More...
 
FORCEINLINE entt::registry & GetRegistry () const
 
- Public Member Functions inherited from Fling::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=default
 

Private Attributes

entt::registry & m_Registry
 The registry and represents all active entities in this world. More...
 
Fling::Gamem_Game = nullptr
 The game will allow users to specify their own update/read/write functions. More...
 
UINT8 m_ShouldQuit = false
 Flag if the world should quit or not! More...
 

Additional Inherited Members

- Protected Member Functions inherited from Fling::NonCopyable
 NonCopyable ()=default
 
virtual ~NonCopyable ()=default
 

Detailed Description

The world holds all active levels in the game.

There will only ever be exactly one World instance at any given time.

See also
Level

Constructor & Destructor Documentation

◆ World()

Fling::World::World ( entt::registry &  t_Reg,
Fling::Game t_Game 
)
explicit

Member Function Documentation

◆ GetRegistry()

FORCEINLINE entt::registry& Fling::World::GetRegistry ( ) const
inline

◆ Init()

void Fling::World::Init ( )

Initializes the world.

Loads the StartLevel that is specified in the config.

Note
Keep explicit Init and Shutdown functions to make the startup order more readable

◆ LoadLevelFile()

template<class ... ARGS>
bool Fling::World::LoadLevelFile ( const std::string &  t_LevelToLoad)

Reset the current registry and load in new entities/components from a JSON file This will read in some core engine components along with the specified custom game components.

Template Parameters
ARGSAny component types from your game that need to be serialized
Parameters
t_LevelToLoadFile path to load (relative to the assets directory)
Returns
True on success

◆ OutputLevelFile()

template<class ... ARGS>
bool Fling::World::OutputLevelFile ( const std::string &  t_LevelToLoad)

Based on all current entities in the registry serialize that data to a JSON file This will write out some core engine components along with the specified custom game components.

Template Parameters
ARGSAny component types from your game that need to be serialized
Parameters
t_LevelToLoadFile path to load (relative to the assets directory)
Returns
True on success

◆ ShouldQuit()

FORCEINLINE bool Fling::World::ShouldQuit ( ) const
inline

Check if the world wants to exit the program.

See also
Engine::Tick
Returns
True if the world has signaled for exit

◆ Shutdown()

void Fling::World::Shutdown ( )

Called just before destruction.

◆ Update()

void Fling::World::Update ( float  t_DeltaTime)

Tick all active levels in the world.

Parameters
t_DeltaTimeTime between previous frame and the current one.

Field Documentation

◆ m_Game

Fling::Game* Fling::World::m_Game = nullptr
private

The game will allow users to specify their own update/read/write functions.

◆ m_Registry

entt::registry& Fling::World::m_Registry
private

The registry and represents all active entities in this world.

◆ m_ShouldQuit

UINT8 Fling::World::m_ShouldQuit = false
private

Flag if the world should quit or not!


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