Clean up window creation somewhat

Fixes most of the rat's nest situation mentioned in 8cfe7cdd93e8.
This commit is contained in:
Tamás Bálint Misius 2023-10-05 19:42:20 +02:00
parent 1a8ebd0981
commit 0fb36012a2
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
7 changed files with 155 additions and 179 deletions

View File

@ -81,12 +81,13 @@ void SaveWindowPosition()
void LargeScreenDialog() void LargeScreenDialog()
{ {
StringBuilder message; StringBuilder message;
auto scale = ui::Engine::Ref().windowFrameOps.scale;
message << "Switching to " << scale << "x size mode since your screen was determined to be large enough: "; message << "Switching to " << scale << "x size mode since your screen was determined to be large enough: ";
message << desktopWidth << "x" << desktopHeight << " detected, " << WINDOWW*scale << "x" << WINDOWH*scale << " required"; message << desktopWidth << "x" << desktopHeight << " detected, " << WINDOWW * scale << "x" << WINDOWH * scale << " required";
message << "\nTo undo this, hit Cancel. You can change this in settings at any time."; message << "\nTo undo this, hit Cancel. You can change this in settings at any time.";
new ConfirmPrompt("Large screen detected", message.Build(), { nullptr, []() { new ConfirmPrompt("Large screen detected", message.Build(), { nullptr, []() {
GlobalPrefs::Ref().Set("Scale", 1); GlobalPrefs::Ref().Set("Scale", 1);
ui::Engine::Ref().SetScale(1); ui::Engine::Ref().windowFrameOps.scale = 1;
} }); } });
} }
@ -285,7 +286,14 @@ int Main(int argc, char *argv[])
explicitSingletons->globalPrefs = std::make_unique<GlobalPrefs>(); explicitSingletons->globalPrefs = std::make_unique<GlobalPrefs>();
auto &prefs = GlobalPrefs::Ref(); auto &prefs = GlobalPrefs::Ref();
scale = prefs.Get("Scale", 1);
WindowFrameOps windowFrameOps{
prefs.Get("Scale", 1),
prefs.Get("Resizable", false),
prefs.Get("Fullscreen", false),
prefs.Get("AltFullscreen", false),
prefs.Get("ForceIntegerScaling", true),
};
auto graveExitsConsole = prefs.Get("GraveExitsConsole", true); auto graveExitsConsole = prefs.Get("GraveExitsConsole", true);
momentumScroll = prefs.Get("MomentumScroll", true); momentumScroll = prefs.Get("MomentumScroll", true);
showAvatars = prefs.Get("ShowAvatars", true); showAvatars = prefs.Get("ShowAvatars", true);
@ -307,8 +315,8 @@ int Main(int argc, char *argv[])
auto kioskArg = arguments["kiosk"]; auto kioskArg = arguments["kiosk"];
if (kioskArg.has_value()) if (kioskArg.has_value())
{ {
currentFrameOps.fullscreen = true_string(kioskArg.value()); windowFrameOps.fullscreen = true_string(kioskArg.value());
prefs.Set("Fullscreen", currentFrameOps.fullscreen); prefs.Set("Fullscreen", windowFrameOps.fullscreen);
} }
if (true_arg(arguments["redirect"])) if (true_arg(arguments["redirect"]))
@ -326,8 +334,8 @@ int Main(int argc, char *argv[])
{ {
try try
{ {
scale = scaleArg.value().ToNumber<int>(); windowFrameOps.scale = scaleArg.value().ToNumber<int>();
prefs.Set("Scale", scale); prefs.Set("Scale", windowFrameOps.scale);
} }
catch (const std::runtime_error &e) catch (const std::runtime_error &e)
{ {
@ -366,40 +374,29 @@ int Main(int argc, char *argv[])
explicitSingletons->engine = std::make_unique<ui::Engine>(); explicitSingletons->engine = std::make_unique<ui::Engine>();
// TODO: maybe bind the maximum allowed scale to screen size somehow // TODO: maybe bind the maximum allowed scale to screen size somehow
if(scale < 1 || scale > SCALE_MAXIMUM) if(windowFrameOps.scale < 1 || windowFrameOps.scale > SCALE_MAXIMUM)
scale = 1; windowFrameOps.scale = 1;
SDLOpen();
StopTextInput();
auto &engine = ui::Engine::Ref(); auto &engine = ui::Engine::Ref();
engine.g = new Graphics(); engine.g = new Graphics();
engine.Scale = scale;
engine.GraveExitsConsole = graveExitsConsole; engine.GraveExitsConsole = graveExitsConsole;
engine.SetWindowFrameOps(currentFrameOps);
engine.MomentumScroll = momentumScroll; engine.MomentumScroll = momentumScroll;
engine.ShowAvatars = showAvatars; engine.ShowAvatars = showAvatars;
engine.Begin(); engine.Begin();
engine.SetFastQuit(prefs.Get("FastQuit", true)); engine.SetFastQuit(prefs.Get("FastQuit", true));
engine.TouchUI = prefs.Get("TouchUI", DEFAULT_TOUCH_UI); engine.TouchUI = prefs.Get("TouchUI", DEFAULT_TOUCH_UI);
if (Client::Ref().IsFirstRun() && FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone) if (Client::Ref().IsFirstRun() && FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone)
{ {
scale = GuessBestScale(); windowFrameOps.scale = GuessBestScale();
if (scale > 1) if (windowFrameOps.scale)
{ {
prefs.Set("Scale", scale); prefs.Set("Scale", windowFrameOps.scale);
showLargeScreenDialog = true; showLargeScreenDialog = true;
} }
} }
engine.windowFrameOps = windowFrameOps;
SDLSetScreen(scale, { SDLOpen();
prefs.Get("Resizable", false),
prefs.Get("Fullscreen", false),
prefs.Get("AltFullscreen", false),
prefs.Get("ForceIntegerScaling", true),
}, vsyncHint);
bool enableBluescreen = USE_BLUESCREEN && !true_arg(arguments["disable-bluescreen"]); bool enableBluescreen = USE_BLUESCREEN && !true_arg(arguments["disable-bluescreen"]);
if (enableBluescreen) if (enableBluescreen)

View File

@ -41,31 +41,30 @@ int main(int argc, char * argv[])
}); });
explicitSingletons = std::make_unique<ExplicitSingletons>(); explicitSingletons = std::make_unique<ExplicitSingletons>();
scale = 1; WindowFrameOps windowFrameOps;
if (argc >= 3) if (argc >= 3)
{ {
std::istringstream ss(argv[2]); std::istringstream ss(argv[2]);
int buf; int buf;
if (ss >> buf) if (ss >> buf)
{ {
scale = buf; windowFrameOps.scale = buf;
} }
} }
// TODO: maybe bind the maximum allowed scale to screen size somehow // TODO: maybe bind the maximum allowed scale to screen size somehow
if(scale < 1 || scale > 10) if (windowFrameOps.scale < 1 || windowFrameOps.scale > 10)
scale = 1; {
windowFrameOps.scale = 1;
}
explicitSingletons->engine = std::make_unique<ui::Engine>(); explicitSingletons->engine = std::make_unique<ui::Engine>();
SDLOpen();
StopTextInput();
auto &engine = ui::Engine::Ref(); auto &engine = ui::Engine::Ref();
engine.g = new Graphics(); engine.g = new Graphics();
engine.Scale = scale; engine.windowFrameOps = windowFrameOps;
engine.SetWindowFrameOps({ false, false, false, false });
SDLOpen();
engine.Begin(); engine.Begin();
engine.SetFastQuit(true); engine.SetFastQuit(true);

View File

@ -12,9 +12,8 @@ int desktopHeight = 1024;
SDL_Window *sdl_window = NULL; SDL_Window *sdl_window = NULL;
SDL_Renderer *sdl_renderer = NULL; SDL_Renderer *sdl_renderer = NULL;
SDL_Texture *sdl_texture = NULL; SDL_Texture *sdl_texture = NULL;
int scale = 1;
bool vsyncHint = false; bool vsyncHint = false;
WindowFrameOps currentFrameOps = { false, false, false, false }; WindowFrameOps currentFrameOps;
bool momentumScroll = true; bool momentumScroll = true;
bool showAvatars = true; bool showAvatars = true;
uint64_t lastTick = 0; uint64_t lastTick = 0;
@ -71,7 +70,7 @@ unsigned int GetTicks()
return SDL_GetTicks(); return SDL_GetTicks();
} }
void CalculateMousePosition(int *x, int *y) static void CalculateMousePosition(int *x, int *y)
{ {
int globalMx, globalMy; int globalMx, globalMy;
SDL_GetGlobalMouseState(&globalMx, &globalMy); SDL_GetGlobalMouseState(&globalMx, &globalMy);
@ -79,9 +78,9 @@ void CalculateMousePosition(int *x, int *y)
SDL_GetWindowPosition(sdl_window, &windowX, &windowY); SDL_GetWindowPosition(sdl_window, &windowX, &windowY);
if (x) if (x)
*x = (globalMx - windowX) / scale; *x = (globalMx - windowX) / currentFrameOps.scale;
if (y) if (y)
*y = (globalMy - windowY) / scale; *y = (globalMy - windowY) / currentFrameOps.scale;
} }
void blit(pixel *vid) void blit(pixel *vid)
@ -102,11 +101,7 @@ void SDLOpen()
Platform::Exit(-1); Platform::Exit(-1);
} }
if (!RecreateWindow()) SDLSetScreen();
{
fprintf(stderr, "Creating SDL window: %s\n", SDL_GetError());
Platform::Exit(-1);
}
int displayIndex = SDL_GetWindowDisplayIndex(sdl_window); int displayIndex = SDL_GetWindowDisplayIndex(sdl_window);
if (displayIndex >= 0) if (displayIndex >= 0)
@ -123,6 +118,8 @@ void SDLOpen()
{ {
WindowIcon(sdl_window); WindowIcon(sdl_window);
} }
StopTextInput();
} }
void SDLClose() void SDLClose()
@ -141,8 +138,10 @@ void SDLClose()
SDL_Quit(); SDL_Quit();
} }
void SDLSetScreen(int scale_, WindowFrameOps newFrameOps, bool vsyncHint_) void SDLSetScreen()
{ {
auto newFrameOps = ui::Engine::Ref().windowFrameOps;
auto newVsyncHint = std::holds_alternative<FpsLimitVsync>(ui::Engine::Ref().GetFpsLimit());
if (FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsEmbedded) if (FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsEmbedded)
{ {
newFrameOps.resizable = false; newFrameOps.resizable = false;
@ -157,95 +156,107 @@ void SDLSetScreen(int scale_, WindowFrameOps newFrameOps, bool vsyncHint_)
newFrameOps.changeResolution = false; newFrameOps.changeResolution = false;
newFrameOps.forceIntegerScaling = false; newFrameOps.forceIntegerScaling = false;
} }
// bool changingScale = scale != scale_;
bool changingFullscreen = newFrameOps.fullscreen != currentFrameOps.fullscreen || (newFrameOps.changeResolution != currentFrameOps.changeResolution && currentFrameOps.fullscreen); auto currentFrameOpsNorm = currentFrameOps.Normalize();
bool changingResizable = currentFrameOps.resizable != newFrameOps.resizable; auto newFrameOpsNorm = newFrameOps.Normalize();
bool changingVsync = vsyncHint != vsyncHint_; auto recreate = !sdl_window ||
scale = scale_; // Recreate the window when toggling fullscreen, due to occasional issues
currentFrameOps.fullscreen = newFrameOps.fullscreen; newFrameOpsNorm.fullscreen != currentFrameOpsNorm.fullscreen ||
currentFrameOps.changeResolution = newFrameOps.changeResolution; // Also recreate it when enabling resizable windows, to fix bugs on windows,
currentFrameOps.resizable = newFrameOps.resizable; // see https://github.com/jacob1/The-Powder-Toy/issues/24
currentFrameOps.forceIntegerScaling = newFrameOps.forceIntegerScaling; newFrameOpsNorm.resizable != currentFrameOpsNorm.resizable ||
vsyncHint = vsyncHint_; newFrameOpsNorm.changeResolution != currentFrameOpsNorm.changeResolution ||
// Recreate the window when toggling fullscreen, due to occasional issues newVsyncHint != vsyncHint;
// Also recreate it when enabling resizable windows, to fix bugs on windows,
// see https://github.com/jacob1/The-Powder-Toy/issues/24 if (!(recreate ||
if (changingFullscreen || currentFrameOps.changeResolution || (changingResizable && currentFrameOps.resizable && !currentFrameOps.fullscreen) || changingVsync) newFrameOpsNorm.scale != currentFrameOpsNorm.scale ||
newFrameOpsNorm.forceIntegerScaling != currentFrameOpsNorm.forceIntegerScaling))
{ {
RecreateWindow();
return; return;
} }
if (changingResizable)
SDL_RestoreWindow(sdl_window);
SDL_SetWindowSize(sdl_window, WINDOWW * scale, WINDOWH * scale); auto size = WINDOW * newFrameOpsNorm.scale;
SDL_RenderSetIntegerScale(sdl_renderer, currentFrameOps.forceIntegerScaling && currentFrameOps.fullscreen ? SDL_TRUE : SDL_FALSE);
unsigned int flags = 0;
if (currentFrameOps.fullscreen)
flags = currentFrameOps.changeResolution ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
SDL_SetWindowFullscreen(sdl_window, flags);
if (currentFrameOps.fullscreen)
SDL_RaiseWindow(sdl_window);
SDL_SetWindowResizable(sdl_window, currentFrameOps.resizable ? SDL_TRUE : SDL_FALSE);
}
bool RecreateWindow() if (recreate)
{
unsigned int flags = 0;
unsigned int rendererFlags = 0;
if (currentFrameOps.fullscreen)
flags = currentFrameOps.changeResolution ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
if (currentFrameOps.resizable && !currentFrameOps.fullscreen)
flags |= SDL_WINDOW_RESIZABLE;
if (vsyncHint)
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
if (sdl_texture)
SDL_DestroyTexture(sdl_texture);
if (sdl_renderer)
SDL_DestroyRenderer(sdl_renderer);
if (sdl_window)
{ {
SaveWindowPosition(); if (sdl_texture)
SDL_DestroyWindow(sdl_window);
}
sdl_window = SDL_CreateWindow(APPNAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOWW * scale, WINDOWH * scale,
flags);
if (!sdl_window)
{
return false;
}
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, rendererFlags);
if (!sdl_renderer)
{
fprintf(stderr, "SDL_CreateRenderer failed; available renderers:\n");
int num = SDL_GetNumRenderDrivers();
for (int i = 0; i < num; ++i)
{ {
SDL_RendererInfo info; SDL_DestroyTexture(sdl_texture);
SDL_GetRenderDriverInfo(i, &info); sdl_texture = NULL;
fprintf(stderr, " - %s\n", info.name);
} }
return false; if (sdl_renderer)
{
SDL_DestroyRenderer(sdl_renderer);
sdl_renderer = NULL;
}
if (sdl_window)
{
SaveWindowPosition();
SDL_DestroyWindow(sdl_window);
sdl_window = NULL;
}
unsigned int flags = 0;
unsigned int rendererFlags = 0;
if (newFrameOpsNorm.fullscreen)
{
flags = newFrameOpsNorm.changeResolution ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
}
if (newFrameOpsNorm.resizable)
{
flags |= SDL_WINDOW_RESIZABLE;
}
if (vsyncHint)
{
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
}
sdl_window = SDL_CreateWindow(APPNAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, size.X, size.Y, flags);
if (!sdl_window)
{
fprintf(stderr, "SDL_CreateWindow failed: %s\n", SDL_GetError());
Platform::Exit(-1);
}
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, rendererFlags);
if (!sdl_renderer)
{
fprintf(stderr, "SDL_CreateRenderer failed; available renderers:\n");
int num = SDL_GetNumRenderDrivers();
for (int i = 0; i < num; ++i)
{
SDL_RendererInfo info;
SDL_GetRenderDriverInfo(i, &info);
fprintf(stderr, " - %s\n", info.name);
}
Platform::Exit(-1);
}
SDL_RenderSetLogicalSize(sdl_renderer, WINDOWW, WINDOWH);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, WINDOWW, WINDOWH);
if (!sdl_texture)
{
fprintf(stderr, "SDL_CreateTexture failed: %s\n", SDL_GetError());
Platform::Exit(-1);
}
SDL_RaiseWindow(sdl_window);
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
//Uncomment this to enable resizing
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
LoadWindowPosition();
UpdateFpsLimit();
} }
SDL_RenderSetLogicalSize(sdl_renderer, WINDOWW, WINDOWH);
if (currentFrameOps.forceIntegerScaling && currentFrameOps.fullscreen)
SDL_RenderSetIntegerScale(sdl_renderer, SDL_TRUE);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, WINDOWW, WINDOWH);
SDL_RaiseWindow(sdl_window);
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
//Uncomment this to enable resizing
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
LoadWindowPosition(); SDL_SetWindowSize(sdl_window, size.X, size.Y);
UpdateFpsLimit(); SDL_RenderSetIntegerScale(sdl_renderer, newFrameOpsNorm.forceIntegerScaling ? SDL_TRUE : SDL_FALSE);
if (newFrameOpsNorm.fullscreen)
return true; {
SDL_RaiseWindow(sdl_window);
}
currentFrameOps = newFrameOps;
vsyncHint = newVsyncHint;
} }
void EventProcess(const SDL_Event &event) static void EventProcess(const SDL_Event &event)
{ {
auto &engine = ui::Engine::Ref(); auto &engine = ui::Engine::Ref();
switch (event.type) switch (event.type)
@ -399,13 +410,7 @@ void EngineProcess()
{ {
engine.Draw(); engine.Draw();
drawingTimer = 0; drawingTimer = 0;
SDLSetScreen();
auto wantVsync = bool(std::get_if<FpsLimitVsync>(&fpsLimit));
if (scale != engine.Scale || currentFrameOps != engine.GetWindowFrameOps() || vsyncHint != wantVsync)
{
SDLSetScreen(engine.Scale, engine.GetWindowFrameOps(), wantVsync);
}
blit(engine.g->Data()); blit(engine.g->Data());
} }
auto now = uint64_t(SDL_GetTicks()) * UINT64_C(1'000'000); auto now = uint64_t(SDL_GetTicks()) * UINT64_C(1'000'000);

View File

@ -12,9 +12,6 @@ extern int desktopHeight;
extern SDL_Window *sdl_window; extern SDL_Window *sdl_window;
extern SDL_Renderer *sdl_renderer; extern SDL_Renderer *sdl_renderer;
extern SDL_Texture *sdl_texture; extern SDL_Texture *sdl_texture;
extern int scale;
extern bool vsyncHint;
extern WindowFrameOps currentFrameOps;
extern bool momentumScroll; extern bool momentumScroll;
extern bool showAvatars; extern bool showAvatars;
extern uint64_t lastTick; extern uint64_t lastTick;
@ -36,16 +33,13 @@ void ClipboardPush(ByteString text);
ByteString ClipboardPull(); ByteString ClipboardPull();
int GetModifiers(); int GetModifiers();
unsigned int GetTicks(); unsigned int GetTicks();
void CalculateMousePosition(int *x, int *y);
void blit(pixel *vid); void blit(pixel *vid);
void SDLOpen(); void SDLOpen();
void SDLClose(); void SDLClose();
void SDLSetScreen(int scale_, WindowFrameOps newFrameOps, bool vsyncHint_); void SDLSetScreen();
void SetFpsLimit(FpsLimit newFpsLimit); void SetFpsLimit(FpsLimit newFpsLimit);
bool RecreateWindow();
void LoadWindowPosition(); void LoadWindowPosition();
void SaveWindowPosition(); void SaveWindowPosition();
void LargeScreenDialog(); void LargeScreenDialog();
void TickClient(); void TickClient();
void EventProcess(const SDL_Event &event);
void UpdateFpsLimit(); void UpdateFpsLimit();

View File

@ -1,26 +1,22 @@
#pragma once #pragma once
#include <variant>
struct WindowFrameOps struct WindowFrameOps
{ {
bool resizable; int scale = 1;
bool fullscreen; bool resizable = false;
bool changeResolution; bool fullscreen = false;
bool forceIntegerScaling; bool changeResolution = false;
bool forceIntegerScaling = false;
bool operator ==(const WindowFrameOps &other) const WindowFrameOps Normalize() const
{ {
if (resizable != other.resizable ) return false; return {
if (fullscreen != other.fullscreen) return false; fullscreen ? 1 : scale ,
if (fullscreen) fullscreen ? false : resizable ,
{ fullscreen ,
if (changeResolution != other.changeResolution ) return false; fullscreen ? changeResolution : false,
if (forceIntegerScaling != other.forceIntegerScaling) return false; fullscreen ? forceIntegerScaling : false,
} };
return true;
}
bool operator !=(const WindowFrameOps &other) const
{
return !(*this == other);
} }
}; };

View File

@ -12,8 +12,6 @@ using namespace ui;
Engine::Engine(): Engine::Engine():
drawingFrequencyLimit(0), drawingFrequencyLimit(0),
Scale(1),
Fullscreen(false),
FrameIndex(0), FrameIndex(0),
state_(NULL), state_(NULL),
windowTargetPosition(0, 0), windowTargetPosition(0, 0),
@ -333,5 +331,6 @@ void Engine::StopTextInput()
void Engine::TextInputRect(Point position, Point size) void Engine::TextInputRect(Point position, Point size)
{ {
::SetTextInputRect(position.X * Scale, position.Y * Scale, size.X * Scale, size.Y * Scale); auto scale = windowFrameOps.scale;
::SetTextInputRect(position.X * scale, position.Y * scale, size.X * scale, size.Y * scale);
} }

View File

@ -48,8 +48,6 @@ namespace ui
void SetDrawingFrequencyLimit(int limit) {drawingFrequencyLimit = limit;} void SetDrawingFrequencyLimit(int limit) {drawingFrequencyLimit = limit;}
inline int GetDrawingFrequencyLimit() {return drawingFrequencyLimit;} inline int GetDrawingFrequencyLimit() {return drawingFrequencyLimit;}
void SetScale(int scale) { Scale = scale; }
inline int GetScale() { return Scale; }
void SetFastQuit(bool fastquit) { FastQuit = fastquit; } void SetFastQuit(bool fastquit) { FastQuit = fastquit; }
inline bool GetFastQuit() {return FastQuit; } inline bool GetFastQuit() {return FastQuit; }
@ -79,9 +77,7 @@ namespace ui
int drawingFrequencyLimit; int drawingFrequencyLimit;
Graphics * g; Graphics * g;
int Scale;
bool GraveExitsConsole; bool GraveExitsConsole;
bool Fullscreen;
unsigned int FrameIndex; unsigned int FrameIndex;
private: private:
@ -121,31 +117,21 @@ namespace ui
String textEditingBuf; String textEditingBuf;
WindowFrameOps windowFrameOps = { false, false, false, false };
public: public:
bool MomentumScroll = true; bool MomentumScroll = true;
bool ShowAvatars = true; bool ShowAvatars = true;
bool TouchUI = false; bool TouchUI = false;
WindowFrameOps windowFrameOps;
inline WindowFrameOps GetWindowFrameOps() const void SetScale (int newScale ) { windowFrameOps.scale = newScale; }
{
return windowFrameOps;
}
inline void SetWindowFrameOps(WindowFrameOps newWindowFrameOps)
{
windowFrameOps = newWindowFrameOps;
}
void SetFullscreen (bool newFullscreen ) { windowFrameOps.fullscreen = newFullscreen; } void SetFullscreen (bool newFullscreen ) { windowFrameOps.fullscreen = newFullscreen; }
void SetChangeResolution (bool setChangeResolution ) { windowFrameOps.changeResolution = setChangeResolution; } void SetChangeResolution (bool setChangeResolution ) { windowFrameOps.changeResolution = setChangeResolution; }
void SetForceIntegerScaling(bool newForceIntegerScaling) { windowFrameOps.forceIntegerScaling = newForceIntegerScaling; } void SetForceIntegerScaling(bool newForceIntegerScaling) { windowFrameOps.forceIntegerScaling = newForceIntegerScaling; }
void SetResizable (bool newResizable ) { windowFrameOps.resizable = newResizable; } void SetResizable (bool newResizable ) { windowFrameOps.resizable = newResizable; }
inline bool GetFullscreen () const { return windowFrameOps.fullscreen; } int GetScale () const { return windowFrameOps.scale; }
inline bool GetChangeResolution () const { return windowFrameOps.changeResolution; } bool GetFullscreen () const { return windowFrameOps.fullscreen; }
inline bool GetForceIntegerScaling() const { return windowFrameOps.forceIntegerScaling; } bool GetChangeResolution () const { return windowFrameOps.changeResolution; }
inline bool GetResizable () const { return windowFrameOps.resizable; } bool GetForceIntegerScaling() const { return windowFrameOps.forceIntegerScaling; }
bool GetResizable () const { return windowFrameOps.resizable; }
}; };
} }