diff options
| author | Simon 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) |
| commit | 73a18998f6791ae21a568996b5d0b884110b87d5 (patch) | |
| tree | b1c73afd05fca9e6b4af71841842d0365695e9c3 /src/PowderToySDL.cpp | |
| parent | 0004ca1845b569318f8b9ede1dbf6884d3dc1d83 (diff) | |
| download | powder-73a18998f6791ae21a568996b5d0b884110b87d5.zip powder-73a18998f6791ae21a568996b5d0b884110b87d5.tar.gz | |
Scale and fullscreen loaded/saved to config and commandline
Diffstat (limited to 'src/PowderToySDL.cpp')
| -rw-r--r-- | src/PowderToySDL.cpp | 42 |
1 files changed, 39 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); |
