Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

game.h

Go to the documentation of this file.
00001 #ifndef __GAME_H
00002 #define __GAME_H
00003 
00004 #include <list>
00005 using namespace std;
00006 
00007 #include "sfcave.h"
00008 
00009 class Terrain;
00010 class Player;
00011 
00012 class Game
00013 {
00014 public:
00015         Game( SFCave *p, int w, int h, int diff );
00016         virtual ~Game();
00017 
00018         virtual void init( );
00019         virtual void update( int state );
00020         virtual void preDraw( SDL_Surface * );
00021         virtual void draw( SDL_Surface * );
00022 
00023         virtual void stateChanged( int from, int to );
00024 
00025         void setReplay( bool val ) { replay = val; }
00026 
00027         void handleKeys( SDL_KeyboardEvent &key );
00028         string getGameName() { return gameName; }
00029         int getDifficulty() { return difficulty; }
00030         string getGameDifficultyText();
00031         void setDifficulty( int diff );
00032         void setDifficulty( string diff );
00033 
00034         long getScore() { return score; }
00035         long getHighScore() { return highScore; }
00036         void increaseScore( long val ) { score += val; }
00037         void clearScore() { score = 0; }
00038         bool gotHighScore()     { return (score >= highScore); }
00039         bool isReplayAvailable() { return replayList.size() > 0; }
00040 
00041         Terrain *getTerrain() { return terrain; }
00042         Player *getPlayer() { return player; }
00043 
00044         void setSeed( int seed );
00045         void loadReplay( string file );
00046         void saveReplay( string file );
00047 
00048         static Game *createGame( SFCave *p, int w, int h, string game, string difficulty );
00049 
00050 protected:
00051         string gameName;
00052 
00053         int thrustChannel;
00054 
00055         int difficulty;
00056 
00057         SFCave *parent;
00058         Terrain *terrain;
00059         Player *player;
00060 
00061         int nrFrames;
00062 
00063         bool press;
00064 
00065         int sHeight;
00066         int sWidth;
00067         long score;
00068         long highScore;
00069 
00070         // Stuff for the replays
00071     int currentSeed;
00072 
00073         list<int> replayList;
00074         list<int>::iterator replayIt;
00075     bool replay;
00076     string replayFile;
00077 
00078 private:
00079 };
00080 
00081 #endif

Generated on Sat Nov 5 16:17:19 2005 for OPIE by  doxygen 1.4.2