style: toquejant mes la pantalla de carrega
This commit is contained in:
@@ -79,6 +79,7 @@ auto Resource::get() -> Resource* { return Resource::instance; }
|
|||||||
Resource::Resource(LoadingMode mode)
|
Resource::Resource(LoadingMode mode)
|
||||||
: loading_mode_(mode),
|
: loading_mode_(mode),
|
||||||
loading_text_(nullptr) {
|
loading_text_(nullptr) {
|
||||||
|
Screen::get()->show();
|
||||||
if (loading_mode_ == LoadingMode::PRELOAD) {
|
if (loading_mode_ == LoadingMode::PRELOAD) {
|
||||||
loading_text_ = Screen::get()->getText();
|
loading_text_ = Screen::get()->getText();
|
||||||
load();
|
load();
|
||||||
@@ -789,6 +790,7 @@ void Resource::renderProgress() {
|
|||||||
screen->clean();
|
screen->clean();
|
||||||
|
|
||||||
auto color = param.resource.color;
|
auto color = param.resource.color;
|
||||||
|
const auto TEXT_HEIGHT = loading_text_->getCharacterSize();
|
||||||
|
|
||||||
// Dibuja el interior de la barra de progreso
|
// 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);
|
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);
|
param.resource.color);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Muestra nombre de la aplicación y versión
|
// Muestra nombre de la aplicación
|
||||||
loading_text_->writeDX(
|
loading_text_->writeDX(
|
||||||
Text::CENTER | Text::COLOR,
|
Text::CENTER | Text::COLOR,
|
||||||
param.game.game_area.center_x,
|
param.game.game_area.center_x,
|
||||||
Y_PADDING,
|
param.game.game_area.center_y - TEXT_HEIGHT,
|
||||||
spaceBetweenLetters(std::string(Version::APP_NAME)),
|
spaceBetweenLetters(std::string(Version::APP_NAME)),
|
||||||
1,
|
1,
|
||||||
param.resource.color);
|
param.resource.color);
|
||||||
|
|
||||||
|
// Muestra la versión
|
||||||
loading_text_->writeDX(
|
loading_text_->writeDX(
|
||||||
Text::CENTER | Text::COLOR,
|
Text::CENTER | Text::COLOR,
|
||||||
param.game.game_area.center_x,
|
param.game.game_area.center_x,
|
||||||
Y_PADDING + 18,
|
param.game.game_area.center_y + TEXT_HEIGHT,
|
||||||
"(" + std::string(Version::GIT_HASH) + ")",
|
"(" + std::string(Version::GIT_HASH) + ")",
|
||||||
1,
|
1,
|
||||||
param.resource.color);
|
param.resource.color);
|
||||||
|
|||||||
@@ -55,10 +55,14 @@ Screen::Screen()
|
|||||||
setDebugInfoEnabled(true);
|
setDebugInfoEnabled(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Renderizar una vez la textura vacía para que tenga contenido válido
|
// Renderizar una vez la textura vacía para que tenga contenido válido antes de inicializar los shaders (evita pantalla negra)
|
||||||
// antes de inicializar los shaders (evita pantalla negra)
|
|
||||||
SDL_RenderTexture(renderer_, game_canvas_, nullptr, nullptr);
|
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
|
// Ahora sí inicializar los shaders
|
||||||
initShaders();
|
initShaders();
|
||||||
}
|
}
|
||||||
@@ -376,6 +380,7 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
if (Options::video.fullscreen) {
|
if (Options::video.fullscreen) {
|
||||||
window_flags |= SDL_WINDOW_FULLSCREEN;
|
window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
|
window_flags |= SDL_WINDOW_HIDDEN;
|
||||||
window_ = SDL_CreateWindow(
|
window_ = SDL_CreateWindow(
|
||||||
Options::window.caption.c_str(),
|
Options::window.caption.c_str(),
|
||||||
param.game.width * Options::window.zoom,
|
param.game.width * Options::window.zoom,
|
||||||
@@ -403,7 +408,6 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configurar renderer
|
// 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_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_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderVSync(renderer_, Options::video.vsync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
SDL_SetRenderVSync(renderer_, Options::video.vsync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
||||||
|
|||||||
Reference in New Issue
Block a user