scratchass big buttons

This commit is contained in:
Antonio Martinez 2024-09-19 21:51:32 -07:00 committed by AJ Martinez
parent 43960d7a23
commit 9a669ff864
3 changed files with 26 additions and 12 deletions

View file

@ -486,18 +486,22 @@ void Dialogue::Draw(void)
.patch(patchCache["TUTDIAG2"]);
}
auto bt_translate_press = [this]() -> std::optional<bool>
{
std::string ctrl = "<large>";
if (Held())
return true;
if (TextDone())
return {};
return false;
};
ctrl += "<z_pressed>";
else if (TextDone())
ctrl += "<z_animated>";
else
ctrl += "<z>";
// FIXME: Old animation behavior (bt_translate_press above)
std::string parsedctrl = srb2::Draw::TextElement().parse(ctrl).string();
drawer
.xy(17-14 - BASEVIDWIDTH, -39-16)
.button(srb2::Draw::Button::z, bt_translate_press());
.font(Draw::Font::kMenu)
.text(parsedctrl);
}
}

View file

@ -6496,7 +6496,7 @@ void K_drawKartHUD(void)
#if 1
using srb2::Draw;
if (1)
if (0)
{
// Draw::TextElement text = Draw::TextElement().parse("A <a> B <b> C <c> X <x> Y <y> Z <z>\nST <start> L <l> R <r> U <up> D <down> L <left> R <right>");
Draw::TextElement text = Draw::TextElement().parse("Unpressed <large><a> Pressed <x_pressed> Animated <large><start_animated>");

View file

@ -2862,11 +2862,16 @@ void V_DrawStringScaled(
};
cw = V_GetButtonCodeWidth(c) * dupx;
// FIXME do real widths
if (largebutton)
cw += 3*dupx;
cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw);
Draw bt = Draw(
FixedToFloat(cx + cxoff) - (bt_inst->x * dupx),
FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy))
FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy) - (largebutton ? 2*dupy : 0))
.flags(flags);
if (largebutton)
@ -2924,11 +2929,16 @@ void V_DrawStringScaled(
};
cw = V_GetGenericButtonCodeWidth(c) * dupx;
// FIXME do real widths
if (largebutton)
cw += 3*dupx;
cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw);
Draw bt = Draw(
FixedToFloat(cx + cxoff) - (bt_inst->x * dupx),
FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy))
FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy) - (largebutton ? 2*dupy : 0))
.flags(flags);
if (largebutton)