From 6b2a17a2ccb1a0d45489208f7f23b9d6a65b110d Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 23 Mar 2022 22:57:42 +0100 Subject: Removed Clock from Game for now While testing waters around exporting things out from Game to GameWinDX9 I noticed that if both ContentBundle and Clock (primarily) are removed from it, then the WinDX9 will be almost equivalent to base. This is worrying mainly because I'm only fortified in seeing deep relationships between various classes sadly including Video. --- Stars45/Game.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'Stars45/Game.cpp') 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; -- cgit v1.1