fix redraw at top-left of map
[Tsunagari.git] / src / world.h
blob3ca1ca5d3173f7165b92a9aea7858f3691c60fb2
1 /******************************
2 ** Tsunagari Tile Engine **
3 ** world.h **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
7 #ifndef WORLD_H
8 #define WORLD_H
10 #include <string>
11 #include <vector>
13 #include "common.h"
15 namespace Gosu {
16 class Button;
19 class Area;
20 class Player;
21 class Resourcer;
22 class GameWindow;
24 //! World Class
25 /*!
26 This class is conceptually the main class of the Tsunagari Tile Engine.
28 class World
30 public:
31 static World* getWorld();
33 //! World Constructor
34 World(Resourcer* rc, GameWindow* w);
36 //! World Destructor
37 ~World();
39 //! World Initializer
40 bool init();
42 //! Gosu Callback
43 void buttonDown(const Gosu::Button btn);
44 void buttonUp(const Gosu::Button btn);
46 //! Gosu Callback
47 void draw();
49 //! Gosu Callback
50 bool needsRedraw() const;
52 //! Gosu Callback
53 void update(unsigned long dt);
55 bool loadArea(const std::string& areaName, coord_t playerPos);
57 private:
58 bool processDescriptor();
60 Resourcer* rc;
61 GameWindow* wnd;
62 Area* area;
63 boost::scoped_ptr<Player> player;
65 //! WorldTypeLocality XML Storage Enum
66 /*!
67 Stores the World locality type. Options are "local" (singleplayer),
68 or "network" (multiplayer).
70 enum WorldTypeLocality {
71 LOCAL,
72 NETWORK
75 //! WorldTypeMovement XML Storage Enum
76 /*!
77 Stores the World movement type. Options are "turn" (roguelike),
78 "tile" (yume nikki), or "notile" (zeldalike).
80 enum WorldTypeMovement {
81 TURN,
82 TILE,
83 NOTILE
86 //! WorldEntry XML Storage Struct
87 /*!
88 Stores the World's entry point data. Includes the start
89 Area, and starting coordinates.
91 struct WorldEntry {
92 std::string area;
93 coord_t coords;
96 //! WorldValues XML Storage Struct
97 /*!
98 Main XML storage struct for World.
100 struct WorldValues {
101 std::string name;
102 std::string author;
103 std::string playerentity;
104 WorldTypeLocality locality;
105 WorldTypeMovement movement;
106 WorldEntry entry;
107 std::vector<std::string> scripts;
108 } xml;
111 #endif