summaryrefslogtreecommitdiff
path: root/src/game.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-21 20:40:07 +0100
committerChuck Miller <shadowmil@gmail.com>2010-02-21 17:05:40 -0500
commitc8b0d1e56f27c3141895d28b2fc768afffe7bb2d (patch)
tree0a03458836badee3e1b0da13a0721c9261e7fa86 /src/game.h
parent204a14c91bbe4436eb3b26bebf30cbe5669bdd1a (diff)
downloadMana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.tar.gz
Mana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.tar.bz2
Mana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.tar.xz
Mana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.zip
Made tick counter and framerate limiter work during login sequence
Much code was moved from main() to the new Client::exec(). This new event loop now integrates with the Game class, so that the tick counter and framerate limiter apply universally. The Client class is also responsible for some things that used to be global variables. Mantis-issue: ...
Diffstat (limited to 'src/game.h')
-rw-r--r--src/game.h36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/game.h b/src/game.h
index de601af6..cdd22e29 100644
--- a/src/game.h
+++ b/src/game.h
@@ -22,23 +22,18 @@
#ifndef GAME_H
#define GAME_H
-#include "configlistener.h"
+#include <string>
-#include <SDL.h>
-#include <SDL_framerate.h>
-
-extern std::string map_path;
-extern volatile int fps;
-extern volatile int tick_time;
-extern const int MILLISECONDS_IN_A_TICK;
+extern std::string map_path; // TODO: Get rid of this global
class Map;
class WindowMenu;
/**
- * The main class responsible for running the game.
+ * The main class responsible for running the game. The game starts after you
+ * have selected your character.
*/
-class Game : public ConfigListener
+class Game
{
public:
/**
@@ -58,14 +53,13 @@ class Game : public ConfigListener
static Game *instance() { return mInstance; }
/**
- * This method runs the game. It returns when the game stops.
+ * This method takes the game a small step further. It is called 100
+ * times per second.
*/
- void exec();
+ void logic();
void handleInput();
- void optionChanged(const std::string &name);
-
void changeMap(const std::string &mapName);
/**
@@ -76,13 +70,8 @@ class Game : public ConfigListener
const std::string &getCurrentMapName() { return mMapName; }
private:
- int mLastTarget;
- SDL_TimerID mLogicCounterId;
- SDL_TimerID mSecondsCounterId;
-
- bool mLimitFps;
- FPSmanager mFpsManager;
+ int mLastTarget;
WindowMenu *mWindowMenu;
@@ -92,11 +81,4 @@ class Game : public ConfigListener
static Game *mInstance;
};
-/**
- * Returns elapsed time. (Warning: supposes the delay is always < 100 seconds)
- */
-int get_elapsed_time(int start_time);
-
-void setScreenshotDir(const std::string &dir);
-
#endif