summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/game.h
Unidiff
Diffstat (limited to 'noncore/games/sfcave-sdl/game.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/game.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/noncore/games/sfcave-sdl/game.h b/noncore/games/sfcave-sdl/game.h
new file mode 100644
index 0000000..56fa6a1
--- a/dev/null
+++ b/noncore/games/sfcave-sdl/game.h
@@ -0,0 +1,82 @@
1#ifndef __GAME_H
2#define __GAME_H
3
4#include <list>
5using namespace std;
6
7#include "sfcave.h"
8
9class Terrain;
10class Player;
11
12class Game
13{
14public:
15 Game( SFCave *p, int w, int h, int diff );
16 virtual ~Game();
17
18 virtual void init( );
19 virtual void update( int state );
20 virtual void preDraw( SDL_Surface * );
21 virtual void draw( SDL_Surface * );
22
23 virtual void stateChanged( int from, int to );
24
25 void setReplay( bool val ) { replay = val; }
26
27 void handleKeys( SDL_KeyboardEvent &key );
28 QString getGameName() { return gameName; }
29 int getDifficulty() { return difficulty; }
30 QString getGameDifficultyText();
31 void setDifficulty( int diff ) { difficulty = diff; }
32 void setDifficulty( string diff );
33
34 long getScore() { return score; }
35 long getHighScore() { return highScore; }
36 void increaseScore( long val ) { score += val; }
37 void clearScore() { score = 0; }
38 bool gotHighScore() { return (score >= highScore); }
39 bool isReplayAvailable() { return replayList.size() > 0; }
40
41 Terrain *getTerrain() { return terrain; }
42
43 void setSeed( int seed );
44 void loadReplay( QString file );
45 void saveReplay( QString file );
46
47 static Game *createGame( SFCave *p, int w, int h, string game, string difficulty );
48
49protected:
50 QString gameName;
51
52 int thrustChannel;
53
54 int difficulty;
55
56 SFCave *parent;
57 Terrain *terrain;
58 Player *player;
59
60 int nrFrames;
61
62 bool press;
63
64 int sHeight;
65 int sWidth;
66 long score;
67 long highScore;
68
69 // Stuff for the replays
70 int currentSeed;
71
72// QListIterator<int> *replayIt;
73 list<int> replayList;
74 list<int>::iterator replayIt;
75 //QList<int> replayList;
76 bool replay;
77 QString replayFile;
78
79private:
80};
81
82#endif