diff --git a/source/defines.h b/source/defines.h index e6a4533..82c71a7 100644 --- a/source/defines.h +++ b/source/defines.h @@ -45,10 +45,4 @@ constexpr int GAMECANVAS_FIRST_QUARTER_X = GAMECANVAS_WIDTH / 4; constexpr int GAMECANVAS_THIRD_QUARTER_X = (GAMECANVAS_WIDTH / 4) * 3; constexpr int GAMECANVAS_CENTER_Y = GAMECANVAS_HEIGHT / 2; constexpr int GAMECANVAS_FIRST_QUARTER_Y = GAMECANVAS_HEIGHT / 4; -constexpr int GAMECANVAS_THIRD_QUARTER_Y = (GAMECANVAS_HEIGHT / 4) * 3; - -// Colores -// const Color borderColor = {0x27, 0x27, 0x36}; -const Uint8 border_color = 1; -// const Color black = {0xFF, 0xFF, 0xFF}; -const Uint8 black_color = 1; +constexpr int GAMECANVAS_THIRD_QUARTER_Y = (GAMECANVAS_HEIGHT / 4) * 3; \ No newline at end of file diff --git a/source/director.cpp b/source/director.cpp index 9b7e8c9..40a10d1 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -76,7 +76,6 @@ Director::Director(int argc, const char *argv[]) // Crea los objetos Screen::init(window_, renderer_); - Screen::get()->setBorderColor(border_color); Resource::init(); Notifier::init("", "8bithud"); Screen::get()->setNotificationsEnabled(true); diff --git a/source/resource.cpp b/source/resource.cpp index 5b54600..e880cb0 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -49,7 +49,7 @@ void Resource::load() { calculateTotal(); Screen::get()->show(); - Screen::get()->setBorderColor(1); + Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); std::cout << "** LOADING RESOURCES" << std::endl; loadSounds(); loadMusics(); @@ -438,6 +438,8 @@ void Resource::renderProgress() const int full_bar_width = wired_bar_width * count_.getPercentage(); SDL_Rect rect_full = {X_PADDING, bar_position, full_bar_width, X_PADDING}; surface->fillRect(&rect_full, static_cast(PaletteColor::WHITE)); + + Screen::get()->render(); } // Comprueba los eventos de la pantalla de carga diff --git a/source/screen.cpp b/source/screen.cpp index 76fa569..16a5d2a 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -92,10 +92,12 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer) // Crea la surface donde se dibujan los graficos del juego game_surface_ = std::make_shared(options.game.width, options.game.height); game_surface_->setPalette(readPalFile(palettes_.at(current_palette_))); + game_surface_->clear(static_cast(PaletteColor::BLACK)); - // Crea la surface donde se dibujan los graficos del juego + // Crea la surface para el borde de colores border_surface_ = std::make_shared(options.game.width + options.video.border.width * 2, options.game.height + options.video.border.height * 2); border_surface_->setPalette(readPalFile(palettes_.at(current_palette_))); + border_surface_->clear(border_color_); // Establece la surface que actuará como renderer para recibir las llamadas a render() renderer_surface_ = std::make_shared>(game_surface_); @@ -127,10 +129,7 @@ void Screen::clear(Color color) } // Limpia la pantalla -void Screen::clearSurface(Uint8 index) -{ - game_surface_->clear(index); -} +void Screen::clearSurface(Uint8 index) { game_surface_->clear(index); } // Prepara para empezar a dibujar en la textura de juego void Screen::start()