linters
This commit is contained in:
@@ -16,13 +16,9 @@
|
||||
|
||||
// Constructor
|
||||
Scoreboard::Scoreboard(std::shared_ptr<Data> data)
|
||||
: data_(std::move(data)) {
|
||||
const float SURFACE_WIDTH = Options::game.width;
|
||||
constexpr float SURFACE_HEIGHT = 24.0F; // 3 líneas de 8px
|
||||
|
||||
surface_ = std::make_shared<Surface>(SURFACE_WIDTH, SURFACE_HEIGHT);
|
||||
surface_dest_ = {.x = 0, .y = Options::game.height - SURFACE_HEIGHT, .w = SURFACE_WIDTH, .h = SURFACE_HEIGHT};
|
||||
}
|
||||
: data_(std::move(data)),
|
||||
surface_(std::make_shared<Surface>(Options::game.width, SURFACE_HEIGHT)),
|
||||
surface_dest_{.x = 0, .y = Options::game.height - SURFACE_HEIGHT, .w = Options::game.width, .h = SURFACE_HEIGHT} {}
|
||||
|
||||
// Pinta el objeto en pantalla
|
||||
void Scoreboard::render() {
|
||||
@@ -91,19 +87,19 @@ void Scoreboard::fillTexture() {
|
||||
const std::string TIME_LABEL = Locale::get()->get("scoreboard.time");
|
||||
|
||||
// Ancho total: labels proporcionales + valores monoespaciados
|
||||
const int LINE1_W = text->length(LIVES_LABEL) + text->lengthMono(LIVES_STR, MONO_W) + text->length(SEP) + text->length(ITEMS_LABEL) + text->lengthMono(ITEMS_STR, MONO_W) + text->length(SEP) + text->length(TIME_LABEL) + text->lengthMono(TIME_STR, MONO_W);
|
||||
const int LINE1_W = text->length(LIVES_LABEL) + Text::lengthMono(LIVES_STR, MONO_W) + text->length(SEP) + text->length(ITEMS_LABEL) + Text::lengthMono(ITEMS_STR, MONO_W) + text->length(SEP) + text->length(TIME_LABEL) + Text::lengthMono(TIME_STR, MONO_W);
|
||||
|
||||
int x = (CANVAS_W - LINE1_W) / 2;
|
||||
text->writeColored(x, LINE1_Y, LIVES_LABEL, LABEL_COLOR);
|
||||
x += text->length(LIVES_LABEL);
|
||||
text->writeColoredMono(x, LINE1_Y, LIVES_STR, VALUE_COLOR, MONO_W);
|
||||
x += text->lengthMono(LIVES_STR, MONO_W);
|
||||
x += Text::lengthMono(LIVES_STR, MONO_W);
|
||||
text->writeColored(x, LINE1_Y, SEP, LABEL_COLOR);
|
||||
x += text->length(SEP);
|
||||
text->writeColored(x, LINE1_Y, ITEMS_LABEL, LABEL_COLOR);
|
||||
x += text->length(ITEMS_LABEL);
|
||||
text->writeColoredMono(x, LINE1_Y, ITEMS_STR, VALUE_COLOR, MONO_W);
|
||||
x += text->lengthMono(ITEMS_STR, MONO_W);
|
||||
x += Text::lengthMono(ITEMS_STR, MONO_W);
|
||||
text->writeColored(x, LINE1_Y, SEP, LABEL_COLOR);
|
||||
x += text->length(SEP);
|
||||
text->writeColored(x, LINE1_Y, TIME_LABEL, LABEL_COLOR);
|
||||
|
||||
Reference in New Issue
Block a user