Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-03 01:43:03 +0000
committerStijn Buys <ingar@osirion.org>2008-02-03 01:43:03 +0000
commitb4973888aeaea2dde6058bc06c3f6631349e7f3c (patch)
tree010de10692b330d7634ad3090fb94d14c101f484 /src/game
parent67f8a7a783e550cab8e6a77d997b31815ee8cd7e (diff)
command buffer handling
engine function parsing buffered client console
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game.cc28
-rw-r--r--src/game/game.h29
2 files changed, 30 insertions, 27 deletions
diff --git a/src/game/game.cc b/src/game/game.cc
index 7f2ad17..2945657 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -18,23 +18,11 @@
namespace game
{
-Ship ship;
-Star star;
-bool initialized = false;
-
-std::string name; // name of the game
-std::string label; // label of the game
-std::string author; // author of the game
-
-// sectors in space
-std::vector<Sector*> sectors;
-
void Game::init()
{
using math::Vector3f;
using filesystem::IniFile;
- con_print << "Project::OSiRiON " << VERSION << std::endl;
con_debug << "Debug messages enabled" << std::endl;
// read game.ini
@@ -61,7 +49,8 @@ void Game::init()
}
f.close();
- con_print << "game.ini loaded " << name << " [" << label << "] by " << author << std::endl;
+ con_print << name << std::endl;
+ con_print << "by " << author << std::endl;
// read world.ini
std::string tmp;
@@ -108,14 +97,16 @@ void Game::init()
star.location = Vector3f(256.0f, 0.0f, 256.0f);
ship.location = Vector3f(0,0,0);
- // all done, ready to run
- initialized = true;
+ // signal the gameinterface the game is ready
+ core::GameInterface::init();
+
+ // test functions
+ core::cmd << "help" << std::endl;
+ core::cmd << "test" << std::endl;
}
void Game::shutdown()
{
- initialized = false;
-
// delete every sector object in the sectors vector
for (unsigned int n =0; n< sectors.size(); n++) {
delete sectors[n];
@@ -123,6 +114,9 @@ void Game::shutdown()
}
// clear the sectors vector
sectors.clear();
+
+ // signal the gameinterface the game has shutdown
+ core::GameInterface::shutdown();
}
void Game::frame(float elapsed)
diff --git a/src/game/game.h b/src/game/game.h
index 6f77bcf..bd9cebb 100644
--- a/src/game/game.h
+++ b/src/game/game.h
@@ -10,31 +10,40 @@
// project headers
#include "game/ship.h"
#include "game/star.h"
+#include "game/sector.h"
#include "core/core.h"
#include "sys/sys.h"
+// C++ headers
+#include <vector>
+#include <string>
+
/// the game-specific engine
-/** The main game functions. The console should be initialized before calling these.
+/** The main game functions.
*/
namespace game
{
-/// the only ship in the game
-extern Ship ship;
-
-/// the only star in the game
-extern Star star;
-
class Game : public core::GameInterface {
public:
/// initialize the game
void init();
-
/// shutdown the game
void shutdown();
-
- /// update the game state
+ /// execute one game grame
void frame(float sec);
+
+ /// sectors in space
+ std::vector<Sector*> sectors;
+ /// the only ship in the game
+ Ship ship;
+ /// the only star in the game
+ Star star;
+
+private:
+ std::string name;
+ std::string label;
+ std::string author;
};
}