Commit Graph

11 Commits

Author SHA1 Message Date
8706723d53 refactor(ui): simplify Button API with property setters 2026-07-15 11:06:49 +08:00
e911413d84 feat(scene): add credits scene and UI 2026-07-14 16:28:26 +08:00
618d3f1294 feat(ui): add HUD visibility toggle and image fill features 2026-07-14 15:27:55 +08:00
558fd6311d refactor(ui): extract common UI manager logic into base class 2026-07-14 09:15:54 +08:00
80ba6dad89 feat(ui): add Rect widget with fill, color, and parent-relative sizing 2026-07-13 20:48:51 +08:00
acb0b94d7b feat(main_menu): add exit button and refactor layout with ColumnLayout
- Add `should_close_window()` method to force window close from UI.
- Replace standalone button with ColumnLayout for proper centering.
- Add "Exit" button that calls `should_close_window()`.
- Update ESC key handling to only close window when game is not running.
- Fix ColumnLayout to respect parent's anchor instead of hardcoded TOP_LEFT.
- Remove unused parameter name in Image::update for consistency.
2026-07-13 18:15:34 +08:00
f5e53fd13d feat(ui): introduce anchor-based widget positioning system
Replace set_position with anchor and offset for relative positioning. Add parent pointer to widget hierarchy. Remove manual resize logic in UI managers.
2026-07-13 14:52:35 +08:00
e8157ab549 refactor(ui): move scale property to subclasses and fix resize event handling
Remove scale from base Widget class and add per-type set_scale/scale methods to Button, Image, and Label. Dispatch separate WindowResizeEvent alongside existing FrameBufferResizeEvent. Correct centering calculations from `+` to `-` in main menu and world UI managers.
2026-07-13 13:06:09 +08:00
1fa3b9cce8 feat(ui): support scaling of labels and images
Modify width() and height() methods to multiply by m_scale for both Label and Image. Rename internal dimensions to m_real_width and m_real_height for clarity. Adjust Button foreground position to vertically center when label is scaled.
2026-07-13 11:40:27 +08:00
576a2f8072 feat(ui): add button scaling and change square vertices to top-left origin 2026-07-13 11:11:30 +08:00
01c9f61d1c ui: add main menu scene and interactive button widget
- Implement MainMenuScene with a "Start Game" button that pushes the WorldScene.
- Extend Button class with background/foreground, hover detection, and size queries.
- Add virtual width/height and event handlers to Widget base class.
- Update WorldUIManager to propagate mouse move events.
- Adjust Window mouse mode based on game running state.
2026-07-13 10:38:30 +08:00