add sdl_init error message

This commit is contained in:
2025-08-14 14:16:04 +02:00
parent e720439109
commit 1e4af7f298

View File

@@ -13,7 +13,10 @@ namespace td {
Display::Display(int a_Width, int a_Height, const std::string& a_Title) : 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) { 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_Window = SDL_CreateWindow(a_Title.c_str(), a_Width, a_Height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
m_LastWidth = a_Width; m_LastWidth = a_Width;
@@ -109,9 +112,11 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
// Setup scaling // Setup scaling
float main_scale = SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay()); float main_scale = SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay());
// ImGuiStyle& style = ImGui::GetStyle(); // 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) // // 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) // // both here for documentation purpose)