SDL: Replace gfx_mode with scale_factor in initSizeHint()
This commit is contained in:
parent
42bc12a007
commit
a14c5a4a53
6 changed files with 1 additions and 41 deletions
|
@ -61,20 +61,6 @@ protected:
|
||||||
|
|
||||||
bool saveScreenshot(const Common::String &filename) const override;
|
bool saveScreenshot(const Common::String &filename) const override;
|
||||||
|
|
||||||
int getGraphicsModeScale(int mode) const override {
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
|
||||||
int windowWidth, windowHeight;
|
|
||||||
SDL_GetWindowSize(_window->getSDLWindow(), &windowWidth, &windowHeight);
|
|
||||||
int realWidth, realHeight;
|
|
||||||
SDL_GL_GetDrawableSize(_window->getSDLWindow(), &realWidth, &realHeight);
|
|
||||||
int scale = realWidth / windowWidth;
|
|
||||||
//debug(9, "window: %dx%d drawable: %dx%d scale: %d", windowWidth, windowHeight, realWidth, realHeight, scale);
|
|
||||||
return scale;
|
|
||||||
#else
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setupMode(uint width, uint height);
|
bool setupMode(uint width, uint height);
|
||||||
|
|
||||||
|
|
|
@ -138,26 +138,11 @@ bool SdlGraphicsManager::defaultGraphicsModeConfig() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SdlGraphicsManager::getGraphicsModeIdByName(const Common::String &name) const {
|
|
||||||
if (name == "normal" || name == "default") {
|
|
||||||
return getDefaultGraphicsMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
const OSystem::GraphicsMode *mode = getSupportedGraphicsModes();
|
|
||||||
while (mode && mode->name != nullptr) {
|
|
||||||
if (name.equalsIgnoreCase(mode->name)) {
|
|
||||||
return mode->id;
|
|
||||||
}
|
|
||||||
++mode;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SdlGraphicsManager::initSizeHint(const Graphics::ModeList &modes) {
|
void SdlGraphicsManager::initSizeHint(const Graphics::ModeList &modes) {
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
const bool useDefault = defaultGraphicsModeConfig();
|
const bool useDefault = defaultGraphicsModeConfig();
|
||||||
|
|
||||||
int scale = getGraphicsModeScale(getGraphicsModeIdByName(ConfMan.get("gfx_mode")));
|
int scale = ConfMan.getInt("scale_factor");
|
||||||
if (scale == -1) {
|
if (scale == -1) {
|
||||||
warning("Unknown scaler; defaulting to 1");
|
warning("Unknown scaler; defaulting to 1");
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
|
|
@ -153,10 +153,7 @@ protected:
|
||||||
/** Obtain the user configured fullscreen resolution, or default to the desktop resolution */
|
/** Obtain the user configured fullscreen resolution, or default to the desktop resolution */
|
||||||
Common::Rect getPreferredFullscreenResolution();
|
Common::Rect getPreferredFullscreenResolution();
|
||||||
|
|
||||||
virtual int getGraphicsModeScale(int mode) const = 0;
|
|
||||||
|
|
||||||
bool defaultGraphicsModeConfig() const;
|
bool defaultGraphicsModeConfig() const;
|
||||||
int getGraphicsModeIdByName(const Common::String &name) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the dimensions of the window directly from SDL instead of from the
|
* Gets the dimensions of the window directly from SDL instead of from the
|
||||||
|
|
|
@ -559,11 +559,6 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int SurfaceSdlGraphicsManager::getGraphicsModeScale(int mode) const {
|
|
||||||
// TODO: I'm not 100% sure this is correct...
|
|
||||||
return _videoMode.scaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint SurfaceSdlGraphicsManager::getDefaultScaler() const {
|
uint SurfaceSdlGraphicsManager::getDefaultScaler() const {
|
||||||
return ScalerMan.findScalerPluginIndex("normal");
|
return ScalerMan.findScalerPluginIndex("normal");
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,8 +174,6 @@ protected:
|
||||||
|
|
||||||
void handleResizeImpl(const int width, const int height) override;
|
void handleResizeImpl(const int width, const int height) override;
|
||||||
|
|
||||||
int getGraphicsModeScale(int mode) const override;
|
|
||||||
|
|
||||||
virtual void setupHardwareSize();
|
virtual void setupHardwareSize();
|
||||||
|
|
||||||
void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &width, int &height) const;
|
void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &width, int &height) const;
|
||||||
|
|
|
@ -108,7 +108,6 @@ public:
|
||||||
void notifyResize(const int width, const int height) override;
|
void notifyResize(const int width, const int height) override;
|
||||||
|
|
||||||
bool gameNeedsAspectRatioCorrection() const override { return false; }
|
bool gameNeedsAspectRatioCorrection() const override { return false; }
|
||||||
int getGraphicsModeScale(int mode) const override { return 1; }
|
|
||||||
|
|
||||||
void transformMouseCoordinates(Common::Point &point);
|
void transformMouseCoordinates(Common::Point &point);
|
||||||
bool notifyMousePosition(Common::Point &mouse) override {
|
bool notifyMousePosition(Common::Point &mouse) override {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue