From 1e4af7f29888d50d269037fe4d227e86e7c39349 Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Thu, 14 Aug 2025 14:16:04 +0200 Subject: [PATCH] add sdl_init error message --- src/td/display/Display.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/td/display/Display.cpp b/src/td/display/Display.cpp index d4bed37..19017ef 100644 --- a/src/td/display/Display.cpp +++ b/src/td/display/Display.cpp @@ -13,7 +13,10 @@ namespace td { Display::Display(int a_Width, int a_Height, const std::string& a_Title) : m_LastWidth(0), m_LastHeight(0), m_AspectRatio(1), m_ShouldClose(false) { - SDL_Init(SDL_INIT_VIDEO); + if (!SDL_Init(SDL_INIT_VIDEO)) { + utils::LOGE(utils::Format("Could not initialize SDL! SDL error: %s", SDL_GetError())); + } + m_Window = SDL_CreateWindow(a_Title.c_str(), a_Width, a_Height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); m_LastWidth = a_Width; @@ -109,9 +112,11 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) : // Setup scaling float main_scale = SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay()); // ImGuiStyle& style = ImGui::GetStyle(); - // style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this + // style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing + // this // // requires resetting Style + calling this again) - // style.FontSizeBase = 13 * main_scale; // Set initial font scale. (using io.ConfigDpiScaleFonts=true makes this unnecessary. We leave + // style.FontSizeBase = 13 * main_scale; // Set initial font scale. (using io.ConfigDpiScaleFonts=true makes this unnecessary. We + // leave // // both here for documentation purpose)