supertux
Public Member Functions | Public Attributes | List of all members
GameSession Class Referencefinal

Screen that runs a Level, where Players run and jump through Sectors. More...

#include <game_session.hpp>

Inheritance diagram for GameSession:
Screen GameSessionRecorder Currenton< GameSession >

Public Member Functions

 GameSession (const std::string &levelfile, Savegame &savegame, Statistics *statistics=nullptr)
 
virtual void draw (Compositor &compositor) override
 gets called once per frame. More...
 
virtual void update (float dt_sec, const Controller &controller) override
 gets called for once (per logical) frame. More...
 
virtual void setup () override
 gets called before this screen gets activated (which is at least once before the first draw or update call
 
virtual void leave () override
 gets called when the current screen is temporarily suspended
 
void finish (bool win=true)
 ends the current level
 
void respawn (const std::string &sectorname, const std::string &spawnpointname, const bool invincibility=false, const int invincibilityperiod=0)
 
void reset_level ()
 
void set_reset_point (const std::string &sectorname, const Vector &pos)
 
std::string get_reset_point_sectorname () const
 
Vector get_reset_point_pos () const
 
Sectorget_current_sector () const
 
Levelget_current_level () const
 
void start_sequence (Sequence seq, const SequenceData *data=nullptr)
 
std::string get_working_directory () const
 returns the "working directory" usually this is the directory where the currently played level resides. More...
 
int restart_level (bool after_death=false)
 
void toggle_pause ()
 
void abort_level ()
 
bool is_active () const
 
void set_editmode (bool edit_mode=true)
 Enters or leaves level editor mode.
 
void force_ghost_mode ()
 Forces all Players to enter ghost mode.
 
Savegameget_savegame () const
 
- Public Member Functions inherited from GameSessionRecorder
void start_recording ()
 
void record_demo (const std::string &filename)
 
int get_demo_random_seed (const std::string &filename) const
 
void play_demo (const std::string &filename)
 
void process_events ()
 
void reset_demo_controller ()
 Re-sets the demo controller in case the sector (and thus the Player instance) changes. More...
 
bool is_playing_demo () const
 

Public Attributes

bool reset_button
 
bool reset_checkpoint_button
 

Additional Inherited Members

- Static Public Member Functions inherited from Currenton< GameSession >
static GameSessioncurrent ()
 

Detailed Description

Screen that runs a Level, where Players run and jump through Sectors.

Member Function Documentation

§ draw()

void GameSession::draw ( Compositor compositor)
overridevirtual

gets called once per frame.

The screen should draw itself in this function. State changes should not be done in this function, but rather in update

Implements Screen.

§ get_working_directory()

std::string GameSession::get_working_directory ( ) const

returns the "working directory" usually this is the directory where the currently played level resides.

This is used when locating additional resources for the current level/world

§ update()

void GameSession::update ( float  dt_sec,
const Controller controller 
)
overridevirtual

gets called for once (per logical) frame.

Screens should do their state updates and logic here

Implements Screen.


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