summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-08 16:42:04 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-08 16:42:04 (GMT)
commit73a18998f6791ae21a568996b5d0b884110b87d5 (patch)
treeb1c73afd05fca9e6b4af71841842d0365695e9c3 /src
parent0004ca1845b569318f8b9ede1dbf6884d3dc1d83 (diff)
downloadpowder-73a18998f6791ae21a568996b5d0b884110b87d5.zip
powder-73a18998f6791ae21a568996b5d0b884110b87d5.tar.gz
Scale and fullscreen loaded/saved to config and commandline
Diffstat (limited to 'src')
-rw-r--r--src/PowderToySDL.cpp42
-rw-r--r--src/options/OptionsModel.cpp2
2 files changed, 41 insertions, 3 deletions
diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp
index 2b606c9..0e01c66 100644
--- a/src/PowderToySDL.cpp
+++ b/src/PowderToySDL.cpp
@@ -6,6 +6,7 @@
#include "SDL.h"
#ifdef WIN
#include "SDL_syswm.h"
+#include <direct.h>
#endif
#include <iostream>
#include <sstream>
@@ -16,6 +17,11 @@
#include "icon.h"
#endif
+#ifndef WIN
+#include <unistd.h>
+#endif
+
+#include "Format.h"
#include "interface/Engine.h"
#include "interface/Button.h"
#include "interface/Panel.h"
@@ -287,15 +293,45 @@ int main(int argc, char * argv[])
std::map<std::string, std::string> arguments = readArguments(argc, argv);
+ if(arguments["ddir"].length())
+#ifdef WIN
+ _chdir(arguments["ddir"].c_str());
+#else
+ chdir(arguments["ddir"].c_str());
+#endif
+
+ int tempScale = 1;
+ bool tempFullscreen = false;
+
+ tempScale = Client::Ref().GetPrefInteger("Scale", 1);
+ tempFullscreen = Client::Ref().GetPrefBool("Fullscreen", false);
+
+
+ if(arguments["kiosk"] == "true")
+ {
+ tempFullscreen = true;
+ Client::Ref().SetPref("Fullscreen", tempFullscreen);
+ }
+
+ if(arguments["scale"].length())
+ {
+ tempScale = format::StringToNumber<int>(arguments["scale"]);
+ Client::Ref().SetPref("Scale", tempScale);
+ }
+
+ if(tempScale != 1 && tempScale != 2)
+ tempScale = 1;
+
int sdlStatus = SDLOpen();
- sdl_scrn = SDLSetScreen(1, false);
+ sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
#ifdef OGLI
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
//glScaled(2.0f, 2.0f, 1.0f);
-
#endif
ui::Engine::Ref().g = new Graphics();
- //ui::Engine::Ref().g->AttachSDLSurface(SDLOpen());
+ ui::Engine::Ref().Scale = scale;
+ inputScale = 1.0f/float(scale);
+ ui::Engine::Ref().Fullscreen = fullscreen;
ui::Engine * engine = &ui::Engine::Ref();
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
diff --git a/src/options/OptionsModel.cpp b/src/options/OptionsModel.cpp
index 6e71f36..be88d9b 100644
--- a/src/options/OptionsModel.cpp
+++ b/src/options/OptionsModel.cpp
@@ -102,6 +102,7 @@ bool OptionsModel::GetScale()
void OptionsModel::SetScale(bool doubleScale)
{
ui::Engine::Ref().SetScale(doubleScale?2:1);
+ Client::Ref().SetPref("Scale", int(doubleScale?2:1));
notifySettingsChanged();
}
@@ -113,6 +114,7 @@ bool OptionsModel::GetFullscreen()
void OptionsModel::SetFullscreen(bool fullscreen)
{
ui::Engine::Ref().SetFullscreen(fullscreen);
+ Client::Ref().SetPref("Fullscreen", bool(fullscreen));
notifySettingsChanged();
}