How diamondg23/thelegendofzelda works
Project Type and Purpose
• This is a standalone, desktop Java application that combines:
• A 2D tile-based game engine (“main” module)
• An integrated tile/map editor (“editor” module)
• It uses Java 9+ modules (module-info.java), Swing/AWT UI components (MyFrame, MyButton, MyLabel), and a custom MVC-inspired structure for input, rendering, and resource management.
High-Level Components
a. Presentation Layer (Views & UI)
– EditorUI, EditorPanel (src/editor)
– GamePanel, MyFrame, MyButton, MyLabel (src/main)
b. Input Controllers
– KeyboardController, MouseController (src/controllers)
c. Domain/Business Logic
– TileManager, TileRenderer (src/tile)
– EditorTileManager, EditorTileRenderer (src/editor)
d. Model Entities
– Tile, Sprite, SpriteSheet (src/tile)
e. Resource & File System
– res/maps/*.txt (map definitions)
– res/spritesheet (image assets)
– I/O routines embedded in TileManager/EditorTileManager
f. Platform & Infrastructure
– Java Module System (module-info.java)
– Build output (bin/) and Eclipse project settings
Relationships & Data Flows
1. User interacts with the UI (EditorUI or GamePanel) →
2. UI hands events to Controllers (KeyboardController, MouseController) →
3. Controllers invoke Domain logic (TileManager or EditorTileManager) →
4. Domain logic loads or manipulates Model Entities (Tile, Sprite, SpriteSheet) via Resource layer →
6. Save/load operations read/write map files under res/maps.
Architectural Patterns & Principles
• MVC (or Model-View-Controller) separation:
• Model = Tile, Sprite, SpriteSheet, map data
• View = Swing panels & frames
• Controller = KeyboardController, MouseController
• Single responsibility: editor classes vs. runtime classes separated into distinct packages.
• Modularization via Java modules (module-info.java).
Key Details to Capture
• Separate the Editor and Game runtimes but show shared core (tile & resource management).
• Java Module boundary.
• Both user input flow and resource I/O flow.