Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::GameScene Class Reference

This class is responsible for serving as a parent class for each instance of the game. In order to create a new instance for the game, copy this class and add objects as needed. More...

#include <gameScene.h>

Collaboration diagram for rune::GameScene:

Public Member Functions

 GameScene ()
 Default constructor to create a new rune::GameScene.
 
virtual void doInit (void)
 Initializes the state. More...
 
virtual void reInit (void)
 Reset the scene without unloading game objects. More...
 
virtual void deInit (void)
 
virtual void pause (void)
 
virtual void resume (void)
 
virtual void updateFixed (void)
 
virtual void updateVariable (void)
 
virtual void Draw (RenderWindow &window)
 
void updatePhysics (void)
 
virtual void handleCleanup (void)
 
virtual void handleUI (RenderWindow &window)
 
void startComponents (void)
 Call the start function for all the components on all the objects in the scene.
 
void updateComponents (void)
 Call the update function for all the components on all the objects in the scene.
 
void renderScene (RenderWindow &window)
 Makes all of the draw calls for the scene. More...
 
bool isActive (void)
 Determines whether or not the scene is currently active. More...
 
void addObjectToScene (rune::GameObject &)
 Place a new rune::GameObject into the scene.
 
void submitToRenderer (rune::Drawable &)
 Submits a drawable object into the rendering stack to be drawn to the screen each frame. More...
 
void addPhysicsObject (physics::RigidBody &body)
 Add a physics object to the scene.
 

Protected Attributes

bool isStateActive = false
 Whether or not the scene is currently active.
 
std::vector< physics::RigidBody * > physicsBodies
 The physics bodies in the scene to be simulated.
 
List< rune::GameObject * > sceneObjects
 Objects in the scene that need to have their components updated every frame.
 
std::vector< rune::Drawable * > drawableObjects
 The drawable objects contained in the scene that should be rendered to the screen.
 
rune::Clock variableClock
 A clock that records the amount of time between variable update calls.
 
double dT
 Time between variable update calls.
 
double accumulator
 Clamping value for physics simulator.
 
double frameStart
 The time that the current frame started.
 
rune::Color clearColor
 The color that the screen will be when cleared.
 

Friends

class SceneSerializer
 

Detailed Description

This class is responsible for serving as a parent class for each instance of the game. In order to create a new instance for the game, copy this class and add objects as needed.

Author
Thomas Montano
Date
March 2 2020

Member Function Documentation

◆ deInit()

void rune::GameScene::deInit ( void  )
virtual

DeInit is responsible for marking this state to be cleaned up

◆ doInit()

void rune::GameScene::doInit ( void  )
virtual

Initializes the state.

DoInit is responsible for initializing this State. HandleCleanup will be called if mCleanup is true so Derived classes should always call IState::DoInit() first before initializing their assets.

◆ Draw()

void rune::GameScene::Draw ( RenderWindow window)
virtual

Draw is responsible for handling all Drawing needs for this State when it is the Active State.

Parameters
windowRenderWindow to which the object should be drawn to.

◆ handleCleanup()

void rune::GameScene::handleCleanup ( void  )
virtual

HandleCleanup is responsible for performing any cleanup required before this State is removed.

◆ handleUI()

void rune::GameScene::handleUI ( RenderWindow window)
virtual

Handle scene level UI that needs to be run independent of the update rate.

Parameters
windowRender window that should be used for mouse positions

◆ isActive()

bool rune::GameScene::isActive ( void  )

Determines whether or not the scene is currently active.

Returns
Whether or not the current scene is flagged as active.

◆ pause()

void rune::GameScene::pause ( void  )
virtual

Pause is responsible for pausing this State since the Application may have lost focus or another State has become activate.

◆ reInit()

void rune::GameScene::reInit ( void  )
virtual

Reset the scene without unloading game objects.

ReInit is responsible for Resetting this state when the StateManager::ResetActiveState() method is called. This way a Game State can be restarted without unloading and reloading the game assets

◆ renderScene()

void rune::GameScene::renderScene ( RenderWindow window)

Makes all of the draw calls for the scene.

Parameters
windowA handle to the rune::RenderWindow that is being drawn to.
Warning
This function is only meant to be used in between a frame buffer bind and unbind only.

◆ resume()

void rune::GameScene::resume ( void  )
virtual

Resume is responsible for resuming this State since the Application may have gained focus or the previous State was removed.

◆ submitToRenderer()

void rune::GameScene::submitToRenderer ( rune::Drawable newDrawable)

Submits a drawable object into the rendering stack to be drawn to the screen each frame.

Parameters
newDrawablea pointer to an object that needs to be drawn to the screen.

◆ updateFixed()

void rune::GameScene::updateFixed ( void  )
virtual

UpdateFixed is responsible for handling all State fixed update needs for this State when it is the active State.

◆ updatePhysics()

void rune::GameScene::updatePhysics ( void  )

Update the RigidBodies in the scene.

◆ updateVariable()

void rune::GameScene::updateVariable ( void  )
virtual

UpdateVariable is responsible for handling all State variable update needs for this State when it is the active State.


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