Skip to content

Persist HUD element layout between sessions #338

@dmccoystephenson

Description

@dmccoystephenson

Summary

Persist HUD element positions between sessions so player layout customizations are preserved across launches.

Background

HudDragManager (src/ui/hudDragManager.py) tracks per-element drag offsets at runtime, but these are never written to disk. On every launch the layout resets to defaults regardless of any repositioning the player did in the previous session.

Requirements

  • In HudDragManager, add save() and load() methods that read/write element offsets to config.yml using the existing Config.saveWindowSize() pattern (key-per-element, e.g. hudOffset_hotbar_x, hudOffset_hotbar_y)
  • Call hudDragManager.save() from Roam.quitApplication() alongside the existing config.saveWindowSize() call
  • Call hudDragManager.load() during world screen initialization, after HUD elements are registered with the drag manager
  • If no saved offsets exist for an element, fall back to its default position (current behaviour)
  • Saved offsets must be clamped through the existing clampPosition() logic on load to handle resolution changes between sessions

Acceptance Criteria

  • HUD element offsets are written to config.yml on game exit
  • Offsets are restored correctly on the next launch
  • Missing or malformed offset entries fall back to defaults without crashing
  • Layout is still clamped to screen bounds on load (handles resolution changes)
  • All existing tests pass; new tests cover save/load round-trip and missing-key fallback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions