Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
bomberman::Scene Class Reference

Scene base class. More...

#include <Scene.h>

Inheritance diagram for bomberman::Scene:
[legend]

Public Member Functions

 Scene (Game *game)
 Construct a new Scene object.
 
virtual ~Scene ()
 Destroy the Scene object.
 
void addObject (std::shared_ptr< Object > object)
 Add object to scene for drawing.
 
void insertObject (std::shared_ptr< Object > object, int position)
 Add object to scene for drawing to specific position.
 
void removeObject (std::shared_ptr< Object > object)
 Remove object from scene.
 
void setCamera (const int x, const int y)
 Set the Camera object to specific position.
 
virtual void onEnter ()
 Called when scene become activated.
 
virtual void onExit ()
 CAlled when scene become deactivated.
 
virtual void onEvent (const SDL_Event &event)
 Trigger on SDL2 event if scene is active.
 
virtual void update (const unsigned int delta)
 Trigger on update if scene is active.
 
void draw () const
 Draw objects on the screen.
 
SDL_Rect getCamera () const
 Returns the current camera position.
 
virtual bool wantsNetworkInputPolling () const
 Returns true when this scene wants Game to poll and send multiplayer input every sim tick.
 
virtual void onNetInputQueued (uint32_t inputSeq, uint8_t buttons)
 Called after Game samples and queues a local input for multiplayer scenes.
 

Protected Attributes

Gamegame = nullptr
 

Detailed Description

Scene base class.

Constructor & Destructor Documentation

◆ Scene()

bomberman::Scene::Scene ( Game game)

Construct a new Scene object.

Parameters
game- pointer to game

Member Function Documentation

◆ addObject()

void bomberman::Scene::addObject ( std::shared_ptr< Object object)

Add object to scene for drawing.

Parameters
object

◆ insertObject()

void bomberman::Scene::insertObject ( std::shared_ptr< Object object,
int  position 
)

Add object to scene for drawing to specific position.

Parameters
object
position- position where to insert object

◆ onEnter()

void bomberman::Scene::onEnter ( )
virtual

Called when scene become activated.

Reimplemented in bomberman::ConnectScene, bomberman::LevelScene, and bomberman::MenuScene.

◆ onEvent()

void bomberman::Scene::onEvent ( const SDL_Event &  event)
virtual

Trigger on SDL2 event if scene is active.

Parameters
event- SDL2 event

Reimplemented in bomberman::ConnectScene, bomberman::LevelScene, bomberman::LobbyScene, and bomberman::MenuScene.

◆ onExit()

void bomberman::Scene::onExit ( )
virtual

CAlled when scene become deactivated.

Reimplemented in bomberman::ConnectScene, bomberman::LevelScene, bomberman::MenuScene, and bomberman::MultiplayerLevelScene.

◆ onNetInputQueued()

void bomberman::Scene::onNetInputQueued ( uint32_t  inputSeq,
uint8_t  buttons 
)
virtual

Called after Game samples and queues a local input for multiplayer scenes.

inputSeq is the local sequence assigned by NetClient. Scenes that do not care about local prediction can ignore this hook.

Reimplemented in bomberman::MultiplayerLevelScene.

◆ removeObject()

void bomberman::Scene::removeObject ( std::shared_ptr< Object object)

Remove object from scene.

Parameters
object

◆ setCamera()

void bomberman::Scene::setCamera ( const int  x,
const int  y 
)

Set the Camera object to specific position.

Parameters
x- position x
y- position y

◆ update()

void bomberman::Scene::update ( const unsigned int  delta)
virtual

Trigger on update if scene is active.

Parameters
delta- time in milliseconds

Reimplemented in bomberman::GameOverScene, bomberman::LevelScene, bomberman::StageScene, bomberman::ConnectScene, and bomberman::LobbyScene.

◆ wantsNetworkInputPolling()

virtual bool bomberman::Scene::wantsNetworkInputPolling ( ) const
inlinevirtual

Returns true when this scene wants Game to poll and send multiplayer input every sim tick.

Reimplemented in bomberman::MultiplayerLevelScene.


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