ST_engine  0.3-ALPHA
Public Member Functions | Public Attributes | Friends | List of all members
ST::level Class Reference

This object contains all the data for a level and provides functions for loading and unloading a level. More...

#include <level.hpp>

Public Member Functions

 level (const std::string &, message_bus *)
 
int8_t load ()
 
void reload ()
 
void unload ()
 
std::string get_name () const
 
 ~level ()
 
int8_t load_input_conf ()
 

Public Attributes

ska::bytell_hash_map< uint16_t, std::vector< ST::key > > actions_buttons {}
 
std::vector< ST::entityentities {}
 
std::vector< ST::lightlights {}
 
std::vector< ST::texttext_objects {}
 
uint16_t background [PARALLAX_BG_LAYERS] = {65535, 65535, 65535, 65535}
 
uint8_t parallax_speed [PARALLAX_BG_LAYERS] = {0, 0, 0, 0}
 
SDL_Color background_color {0, 0, 0, 0}
 
uint16_t overlay = 65535
 
uint8_t overlay_sprite_num = 1
 
uint32_t physics_objects_count = 0
 
ST::camera camera = {0, 0, -1, 1920, 0, 1080}
 

Friends

class ::level_tests
 

Detailed Description

This object contains all the data for a level and provides functions for loading and unloading a level.

Sends messages to load assets and loads the input configuration from disk.

Definition at line 29 of file level.hpp.

Constructor & Destructor Documentation

◆ level()

ST::level::level ( const std::string &  lvl_name,
message_bus msg_bus 
)

Constructor for the level.

Parameters
lvl_nameThe name of the level;
msg_busA pointer to the global message bus.

Definition at line 20 of file level.cpp.

◆ ~level()

ST::level::~level ( )

Destroys the level. Frees all data.

Definition at line 84 of file level.cpp.

Member Function Documentation

◆ get_name()

std::string ST::level::get_name ( ) const

Get the name of the level.

Returns
The name of the level.

Definition at line 76 of file level.cpp.

◆ load()

int8_t ST::level::load ( )

Loads the level. Sends a LOAD_LIST message to load the assets.list in the directory of the level.

Returns
-1 if the input configuration could not be loaded, 0 on success

Definition at line 30 of file level.cpp.

◆ load_input_conf()

int8_t ST::level::load_input_conf ( )

Loads the input configuration of the level. File inputConf.cfg must exist.

Returns
-1 on error or 0 on success.

Definition at line 132 of file level.cpp.

◆ reload()

void ST::level::reload ( )

reloads the level.

Definition at line 50 of file level.cpp.

◆ unload()

void ST::level::unload ( )

Unloads a level. Sends a UNLOAD_LIST message to unload all assets and unregisters all keys.

Definition at line 102 of file level.cpp.


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