Back to TPG

TPG.UI.Pill

C🏷️ Palette

Part of TPG namespace

TPG.UI.Pill(text, font, x, y, h, accent, color, padX)
View on GitHub|gamemode/config/sh_palette.lua:297-306
📋 Has LDoc👁️ 0 viewsUpdated 1 month ago

Description

Draw a panel sized to its own label text, returning the width it used. Fixed-width pills don't survive contact with real strings: 132px fits "Control Points" and clips "King of the Hill", and the economy tag was wider than its box on the first render. Measuring means the box is right for whatever mode name or font the client actually ends up with. defaults to TPG.UI.S(14). comes next.

Parameters

NameTypeDescription
textstring
fontstringA font name already created by `TPG.UI.BuildFonts`.
xnumber
ynumber
hnumber
accent?ColorPassed through to `TPG.UI.Panel`.
color?ColorText colour; defaults to `C.Text`.
padX?numberHorizontal padding on each side of the text;

Returns

TypeDescription
numberThe pill's total width, so the caller can lay out what

Examples

No examples available.

Used In

No usages found in the codebase.