mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
screen texture and main window are now private members of screen handler
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -111,7 +111,7 @@ void CGuiHandler::renderFrame()
|
||||
CCS->curh->update();
|
||||
}
|
||||
|
||||
screenHandlerInstance->presetScreenTexture();
|
||||
screenHandlerInstance->presentScreenTexture();
|
||||
framerate().framerateDelay(); // holds a constant FPS
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user