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