summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-07 22:33:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-07 22:33:10 +0300
commit5f478df06f4c04bdef94874860a1b40e8d0d62fe (patch)
treeab7c0d03637d8d94e13b6e35466289a1445495e5
parent6adc2a5654e55f4a0e817cd5731753cdc3bc5ff4 (diff)
downloadmanaverse-5f478df06f4c04bdef94874860a1b40e8d0d62fe.tar.gz
manaverse-5f478df06f4c04bdef94874860a1b40e8d0d62fe.tar.bz2
manaverse-5f478df06f4c04bdef94874860a1b40e8d0d62fe.tar.xz
manaverse-5f478df06f4c04bdef94874860a1b40e8d0d62fe.zip
Improve a bit video mode initialisation code.
-rw-r--r--src/Makefile.am7
-rw-r--r--src/client.cpp8
-rw-r--r--src/graphicsmanager.cpp14
-rw-r--r--src/graphicsmanager.h4
4 files changed, 18 insertions, 15 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 32fb4ef13..ca904f168 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,9 +33,8 @@ dyecmd_SOURCES = gui/cliprect.cpp \
gui/cliprect.h \
gui/color.h \
events/event.h \
- gui/rect.h
-
-dyecmd_SOURCES += dyetool/dyemain.cpp \
+ gui/rect.h \
+ dyetool/dyemain.cpp \
animatedsprite.cpp \
animatedsprite.h \
animationdelayload.cpp \
@@ -50,6 +49,8 @@ dyecmd_SOURCES += dyetool/dyemain.cpp \
logger.h \
navigationmanager.cpp \
navigationmanager.h \
+ settings.cpp \
+ settings.h \
resources/map/walklayer.cpp \
resources/map/walklayer.h \
render/graphics.cpp \
diff --git a/src/client.cpp b/src/client.cpp
index 8adf4f5f1..12d0b82a3 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -508,11 +508,11 @@ void Client::updateEnv()
void Client::initGraphics()
{
- graphicsManager.initGraphics(settings.options.noOpenGL);
-
- runCounters = config.getBoolValue("packetcounters");
WindowManager::applyVSync();
- graphicsManager.setVideoMode();
+ runCounters = config.getBoolValue("packetcounters");
+
+ graphicsManager.initGraphics();
+
imageHelper->postInit();
getConfigDefaults2(config.getDefaultValues());
WindowManager::applyGrabMode();
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 870f52bb9..25c083124 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -40,6 +40,7 @@
#include "configuration.h"
#include "logger.h"
+#include "settings.h"
#include "render/graphics.h"
#include "render/mgl.h"
@@ -245,10 +246,10 @@ int GraphicsManager::detectGraphics()
| (1024 * textureSampler) | (2048 * compressTextures);
}
-void GraphicsManager::createRenderers(const bool noOpenGL)
+void GraphicsManager::createRenderers()
{
RenderType useOpenGL = RENDER_SOFTWARE;
- if (!noOpenGL)
+ if (!settings.options.noOpenGL)
useOpenGL = intToRenderType(config.getIntValue("opengl"));
// Setup image loading for the right image format
@@ -311,10 +312,10 @@ void GraphicsManager::createRenderers(const bool noOpenGL)
#else // USE_OPENGL
-void GraphicsManager::createRenderers(const bool noOpenGL)
+void GraphicsManager::createRenderers()
{
RenderType useOpenGL = RENDER_SOFTWARE;
- if (!noOpenGL)
+ if (!settings.options.noOpenGL)
useOpenGL = intToRenderType(config.getIntValue("opengl"));
// Setup image loading for the right image format
@@ -421,7 +422,7 @@ void GraphicsManager::setVideoMode()
}
}
-void GraphicsManager::initGraphics(const bool noOpenGL)
+void GraphicsManager::initGraphics()
{
openGLMode = intToRenderType(config.getIntValue("opengl"));
#ifdef USE_OPENGL
@@ -435,8 +436,9 @@ void GraphicsManager::initGraphics(const bool noOpenGL)
config.getBoolValue("alphaCache"));
ImageHelper::setEnableAlpha(config.getFloatValue("guialpha") != 1.0F);
#endif
- createRenderers(noOpenGL);
+ createRenderers();
detectPixelSize();
+ setVideoMode();
}
#ifdef USE_SDL2
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 6fe51795f..b0d6e9c9f 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -76,9 +76,9 @@ class GraphicsManager final
~GraphicsManager();
- void createRenderers(const bool noOpenGL);
+ void createRenderers();
- void initGraphics(const bool noOpenGL);
+ void initGraphics();
static void setVideoMode();