Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 219 lines (196 sloc) 6.931 kb
96342f3d » tompox
2008-06-24 initial import
1 #ifndef _PI_H
2 #define _PI_H
3
4 #include "libs.h"
0c2a82c0 » Darren Salt
2011-05-21 Move src/Gui* into src/gui/.
5 #include "gui/Gui.h"
96342f3d » tompox
2008-06-24 initial import
6 #include "View.h"
7 #include "mtrand.h"
a6ab9146 » tompox
2008-09-07 landing on ground-based space stations. uses same geom flag 1 thing t…
8 #include "gameconsts.h"
388cc951 » tompox
2010-05-22 make serialize and unserialize functions use reader and writer object…
9 #include "Serializer.h"
8e2d5fcd »
2011-05-19 separate config parser from game config init. now we can make other k…
10 #include "GameConfig.h"
57938dd9 »
2011-03-25 move the lua events into Pi, sucks but can't think of a better place.…
11 #include "LuaEventQueue.h"
322d4fca »
2011-03-29 new module serializer class
12 #include "LuaSerializer.h"
eed70744 »
2011-04-19 lua timers
13 #include "LuaTimer.h"
26ee523c »
2011-04-25 expose cargobody to lua and have jettison event emit it
14 #include "CargoBody.h"
5bd601b9 »
2011-11-09 first cut turning Space:: into an object. builds, doesn't run :)
15 #include "Space.h"
96342f3d » tompox
2008-06-24 initial import
16 #include <map>
17 #include <string>
8f55848d » unavowed
2011-01-12 Add support for querying joystick states
18 #include <vector>
96342f3d » tompox
2008-06-24 initial import
19
20 class Player;
21 class SectorView;
22 class SystemView;
23 class WorldView;
24 class SystemInfoView;
25 class ShipCpanel;
26 class StarSystem;
27 class SpaceStationView;
40f1abf4 » tompox
2008-06-27 a little more ship stats. ship info screen. make the ship angular vel…
28 class InfoView;
dbf87ea8 » tompox
2009-07-31 more buildings for city. some work on proper space station docking pr…
29 class SpaceStation;
073acf6e » tompox
2009-10-18 galaxy view and sector density from galaxy map
30 class GalacticView;
f6bb8fef » tompox
2010-04-24 more work on lua missions. now they get events in a fairly clean way …
31 class Ship;
6d056cc4 » tompox
2009-10-24 save game dialog thing (hit escape)
32 class GameMenuView;
10aed587 » johnbartholomew
2011-09-18 Hook up the first pass as a GUI for the Lua console.
33 class LuaConsole;
bdeed542 » Luomu
2011-06-11 Added MusicPlayer stub + added to vs2010 build
34 namespace Sound { class MusicPlayer; }
96342f3d » tompox
2008-06-24 initial import
35
7623e356 »
2011-04-29 seperate the objectviewer from the debug define, and enable it by def…
36 #if OBJECTVIEWER
b1215078 »
2011-04-28 only enable the objectviewer when DEBUG is enabled
37 class ObjectViewerView;
38 #endif
39
8ccd6b60 » tompox
2009-10-24 configurable planet detail level
40 struct DetailLevel {
41 int planets;
1e85f5bd » s20dan
2011-08-29 Textures can be toggled on or off depending on user's preference for …
42 int textures;
ef27b146 » s20dan
2011-08-29 Configurable fractal multiplier for higher and lower quality/speed. W…
43 int fracmult;
0276d781 » tompox
2009-11-01 city detail level setting
44 int cities;
8ccd6b60 » tompox
2009-10-24 configurable planet detail level
45 };
46
284e7145 » tompox
2010-06-19 make buying and selling more verbose
47 enum MsgLevel {
48 MSG_NORMAL,
49 MSG_IMPORTANT
50 };
51
e3d42870 » tompox
2008-08-14 initial rotating frames work
52 class Frame;
18ee77e0 » johnbartholomew
2010-10-27 Delete erroneous comment in Pi.h (implementation of class Pi is no lo…
53
292e3bd7 » John Jordan
2011-03-04 60Hz physics for philistine consumption
54 #define PHYSICS_HZ (60.0f)
cfe5a108 » tomm
2010-11-16 fixed crazy time accel. cities exist again
55
96342f3d » tompox
2008-06-24 initial import
56 class Pi {
57 public:
32e1e8cf » tompox
2010-07-05 make screen config be configurable from the UI (hit escape). progress…
58 static void Init();
fc6f7b99 »
2011-08-31 redirect stdio to files in userdir based on config
59 static void RedirectStdio();
61a0e268 » tompox
2009-10-24 load savefiles dialog
60 static void InitGame();
61 static void StartGame();
62 static void UninitGame();
63 static void EndGame();
d1c11e73 » tompox
2008-09-15 intro screen and starting points. more crud relating to starport gene…
64 static void Start();
96342f3d » tompox
2008-06-24 initial import
65 static void MainLoop();
e1c48438 » tompox
2008-11-13 ships take damage and die. player tombstone.
66 static void TombStoneLoop();
8ccd6b60 » tompox
2009-10-24 configurable planet detail level
67 static void OnChangeDetailLevel();
10aed587 » johnbartholomew
2011-09-18 Hook up the first pass as a GUI for the Lua console.
68 static void ToggleLuaConsole();
ad375d5f » Darren Salt
2011-05-12 Mark some functions as noreturn.
69 static void Quit() __attribute((noreturn));
388cc951 » tompox
2010-05-22 make serialize and unserialize functions use reader and writer object…
70 static void Serialize(Serializer::Writer &wr);
71 static void Unserialize(Serializer::Reader &rd);
96342f3d » tompox
2008-06-24 initial import
72 static float GetFrameTime() { return frameTime; }
73 static double GetGameTime() { return gameTime; }
a19c7645 » tompox
2009-09-11 initial crappy work on autopilot flying to places. made time accel li…
74 static void SetTimeAccel(int v);
865305f5 »
2011-08-27 hold ctrl to have the timeaccel override the mass lockout
75 static void RequestTimeAccel(int v, bool force = false);
0597d1da » Snaar
2011-02-06 Fixing warnings.
76 static int GetRequestedTimeAccelIdx() { return requestedTimeAccelIdx; }
77 static int GetTimeAccelIdx() { return timeAccelIdx; }
43e74a27 » johnbartholomew
2011-08-19 Use new Pi::IsTimeAccelPause() function rather than checking result o…
78 static bool IsTimeAccelPause() { return (timeAccelIdx == 0); }
79 static bool IsTimeAccelNormal() { return (timeAccelIdx == 1); }
80 static bool IsTimeAccelFast() { return (timeAccelIdx > 1); }
a19c7645 » tompox
2009-09-11 initial crappy work on autopilot flying to places. made time accel li…
81 static float GetTimeAccel() { return timeAccelRates[timeAccelIdx]; }
cfe5a108 » tomm
2010-11-16 fixed crazy time accel. cities exist again
82 static float GetTimeStep() { return timeAccelRates[timeAccelIdx]*(1.0f/PHYSICS_HZ); }
7a1343fd » tomm
2010-11-12 initial dog's arse of an attempt to fix the timestep
83 static float GetGameTickAlpha() { return gameTickAlpha; }
96342f3d » tompox
2008-06-24 initial import
84 static int GetScrWidth() { return scrWidth; }
85 static int GetScrHeight() { return scrHeight; }
86 static float GetScrAspect() { return scrAspect; }
87 static int KeyState(SDLKey k) { return keyState[k]; }
431b2968 » tompox
2010-08-16 make some keyboard controls configurable
88 static int KeyModState() { return keyModState; }
6dfe6c7e » johnbartholomew
2011-09-18 Add a function to quickly check if the console is active.
89 static bool IsConsoleActive();
8f55848d » unavowed
2011-01-12 Add support for querying joystick states
90 static int JoystickButtonState(int joystick, int button);
91 static int JoystickHatState(int joystick, int hat);
92 static float JoystickAxisState(int joystick, int axis);
99736d48 » John Jordan
2011-03-11 Joystick disabling option
93 static bool IsJoystickEnabled() { return joystickEnabled; }
94 static void SetJoystickEnabled(bool state) { joystickEnabled = state; }
944a9a19 » Philbywhizz
2011-04-16 UI interface for the MouseY setting done
95 static void SetMouseYInvert(bool state) { mouseYInvert = state; }
96 static bool IsMouseYInvert() { return mouseYInvert; }
96342f3d » tompox
2008-06-24 initial import
97 static int MouseButtonState(int button) { return mouseButton[button]; }
98 static void GetMouseMotion(int motion[2]) {
99 memcpy(motion, mouseMotion, sizeof(int)*2);
100 }
e52ef5a4 »
2011-05-04 don't set the grab state every frame, only when it changes
101 static void SetMouseGrab(bool on);
83f51f34 » tompox
2009-09-24 ui bing api function.
102 static void BoinkNoise();
61a0e268 » tompox
2009-10-24 load savefiles dialog
103 static bool IsGameStarted() { return isGameStarted; }
c33a8cd3 » tompox
2009-10-19 ships come with a particular class of hyperdrive. show hyperspace ran…
104 static float CalcHyperspaceRange(int hyperclass, int total_mass_in_tonnes);
284e7145 » tompox
2010-06-19 make buying and selling more verbose
105 static void Message(const std::string &message, const std::string &from = "", enum MsgLevel level = MSG_NORMAL);
18ee77e0 » johnbartholomew
2010-10-27 Delete erroneous comment in Pi.h (implementation of class Pi is no lo…
106
96342f3d » tompox
2008-06-24 initial import
107 static sigc::signal<void, SDL_keysym*> onKeyPress;
108 static sigc::signal<void, SDL_keysym*> onKeyRelease;
109 static sigc::signal<void, int, int, int> onMouseButtonUp;
110 static sigc::signal<void, int, int, int> onMouseButtonDown;
b1a9a5ef » tompox
2009-09-11 add some files i forgot... change ship controls so WASD area is pitch…
111 static sigc::signal<void> onPlayerChangeTarget; // navigation or combat
850c8701 » tompox
2009-09-26 dubious initial shader atmosphere work
112 static sigc::signal<void> onPlayerChangeFlightControlState;
08e7aa3a » tompox
2009-10-30 ECM. need sfx
113 static sigc::signal<void> onPlayerChangeEquipment;
dbf87ea8 » tompox
2009-07-31 more buildings for city. some work on proper space station docking pr…
114 static sigc::signal<void, const SpaceStation*> onDockingClearanceExpired;
96342f3d » tompox
2008-06-24 initial import
115
92f3d655 »
2011-09-15 allocate all the lua stuff on the heap at game start
116 static LuaManager *luaManager;
f4e6c658 »
2011-04-29 remove the auto_ptr stuff from LuaManager. now its just a boring obje…
117
92f3d655 »
2011-09-15 allocate all the lua stuff on the heap at game start
118 static LuaSerializer *luaSerializer;
119 static LuaTimer *luaTimer;
322d4fca »
2011-03-29 new module serializer class
120
92f3d655 »
2011-09-15 allocate all the lua stuff on the heap at game start
121 static LuaEventQueue<> *luaOnGameStart;
122 static LuaEventQueue<> *luaOnGameEnd;
123 static LuaEventQueue<Ship> *luaOnEnterSystem;
124 static LuaEventQueue<Ship> *luaOnLeaveSystem;
125 static LuaEventQueue<Body> *luaOnFrameChanged;
126 static LuaEventQueue<Ship,Body> *luaOnShipDestroyed;
127 static LuaEventQueue<Ship,Body> *luaOnShipHit;
128 static LuaEventQueue<Ship,Body> *luaOnShipCollided;
129 static LuaEventQueue<Ship,SpaceStation> *luaOnShipDocked;
130 static LuaEventQueue<Ship,SpaceStation> *luaOnShipUndocked;
131 static LuaEventQueue<Ship,Body> *luaOnShipLanded;
132 static LuaEventQueue<Ship,Body> *luaOnShipTakeOff;
133 static LuaEventQueue<Ship,const char *> *luaOnShipAlertChanged;
134 static LuaEventQueue<Ship,CargoBody> *luaOnJettison;
135 static LuaEventQueue<Ship> *luaOnAICompleted;
136 static LuaEventQueue<SpaceStation> *luaOnCreateBB;
137 static LuaEventQueue<SpaceStation> *luaOnUpdateBB;
138 static LuaEventQueue<> *luaOnSongFinished;
b6821d08 » johnbartholomew
2011-09-21 Add new Lua event queues: luaOnShip{Flavour,Equipment}Changed
139 static LuaEventQueue<Ship> *luaOnShipFlavourChanged;
140 static LuaEventQueue<Ship,const char *> *luaOnShipEquipmentChanged;
57938dd9 »
2011-03-25 move the lua events into Pi, sucks but can't think of a better place.…
141
96342f3d » tompox
2008-06-24 initial import
142 static MTRand rng;
5aa4f99b » tompox
2009-03-16 add some titillating stats
143 static int statSceneTris;
96342f3d » tompox
2008-06-24 initial import
144
145 static void SetView(View *v);
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
146 static View *GetView() { return currentView; }
96342f3d » tompox
2008-06-24 initial import
147 static StarSystem *GetSelectedSystem();
148
3735854a »
2011-04-30 seperate build options for devkeys and debug, and move build opts to …
149 #if DEVKEYS
fef6df0f » tompox
2008-08-25 add i key to toggle debug messages
150 static bool showDebugInfo;
3735854a »
2011-04-30 seperate build options for devkeys and debug, and move build opts to …
151 #endif
96342f3d » tompox
2008-06-24 initial import
152 static Player *player;
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
153 static SectorView *sectorView;
073acf6e » tompox
2009-10-18 galaxy view and sector density from galaxy map
154 static GalacticView *galacticView;
6d056cc4 » tompox
2009-10-24 save game dialog thing (hit escape)
155 static GameMenuView *gameMenuView;
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
156 static SystemInfoView *systemInfoView;
76c98b53 » tompox
2009-10-19 hopefully make starmap views navigation more comprehensible. indicate…
157 static SystemView *systemView;
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
158 static WorldView *worldView;
96342f3d » tompox
2008-06-24 initial import
159 static SpaceStationView *spaceStationView;
40f1abf4 » tompox
2008-06-27 a little more ship stats. ship info screen. make the ship angular vel…
160 static InfoView *infoView;
10aed587 » johnbartholomew
2011-09-18 Hook up the first pass as a GUI for the Lua console.
161 static LuaConsole *luaConsole;
96342f3d » tompox
2008-06-24 initial import
162 static ShipCpanel *cpan;
e906e54a » tompox
2008-06-27 single GLUQuadric object. fix ship laser drawing
163 static GLUquadric *gluQuadric;
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
164 static StarSystem *currentSystem;
bdeed542 » Luomu
2011-06-11 Added MusicPlayer stub + added to vs2010 build
165 static Sound::MusicPlayer &GetMusicPlayer() { return musicPlayer; }
d36b5929 » tompox
2009-10-18 combat rating
166
7623e356 »
2011-04-29 seperate the objectviewer from the debug define, and enable it by def…
167 #if OBJECTVIEWER
b1215078 »
2011-04-28 only enable the objectviewer when DEBUG is enabled
168 static ObjectViewerView *objectViewerView;
169 #endif
170
5bd601b9 »
2011-11-09 first cut turning Space:: into an object. builds, doesn't run :)
171 static Space *space;
172
d36b5929 » tompox
2009-10-18 combat rating
173 static int CombatRating(int kills);
174 static const char * const combatRating[];
8ccd6b60 » tompox
2009-10-24 configurable planet detail level
175
176 static struct DetailLevel detail;
8e2d5fcd »
2011-05-19 separate config parser from game config init. now we can make other k…
177 static GameConfig config;
96342f3d » tompox
2008-06-24 initial import
178 private:
179 static void InitOpenGL();
180 static void HandleEvents();
8f55848d » unavowed
2011-01-12 Add support for querying joystick states
181 static void InitJoysticks();
18ee77e0 » johnbartholomew
2010-10-27 Delete erroneous comment in Pi.h (implementation of class Pi is no lo…
182
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
183 static View *currentView;
18ee77e0 » johnbartholomew
2010-10-27 Delete erroneous comment in Pi.h (implementation of class Pi is no lo…
184
96342f3d » tompox
2008-06-24 initial import
185 static double gameTime;
7a1343fd » tomm
2010-11-12 initial dog's arse of an attempt to fix the timestep
186 /** So, the game physics rate (50Hz) can run slower
187 * than the frame rate. gameTickAlpha is the interpolation
188 * factor between one physics tick and another [0.0-1.0]
189 */
190 static float gameTickAlpha;
f28cbf3d » tompox
2008-08-16 some renaming to conform to NAMING CONVENTION
191 static StarSystem *selectedSystem;
a19c7645 » tompox
2009-09-11 initial crappy work on autopilot flying to places. made time accel li…
192 static int timeAccelIdx;
193 static int requestedTimeAccelIdx;
865305f5 »
2011-08-27 hold ctrl to have the timeaccel override the mass lockout
194 static bool forceTimeAccel;
96342f3d » tompox
2008-06-24 initial import
195 static float frameTime;
196 static int scrWidth, scrHeight;
197 static float scrAspect;
198 static SDL_Surface *scrSurface;
199 static char keyState[SDLK_LAST];
431b2968 » tompox
2010-08-16 make some keyboard controls configurable
200 static int keyModState;
3ca9ea34 » tompox
2010-03-13 Patch by Nic:
201 static char mouseButton[6];
96342f3d » tompox
2008-06-24 initial import
202 static int mouseMotion[2];
e52ef5a4 »
2011-05-04 don't set the grab state every frame, only when it changes
203 static bool doingMouseGrab;
a19c7645 » tompox
2009-09-11 initial crappy work on autopilot flying to places. made time accel li…
204 static const float timeAccelRates[];
61a0e268 » tompox
2009-10-24 load savefiles dialog
205 static bool isGameStarted;
8f55848d » unavowed
2011-01-12 Add support for querying joystick states
206
99736d48 » John Jordan
2011-03-11 Joystick disabling option
207 static bool joystickEnabled;
944a9a19 » Philbywhizz
2011-04-16 UI interface for the MouseY setting done
208 static bool mouseYInvert;
8f55848d » unavowed
2011-01-12 Add support for querying joystick states
209 struct JoystickState {
210 SDL_Joystick *joystick;
211 std::vector<bool> buttons;
212 std::vector<int> hats;
213 std::vector<float> axes;
214 };
215 static std::vector<JoystickState> joysticks;
bdeed542 » Luomu
2011-06-11 Added MusicPlayer stub + added to vs2010 build
216 static Sound::MusicPlayer musicPlayer;
96342f3d » tompox
2008-06-24 initial import
217 };
218
219 #endif /* _PI_H */
Something went wrong with that request. Please try again.