Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 75 lines (54 sloc) 1.712 kB
252d1e9 @robn rename SpaceManager to Game, for I have discovered the long-sought-af…
authored
1 #ifndef _GAME_H
2 #define _GAME_H
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
3
252d1e9 @robn rename SpaceManager to Game, for I have discovered the long-sought-af…
authored
4 // Game takes care of creating and destroying spaces as the player
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
5 // moves from system to hyperspace to system
6
7 #include "vector3.h"
8 #include "SystemPath.h"
202be71 @robn Space and SpaceManager serializers
authored
9 #include "Serializer.h"
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
10
11 class Space;
12 class Player;
13 class HyperspaceCloud;
14
252d1e9 @robn rename SpaceManager to Game, for I have discovered the long-sought-af…
authored
15 class Game {
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
16 public:
cd8697b @robn rework game class construction some. have the player be created and o…
authored
17 // start docked in station referenced by path
18 Game(const SystemPath &path);
19
20 // start at position relative to body referenced by path
21 Game(const SystemPath &path, const vector3d &pos);
22
23 // load game
252d1e9 @robn rename SpaceManager to Game, for I have discovered the long-sought-af…
authored
24 Game(Serializer::Reader &rd);
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
25
cd8697b @robn rework game class construction some. have the player be created and o…
authored
26 // save game
202be71 @robn Space and SpaceManager serializers
authored
27 void Serialize(Serializer::Writer &wr);
28
cd8697b @robn rework game class construction some. have the player be created and o…
authored
29 // various game states
98e01b9 @robn methods to test SpaceManager state
authored
30 bool IsNormalSpace() const { return m_state == STATE_NORMAL; }
31 bool IsHyperspace() const { return m_state == STATE_HYPERSPACE; }
32
f8e44ed @robn switch a few things over to smart pointers
authored
33 Space *GetSpace() const { return m_space.Get(); }
29c67f2 @robn move the game time into Game
authored
34 double GetTime() const { return m_time; }
cd8697b @robn rework game class construction some. have the player be created and o…
authored
35 Player *GetPlayer() const { return m_player.Get(); }
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
36
cd8697b @robn rework game class construction some. have the player be created and o…
authored
37 // request switch to hyperspace
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
38 void WantHyperspace();
39
cd8697b @robn rework game class construction some. have the player be created and o…
authored
40 // physics step
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
41 void TimeStep(float step);
42
cd8697b @robn rework game class construction some. have the player be created and o…
authored
43 // hyperspace parameters. only meaningful when IsHyperspace() is true
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
44 float GetHyperspaceProgress() const { return m_hyperspaceProgress; }
45 double GetHyperspaceDuration() const { return m_hyperspaceDuration; }
46 double GetHyperspaceEndTime() const { return m_hyperspaceEndTime; }
47
48 private:
cd8697b @robn rework game class construction some. have the player be created and o…
authored
49 void CreatePlayer();
50
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
51 void SwitchToHyperspace();
52 void SwitchToNormalSpace();
53
cd8697b @robn rework game class construction some. have the player be created and o…
authored
54 ScopedPtr<Space> m_space;
29c67f2 @robn move the game time into Game
authored
55 double m_time;
56
cd8697b @robn rework game class construction some. have the player be created and o…
authored
57 ScopedPtr<Player> m_player;
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
58
d351c90 @robn make enum Game::State private
authored
59 enum State {
60 STATE_NORMAL,
61 STATE_HYPERSPACE,
62 };
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
63 State m_state;
f8e44ed @robn switch a few things over to smart pointers
authored
64
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
65 bool m_wantHyperspace;
66
67 std::list<HyperspaceCloud*> m_hyperspaceClouds;
68 SystemPath m_hyperspaceSource;
202be71 @robn Space and SpaceManager serializers
authored
69 double m_hyperspaceProgress;
cadf8f9 @robn rework spacemanager to handle all the detials of moving the player be…
authored
70 double m_hyperspaceDuration;
71 double m_hyperspaceEndTime;
72 };
73
74 #endif
Something went wrong with that request. Please try again.