From 0703d8f36d02a4b87a8898cc847dc0d4da7bb27f Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 3 Apr 2022 20:33:07 +0200 Subject: Moved video and sound related members to GameWinDX9 --- StarsEx/Game.cpp | 15 ++++----------- StarsEx/Game.h | 13 ------------- StarsEx/GameWinDX9.cpp | 12 ++++++++++++ StarsEx/GameWinDX9.h | 6 ++++++ 4 files changed, 22 insertions(+), 24 deletions(-) (limited to 'StarsEx') diff --git a/StarsEx/Game.cpp b/StarsEx/Game.cpp index 6cf7321..d4de97c 100644 --- a/StarsEx/Game.cpp +++ b/StarsEx/Game.cpp @@ -31,10 +31,10 @@ const double MAX_FRAME_TIME_NORMAL = 1.0 / 5.0; // +--------------------------------------------------------------------+ -Game::Game() - : world(0), video_factory(0), video(0), video_settings(0), soundcard(0), - screen(0), - status(Game::OK), exit_code(0) +Game::Game() : + world(0), + status(Game::OK), + exit_code(0) { Clock::Init(); if (!game) { @@ -47,8 +47,6 @@ Game::Game() frame_number = 0; max_frame_length = MAX_FRAME_TIME_NORMAL; - - video_settings = new VideoSettings; } else status = TOO_MANY; @@ -62,11 +60,6 @@ Game::~Game() Clock::Close(); delete world; - delete screen; - delete video_factory; - delete video; - delete soundcard; - delete video_settings; } // +--------------------------------------------------------------------+ diff --git a/StarsEx/Game.h b/StarsEx/Game.h index 228d23f..4070faf 100644 --- a/StarsEx/Game.h +++ b/StarsEx/Game.h @@ -11,18 +11,10 @@ #define Game_h #include "Types.h" -#include "Screen.h" -#include "Video.h" -#include "VideoSettings.h" // +--------------------------------------------------------------------+ class Universe; -class Sound; -class SoundCard; -class Video; -class VideoFactory; -class Text; // +--------------------------------------------------------------------+ @@ -74,11 +66,6 @@ public: protected: Universe* world; - VideoFactory* video_factory; - Video* video; - VideoSettings* video_settings; - SoundCard* soundcard; - Screen* screen; int status; int exit_code; diff --git a/StarsEx/GameWinDX9.cpp b/StarsEx/GameWinDX9.cpp index 3020eea..2e1aabc 100644 --- a/StarsEx/GameWinDX9.cpp +++ b/StarsEx/GameWinDX9.cpp @@ -21,6 +21,7 @@ #include "Utils.h" #include "VideoFactory.h" #include "Video.h" +#include "VideoSettings.h" GameWinDX9* GameWinDX9::instance = nullptr; @@ -40,6 +41,11 @@ GameWinDX9::GameWinDX9() : hwnd {nullptr}, hmenu {nullptr}, window_style {0}, + video_factory {nullptr}, + video {nullptr}, + video_settings {nullptr}, + soundcard {nullptr}, + screen {nullptr}, is_windowed {false}, is_active {false}, is_device_lost {false}, @@ -52,6 +58,7 @@ GameWinDX9::GameWinDX9() : if (instance != nullptr) Panic::Panic("Multiple instances of GameWinDX9"); instance = this; + video_settings = new VideoSettings; } @@ -59,6 +66,11 @@ GameWinDX9::~GameWinDX9() { if (instance != nullptr) instance = nullptr; + if (screen) delete screen; + if (video_factory) delete video_factory; + if (video) delete video; + if (soundcard) delete soundcard; + if (video_settings) delete video_settings; } diff --git a/StarsEx/GameWinDX9.h b/StarsEx/GameWinDX9.h index f194504..16b620c 100644 --- a/StarsEx/GameWinDX9.h +++ b/StarsEx/GameWinDX9.h @@ -76,6 +76,12 @@ protected: const char* title_text; const char* palette_name; + VideoFactory* video_factory; + Video* video; + VideoSettings* video_settings; + SoundCard* soundcard; + Screen* screen; + bool is_windowed; bool is_active; bool is_device_lost; -- cgit v1.1