Ver código fonte

screen texture and main window are now private members of screen handler

Ivan Savenko 8 meses atrás
pai
commit
5a9dbc03a8

+ 0 - 4
client/CMT.h

@@ -9,11 +9,7 @@
  */
 #pragma once
 
-struct SDL_Texture;
 struct SDL_Renderer;
-struct SDL_Surface;
-
-extern SDL_Texture * screenTexture;
 extern SDL_Renderer * mainRenderer;
 
 /// Notify user about encountered fatal error and terminate the game

+ 1 - 1
client/gui/CGuiHandler.cpp

@@ -111,7 +111,7 @@ void CGuiHandler::renderFrame()
 		CCS->curh->update();
 	}
 
-	screenHandlerInstance->presetScreenTexture();
+	screenHandlerInstance->presentScreenTexture();
 	framerate().framerateDelay(); // holds a constant FPS
 }
 

+ 1 - 1
client/render/IScreenHandler.h

@@ -38,7 +38,7 @@ public:
 	virtual void updateScreenTexture() = 0;
 
 	/// Presents screen texture on the screen
-	virtual void presetScreenTexture() = 0;
+	virtual void presentScreenTexture() = 0;
 
 	/// Returns list of resolutions supported by current screen
 	virtual std::vector<Point> getSupportedResolutions() const = 0;

+ 1 - 3
client/renderSDL/ScreenHandler.cpp

@@ -34,9 +34,7 @@
 #include <SDL.h>
 
 // TODO: should be made into a private members of ScreenHandler
-static SDL_Window * mainWindow = nullptr;
 SDL_Renderer * mainRenderer = nullptr;
-SDL_Texture * screenTexture = nullptr;
 
 static const std::string NAME = GameConstants::VCMI_VERSION; //application name
 static constexpr Point heroes3Resolution = Point(800, 600);
@@ -633,7 +631,7 @@ void ScreenHandler::updateScreenTexture()
 	SDL_UpdateTexture(screenTexture, nullptr, screen->pixels, screen->pitch);
 }
 
-void ScreenHandler::presetScreenTexture()
+void ScreenHandler::presentScreenTexture()
 {
 	SDL_RenderClear(mainRenderer);
 	SDL_RenderCopy(mainRenderer, screenTexture, nullptr, nullptr);

+ 4 - 2
client/renderSDL/ScreenHandler.h

@@ -44,7 +44,9 @@ enum class EUpscalingFilter
 /// This class is responsible for management of game window and its main rendering surface
 class ScreenHandler final : public IScreenHandler
 {
-	SDL_Surface * screen = nullptr; //main screen surface
+	SDL_Window * mainWindow = nullptr;
+	SDL_Texture * screenTexture = nullptr;
+	SDL_Surface * screen = nullptr;
 
 	EUpscalingFilter upscalingFilter = EUpscalingFilter::AUTO;
 
@@ -118,7 +120,7 @@ public:
 
 	Canvas getScreenCanvas() const final;
 	void updateScreenTexture() final;
-	void presetScreenTexture() final;
+	void presentScreenTexture() final;
 
 	std::vector<Point> getSupportedResolutions() const final;
 	std::vector<Point> getSupportedResolutions(int displayIndex) const;