|
@@ -24,11 +24,12 @@
|
|
|
|
|
|
SDL_Window* graphics::window = nullptr;
|
|
|
SDL_Renderer* graphics::renderer = nullptr;
|
|
|
+int graphics::windowFlags = 0;
|
|
|
int graphics::windowWidth = 0;
|
|
|
int graphics::windowHeight = 0;
|
|
|
TTF_Font *graphics::font = nullptr;
|
|
|
|
|
|
-bool graphics::openWindow()
|
|
|
+bool graphics::openWindow(bool fullScreen)
|
|
|
{
|
|
|
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
|
|
|
{
|
|
@@ -45,11 +46,23 @@ bool graphics::openWindow()
|
|
|
SDL_DisplayMode display_mode;
|
|
|
SDL_GetCurrentDisplayMode(0, &display_mode);
|
|
|
|
|
|
- graphics::windowWidth = display_mode.w;
|
|
|
- graphics::windowHeight = display_mode.h;
|
|
|
+ if (fullScreen)
|
|
|
+ {
|
|
|
+ graphics::windowWidth = display_mode.w;
|
|
|
+ graphics::windowHeight = display_mode.h;
|
|
|
+ graphics::windowFlags = SDL_WINDOW_BORDERLESS;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ graphics::windowWidth = 1024;
|
|
|
+ graphics::windowHeight = 758;
|
|
|
+ graphics::windowFlags = 0;
|
|
|
+ }
|
|
|
|
|
|
graphics::window = SDL_CreateWindow(nullptr, 0, 0,
|
|
|
- windowWidth, windowHeight, SDL_WINDOW_BORDERLESS);
|
|
|
+ graphics::windowWidth, graphics::windowHeight,
|
|
|
+ graphics::windowFlags);
|
|
|
+
|
|
|
if (!graphics::window)
|
|
|
{
|
|
|
logger::critical("Error creating SDL window: %s", SDL_GetError());
|
|
@@ -70,7 +83,10 @@ bool graphics::openWindow()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- SDL_SetWindowFullscreen(graphics::window, SDL_WINDOW_FULLSCREEN);
|
|
|
+ if (fullScreen)
|
|
|
+ {
|
|
|
+ SDL_SetWindowFullscreen(graphics::window, SDL_WINDOW_FULLSCREEN);
|
|
|
+ }
|
|
|
|
|
|
ImGui::CreateContext();
|
|
|
ImGuiSDL::Initialize(graphics::renderer, graphics::windowWidth, graphics::windowHeight);
|