17 if(takesLetter && letter && *letter)
19 const int px = (int)strlen(letter) > 1 ? 11 : 14;
21 text->setParent(
this);
22 text->setAlignment(ALIGN_H::CENTRE, ALIGN_V::MIDDLE);
41 const float feather = uiScale > 0.0f ? 1.0f / uiScale : 1.0f;
42 if(feather != meshFeather)
46 meshFeather = feather;
49 const float ox = (float)this->
getLeft(), oy = (float)this->
getTop();
50 const std::vector<MeshVertex>& src = mesh.vertices();
51 scratch.resize(src.size());
52 for(
size_t i = 0; i < src.size(); i++)
58 scratch[i].c.a = (uint8_t)((src[i].c.a * a + 127) / 255);
Umbrella header for the platform-agnostic libgui core.
bool isVisible()
Checks whether or not the element is visible.
int getTop()
Gets the current topmost coordinate of the element Considers vertical alignment, y offset,...
int height
Element height.
void updateEffects()
Updates the element's effects (dynamic values) Called by Draw(), used for animation purposes.
int getLeft()
Gets the current leftmost coordinate of the element Considers horizontal alignment,...
int getAlpha()
Gets the element's alpha value Considers alpha, alphaDyn, and the parent element's GetAlpha() value.
GuiGlyph(GLYPH kind, const char *letter="")
void draw() override
Called constantly to redraw the element.
Accumulates shapes as a triangle list of MeshVertex.
Display, manage, and manipulate text in the GUI.
virtual void drawMesh(const MeshVertex *vertices, size_t count)=0
Draws a triangle list: three vertices per triangle, each with its own color.
Platform video backend owning the frame lifecycle (init/render/clear, screen size,...
virtual ImageRenderer * getImageRenderer()=0
virtual float getUIScale() const
Ratio of physical render-target pixels to design-canvas pixels (the width/height passed to init()).
static void size(GLYPH kind, float &w, float &h)
Gets the natural size of a glyph.
GLYPH
Small control icons for lists and hints (the "A" in a circle, a bumper, a D-pad arrow).
static void build(GuiMesh &mesh, GLYPH kind, float w, float h)
Builds a glyph filling a w x h box at the origin, in the theme's light-on-dark colors.
@ BUMPER
A light rounded rectangle (L, R, ZL, ZR)
@ BUTTON
A light circle (face buttons; the letter goes on it)
@ STICK
A circle with an inner ring (stick click; the letter goes on it)
static GuiTheme & current()
The theme the rest of the library reads. Starts as the default dark theme.