MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / DrawButtonLabel

Method DrawButtonLabel

LibLemon/src/gui/widgets.cpp:246–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244 }
245
246 void Button::DrawButtonLabel(surface_t* surface, bool white){
247 rgba_colour_t colour;
248 vector2i_t btnPos = fixedBounds.pos;
249
250 if(white){
251 colour = colours[Colour::TextAlternate];
252 } else {
253 colour = colours[Colour::Text];
254 }
255
256 if(labelAlignment == TextAlignment::Centre){
257 Graphics::DrawString(label.c_str(), btnPos.x + (fixedBounds.size.x / 2) - (labelLength / 2), btnPos.y + (bounds.size.y / 2 - 8), colour.r, colour.g, colour.b, surface);
258 } else {
259 Graphics::DrawString(label.c_str(), btnPos.x + 2, btnPos.y + (fixedBounds.size.y / 2 - 6), colour.r, colour.g, colour.b, surface);
260 }
261 }
262
263 void Button::Paint(surface_t* surface){
264 vector2i_t btnPos = fixedBounds.pos;

Callers

nothing calls this directly

Calls 1

DrawStringFunction · 0.50

Tested by

no test coverage detected