From afc770043be553998555e9ac1cffca68dc482d48 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 13 Aug 2006 11:36:36 +0000 Subject: Merged cleanups and content changes from the trunk. Also fixed compiling with OpenGL enabled. --- src/main.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index ce68b7bb..a4ef29ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,6 @@ #define NOGDI #endif -#include "animation.h" #include "configuration.h" #include "game.h" #include "graphics.h" @@ -216,15 +215,6 @@ void init_engine() resman->addToSearchPath("data", true); resman->addToSearchPath(TMW_DATADIR "data", true); - int width, height, bpp; - bool fullscreen, hwaccel; - - width = (int)config.getValue("screenwidth", 800); - height = (int)config.getValue("screenheight", 600); - bpp = 0; - fullscreen = ((int)config.getValue("screen", 0) == 1); - hwaccel = ((int)config.getValue("hwaccel", 0) == 1); - #ifdef USE_OPENGL bool useOpenGL = (config.getValue("opengl", 0) == 1); @@ -232,16 +222,18 @@ void init_engine() Image::setLoadAsOpenGL(useOpenGL); // Create the graphics context - if (useOpenGL) { - graphics = new OpenGLGraphics(); - } else { - graphics = new Graphics(); - } + graphics = useOpenGL ? new OpenGLGraphics() : new Graphics(); #else // Create the graphics context graphics = new Graphics(); #endif + int width = (int)config.getValue("screenwidth", 800); + int height = (int)config.getValue("screenheight", 600); + int bpp = 0; + bool fullscreen = ((int)config.getValue("screen", 0) == 1); + bool hwaccel = ((int)config.getValue("hwaccel", 0) == 1); + // Try to set the desired video mode if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel)) { @@ -299,11 +291,8 @@ void exit_engine() delete gui; delete graphics; - std::vector::iterator iter; - for (iter = hairset.begin(); iter != hairset.end(); ++iter) - { - (*iter)->decRef(); - } + std::for_each(hairset.begin(), hairset.end(), + std::mem_fun(&Spriteset::decRef)); hairset.clear(); playerset[0]->decRef(); -- cgit v1.2.3-60-g2f50