Retocat un poc el disseny de Title

Retocades les notificacions
This commit is contained in:
2025-03-06 23:12:53 +01:00
parent ff309168ef
commit 9eaf3bc134
4 changed files with 17 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -183,12 +183,14 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
} }
// Inicializa variables // Inicializa variables
const auto PADDING_IN_H = text_->getCharacterSize(); //const int text_size = text_->getCharacterSize();
const auto PADDING_IN_V = text_->getCharacterSize() / 2; const int text_size = 6;
const auto PADDING_IN_H = text_size;
const auto PADDING_IN_V = text_size / 2;
const int ICON_SPACE = icon >= 0 ? ICON_SIZE_ + PADDING_IN_H : 0; const int ICON_SPACE = icon >= 0 ? ICON_SIZE_ + PADDING_IN_H : 0;
text_is = ICON_SPACE > 0 ? NotificationText::LEFT : text_is; text_is = ICON_SPACE > 0 ? NotificationText::LEFT : text_is;
const int WIDTH = options.game.width - (PADDING_OUT_ * 2); const int WIDTH = options.game.width - (PADDING_OUT_ * 2);
const int HEIGHT = (text_->getCharacterSize() * texts.size()) + (PADDING_IN_V * 2); const int HEIGHT = (text_size * texts.size()) + (PADDING_IN_V * 2);
const auto SHAPE = NotificationShape::SQUARED; const auto SHAPE = NotificationShape::SQUARED;
// Posición horizontal // Posición horizontal
@@ -260,6 +262,8 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
else if (SHAPE == NotificationShape::SQUARED) else if (SHAPE == NotificationShape::SQUARED)
{ {
n.surface->clear(bg_color_); n.surface->clear(bg_color_);
SDL_Rect rect = {0, 0, n.surface->getWidth(), n.surface->getHeight()};
n.surface->drawRectBorder(&rect, static_cast<Uint8>(PaletteColor::RED));
} }
// Dibuja el icono de la notificación // Dibuja el icono de la notificación
@@ -272,17 +276,17 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
} }
// Escribe el texto de la notificación // Escribe el texto de la notificación
const Uint8 COLOR = stringToColor("white"); const Uint8 COLOR = static_cast<Uint8>(PaletteColor::WHITE);
int iterator = 0; int iterator = 0;
for (const auto &text : texts) for (const auto &text : texts)
{ {
switch (text_is) switch (text_is)
{ {
case NotificationText::LEFT: case NotificationText::LEFT:
text_->writeColored(PADDING_IN_H + ICON_SPACE, PADDING_IN_V + iterator * (text_->getCharacterSize() + 1), text, COLOR); text_->writeColored(PADDING_IN_H + ICON_SPACE, PADDING_IN_V + iterator * (text_size + 1), text, COLOR);
break; break;
case NotificationText::CENTER: case NotificationText::CENTER:
text_->writeDX(TEXT_CENTER | TEXT_COLOR, WIDTH / 2, PADDING_IN_V + iterator * (text_->getCharacterSize() + 1), text, 1, COLOR); text_->writeDX(TEXT_CENTER | TEXT_COLOR, WIDTH / 2, PADDING_IN_V + iterator * (text_size + 1), text, 1, COLOR);
break; break;
default: default:
break; break;

View File

@@ -140,7 +140,7 @@ void Title::checkInput()
// Actualiza la marquesina // Actualiza la marquesina
void Title::updateMarquee() void Title::updateMarquee()
{ {
const auto TEXT = Resource::get()->getText("smb2"); const auto TEXT = Resource::get()->getText("gauntlet");
for (int i = 0; i < (int)letters_.size(); ++i) for (int i = 0; i < (int)letters_.size(); ++i)
{ {
@@ -172,12 +172,12 @@ void Title::updateMarquee()
// Dibuja la marquesina // Dibuja la marquesina
void Title::renderMarquee() void Title::renderMarquee()
{ {
const auto TEXT = Resource::get()->getText("smb2"); const auto TEXT = Resource::get()->getText("gauntlet");
for (const auto &l : letters_) for (const auto &l : letters_)
{ {
if (l.enabled) if (l.enabled)
{ {
TEXT->writeColored(l.x, 184, l.letter, stringToColor("white")); TEXT->writeColored(l.x, 184, l.letter, static_cast<Uint8>(PaletteColor::BRIGHT_RED));
} }
} }
} }
@@ -327,8 +327,7 @@ 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, 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, 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, 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); //text->writeDX(TEXT_CENTER | TEXT_COLOR, PLAY_AREA_CENTER_X, 20 * TEXT_SIZE, "ESC.EXIT GAME", 1, COLOR);
text->writeColored(PLAY_AREA_CENTER_X, 30 * TEXT_SIZE, "ESC.EXIT GAME", COLOR);
// Devuelve el puntero del renderizador a su sitio // Devuelve el puntero del renderizador a su sitio
Screen::get()->setRendererSurface(previuos_renderer); Screen::get()->setRendererSurface(previuos_renderer);
@@ -341,7 +340,7 @@ void Title::createCheevosTexture()
const auto CHEEVOS_LIST = Cheevos::get()->list(); const auto CHEEVOS_LIST = Cheevos::get()->list();
const auto TEXT = Resource::get()->getText("subatomic"); const auto TEXT = Resource::get()->getText("subatomic");
constexpr int CHEEVOS_TEXTURE_WIDTH = 200; constexpr int CHEEVOS_TEXTURE_WIDTH = 200;
constexpr int CHEEVOS_TEXTURE_VIEW_HEIGHT = 110; constexpr int CHEEVOS_TEXTURE_VIEW_HEIGHT = 110 - 8;
constexpr int CHEEVOS_TEXTURE_POS_Y = 73; constexpr int CHEEVOS_TEXTURE_POS_Y = 73;
constexpr int CHEEVOS_PADDING = 10; constexpr int CHEEVOS_PADDING = 10;
const int CHEEVO_HEIGHT = CHEEVOS_PADDING + (TEXT->getCharacterSize() * 2) + 1; const int CHEEVO_HEIGHT = CHEEVOS_PADDING + (TEXT->getCharacterSize() * 2) + 1;

View File

@@ -39,7 +39,7 @@ private:
std::string long_text_; // Texto que aparece en la parte inferior del titulo std::string long_text_; // Texto que aparece en la parte inferior del titulo
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
std::vector<TitleLetter> letters_; // Vector con las letras de la marquesina std::vector<TitleLetter> letters_; // Vector con las letras de la marquesina
int marquee_speed_ = 3; // Velocidad de desplazamiento de la marquesina int marquee_speed_ = 2; // Velocidad de desplazamiento de la marquesina
bool show_cheevos_ = false; // Indica si se muestra por pantalla el listado de logros bool show_cheevos_ = false; // Indica si se muestra por pantalla el listado de logros
SDL_Rect cheevos_surface_view_; // Zona visible de la surface con el listado de logros SDL_Rect cheevos_surface_view_; // Zona visible de la surface con el listado de logros
TitleState state_; // Estado en el que se encuentra el bucle principal TitleState state_; // Estado en el que se encuentra el bucle principal