From f49d139c6bb975a68478eedd9763028443f47d25 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 16 Feb 2022 23:59:33 +0100 Subject: Changed video related static game method to instance methods --- Stars45/Game.cpp | 7 ++----- Stars45/Game.h | 4 ++-- Stars45/VidDlg.cpp | 51 ++++++++++++++++++++++++++------------------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp index 9632d6a..d0a5735 100644 --- a/Stars45/Game.cpp +++ b/Stars45/Game.cpp @@ -195,7 +195,7 @@ Game::SetMaxTexSize(int n) bool Game::DisplayModeSupported(int w, int h, int bpp) { - return game && game->video && game->video->IsModeSupported(w,h,bpp); + return video && video->IsModeSupported(w, h, bpp); } double @@ -1006,10 +1006,7 @@ Game::GetInstance() Video* Game::GetVideo() { - if (game) - return game->video; - - return 0; + return video; } Color diff --git a/Stars45/Game.h b/Stars45/Game.h index d4042ec..9463338 100644 --- a/Stars45/Game.h +++ b/Stars45/Game.h @@ -68,7 +68,7 @@ public: // static void Panic(const char* msg=0); - static bool DisplayModeSupported(int w, int h, int bpp); + bool DisplayModeSupported(int w, int h, int bpp); static int MaxTexSize(); static int MaxTexAspect(); static int GammaLevel(); @@ -92,7 +92,7 @@ public: static double GetMinFrameLength() { return min_frame_length; } static Game* GetInstance(); - static Video* GetVideo(); + Video* GetVideo(); static Color GetScreenColor(); static void SetScreenColor(Color c); static int GetScreenWidth(); diff --git a/Stars45/VidDlg.cpp b/Stars45/VidDlg.cpp index 88f5e56..95aa8e1 100644 --- a/Stars45/VidDlg.cpp +++ b/Stars45/VidDlg.cpp @@ -11,6 +11,7 @@ Main Menu Dialog Active Window class */ +#include "Game.h" #include "MemDebug.h" #include "VidDlg.h" #include "BaseScreen.h" @@ -465,43 +466,43 @@ VidDlg::BuildModeList() mode->ClearItems(); selected_mode = 0; - if (Game::DisplayModeSupported( 800, 600, 16)) mode->AddItem("800 x 600 x 16"); - if (Game::DisplayModeSupported( 800, 600, 32)) mode->AddItem("800 x 600 x 32"); + if (stars->DisplayModeSupported( 800, 600, 16)) mode->AddItem("800 x 600 x 16"); + if (stars->DisplayModeSupported( 800, 600, 32)) mode->AddItem("800 x 600 x 32"); - if (Game::DisplayModeSupported(1024, 768, 16)) mode->AddItem("1024 x 768 x 16"); - if (Game::DisplayModeSupported(1024, 768, 32)) mode->AddItem("1024 x 768 x 32"); + if (stars->DisplayModeSupported(1024, 768, 16)) mode->AddItem("1024 x 768 x 16"); + if (stars->DisplayModeSupported(1024, 768, 32)) mode->AddItem("1024 x 768 x 32"); - if (Game::DisplayModeSupported(1152, 864, 16)) mode->AddItem("1152 x 864 x 16"); - if (Game::DisplayModeSupported(1152, 864, 32)) mode->AddItem("1152 x 864 x 32"); + if (stars->DisplayModeSupported(1152, 864, 16)) mode->AddItem("1152 x 864 x 16"); + if (stars->DisplayModeSupported(1152, 864, 32)) mode->AddItem("1152 x 864 x 32"); - if (Game::DisplayModeSupported(1280, 800, 16)) mode->AddItem("1280 x 800 x 16"); - if (Game::DisplayModeSupported(1280, 800, 32)) mode->AddItem("1280 x 800 x 32"); + if (stars->DisplayModeSupported(1280, 800, 16)) mode->AddItem("1280 x 800 x 16"); + if (stars->DisplayModeSupported(1280, 800, 32)) mode->AddItem("1280 x 800 x 32"); - if (Game::DisplayModeSupported(1280, 960, 16)) mode->AddItem("1280 x 960 x 16"); - if (Game::DisplayModeSupported(1280, 960, 32)) mode->AddItem("1280 x 960 x 32"); + if (stars->DisplayModeSupported(1280, 960, 16)) mode->AddItem("1280 x 960 x 16"); + if (stars->DisplayModeSupported(1280, 960, 32)) mode->AddItem("1280 x 960 x 32"); - if (Game::DisplayModeSupported(1280,1024, 16)) mode->AddItem("1280 x 1024 x 16"); - if (Game::DisplayModeSupported(1280,1024, 32)) mode->AddItem("1280 x 1024 x 32"); + if (stars->DisplayModeSupported(1280,1024, 16)) mode->AddItem("1280 x 1024 x 16"); + if (stars->DisplayModeSupported(1280,1024, 32)) mode->AddItem("1280 x 1024 x 32"); - if (Game::DisplayModeSupported(1366, 768, 16)) mode->AddItem("1366 x 768 x 16"); - if (Game::DisplayModeSupported(1366, 768, 32)) mode->AddItem("1366 x 768 x 32"); + if (stars->DisplayModeSupported(1366, 768, 16)) mode->AddItem("1366 x 768 x 16"); + if (stars->DisplayModeSupported(1366, 768, 32)) mode->AddItem("1366 x 768 x 32"); - if (Game::DisplayModeSupported(1440, 900, 16)) mode->AddItem("1440 x 900 x 16"); - if (Game::DisplayModeSupported(1440, 900, 32)) mode->AddItem("1440 x 900 x 32"); + if (stars->DisplayModeSupported(1440, 900, 16)) mode->AddItem("1440 x 900 x 16"); + if (stars->DisplayModeSupported(1440, 900, 32)) mode->AddItem("1440 x 900 x 32"); - if (Game::DisplayModeSupported(1600, 900, 16)) mode->AddItem("1600 x 900 x 16"); - if (Game::DisplayModeSupported(1600, 900, 32)) mode->AddItem("1600 x 900 x 32"); + if (stars->DisplayModeSupported(1600, 900, 16)) mode->AddItem("1600 x 900 x 16"); + if (stars->DisplayModeSupported(1600, 900, 32)) mode->AddItem("1600 x 900 x 32"); - if (Game::DisplayModeSupported(1600,1200, 16)) mode->AddItem("1600 x 1200 x 16"); - if (Game::DisplayModeSupported(1600,1200, 32)) mode->AddItem("1600 x 1200 x 32"); + if (stars->DisplayModeSupported(1600,1200, 16)) mode->AddItem("1600 x 1200 x 16"); + if (stars->DisplayModeSupported(1600,1200, 32)) mode->AddItem("1600 x 1200 x 32"); - if (Game::DisplayModeSupported(1680,1050, 16)) mode->AddItem("1680 x 1050 x 16"); - if (Game::DisplayModeSupported(1680,1050, 32)) mode->AddItem("1680 x 1050 x 32"); + if (stars->DisplayModeSupported(1680,1050, 16)) mode->AddItem("1680 x 1050 x 16"); + if (stars->DisplayModeSupported(1680,1050, 32)) mode->AddItem("1680 x 1050 x 32"); - if (Game::DisplayModeSupported(1920,1080, 16)) mode->AddItem("1920 x 1080 x 16"); - if (Game::DisplayModeSupported(1920,1080, 32)) mode->AddItem("1920 x 1080 x 32"); + if (stars->DisplayModeSupported(1920,1080, 16)) mode->AddItem("1920 x 1080 x 16"); + if (stars->DisplayModeSupported(1920,1080, 32)) mode->AddItem("1920 x 1080 x 32"); - Video* video = Game::GetVideo(); + Video* video = stars->GetVideo(); if (stars && video) { switch (video->Width()) { -- cgit v1.1