How sudo-nick/hatori works
Project Overview
• Hatori is an image editor with an infinite canvas, and its primary purpose is to handle drawing, image editing, and interaction with the canvas.
• It is written in C (with some C++ files as seen in hatori.cpp and hatori2.cpp) and integrates Raylib for managing the graphics and possibly input events.
• The build and deployment process has both native and web targets. This is controlled via a custom “make” script that orchestrates building Raylib (included as an external dependency) and then compiling the application.
Main Components
a. User Interface / Presentation Layer:
– The canvas and image editing interface that the user directly interacts with.
– This will be depicted as a top-level UI module/component.
b. Application Core / Business Logic:
– The logic for starting up, managing the canvas (handling drawing, zoom/pan events, etc.), and interfacing with user commands.
– This core likely resides in files like hatori.cpp, hatori.h, hatori2.cpp, and hatori3.c.
c. Graphics Abstraction / Raylib Integration:
– Raylib (sourced under src/external/raylib) is responsible for rendering and handling low-level graphics operations.
d. Build & Platform Layer:
– The “make” script and associated build configurations (targeting native and web builds) form the build system layer.
– Separate nodes can represent the build orchestration (compilation of external libraries and application code) and the platform-specific integration (e.g., raylib-web for the browser target via WebAssembly or native desktop builds).
Relationships and Data Flow
• If needed, you might also represent configuration files (.clang-format, .gitignore) as supporting components for code quality and source control, but these are less critical for the high-level system design.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly distinguish the application’s core logic from the graphics subsystem (Raylib). This isolation allows easier maintenance, testing, and potential swapping of the rendering engine.
• Layered Architecture: One layer deals with user interface interactions, the next manages business logic (canvas operations), and the lowest lever handles graphics and platform-specific code.
• Modular Inclusion: The external Raylib source is kept as a submodule or embedded dependency. Emphasize how the project encapsulates its use of Raylib without altering its core.