#include <level.hpp>
Inherits GameObject.
Public Member Functions | |
LevelTile (const std::string &basedir, const Reader &lisp) | |
virtual | ~LevelTile () |
virtual void | draw (DrawingContext &context) |
The GameObject should draw itself onto the provided DrawingContext if this function is called. | |
virtual void | update (float elapsed_time) |
This function is called once per frame and allows the object to update it's state. | |
Public Attributes | |
Vector | pos |
std::string | title |
bool | solved |
bool | auto_play |
true if Tux should automatically enter this level if it's unfinished | |
SpritePtr | sprite |
Statistics | statistics |
Statistics for level tiles. | |
std::string | extro_script |
Script that is run when the level is successfully finished. | |
Private Member Functions | |
LevelTile (const LevelTile &) | |
LevelTile & | operator= (const LevelTile &) |
Private Attributes | |
std::string | basedir |
bool | picture_cached |
Surface * | picture |
Definition at line 33 of file level.hpp.
worldmap::LevelTile::LevelTile | ( | const std::string & | basedir, | |
const Reader & | lisp | |||
) |
Definition at line 32 of file level.cpp.
References auto_play, SpriteManager::create(), extro_script, lisp::Lisp::get(), log_warning, GameObject::name, pos, sprite, sprite_manager, Vector::x, and Vector::y.
00032 : 00033 pos(), 00034 title(), 00035 solved(false), 00036 auto_play(false), 00037 sprite(), 00038 statistics(), 00039 extro_script(), 00040 basedir(basedir), 00041 picture_cached(false), 00042 picture(0) 00043 { 00044 lisp.get("name", name); 00045 lisp.get("x", pos.x); 00046 lisp.get("y", pos.y); 00047 lisp.get("auto-play", auto_play); 00048 00049 std::string spritefile = "images/worldmap/common/leveldot.sprite"; 00050 lisp.get("sprite", spritefile); 00051 sprite = sprite_manager->create(spritefile); 00052 00053 lisp.get("extro-script", extro_script); 00054 00055 if (!PHYSFS_exists((basedir + name).c_str())) 00056 { 00057 log_warning << "level file '" << name 00058 << "' does not exist and will not be added to the worldmap" << std::endl; 00059 return; 00060 } 00061 }
worldmap::LevelTile::~LevelTile | ( | ) | [virtual] |
worldmap::LevelTile::LevelTile | ( | const LevelTile & | ) | [private] |
void worldmap::LevelTile::draw | ( | DrawingContext & | context | ) | [virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Definition at line 69 of file level.cpp.
References LAYER_OBJECTS, pos, and sprite.
00070 { 00071 sprite->draw(context, pos*32 + Vector(16, 16), LAYER_OBJECTS - 1); 00072 }
void worldmap::LevelTile::update | ( | float | elapsed_time | ) | [virtual] |
This function is called once per frame and allows the object to update it's state.
The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)
Implements GameObject.
Definition at line 75 of file level.cpp.
Definition at line 43 of file level.hpp.
Referenced by draw(), LevelTile(), and worldmap::WorldMap::update().
std::string worldmap::LevelTile::title |
Definition at line 45 of file level.hpp.
Referenced by worldmap::WorldMap::finished_level(), worldmap::Tux::tryStartWalking(), and worldmap::WorldMap::update().
true if Tux should automatically enter this level if it's unfinished
Definition at line 46 of file level.hpp.
Referenced by LevelTile(), and worldmap::WorldMap::update().
Definition at line 48 of file level.hpp.
Referenced by draw(), worldmap::WorldMap::finished_level(), and LevelTile().
Statistics for level tiles.
Definition at line 51 of file level.hpp.
Referenced by worldmap::WorldMap::finished_level(), and worldmap::WorldMap::update().
std::string worldmap::LevelTile::extro_script |
Script that is run when the level is successfully finished.
Definition at line 54 of file level.hpp.
Referenced by worldmap::WorldMap::finished_level(), and LevelTile().
std::string worldmap::LevelTile::basedir [private] |
bool worldmap::LevelTile::picture_cached [private] |
Surface* worldmap::LevelTile::picture [private] |