llevat soport per a colors amb nom
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#include "game/options.hpp" // Para Options, options, SectionState, Options...
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "utils/defines.hpp" // Para GAME_SPEED
|
||||
#include "utils/utils.hpp" // Para stringToColor, PaletteColor
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
// Constructor
|
||||
LoadingScreen::LoadingScreen()
|
||||
@@ -28,7 +28,7 @@ LoadingScreen::LoadingScreen()
|
||||
screen_surface_(std::make_shared<Surface>(Options::game.width, Options::game.height)),
|
||||
delta_timer_(std::make_unique<DeltaTimer>()) {
|
||||
// Configura la superficie donde se van a pintar los sprites
|
||||
screen_surface_->clear(static_cast<Uint8>(PaletteColor::WHITE));
|
||||
screen_surface_->clear(14);
|
||||
|
||||
// Inicializa variables
|
||||
SceneManager::current = SceneManager::Scene::LOADING_SCREEN;
|
||||
@@ -39,7 +39,7 @@ LoadingScreen::LoadingScreen()
|
||||
initLineIndexArray();
|
||||
|
||||
// Cambia el color del borde
|
||||
Screen::get()->setBorderColor(stringToColor("white"));
|
||||
Screen::get()->setBorderColor(14);
|
||||
transitionToState(State::SILENT1);
|
||||
}
|
||||
|
||||
@@ -279,10 +279,10 @@ void LoadingScreen::renderDataBorder() {
|
||||
auto border = Screen::get()->getBorderSurface();
|
||||
|
||||
// Pinta el borde de color azul
|
||||
border->clear(static_cast<Uint8>(PaletteColor::BLUE));
|
||||
border->clear(2);
|
||||
|
||||
// Añade lineas amarillas
|
||||
const auto COLOR = static_cast<Uint8>(PaletteColor::YELLOW);
|
||||
const auto COLOR = 12;
|
||||
const int WIDTH = Options::game.width + (Options::video.border.width * 2);
|
||||
const int HEIGHT = Options::game.height + (Options::video.border.height * 2);
|
||||
bool draw_enabled = rand() % 2 == 0;
|
||||
@@ -306,10 +306,10 @@ void LoadingScreen::renderHeaderBorder() const {
|
||||
auto border = Screen::get()->getBorderSurface();
|
||||
|
||||
// Pinta el borde de color azul o rojo
|
||||
border->clear(carrier_.toggle ? static_cast<Uint8>(PaletteColor::CYAN) : static_cast<Uint8>(PaletteColor::RED));
|
||||
border->clear(carrier_.toggle ? 10 : 4);
|
||||
|
||||
// Añade lineas rojas o azules
|
||||
const auto COLOR = carrier_.toggle ? static_cast<Uint8>(PaletteColor::RED) : static_cast<Uint8>(PaletteColor::CYAN);
|
||||
const auto COLOR = carrier_.toggle ? 4 : 10;
|
||||
const int WIDTH = Options::game.width + (Options::video.border.width * 2);
|
||||
const int HEIGHT = Options::game.height + (Options::video.border.height * 2);
|
||||
|
||||
@@ -335,12 +335,12 @@ void LoadingScreen::renderHeaderBorder() const {
|
||||
}
|
||||
|
||||
// Dibuja el borde de color
|
||||
void LoadingScreen::renderColoredBorder(PaletteColor color) {
|
||||
void LoadingScreen::renderColoredBorder(Uint8 color) {
|
||||
// Obtiene la Surface del borde
|
||||
auto border = Screen::get()->getBorderSurface();
|
||||
|
||||
// Pinta el borde de color azul
|
||||
border->clear(static_cast<Uint8>(color));
|
||||
// Pinta el borde del color indicado
|
||||
border->clear(color);
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
@@ -391,7 +391,7 @@ void LoadingScreen::render() {
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(stringToColor("white"));
|
||||
Screen::get()->clearSurface(14);
|
||||
|
||||
// Copia la surface a la surface de Screen
|
||||
screen_surface_->render(0, 0);
|
||||
@@ -430,16 +430,16 @@ void LoadingScreen::renderBorder() {
|
||||
renderHeaderBorder();
|
||||
break;
|
||||
case Border::WHITE:
|
||||
renderColoredBorder(PaletteColor::WHITE);
|
||||
renderColoredBorder(14);
|
||||
break;
|
||||
case Border::BLACK:
|
||||
renderColoredBorder(PaletteColor::BLACK);
|
||||
renderColoredBorder(0);
|
||||
break;
|
||||
case Border::RED:
|
||||
renderColoredBorder(PaletteColor::RED);
|
||||
renderColoredBorder(4);
|
||||
break;
|
||||
case Border::CYAN:
|
||||
renderColoredBorder(PaletteColor::CYAN);
|
||||
renderColoredBorder(10);
|
||||
break;
|
||||
case Border::NONE:
|
||||
// No renderizar borde
|
||||
|
||||
Reference in New Issue
Block a user