#include <string>
#include "musicref.h"
+#include "screen.h"
namespace WorldMapNS {
-struct Point
-{
- Point() : x(0), y(0) {}
-
- Point(const Point& pos)
- : x(pos.x), y(pos.y) {}
-
- Point& operator=(const Point& pos)
- { x = pos.x;
- y = pos.y;
- return *this; }
-
- Point(int x_, int y_)
- : x(x_), y(y_) {}
-
- int x;
- int y;
-};
-
-struct Tile
+class Tile
{
+public:
+ Tile();
+ ~Tile();
+
Surface* sprite;
// Directions in which Tux is allowed to walk from this tile
/** Stop on this tile or walk over it? */
bool stop;
+
+ /** When set automatically turn directions when walked over such a
+ tile (ie. walk smoothly a curve) */
+ bool auto_walk;
};
class TileManager
private:
typedef std::vector<Tile*> Tiles;
Tiles tiles;
- static TileManager* instance_ ;
- TileManager();
public:
- static TileManager* instance() { return instance_ ? instance_ : instance_ = new TileManager(); }
+ TileManager();
+ ~TileManager();
- void load();
Tile* get(int i);
};
-enum Direction { NONE, WEST, EAST, NORTH, SOUTH };
+enum Direction { D_NONE, D_WEST, D_EAST, D_NORTH, D_SOUTH };
std::string direction_to_string(Direction d);
Direction string_to_direction(const std::string& d);
Direction back_direction;
private:
WorldMap* worldmap;
- Surface* sprite;
+ Surface* largetux_sprite;
+ Surface* firetux_sprite;
+ Surface* smalltux_sprite;
Direction input_direction;
Direction direction;
void stop();
public:
Tux(WorldMap* worldmap_);
+ ~Tux();
void draw(const Point& offset);
void update(float delta);
int width;
int height;
+ TileManager* tile_manager;
+
public:
struct Level
{
std::string title;
bool solved;
+ /** Filename of the extro text to show once the level is
+ successfully completed */
+ std::string extro_filename;
+
// Directions which are walkable from this level
bool north;
bool east;
void get_input();
/** Update Tux position */
- void update();
+ void update(float delta);
/** Draw one frame */
void draw(const Point& offset);