supertux
Classes | 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:
Inheritance graph
[legend]
Collaboration diagram for GameSession:
Collaboration graph
[legend]

Public Member Functions

 GameSession (const std::string &levelfile, Savegame &savegame, Statistics *statistics=nullptr, bool preserve_music=false)
 
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
 
virtual IntegrationStatus get_status () const override
 Gives details about what the user is doing right now. More...
 
void finish (bool win=true)
 ends the current level
 
void respawn (const std::string &sectorname, const std::string &spawnpointname)
 
void respawn_with_fade (const std::string &sectorname, const std::string &spawnpointname, const ScreenFade::FadeType fade_type, const Vector &fade_point, const bool make_invincible=false)
 
void reset_level ()
 
void set_start_point (const std::string &sectorname, const std::string &spawnpointname)
 
void set_start_pos (const std::string &sectorname, const Vector &pos)
 
void set_respawn_point (const std::string &sectorname, const std::string &spawnpointname)
 
void set_respawn_pos (const std::string &sectorname, const Vector &pos)
 
void clear_respawn_points ()
 
const SpawnPoint & get_last_spawnpoint () const
 
void set_checkpoint_pos (const std::string &sectorname, const Vector &pos)
 
const SpawnPoint * get_active_checkpoint_spawnpoint () const
 
Sectorget_current_sector () const
 
Levelget_current_level () const
 
void start_sequence (Player *caller, Sequence seq, const SequenceData *data=nullptr)
 
void set_target_timer_paused (bool paused)
 
std::string get_working_directory () const
 returns the "working directory" usually this is the directory where the currently played level resides. More...
 
const std::string & get_level_file () const
 
bool has_active_sequence () const
 
int restart_level (bool after_death=false, bool preserve_music=false)
 
void toggle_pause ()
 
void abort_level ()
 
bool is_active () const
 
Savegameget_savegame () const
 
void set_scheduler (SquirrelScheduler &new_scheduler)
 

Public Attributes

bool reset_button
 
bool reset_checkpoint_button
 
bool m_prevent_death
 true if players should enter ghost mode instead of dying
 

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_status()

IntegrationStatus GameSession::get_status ( ) const
overridevirtual

Gives details about what the user is doing right now.

Returns
activity details for presence integrations

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: