Repository navigation
Player HUD
The Player HUD handles all components and features visually displayed on the game screen relating to the player. It gives the player constant feedback on their health, equipment, resources and level context without interrupting gameplay.
This page is the overview. Each substantial component has its own page with the same layout: purpose, class diagram, lifecycle, public methods, tuning constants, tests and a link back here.
-
Screen-space overlay. Every HUD element is a
UIComponentthat adds actors to the UIStage, drawn independently of the world camera, so it stays fixed while the level scrolls. -
Event-driven updates. Components do not poll game state. They listen for events fired on the player entity (
updateHealth,inventoryChanged,inventorySelectionChanged,goldChanged,itemDictionaryChanged,itemPurchased, ...) and update when one arrives. The arrow wheel is the exception: it polls its state indraw()because it only exists whileTabis held. - One visual style. Hotbar slots, the backpack, the item dictionary and the arrow wheel share the dark teal box with a brown selected border (see the Graphics UI Style Guide).
-
Data and UI are separate. Each display reads a data component (
CombatStatsComponent,InventoryComponent,ItemDictionaryComponent,ShopComponent,ArrowWheelComponent) and holds no game state of its own.
| Component | Summary | Page |
|---|---|---|
| Health | Row of hearts, top-left, that flicker out as health is lost and grow with max health | Player HUD: Health |
| Hotbar | Bottom-edge row of inventory slots with a highlighted selection | Player HUD: Hotbar |
| Arrow Wheel | Pie menu opened by holding Tab to choose the arrow type |
Player HUD: Arrow Wheel |
| Item Dictionary | Full-screen overlay (I) of every item, discovered on pickup |
Player HUD: Item Dictionary |
| Shop | Pausing overlay (F at a shopkeeper) for buying arrows and potions |
Player HUD: Shop |
| Gold, Game Icon | Short enough to stay on this page | below |

The player's gold is shown in the HUD directly below the hearts, as a number followed by a gold coin icon (images/items/gold_coin.png, drawn 40x40px). It is built by PlayerStatsDisplay in the same root Table as the health row.
- Gold is stored on
InventoryComponent(getGold(),hasGold(int),addGold(int)).addGoldclamps the result to[0, Integer.MAX_VALUE], so gold can never go negative. - The player starts with the
goldvalue fromconfigs/player.json(currently 50), passed tonew InventoryComponent(stats.gold)inPlayerFactory. -
PlayerStatsDisplaylistens for thegoldChangedevent on the player and rewrites the label text, so the counter updates the moment gold is picked up or spent. The label is only created if the player has anInventoryComponent. - Gold is earned by pressing
Fnear a gold pickup (PlayerInteractionComponent.pickupGold), which adds the pickup's amount and firesgoldPickedUp. It is spent in the shop.

The game window is titled Odysseus and uses a custom icon, set in DesktopLauncher:
-
Lwjgl3ApplicationConfiguration.setWindowIconis given three sizes (desktop_icon_256.png,_64.png,_32.pnginassets/images/ui/) so the OS can pick the best fit for the title bar, taskbar and alt-tab. - GLFW ignores window icons on macOS, so
MacDockIcon.set("images/ui/desktop_icon_256.png")sets the Dock icon through Cocoa once the game has started (called fromcreate()aftersuper.create()).
![]()
- Player HUD Test Plan (manual checks for every component)
- Component pages: Health, Hotbar, Arrow Wheel, Item Dictionary, Shop
- Player Health and Damage
- Player Inventory
- Arrow Selection Wheel (state and input behind the wheel)
- Item Dictionary (data behind the dictionary)
- HUD implementation PR #62
Entities and Components
Input Handling
Arrow Selection Wheel Arrow Selection Wheel — Sprint 3