Debian Codegraph @

src/game.h

raw symbols SCIP
1 // game.h
2 // Class which resembles a game and the events which can be triggered
3 // within it from a player's perspective.
4 //
5 // (c) Robert Schuster, 2007
6 //
7 // Licensed under GNU GPL version 2 or, at your option, any later version.
8
9 #ifndef GAME_H
10 #define GAME_H
11
12 #include "input.h"
13 #include "timer.h"
14
15 class Universe;
16 class Players;
17 class HumanPlayer;
18 class Message;
19 class Messages;
20 class Selection;
21 class GameOptions;
22
23 class Game {
24
25 public:
26 Game(GameOptions &);
27
28 ~Game();
29
30 bool run(bool);
31
32 bool checkWin();
33
34 bool checkLost();
35
36 void handle(GameAction, int);
37
38 void addMessage(int, Message);
39
40 void render();
41
42 void setPaused(bool);
43
44 Uint32 getTime() const;
45
46 private:
47 void moveCursor(int, int);
48
49 void fleetStrengthUp();
50
51 void fleetStrengthDown();
52
53 void setFleetStrength(int);
54
55 void selectAllPlanets();
56
57 void setEnemyVisibility(bool);
58
59 void selectNearestPlanet(int, int);
60
61 void moveToNearestPlanet(int, int);
62
63 void startSelection(int, int);
64
65 void updateSelection(int, int);
66
67 void endSelection(int, int);
68
69 /** Location of the soft cursor. */
70 int x, y;
71
72 /** Current cursor movement forces: x positive, x negative and the same for y. */
73 int xp, xn, yp, yn;
74
75 Universe *universe;
76 HumanPlayer *humanPlayer;
77 Messages *messages;
78 Timer *timer;
79 Players *players;
80 Selection *selection;
81
82 enum States { PLAYING, LOST, WON };
83 States state;
84
85 bool quit;
86 bool nextRound;
87
88 GameOptions &gameOptions;
89
90 int nextNumberOfPlanets;
91 int nextNumberOfComputerPlayers;
92
93 };
94
95 #endif