diff options
| author | Max Horn | 2004-11-22 23:25:08 +0000 |
|---|---|---|
| committer | Max Horn | 2004-11-22 23:25:08 +0000 |
| commit | 8ac347fd952a3811e6a948dfca3dec081882c335 (patch) | |
| tree | 001858ccbbc2c37f1957c62c3e5c7c635f386a31 /base | |
| parent | 96804652a2f310b31ad7dc4799872805d8c95e71 (diff) | |
| download | scummvm-rg350-8ac347fd952a3811e6a948dfca3dec081882c335.tar.gz scummvm-rg350-8ac347fd952a3811e6a948dfca3dec081882c335.tar.bz2 scummvm-rg350-8ac347fd952a3811e6a948dfca3dec081882c335.zip | |
Added OSystem::beginGFXTransaction / endGFXTransaction (not yet implemented, though :-)
svn-id: r15864
Diffstat (limited to 'base')
| -rw-r--r-- | base/main.cpp | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/base/main.cpp b/base/main.cpp index 24988c50de..15870d7a0b 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -185,15 +185,19 @@ static void do_memory_test(void) { #endif static int launcherDialog(GameDetector &detector, OSystem *system) { - // Set the user specified graphics mode (if any). - system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); - - // FIXME - we need to call initSize() here so that we can display for example - // the launcher dialog. But the Engine object will also call it again (possibly - // with a different widht/height!9 However, this method is not for all OSystem - // implementations reentrant (it is so now for the SDL backend). Thus we need - // to fix all backends to support it, if they don't already. - system->initSize(320, 200); + + system->beginGFXTransaction(); + // Set the user specified graphics mode (if any). + system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + + // FIXME - we need to call initSize() here so that we can display for example + // the launcher dialog. But the Engine object will also call it again (possibly + // with a different widht/height!9 However, this method is not for all OSystem + // implementations reentrant (it is so now for the SDL backend). Thus we need + // to fix all backends to support it, if they don't already. + system->initSize(320, 200); + system->endGFXTransaction(); + // Clear the main screen system->clearScreen(); @@ -252,21 +256,37 @@ static void runGame(GameDetector &detector, OSystem *system) { !scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "normal") || !scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "default"); - // See if the game should default to 1x scaler - if (useDefaultGraphicsMode && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) { - system->setGraphicsMode(GFX_NORMAL); - } else { - // Override global scaler with any game-specific define - if (ConfMan.hasKey("gfx_mode")) { - system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); - } - } + system->beginGFXTransaction(); - // (De)activate aspect-ratio correction as determined by the config settings - system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); + // See if the game should default to 1x scaler + if (useDefaultGraphicsMode && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) { + system->setGraphicsMode(GFX_NORMAL); + } else { + // Override global scaler with any game-specific define + if (ConfMan.hasKey("gfx_mode")) { + system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + } + } - // (De)activate fullscreen mode as determined by the config settings - system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); + // (De)activate aspect-ratio correction as determined by the config settings + system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); + + // (De)activate fullscreen mode as determined by the config settings + system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); + + // TODO / FIXME: this transaction sould also contain the initial call to initSize + // which all engines perform. However, as long as that is contained within + // the "engine->go()", this is not possible. + // Multiple solutions come to mind, including these: + // * Don't let the engine invoke initSize(); rather, add a method to them which we can + // use to query their desired res, then we set it for them + // * Move the setGraphicsMode/setFeatureState calls here to the Engine class, which the + // engines invoke (in other words: move this transaction into the engines + // * Add an explicit Engine::init() method, which all engines have to implement, + // and into which they should put their call to initSize. Then, make sure this transaction + // surrounds the call to engine->init(); + + system->endGFXTransaction(); // Create the game engine Engine *engine = detector.createEngine(system); |
