posat orden en defaults i defines

This commit is contained in:
2025-11-21 09:30:33 +01:00
parent 0fb986d7c4
commit 6bf26f7470
18 changed files with 307 additions and 297 deletions

View File

@@ -18,7 +18,7 @@ Scoreboard::Scoreboard(std::shared_ptr<Data> data)
: item_surface_(Resource::Cache::get()->getSurface("items.gif")),
data_(std::move(std::move(data))) {
const float SURFACE_WIDTH = Options::game.width;
constexpr float SURFACE_HEIGHT = 6.0F * TILE_SIZE;
constexpr float SURFACE_HEIGHT = 6.0F * Tile::SIZE;
// Reserva memoria para los objetos
const auto& player_animation_data = Resource::Cache::get()->getAnimationData(Options::cheats.alternate_skin == Options::Cheat::State::ENABLED ? "player2.yaml" : "player.yaml");
@@ -130,8 +130,8 @@ void Scoreboard::fillTexture() {
surface_->clear(stringToColor("black"));
// Anclas
constexpr int LINE1 = TILE_SIZE;
constexpr int LINE2 = 3 * TILE_SIZE;
constexpr int LINE1 = Tile::SIZE;
constexpr int LINE2 = 3 * Tile::SIZE;
// Dibuja las vidas
// Calcular desplazamiento basado en tiempo
@@ -149,21 +149,21 @@ void Scoreboard::fillTexture() {
if (data_->music) {
const Uint8 C = data_->color;
SDL_FRect clip = {0, 8, 8, 8};
item_surface_->renderWithColorReplace(20 * TILE_SIZE, LINE2, 1, C, &clip);
item_surface_->renderWithColorReplace(20 * Tile::SIZE, LINE2, 1, C, &clip);
}
// Escribe los textos
auto text = Resource::Cache::get()->getText("smb2");
const std::string TIME_TEXT = std::to_string((clock_.minutes % 100) / 10) + std::to_string(clock_.minutes % 10) + clock_.separator + std::to_string((clock_.seconds % 60) / 10) + std::to_string(clock_.seconds % 10);
const std::string ITEMS_TEXT = std::to_string(data_->items / 100) + std::to_string((data_->items % 100) / 10) + std::to_string(data_->items % 10);
text->writeColored(TILE_SIZE, LINE1, "Items collected ", data_->color);
text->writeColored(17 * TILE_SIZE, LINE1, ITEMS_TEXT, items_color_);
text->writeColored(20 * TILE_SIZE, LINE1, " Time ", data_->color);
text->writeColored(26 * TILE_SIZE, LINE1, TIME_TEXT, stringToColor("white"));
text->writeColored(Tile::SIZE, LINE1, "Items collected ", data_->color);
text->writeColored(17 * Tile::SIZE, LINE1, ITEMS_TEXT, items_color_);
text->writeColored(20 * Tile::SIZE, LINE1, " Time ", data_->color);
text->writeColored(26 * Tile::SIZE, LINE1, TIME_TEXT, stringToColor("white"));
const std::string ROOMS_TEXT = std::to_string(data_->rooms / 100) + std::to_string((data_->rooms % 100) / 10) + std::to_string(data_->rooms % 10);
text->writeColored(22 * TILE_SIZE, LINE2, "Rooms", stringToColor("white"));
text->writeColored(28 * TILE_SIZE, LINE2, ROOMS_TEXT, stringToColor("white"));
text->writeColored(22 * Tile::SIZE, LINE2, "Rooms", stringToColor("white"));
text->writeColored(28 * Tile::SIZE, LINE2, ROOMS_TEXT, stringToColor("white"));
// Deja el renderizador como estaba
Screen::get()->setRendererSurface(previuos_renderer);