From 596a36aef02e3bdd41f15c1b2f142acbd49f50f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 8 Nov 2018 18:48:29 -0800 Subject: GLK: Allow video mode to be specified in the configuration --- engines/gargoyle/gargoyle.cpp | 18 +++++++++++++++++- engines/gargoyle/gargoyle.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/engines/gargoyle/gargoyle.cpp b/engines/gargoyle/gargoyle.cpp index 3135fcb5fe..1a817c605d 100644 --- a/engines/gargoyle/gargoyle.cpp +++ b/engines/gargoyle/gargoyle.cpp @@ -68,7 +68,7 @@ void GargoyleEngine::initialize() { DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); - initGraphics(640, 480, false); + initGraphicsMode(); _conf = new Conf(); _screen = new Screen(); @@ -80,6 +80,22 @@ void GargoyleEngine::initialize() { _windowMask = new WindowMask(); } +void GargoyleEngine::initGraphicsMode() { + uint width = ConfMan.hasKey("width") ? ConfMan.getInt("width") : 640; + uint height = ConfMan.hasKey("height") ? ConfMan.getInt("height") : 480; + Common::List formats = g_system->getSupportedFormats(); + Graphics::PixelFormat format = formats.front(); + + for (Common::List::iterator i = formats.begin(); i != formats.end(); ++i) { + if ((*i).bytesPerPixel > 1) { + format = *i; + break; + } + } + + initGraphics(width, height, &format); +} + Common::Error GargoyleEngine::run() { initialize(); diff --git a/engines/gargoyle/gargoyle.h b/engines/gargoyle/gargoyle.h index 0b8bca7856..728dc0fae3 100644 --- a/engines/gargoyle/gargoyle.h +++ b/engines/gargoyle/gargoyle.h @@ -81,6 +81,11 @@ private: * Handles basic initialization */ void initialize(); + + /** + * Setup the video mode + */ + void initGraphicsMode(); protected: const GargoyleGameDescription *_gameDescription; Common::RandomSource _random; -- cgit v1.2.3