How emoon/minifb works
Main Components and Architecture
The system should be represented as a layered architecture with the following main components:
a) API Layer (Top Level):
• Public headers (MiniFB.h, MiniFB_cpp.h, MiniFB_enums.h)
• C and C++ interfaces
b) Platform-Specific Implementations (Middle Layer):
Divide into separate modules for each supported platform:
• Windows (WinMiniFB)
• MacOS X (MacMiniFB)
• X11 (X11MiniFB)
• Wayland (WaylandMiniFB)
• iOS (iOSMiniFB)
• Android (AndroidMiniFB)
• Web/WASM (WebMiniFB)
c) Common Core (Bottom Layer):
• Common functionality (MiniFB_common.c)
• Internal implementations (MiniFB_internal.c)
• Timer functionality (MiniFB_timer.c)
• OpenGL backend (MiniFB_GL.c)
Component Relationships
a) Data Flow:
• How pixel buffer data flows from user application through the API
• How platform-specific implementations handle the buffer
• Event handling flow (keyboard, mouse, window events)
b) Dependencies:
• Platform-specific modules to their respective window systems
• OpenGL backend integration where applicable
• Timer system connections
Specific Elements
a) Core Features:
• Window management
• Buffer rendering
• Event handling
• Timer system
• Viewport management
b) Platform-Specific Features:
• Metal API support for MacOS
• OpenGL backend for Windows/X11
• Native UI components for mobile
Additional Details
Annotations for:
• Supported pixel formats (32-bit)
• API version compatibility notes
• Platform-specific limitations
• Build system requirements
Buffer management flow
This design will help developers understand both the high-level architecture and the specific implementation details of MiniFB while maintaining clarity about platform-specific variations.