manuals tidy tier 3a: rondes, ternaris, anyofallof, padding, etc.

This commit is contained in:
2026-05-14 19:24:02 +02:00
parent 0b82be193f
commit a48fe51f73
13 changed files with 54 additions and 32 deletions
+15 -3
View File
@@ -223,7 +223,7 @@ namespace Menu {
// Converteix volum 0..1 a percentatge i ho formata com "50%"
static auto volPct(float v) -> std::string {
int pct = static_cast<int>((v * 100.0F) + 0.5F);
int pct = static_cast<int>(std::lround(v * 100.0F));
pct = std::max(pct, 0);
pct = std::min(pct, 100);
char buf[8];
@@ -605,12 +605,24 @@ namespace Menu {
font_->drawClipped(pixel_data, box_x + BOX_W - ITEM_PAD_X - aw + x_offset, y, arrow, ac, clip_x_min, clip_x_max, clip_y_min, clip_y_max);
} else if (item.kind == ItemKind::KeyBind) {
bool this_capturing = (capturing_ == item.scancode);
const char* text = this_capturing ? Locale::get("menu.values.press_key") : ((item.scancode != nullptr) ? SDL_GetScancodeName(*item.scancode) : "");
const char* text = nullptr;
if (this_capturing) {
text = Locale::get("menu.values.press_key");
} else if (item.scancode != nullptr) {
text = SDL_GetScancodeName(*item.scancode);
} else {
text = "";
}
if ((text == nullptr) || (*text == 0)) {
text = Locale::get("menu.values.unknown");
}
int tw = font_->width(text);
Uint32 tc = this_capturing ? 0xFF00FFFF : (selected ? CURSOR_COLOR : VALUE_COLOR);
Uint32 tc = 0;
if (this_capturing) {
tc = 0xFF00FFFF;
} else {
tc = selected ? CURSOR_COLOR : VALUE_COLOR;
}
font_->drawClipped(pixel_data, box_x + BOX_W - ITEM_PAD_X - tw + x_offset, y, text, tc, clip_x_min, clip_x_max, clip_y_min, clip_y_max);
} else if (item.getValue) {
std::string value = item.getValue();