summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Game.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-23 22:57:42 +0100
committerAki <please@ignore.pl>2022-03-23 22:57:42 +0100
commit6b2a17a2ccb1a0d45489208f7f23b9d6a65b110d (patch)
tree0c0c86871cdd51462617a946a9f35fe3501bd6a7 /Stars45/Game.cpp
parent9f9f2456d5ee0091bf171fae3ad321f82e5f2ca4 (diff)
downloadstarshatter-6b2a17a2ccb1a0d45489208f7f23b9d6a65b110d.zip
starshatter-6b2a17a2ccb1a0d45489208f7f23b9d6a65b110d.tar.gz
starshatter-6b2a17a2ccb1a0d45489208f7f23b9d6a65b110d.tar.bz2
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.
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;