Points Bar App
HUD progress bar for displaying point-based scoring with configurable thresholds.
HUD progress bar for displaying point-based scoring with configurable thresholds.
Overview
ui_apps_pointsBar provides a simple API for gameplay systems to display a points progress bar with multiple star/medal thresholds. Data is streamed to the UI via guihooks.queueStream('pointsBar').
Extension path: lua/ge/extensions/ui/apps/pointsBar.lua
Unload mode: Manual
Exports (M)
| Function | Signature | Description |
|---|---|---|
setPoints | (points, pointsLabel?) | Updates the current point value and optional display label. |
setThresholds | (thresholds) | Sets the threshold array (e.g., {100, 200, 300} for bronze/silver/gold). |
clearData | () | Resets to default thresholds and zero points. |
requestAllData | () | Re-sends current state to the UI (e.g., after app reconnect). |
onInit | () | Hook - sets extension unload mode to manual. |
onUpdate | () | Per-frame update hook. |
Internals
Data Flow
When setPoints() or setThresholds() is called, a guiData table is computed and streamed:
guiData = {
fillPercent = points / maxValue, -- 0-1 bar fill
pointsLabel = "250", -- Display text
thresholdsReached = {true, true, false}, -- Which thresholds are met
thresholdPercentages = {30.3, 60.6, 90.9}, -- Threshold positions as % of bar
thresholdCount = 3 -- Number of thresholds
}
guihooks.queueStream('pointsBar', guiData)The max value is lastThreshold * 1.1 (10% buffer beyond the highest threshold).
Default State
pointsData = {
currentPoints = 0,
pointsLabel = "0",
thresholds = {100, 200, 300}
}Debug Mode
When debug = true, an ImGui window shows current points and thresholds with a clear button.
How It Works
- Gameplay system calls
setThresholds({100, 200, 300})to configure medal levels - During gameplay, calls
setPoints(currentScore)each update - Module computes fill percent, threshold positions, and which thresholds are reached
- Data is streamed to UI which renders a progress bar with threshold markers
clearData()resets everything when the activity ends
Additional Exports
The following exports are available but not yet documented in detail:
M.clearDataM.onInitM.onUpdateM.requestAllDataM.setPointsM.setThresholds