From 2f370ef8ab65db8443c496c47de98740b31c4220 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Fri, 10 Jul 2009 10:43:48 +0000 Subject: Overloaded initGraphics to provide for simpler procedures for engines supporting more than one format. svn-id: r42330 --- engines/engine.cpp | 16 +++++++++++++++- engines/engine.h | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/engines/engine.cpp b/engines/engine.cpp index 1fd77eb310..399f188962 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -131,7 +131,13 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: initCommonGFX(defaultTo1xScaler); #ifdef ENABLE_RGB_COLOR - g_system->initSize(width, height, format); + if (format) + g_system->initSize(width, height, format); + else { + Graphics::PixelFormat Format = g_system->getSupportedFormats().front(); + debug("%d,%X,%X,%X",Format.bytesPerPixel << 3, Format.rBits(), Format.gBits(), Format.bBits()); + g_system->initSize(width, height, &Format); + } #else g_system->initSize(width, height); #endif @@ -183,6 +189,14 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: dialog.runModal(); } } +void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List &formatList) { + Graphics::PixelFormat format = Graphics::findCompatibleFormat(g_system->getSupportedFormats(),formatList); + initGraphics(width,height,defaultTo1xScaler,&format); +} +void initGraphics(int width, int height, bool defaultTo1xScaler) { + Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8(); + initGraphics(width,height,defaultTo1xScaler,&format); +} void GUIErrorMessage(const Common::String msg) { g_system->setWindowCaption("Error"); diff --git a/engines/engine.h b/engines/engine.h index d570f18073..0f5585378b 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -62,7 +62,9 @@ void initCommonGFX(bool defaultTo1XScaler); * * Defaults to 256 color paletted mode if no graphics format is provided. */ -void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format = NULL); +void initGraphics(int width, int height, bool defaultTo1xScaler); +void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format); +void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List &formatList); /** * Initializes graphics and shows error message. -- cgit v1.2.3