Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | Friends | List of all members
jop::Scene Class Reference

#include <Scene.hpp>

Inheritance diagram for jop::Scene:
jop::Object

Public Types

using TransformRestriction = Object::TransformRestriction
 

Public Member Functions

 JOP_DISALLOW_COPY_MOVE (Scene)
 
 Scene (const std::string &ID)
 Constructor. More...
 
virtual ~Scene ()
 Virtual destructor. More...
 
template<typename T , typename... Args>
T & setRenderer (Args &&...args)
 Set a new renderer. More...
 
template<int D>
detail::WorldType< D >::type & getWorld ()
 Get the physics world. More...
 
template<int D>
bool worldEnabled () const
 Check if a world is enabled. More...
 
template<int D>
void disableWorld ()
 Disable a world. More...
 
RenderergetRenderer () const
 Get the renderer. More...
 
void setDeltaScale (const float scale)
 Set the delta time scalar. More...
 
float getDeltaScale () const
 Get the delta time scalar. More...
 
Message::Result sendMessage (const Message &message)
 Send a message to this scene. More...
 
void updateBase (const float deltaTime)
 Base update. More...
 
virtual void preUpdate (const float deltaTime)
 Pre-update. More...
 
virtual void postUpdate (const float deltaTime)
 Post-update. More...
 
ObjectgetAsObject ()
 Get this scene as object. More...
 
const ObjectgetAsObject () const
 Get this scene as object. More...
 

Friends

class SceneLoader
 
class Object
 
class Renderer
 

Detailed Description

Definition at line 66 of file Scene.hpp.

Member Typedef Documentation

Definition at line 104 of file Scene.hpp.

Constructor & Destructor Documentation

jop::Scene::Scene ( const std::string &  ID)

Constructor.

Parameters
IDScene identifier
virtual jop::Scene::~Scene ( )
virtual

Virtual destructor.

Member Function Documentation

template<int D>
void jop::Scene::disableWorld ( )

Disable a world.

The template argument D must be either 2 or 3. The world will be deleted immediately. You shouldn't need to ever call this in typical situations, but should you, you'll need to ensure that all colliders that exist within the world are destroyed beforehand.

After this call returns, getWorld() will create the world again once called.

See also
getWorld()
Object& jop::Scene::getAsObject ( )

Get this scene as object.

This can be used to work around the privately inherited jop::Object. Do not ever call this unless you know what you're doing.

Returns
Reference to this as Object
const Object& jop::Scene::getAsObject ( ) const

Get this scene as object.

This can be used to work around the privately inherited jop::Object. Do not ever call this unless you know what you're doing.

Returns
Reference to this as Object
float jop::Scene::getDeltaScale ( ) const

Get the delta time scalar.

Returns
The delta time scalar
Renderer& jop::Scene::getRenderer ( ) const

Get the renderer.

Returns
Reference to the renderer
template<int D>
detail::WorldType<D>::type& jop::Scene::getWorld ( )

Get the physics world.

The template argument D must be either 2 or 3. If a world hasn't been enabled yet, it will be created by this function.

Returns
Reference to the world
jop::Scene::JOP_DISALLOW_COPY_MOVE ( Scene  )
virtual void jop::Scene::postUpdate ( const float  deltaTime)
virtual

Post-update.

This will be called after objects are updated.

Parameters
deltaTimeThe delta time
virtual void jop::Scene::preUpdate ( const float  deltaTime)
virtual

Pre-update.

This will be called before objects are updated.

Parameters
deltaTimeThe delta time
Message::Result jop::Scene::sendMessage ( const Message message)

Send a message to this scene.

The message will be forwarded to the objects, should it pass the filter.

Parameters
messageThe message
Returns
The message result
void jop::Scene::setDeltaScale ( const float  scale)

Set the delta time scalar.

The delta time value will be multiplied by this value every frame. This makes it possible to create slow-down or fast-forward effects.

Warning
The delta scale is allowed to be zero. You should ensure that divisions by zero won't occur because of this.
Parameters
scaleThe scale to set
See also
Engine::getDeltaTimeUnscaled()
template<typename T , typename... Args>
T& jop::Scene::setRenderer ( Args &&...  args)

Set a new renderer.

Parameters
argsArguments to pass into the renderer's constructor
Returns
Reference to the newly constructed renderer
void jop::Scene::updateBase ( const float  deltaTime)

Base update.

This will call preUpdate() and postUpdate().

Parameters
deltaTimeThe delta time
template<int D>
bool jop::Scene::worldEnabled ( ) const

Check if a world is enabled.

The template argument D must be either 2 or 3.

Returns
True if world has been enabled

Friends And Related Function Documentation

friend class Object
friend

Definition at line 111 of file Scene.hpp.

friend class Renderer
friend

Definition at line 112 of file Scene.hpp.

friend class SceneLoader
friend

Definition at line 110 of file Scene.hpp.


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