forked from jaildesigner-jailgames/jaildoctors_dilemma
Arreglats alguns colorets que havia per ahi rebolicats
fix: Credits no estava ben portat a surfaces
This commit is contained in:
@@ -43,7 +43,7 @@ Title::Title()
|
||||
createCheevosTexture();
|
||||
|
||||
// Cambia el color del borde
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BRIGHT_BLACK));
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
// Rellena la textura de fondo con todos los gráficos
|
||||
fillSurface();
|
||||
@@ -164,7 +164,8 @@ void Title::updateMarquee()
|
||||
|
||||
// Comprueba si ha terminado la marquesina y la reinicia
|
||||
if (letters_[letters_.size() - 1].x < -10)
|
||||
{ // Inicializa la marquesina
|
||||
{
|
||||
// Inicializa la marquesina
|
||||
initMarquee();
|
||||
}
|
||||
}
|
||||
@@ -246,10 +247,11 @@ void Title::render()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(stringToColor("black"));
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
if (state_ == TitleState::SHOW_MENU)
|
||||
switch (state_)
|
||||
{
|
||||
case TitleState::SHOW_MENU:
|
||||
// Dibuja la textura de fondo
|
||||
bg_surface_->render(0, 0);
|
||||
|
||||
@@ -261,9 +263,10 @@ void Title::render()
|
||||
{
|
||||
cheevos_sprite_->render();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
||||
case TitleState::SHOW_LOADING_SCREEN:
|
||||
case TitleState::FADE_LOADING_SCREEN:
|
||||
// Dibuja la pantalla de carga
|
||||
pCls(4);
|
||||
pBlit(0, 0, 0, 0, 256, 128);
|
||||
@@ -271,6 +274,10 @@ void Title::render()
|
||||
|
||||
// Dibuja el logo del título
|
||||
title_logo_sprite_->render();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
@@ -291,18 +298,13 @@ void Title::run()
|
||||
// Desplaza la lista de logros
|
||||
void Title::moveCheevosList(int direction)
|
||||
{
|
||||
const int speed = 2;
|
||||
cheevos_surface_view_.y = direction == 0 ? cheevos_surface_view_.y - speed : cheevos_surface_view_.y + speed;
|
||||
// Modifica la posición de la ventana de vista
|
||||
constexpr int SPEED = 2;
|
||||
cheevos_surface_view_.y = direction == 0 ? cheevos_surface_view_.y - SPEED : cheevos_surface_view_.y + SPEED;
|
||||
|
||||
const int bottom = cheevos_surface_->getHeight() - cheevos_surface_view_.h;
|
||||
if (cheevos_surface_view_.y < 0)
|
||||
{
|
||||
cheevos_surface_view_.y = 0;
|
||||
}
|
||||
else if (cheevos_surface_view_.y > bottom)
|
||||
{
|
||||
cheevos_surface_view_.y = bottom;
|
||||
}
|
||||
// Ajusta los limites
|
||||
const int BOTTOM = cheevos_surface_->getHeight() - cheevos_surface_view_.h;
|
||||
cheevos_surface_view_.y = std::clamp(cheevos_surface_view_.y, 0, BOTTOM);
|
||||
|
||||
cheevos_sprite_->setClip(cheevos_surface_view_);
|
||||
}
|
||||
@@ -315,7 +317,7 @@ void Title::fillSurface()
|
||||
Screen::get()->setRendererSurface(bg_surface_);
|
||||
|
||||
// Rellena la textura de color
|
||||
bg_surface_->clear(1);
|
||||
bg_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
// Pinta el gráfico del titulo a partir del sprite
|
||||
title_logo_sprite_->render();
|
||||
@@ -327,7 +329,6 @@ void Title::fillSurface()
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR, PLAY_AREA_CENTER_X, 11 * TEXT_SIZE, "1.PLAY", 1, COLOR);
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR, PLAY_AREA_CENTER_X, 13 * TEXT_SIZE, "2.ACHIEVEMENTS", 1, COLOR);
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR, PLAY_AREA_CENTER_X, 15 * TEXT_SIZE, "3.REDEFINE KEYS", 1, COLOR);
|
||||
//text->writeDX(TEXT_CENTER | TEXT_COLOR, PLAY_AREA_CENTER_X, 20 * TEXT_SIZE, "ESC.EXIT GAME", 1, COLOR);
|
||||
|
||||
// Devuelve el puntero del renderizador a su sitio
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
@@ -352,7 +353,7 @@ void Title::createCheevosTexture()
|
||||
Screen::get()->setRendererSurface(cheevos_surface_);
|
||||
|
||||
// Rellena la textura con color sólido
|
||||
const Uint8 CHEEVOS_BG_COLOR = stringToColor("black");
|
||||
const Uint8 CHEEVOS_BG_COLOR = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
cheevos_surface_->clear(CHEEVOS_BG_COLOR);
|
||||
|
||||
// Escribe la lista de logros en la textura
|
||||
@@ -363,20 +364,18 @@ void Title::createCheevosTexture()
|
||||
pos += TEXT->getCharacterSize();
|
||||
const Uint8 CHEEVO_LOCKED_COLOR = stringToColor("white");
|
||||
const Uint8 CHEEVO_UNLOCKED_COLOR = stringToColor("bright_green");
|
||||
Uint8 cheevoColor;
|
||||
constexpr int LINE_X1 = (CHEEVOS_TEXTURE_WIDTH / 7) * 3;
|
||||
constexpr int LINE_X2 = LINE_X1 + ((CHEEVOS_TEXTURE_WIDTH / 7) * 1);
|
||||
|
||||
for (const auto &cheevo : CHEEVOS_LIST)
|
||||
{
|
||||
cheevoColor = cheevo.completed ? CHEEVO_UNLOCKED_COLOR : CHEEVO_LOCKED_COLOR;
|
||||
const Uint8 CHEEVO_COLOR = cheevo.completed ? CHEEVO_UNLOCKED_COLOR : CHEEVO_LOCKED_COLOR;
|
||||
pos += CHEEVOS_PADDING;
|
||||
constexpr int HALF = CHEEVOS_PADDING / 2;
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
surface->drawLine(LINE_X1, pos - HALF - 1, LINE_X2, pos - HALF - 1, cheevoColor);
|
||||
TEXT->writeDX(TEXT_CENTER | TEXT_COLOR, CHEEVOS_TEXTURE_WIDTH / 2, pos, cheevo.caption, 1, cheevoColor);
|
||||
cheevos_surface_->drawLine(LINE_X1, pos - HALF - 1, LINE_X2, pos - HALF - 1, CHEEVO_COLOR);
|
||||
TEXT->writeDX(TEXT_CENTER | TEXT_COLOR, CHEEVOS_TEXTURE_WIDTH / 2, pos, cheevo.caption, 1, CHEEVO_COLOR);
|
||||
pos += TEXT->getCharacterSize() + 1;
|
||||
TEXT->writeDX(TEXT_CENTER | TEXT_COLOR, CHEEVOS_TEXTURE_WIDTH / 2, pos, cheevo.description, 1, cheevoColor);
|
||||
TEXT->writeDX(TEXT_CENTER | TEXT_COLOR, CHEEVOS_TEXTURE_WIDTH / 2, pos, cheevo.description, 1, CHEEVO_COLOR);
|
||||
pos += TEXT->getCharacterSize();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user