diff --git a/source/resource.cpp b/source/resource.cpp index ff5f933..8af057c 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -79,6 +79,7 @@ auto Resource::get() -> Resource* { return Resource::instance; } Resource::Resource(LoadingMode mode) : loading_mode_(mode), loading_text_(nullptr) { + Screen::get()->show(); if (loading_mode_ == LoadingMode::PRELOAD) { loading_text_ = Screen::get()->getText(); load(); @@ -789,6 +790,7 @@ void Resource::renderProgress() { screen->clean(); auto color = param.resource.color; + const auto TEXT_HEIGHT = loading_text_->getCharacterSize(); // Dibuja el interior de la barra de progreso SDL_SetRenderDrawColor(renderer, param.resource.color.r, param.resource.color.g, param.resource.color.b, param.resource.color.a); @@ -807,19 +809,20 @@ void Resource::renderProgress() { param.resource.color); */ - // Muestra nombre de la aplicación y versión + // Muestra nombre de la aplicación loading_text_->writeDX( Text::CENTER | Text::COLOR, param.game.game_area.center_x, - Y_PADDING, + param.game.game_area.center_y - TEXT_HEIGHT, spaceBetweenLetters(std::string(Version::APP_NAME)), 1, param.resource.color); + // Muestra la versión loading_text_->writeDX( Text::CENTER | Text::COLOR, param.game.game_area.center_x, - Y_PADDING + 18, + param.game.game_area.center_y + TEXT_HEIGHT, "(" + std::string(Version::GIT_HASH) + ")", 1, param.resource.color); diff --git a/source/screen.cpp b/source/screen.cpp index 86d32bb..05127b2 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -55,10 +55,14 @@ Screen::Screen() setDebugInfoEnabled(true); #endif - // Renderizar una vez la textura vacía para que tenga contenido válido - // antes de inicializar los shaders (evita pantalla negra) + // Renderizar una vez la textura vacía para que tenga contenido válido antes de inicializar los shaders (evita pantalla negra) SDL_RenderTexture(renderer_, game_canvas_, nullptr, nullptr); + // Limpiar renderer + SDL_SetRenderDrawColor(renderer_, 0, 0, 0, 255); + SDL_RenderClear(renderer_); + SDL_RenderPresent(renderer_); + // Ahora sí inicializar los shaders initShaders(); } @@ -376,6 +380,7 @@ auto Screen::initSDLVideo() -> bool { if (Options::video.fullscreen) { window_flags |= SDL_WINDOW_FULLSCREEN; } + window_flags |= SDL_WINDOW_HIDDEN; window_ = SDL_CreateWindow( Options::window.caption.c_str(), param.game.width * Options::window.zoom, @@ -403,7 +408,6 @@ auto Screen::initSDLVideo() -> bool { } // Configurar renderer - SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF); SDL_SetRenderLogicalPresentation(renderer_, param.game.width, param.game.height, Options::video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX); SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND); SDL_SetRenderVSync(renderer_, Options::video.vsync ? 1 : SDL_RENDERER_VSYNC_DISABLED);