SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
Scene Class Referenceabstract

Represents a scene in the engine. More...

#include <Scene.h>

Inheritance diagram for Scene:
Inheritance graph

Public Member Functions

 Scene (const Scene &)=delete
 
Sceneoperator= (const Scene &)=delete
 
void SetCurrentCamera (Camera *cam)
 Sets the current 3D camera for the scene.
 
Camera * GetCurrentCamera () const
 Gets the current camera for the scene.
 
void SetCurrentCamera2D (Camera *cam)
 Sets the current 2D camera for the scene.
 
Camera * GetCurrentCamera2D () const
 Gets the current 2D camera for the scene.
 
void SetTerrain (const std::string &key)
 Sets the terrain for the scene using a key.
 
TerrainGetTerrain () const
 Sets the terrain for the scene using a pointer to a Terrain object.
 

Protected Member Functions

template<typename C>
void SetCollisionSelf ()
 Sets the collision self test for the specified collidable type.
 
template<typename C1, typename C2>
void SetCollisionPair ()
 Sets the collision pair test for the specified collidable types.
 
template<typename Type>
void SetCollisionTerrain ()
 Sets up collision detection between the specified type and the current terrain.
 

Private Member Functions

virtual void Initialize ()=0
 Initializes the scene. Defined by the user.
 
void Update ()
 Updates the scene. Specifically, the broker and managers other than draw.
 
void Draw ()
 Draws the scene.
 
virtual void SceneEnd ()=0
 Ends the scene. Defined by the user.
 
void Register (Updatable *up)
 Registers an updatable GameObject.
 
void Deregister (Updatable *up)
 Deregisters an updatable GameObject.
 
void Register (Drawable *dr)
 Registers a drawable GameObject.
 
void Deregister (Drawable *dr)
 Deregisters a drawable GameObject.
 
void Register (Alarmable *al, AlarmableManager::ALARM_ID id, float t)
 Registers an alarmable GameObject.
 
void Deregister (Alarmable *al, AlarmableManager::ALARM_ID id)
 Deregisters an alarmable GameObject.
 
void Register (Inputable *in, AZUL_KEY k, EventType e)
 Registers an inputable GameObject.
 
void Deregister (Inputable *in, AZUL_KEY k, EventType e)
 Deregisters an inputable GameObject.
 
void Register (Inputable *in, AZUL_MOUSE m, EventType e)
 Registers an inputable GameObject for mouse events.
 
void Deregister (Inputable *in, AZUL_MOUSE m, EventType e)
 Deregisters an inputable GameObject for mouse events.
 
void SubmitCommand (CommandBase *cmd)
 Submits a command to the scene.
 
CollisionManagerGetCollisionManager ()
 Gets the collision manager for the scene.
 

Private Attributes

CameraManagercameraManager
 Pointer to the camera manager.
 
SceneRegistrationBrokerregistrationBroker
 Pointer to the scene registration broker.
 
UpdatableManagerupdatableManager
 Pointer to the updatable manager.
 
AlarmableManageralarmableManager
 Pointer to the alarmable manager.
 
KeyboardEventManagerkeyboardEventManager
 Pointer to the keyboard event manager.
 
DrawableManagerdrawableManager
 Pointer to the drawable manager.
 
CollisionManagercollisionManager
 Pointer to the collision manager.
 
TerrainManagerterrainManager
 Pointer to the current terrain.
 

Friends

class SceneAttorney
 

Detailed Description

Represents a scene in the engine.

The Scene class is responsible for managing the GameObjects and their interactions within a scene. It provides methods to initialize, update, draw, and end the scene. It also manages the registration and deregistration of GameObjects for various systems such as updates, drawing, alarms, input, and collisions.

Member Function Documentation

◆ Deregister() [1/5]

void Scene::Deregister ( Alarmable * al,
AlarmableManager::ALARM_ID id )
private

Deregisters an alarmable GameObject.

Parameters
alPointer to the alarmable GameObject.
idThe alarm ID to deregister.

◆ Deregister() [2/5]

void Scene::Deregister ( Drawable * dr)
private

Deregisters a drawable GameObject.

Parameters
drPointer to the drawable GameObject.

◆ Deregister() [3/5]

void Scene::Deregister ( Inputable * in,
AZUL_KEY k,
EventType e )
private

Deregisters an inputable GameObject.

Parameters
inPointer to the inputable GameObject.
kThe key to deregister.
eThe event type to deregister.

◆ Deregister() [4/5]

void Scene::Deregister ( Inputable * in,
AZUL_MOUSE m,
EventType e )
private

Deregisters an inputable GameObject for mouse events.

Parameters
inPointer to the inputable GameObject.
mThe mouse key to deregister.
eThe event type to deregister.

◆ Deregister() [5/5]

void Scene::Deregister ( Updatable * up)
private

Deregisters an updatable GameObject.

Parameters
upPointer to the updatable GameObject.
Here is the caller graph for this function:

◆ GetCollisionManager()

CollisionManager * Scene::GetCollisionManager ( )
private

Gets the collision manager for the scene.

Returns
Pointer to the collision manager.
Here is the caller graph for this function:

◆ GetCurrentCamera()

Camera * Scene::GetCurrentCamera ( ) const

Gets the current camera for the scene.

Returns
Pointer to the current camera.

◆ GetCurrentCamera2D()

Camera * Scene::GetCurrentCamera2D ( ) const

Gets the current 2D camera for the scene.

Returns
Pointer to the current 2D camera.

◆ GetTerrain()

Terrain * Scene::GetTerrain ( ) const

Sets the terrain for the scene using a pointer to a Terrain object.

Parameters
tPointer to the Terrain object.
Here is the caller graph for this function:

◆ Initialize()

virtual void Scene::Initialize ( )
privatepure virtual

Initializes the scene. Defined by the user.

Implemented in SceneNull.

Here is the caller graph for this function:

◆ Register() [1/5]

void Scene::Register ( Alarmable * al,
AlarmableManager::ALARM_ID id,
float t )
private

Registers an alarmable GameObject.

Parameters
alPointer to the alarmable GameObject.
idThe alarm ID to register.
tThe time duration for the alarm.

◆ Register() [2/5]

void Scene::Register ( Drawable * dr)
private

Registers a drawable GameObject.

Parameters
drPointer to the drawable GameObject.

◆ Register() [3/5]

void Scene::Register ( Inputable * in,
AZUL_KEY k,
EventType e )
private

Registers an inputable GameObject.

Parameters
inPointer to the inputable GameObject.
kThe key to register.
eThe event type to register.

◆ Register() [4/5]

void Scene::Register ( Inputable * in,
AZUL_MOUSE m,
EventType e )
private

Registers an inputable GameObject for mouse events.

Parameters
inPointer to the inputable GameObject.
mThe mouse key to register.
eThe event type to register.

◆ Register() [5/5]

void Scene::Register ( Updatable * up)
private

Registers an updatable GameObject.

Parameters
upPointer to the updatable GameObject.
Here is the caller graph for this function:

◆ SceneEnd()

virtual void Scene::SceneEnd ( )
privatepure virtual

Ends the scene. Defined by the user.

Implemented in SceneNull.

Here is the caller graph for this function:

◆ SetCollisionPair()

template<typename C1, typename C2>
void Scene::SetCollisionPair ( )
inlineprotected

Sets the collision pair test for the specified collidable types.

Template Parameters
C1The first collidable type.
C2The second collidable type.

◆ SetCollisionSelf()

template<typename C>
void Scene::SetCollisionSelf ( )
inlineprotected

Sets the collision self test for the specified collidable type.

Template Parameters
CThe collidable type.

◆ SetCollisionTerrain()

template<typename Type>
void Scene::SetCollisionTerrain ( )
inlineprotected

Sets up collision detection between the specified type and the current terrain.

Template Parameters
TypeThe type of the collidable object.
Here is the call graph for this function:

◆ SetCurrentCamera()

void Scene::SetCurrentCamera ( Camera * cam)

Sets the current 3D camera for the scene.

Parameters
camPointer to the camera.

◆ SetCurrentCamera2D()

void Scene::SetCurrentCamera2D ( Camera * cam)

Sets the current 2D camera for the scene.

Parameters
camPointer to the 2D camera.

◆ SetTerrain()

void Scene::SetTerrain ( const std::string & key)

Sets the terrain for the scene using a key.

Parameters
keyThe key associated with the terrain in the TerrainManager.
Here is the call graph for this function:

◆ SubmitCommand()

void Scene::SubmitCommand ( CommandBase * cmd)
private

Submits a command to the scene.

Parameters
cmdPointer to the command.
Here is the caller graph for this function:

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