mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-30 21:17:42 +01:00
Scale and fullscreen loaded/saved to config and commandline
This commit is contained in:
parent
0004ca1845
commit
73a18998f6
@ -6,6 +6,7 @@
|
|||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
#include "SDL_syswm.h"
|
#include "SDL_syswm.h"
|
||||||
|
#include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -16,6 +17,11 @@
|
|||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIN
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Format.h"
|
||||||
#include "interface/Engine.h"
|
#include "interface/Engine.h"
|
||||||
#include "interface/Button.h"
|
#include "interface/Button.h"
|
||||||
#include "interface/Panel.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);
|
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();
|
int sdlStatus = SDLOpen();
|
||||||
sdl_scrn = SDLSetScreen(1, false);
|
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
|
||||||
#ifdef OGLI
|
#ifdef OGLI
|
||||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||||
//glScaled(2.0f, 2.0f, 1.0f);
|
//glScaled(2.0f, 2.0f, 1.0f);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
ui::Engine::Ref().g = new Graphics();
|
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();
|
ui::Engine * engine = &ui::Engine::Ref();
|
||||||
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
|
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
|
||||||
|
@ -102,6 +102,7 @@ bool OptionsModel::GetScale()
|
|||||||
void OptionsModel::SetScale(bool doubleScale)
|
void OptionsModel::SetScale(bool doubleScale)
|
||||||
{
|
{
|
||||||
ui::Engine::Ref().SetScale(doubleScale?2:1);
|
ui::Engine::Ref().SetScale(doubleScale?2:1);
|
||||||
|
Client::Ref().SetPref("Scale", int(doubleScale?2:1));
|
||||||
notifySettingsChanged();
|
notifySettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +114,7 @@ bool OptionsModel::GetFullscreen()
|
|||||||
void OptionsModel::SetFullscreen(bool fullscreen)
|
void OptionsModel::SetFullscreen(bool fullscreen)
|
||||||
{
|
{
|
||||||
ui::Engine::Ref().SetFullscreen(fullscreen);
|
ui::Engine::Ref().SetFullscreen(fullscreen);
|
||||||
|
Client::Ref().SetPref("Fullscreen", bool(fullscreen));
|
||||||
notifySettingsChanged();
|
notifySettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user