UiTheme als Font- und Farb-Kontext #14

Closed
opened 2026-04-16 20:01:02 +00:00 by sebastian · 0 comments
Owner

Problem: Jeder Konstruktor in der UI-Hierarchie erfordert Font& als Parameter. Das erzeugt eine Injection-Chain durch alle Layer: UILayer → UiInventoryContainer → UiRessourceWidget → UiText
Lösung:

struct UiTheme {
    Font* small   = nullptr;
    Font* medium  = nullptr;
    Font* large   = nullptr;

    static UiTheme& get();
    static void set(UiTheme theme);
private:
    static UiTheme instance;
};

UILayer registriert die Fonts einmalig, alle Komponenten holen sie sich selbst.
Acceptance Criteria:

  • Kein Font&-Parameter mehr in Composite-Komponenten-Konstruktoren
  • UiTheme::get().small von jedem UI-Node aus erreichbar
**Problem**: Jeder Konstruktor in der UI-Hierarchie erfordert Font& als Parameter. Das erzeugt eine Injection-Chain durch alle Layer: UILayer → UiInventoryContainer → UiRessourceWidget → UiText **Lösung**: ``` struct UiTheme { Font* small = nullptr; Font* medium = nullptr; Font* large = nullptr; static UiTheme& get(); static void set(UiTheme theme); private: static UiTheme instance; }; ``` UILayer registriert die Fonts einmalig, alle Komponenten holen sie sich selbst. Acceptance Criteria: - Kein Font&-Parameter mehr in Composite-Komponenten-Konstruktoren - UiTheme::get().small von jedem UI-Node aus erreichbar
sebastian added this to the Kompositionsmodell milestone 2026-04-16 20:01:02 +00:00
sebastian added the
refactoring
engine
ui
labels 2026-04-16 20:01:02 +00:00
sebastian added this to the Dicewars project 2026-04-16 21:02:03 +00:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sebastian/Dicewars-Siedler#14
No description provided.