68 const float buttonWidth = 200.0f;
69 const float buttonHeight = 45.0f;
70 const float bottomMargin = 120.0f;
73 addServerPtr->SetSize(buttonWidth, buttonHeight);
75 addServerPtr->ApplyAlignment();
78 addServerPtr->GetPosition(x, y);
80 addServerPtr->SetPosition(x, screenHeight - bottomMargin);
82 addServerPtr->SetText(
"Add Server");
83 addServerPtr->SetBackgroundColor(0xFF4CAF50);
84 addServerPtr->SetHoverColor(0xFF66BB6A);
85 addServerPtr->SetTextColor(0xFFFFFFFF);
92 const float exitMargin = 20.0f;
94 exitPtr->SetSize(150.0f, 45.0f);
95 exitPtr->SetPosition(exitMargin, screenHeight - bottomMargin);
96 exitPtr->SetText(
"Exit");
97 exitPtr->SetBackgroundColor(0xFFF44336);
98 exitPtr->SetHoverColor(0xFFE57373);
99 exitPtr->SetTextColor(0xFFFFFFFF);
119 const float deleteButtonWidth = 60.0f;
120 const float buttonSpacing = 10.0f;
132 buttonPtr->ApplyAlignment();
135 buttonPtr->GetPosition(x, y);
137 float adjustedX = x - (deleteButtonWidth + buttonSpacing) / 2.0f;
138 buttonPtr->SetPosition(adjustedX, currentY);
141 std::ostringstream oss;
143 buttonPtr->SetText(oss.str());
145 buttonPtr->SetBackgroundColor(0xFF2196F3);
146 buttonPtr->SetHoverColor(0xFF64B5F6);
147 buttonPtr->SetTextColor(0xFFFFFFFF);
148 buttonPtr->SetTextSize(16);
153 std::shared_ptr<UI::IButton> button = std::move(buttonPtr);
155 _menu->AddButton(button);
160 float deleteX = adjustedX + serverButtonWidth + buttonSpacing;
161 deletePtr->SetPosition(deleteX, currentY);
162 deletePtr->SetText(
"x");
163 deletePtr->SetBackgroundColor(0xFFF44336);
164 deletePtr->SetHoverColor(0xFFE57373);
165 deletePtr->SetTextColor(0xFFFFFFFF);
166 deletePtr->SetTextSize(20);
169 std::shared_ptr<UI::IButton> deleteButton = std::move(deletePtr);
171 _menu->AddButton(deleteButton);
197 const char *title =
"Select a Server";
199 int titleFontSize = 32;
200 int titleWidth =
static_cast<int>(strlen(title) * titleFontSize * 0.5f);
201 int titleX = (screenWidth - titleWidth) / 2;
207 int connectingFontSize = 20;
208 int connectingY = 70;
209 int connectingWidth =
static_cast<int>(connectingMsg.length() * connectingFontSize * 0.5f);
210 int connectingX = (screenWidth - connectingWidth) / 2;
211 _graphics.
DrawText(connectingMsg.c_str(), connectingX, connectingY, connectingFontSize,
216 int errorFontSize = 20;
218 int errorWidth =
static_cast<int>(
_connectionError.length() * errorFontSize * 0.5f);
219 int errorX = (screenWidth - errorWidth) / 2;
virtual void DrawText(int fontHandle, const char *text, int x, int y, int fontSize, unsigned int color)=0
Draw text using a loaded font.