JA VA! Nomes s'havia de fer les coses be i no ser un ansias

This commit is contained in:
2025-02-22 00:30:32 +01:00
parent f6098a479b
commit e361d295c1
39 changed files with 1053 additions and 1098 deletions

View File

@@ -6,21 +6,21 @@
#include "resource.h" // Para Resource
#include "text.h" // Para Text
#include "texture.h" // Para Texture
#include "options.h"
class Asset;
// Constructor
ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset, options_t *options, board_t *board)
ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset, board_t *board)
{
// Obten punteros a objetos
this->renderer = renderer;
this->resource = resource;
this->asset = asset;
this->options = options;
this->board = board;
// Reserva memoria para los objetos
itemTexture = resource->getTexture("items.png");
const std::string playerANI = options->cheat.altSkin ? "player2.ani" : "player.ani";
const std::string playerANI = options.cheat.altSkin ? "player2.ani" : "player.ani";
sprite = new AnimatedSprite(renderer, resource->getAnimation(playerANI));
sprite->setCurrentAnimation("walk_menu");
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
@@ -31,13 +31,13 @@ ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset,
paused = false;
timePaused = 0;
totalTimePaused = 0;
itemsColor = stringToColor(options->palette, "white");
itemsColor = stringToColor(options.palette, "white");
// Inicializa el vector de colores
const std::vector<std::string> vColors = {"blue", "magenta", "green", "cyan", "yellow", "white", "bright_blue", "bright_magenta", "bright_green", "bright_cyan", "bright_yellow", "bright_white"};
for (auto v : vColors)
{
color.push_back(stringToColor(options->palette, v));
color.push_back(stringToColor(options.palette, v));
}
}
@@ -88,11 +88,11 @@ void ScoreBoard::render()
this->text->writeColored(BLOCK, line1, "Items collected ", board->color);
this->text->writeColored(17 * BLOCK, line1, itemsTxt, itemsColor);
this->text->writeColored(20 * BLOCK, line1, " Time ", board->color);
this->text->writeColored(26 * BLOCK, line1, timeTxt, stringToColor(options->palette, "white"));
this->text->writeColored(26 * BLOCK, line1, timeTxt, stringToColor(options.palette, "white"));
const std::string roomsTxt = std::to_string(board->rooms / 100) + std::to_string((board->rooms % 100) / 10) + std::to_string(board->rooms % 10);
this->text->writeColored(22 * BLOCK, line2, "Rooms", stringToColor(options->palette, "white"));
this->text->writeColored(28 * BLOCK, line2, roomsTxt, stringToColor(options->palette, "white"));
this->text->writeColored(22 * BLOCK, line2, "Rooms", stringToColor(options.palette, "white"));
this->text->writeColored(28 * BLOCK, line2, roomsTxt, stringToColor(options.palette, "white"));
}
// Actualiza las variables del objeto
@@ -141,7 +141,7 @@ void ScoreBoard::reLoadPalette()
color.clear();
for (auto v : vColors)
{
color.push_back(stringToColor(options->palette, v));
color.push_back(stringToColor(options.palette, v));
}
}
@@ -169,11 +169,11 @@ void ScoreBoard::updateItemsColor()
if (counter % 20 < 10)
{
itemsColor = stringToColor(options->palette, "white");
itemsColor = stringToColor(options.palette, "white");
}
else
{
itemsColor = stringToColor(options->palette, "magenta");
itemsColor = stringToColor(options.palette, "magenta");
}
}