28 float currentY = startY;
74 const float btnWidth = 100.0f;
75 const float btnHeight = 40.0f;
76 const float btnSpacing = 10.0f;
79 auto createBtn = [&](
const char *label,
float xOffset,
unsigned int color,
unsigned int hover,
84 btn->SetSize(btnWidth, btnHeight);
86 btn->ApplyAlignment();
89 btn->GetPosition(bx, by);
91 btn->SetPosition(bx + xOffset, currentY);
94 btn->SetBackgroundColor(color);
95 btn->SetHoverColor(hover);
96 btn->SetTextColor(0xFFFFFFFF);
99 _menu->AddButton(btn);
103 createBtn(
"LOGIN", -(btnWidth + btnSpacing), 0xFF006400, 0xFF008000, [
this]() {
OnLoginClicked(); });
106 createBtn(
"REGISTER", 0, 0xFF00008B, 0xFF0000FF, [
this]() {
OnRegisterClicked(); });
109 createBtn(
"GUEST", (btnWidth + btnSpacing), 0xFF646464, 0xFF808080, [
this]() {
OnGuestClicked(); });
113 backBtn->SetSize(btnWidth, btnHeight);
115 backBtn->ApplyAlignment();
118 backBtn->GetPosition(bx, by);
119 backBtn->SetPosition(bx, currentY + btnHeight +
SPACING);
121 backBtn->SetText(
"BACK");
122 backBtn->SetBackgroundColor(0xFF424242);
123 backBtn->SetHoverColor(0xFF616161);
124 backBtn->SetTextColor(0xFFFFFFFF);
129 _menu->AddButton(backBtn);
virtual void DrawText(int fontHandle, const char *text, int x, int y, int fontSize, unsigned int color)=0
Draw text using a loaded font.
int EstimateTextWidth(const std::string &text, int fontSize)
Estimate the width of text in pixels.