mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 20:51:14 +00:00
SDL: Support auto-detection of GUI resolution.
This commit is contained in:
parent
47ab3fe4fc
commit
b91d873df6
@ -707,12 +707,42 @@ int SurfaceSdlGraphicsManager::getStretchMode() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
void SurfaceSdlGraphicsManager::getDefaultResolution(uint &w, uint &h) {
|
||||
#ifdef RS90
|
||||
SDL_PixelFormat p;
|
||||
p.BitsPerPixel = 16;
|
||||
p.BytesPerPixel = 2;
|
||||
p.Rloss = 3;
|
||||
p.Gloss = 2;
|
||||
p.Bloss = 3;
|
||||
p.Rshift = 11;
|
||||
p.Gshift = 5;
|
||||
p.Bshift = 0;
|
||||
p.Rmask = 0xf800;
|
||||
p.Gmask = 0x07e0;
|
||||
p.Bmask = 0x001f;
|
||||
p.colorkey = 0;
|
||||
p.alpha = 0;
|
||||
// Only native screen resolution is supported in RGB565 fullscreen hwsurface.
|
||||
SDL_Rect const* const*availableModes = SDL_ListModes(&p, SDL_FULLSCREEN|SDL_HWSURFACE);
|
||||
w = availableModes[0]->w;
|
||||
h = availableModes[0]->h;
|
||||
#else
|
||||
w = 320;
|
||||
h = 200;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
|
||||
assert(_transactionMode == kTransactionActive);
|
||||
|
||||
_gameScreenShakeXOffset = 0;
|
||||
_gameScreenShakeYOffset = 0;
|
||||
|
||||
if (w == 0) {
|
||||
getDefaultResolution(w, h);
|
||||
}
|
||||
|
||||
#ifdef USE_RGB_COLOR
|
||||
//avoid redundant format changes
|
||||
Graphics::PixelFormat newFormat;
|
||||
|
@ -428,6 +428,7 @@ protected:
|
||||
|
||||
bool saveScreenshot(const Common::String &filename) const override;
|
||||
virtual void setGraphicsModeIntern();
|
||||
void getDefaultResolution(uint &w, uint &h);
|
||||
|
||||
private:
|
||||
void setFullscreenMode(bool enable);
|
||||
|
@ -351,7 +351,14 @@ static void setupGraphics(OSystem &system) {
|
||||
system.setScaler(ConfMan.get("scaler").c_str(), ConfMan.getInt("scale_factor"));
|
||||
system.setShader(ConfMan.get("shader"));
|
||||
|
||||
#ifdef OPENDINGUX
|
||||
// 0, 0 means "autodetect" but currently only SDL supports
|
||||
// it and really useful only on Opendingux. When more platforms
|
||||
// support it we will switch to it.
|
||||
system.initSize(0, 0);
|
||||
#else
|
||||
system.initSize(320, 200);
|
||||
#endif
|
||||
|
||||
// Parse graphics configuration, implicit fallback to defaults set with RegisterDefaults()
|
||||
system.setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user