Repository navigation
Minimap
Kelvin Hsu edited this page Oct 8, 2026
·
4 revisions
The minimap is a UIComponenet that can be given to the player, to then be rendered by the RenderService
void attachMinimap() {
var minimap = new Minimap(currentConfig, clearedRoomIds);
player.addComponent(minimap);
}For the minimap to work you are required to provide a RoomConfig, and a reference to the cleared dungeonIds. Both should be provided by the RoomManager
The minimap also gives the player a listener to the event RoomChanged which is triggered by the RoomManager (or whoever owns the lifetime of the player)
Note
The minimap is not given to the room entities, since it lifetime should stay with the player since rooms are destroyed after it is switched out.
classDiagram
PlayerEntity "1" *-- "0..1" Minimap
Minimap "1" *-- "3" Table
Table *-- "0..*" Actor
RoomManager *-- PlayerEntity : attaches minimap to player
RoomManager --> Minimap : "constructs minimap for player"
Minimap --> EventManager
PlayerEntity *-- EventManager
RoomManager --> EventManager : coordinates room change events
class Minimap {
- String startingRoomId
- RoomConfig currentRoom
- Set~String~ clearedRooms
- ShapeRenderer
- Table left
- Table right
- Table center
+ void onRoomChanged(RoomConfig room)
- void rebuild()
- Table buildRoom()
}
class Table {
- List~Actor~ Children
+ void clearChildren()
}
UIComponent <|-- Minimap
class UIComponent {
# Stage stage
+ void draw()
}
Actor <|-- ShapeActor
Actor <|-- Image
class Actor {
<<abstract>>
}
class ShapeActor {
- ShapeRenderer shape
}
sequenceDiagram
actor Player
Player->>RenderService: Starts Game
Player->>RoomManager: Interacts with room
RoomManager->>EventManager: trigger("RoomChanged", destinationRoom)
EventManager->>Minimap: onRoomChange(destinationRoom)
Minimap->>Table: clearChildren()
Table->>RenderService: draw()
RenderService->>Player: updates screen