summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/Game.cpp')
-rw-r--r--Stars45/Game.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp
index 62d1e69..5c93e6f 100644
--- a/Stars45/Game.cpp
+++ b/Stars45/Game.cpp
@@ -38,6 +38,7 @@ Game::Game()
hInst(0), hwnd(0),
status(Game::OK), exit_code(0), window_style(0)
{
+ Clock::Init();
if (!game) {
game = this;
@@ -60,6 +61,8 @@ Game::~Game()
if (game == this)
game = 0;
+ Clock::Close();
+
delete world;
delete screen;
delete video_factory;
@@ -136,7 +139,7 @@ Game::Run()
Print("+====================================================================+\n");
// Polling messages from event queue until quit
- clock.Set();
+ Clock::GetInstance()->Set();
while (status < EXIT && !Panic::Panicked()) {
if (PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT)
@@ -221,7 +224,7 @@ Game::GameLoop()
Pause(false);
}
- clock.Step();
+ Clock::GetInstance()->Step();
frame_number++;
Mouse::w = 0;
return wait_for_windows_events;
@@ -233,7 +236,7 @@ void
Game::UpdateWorld()
{
if (world)
- world->ExecFrame(clock.Delta());
+ world->ExecFrame(Clock::GetInstance()->Delta());
}
// +--------------------------------------------------------------------+
@@ -271,7 +274,7 @@ Game::GetInstance()
void
Game::CollectStats()
{
- if (!totaltime) totaltime = clock.RealTime();
+ if (!totaltime) totaltime = Clock::GetInstance()->RealTime();
if (video) {
stats.nframe = video->GetStats().nframe;
@@ -293,7 +296,7 @@ Game::ShowStats()
{
if (server) return;
- totaltime = clock.RealTime() - totaltime;
+ totaltime = Clock::GetInstance()->RealTime() - totaltime;
Print("\n");
Print("Performance Data:\n");
@@ -322,13 +325,6 @@ Game::ShowStats()
// +====================================================================+
-Clock*
-Game::GetClock()
-{
- return &clock;
-}
-
-
DWORD Game::Frame()
{
return frame_number;