Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
bomberman::SingleplayerLevelScene Class Referencefinal

Offline/local gameplay implementation of the level scene. More...

#include <SingleplayerLevelScene.h>

Inheritance diagram for bomberman::SingleplayerLevelScene:
[legend]

Public Member Functions

 SingleplayerLevelScene (Game *game, unsigned int stage, unsigned int prevScore, std::optional< uint32_t > mapSeed=std::nullopt)
 
- Public Member Functions inherited from bomberman::LevelScene
 LevelScene (Game *game, const unsigned int stage, const unsigned int prevScore, std::optional< uint32_t > mapSeed=std::nullopt)
 Construct a shared level scene scaffold.
 
void onEnter () override
 Called when scene become activated.
 
void onExit () override
 CAlled when scene become deactivated.
 
FieldTransform getFieldTransform () const
 Returns the field transform needed to map tile-Q8 world coords to screen pixels.
 
virtual void onEvent (const SDL_Event &event) override
 Catch SDL2 events.
 
virtual void update (const unsigned int delta) override
 Update level scene.
 
void clearLocalMovementInput ()
 Clears locally held movement input and resets player facing/animation state.
 
virtual bool usesEventDrivenLocalMovement () const
 Returns true when this level consumes SDL key press/release events as local movement state.
 
- Public Member Functions inherited from bomberman::Scene
 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.
 
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 Member Functions

virtual void updateLevel (unsigned int delta) override
 Per-mode update body executed when the scene is not paused.
 
virtual void onKeyPressed (SDL_Scancode scancode) override
 Optional per-mode key-down handling.
 
- Protected Member Functions inherited from bomberman::LevelScene
void initializeLevelWorld (std::optional< uint32_t > mapSeed)
 Completes shared world setup after derived state is ready.
 
void generateTileMap (std::optional< uint32_t > mapSeed)
 
void spawnGrass (const int positionX, const int positionY)
 
void spawnBrick (const int positionX, const int positionY)
 
void spawnStone (const int positionX, const int positionY)
 
void spawnPlayer (const int positionX, const int positionY)
 
void updateMovement (const bool isPressed, const int keycode)
 
void updateCamera ()
 
virtual bool supportsPause () const
 Whether ENTER pause toggle is enabled for this level mode.
 
void stepLocalPlayerMovement ()
 Steps the local player position by one simulation tick.
 
void syncPlayerSpriteToSimPosition ()
 Writes playerPos_ to the player sprite in screen space.
 
void setLocalPlayerPositionQ (sim::TilePos posQ)
 Replaces the canonical local player position and syncs the sprite immediately.
 

Additional Inherited Members

- Protected Attributes inherited from bomberman::LevelScene
std::shared_ptr< MusicmenuMusic = nullptr
 
std::shared_ptr< Playerplayer = nullptr
 
Tile tiles [tileArrayHeight][tileArrayWidth]
 
int playerDirectionX = 0
 
int playerDirectionY = 0
 
bool isPaused = false
 
unsigned int stage = 0
 
int fieldPositionX = 0
 
int fieldPositionY = 0
 
int scaledTileSize = 0
 
int backgroundObjectLastNumber = 0
 
sim::TilePos playerPos_ {}
 Canonical player position in tile-Q8, owned by LevelScene.
 
- Protected Attributes inherited from bomberman::Scene
Gamegame = nullptr
 

Detailed Description

Offline/local gameplay implementation of the level scene.

Member Function Documentation

◆ onKeyPressed()

void bomberman::SingleplayerLevelScene::onKeyPressed ( SDL_Scancode  scancode)
overrideprotectedvirtual

Optional per-mode key-down handling.

Reimplemented from bomberman::LevelScene.

◆ updateLevel()

void bomberman::SingleplayerLevelScene::updateLevel ( unsigned int  delta)
overrideprotectedvirtual

Per-mode update body executed when the scene is not paused.

Implements bomberman::LevelScene.


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