How polarix/simplegui works
Project type and purpose
• SimpleGUI is a lightweight C-based GUI interface library for monochrome display screens, accompanied by:
• A core GUI rendering library (GUI/)
• An interaction engine (HMI/)
• A sample application (DemoProc/)
• A PC-side simulator (Simulator/)
• Hardware-specific BSP code for embedded targets (Transplant/MiniDevCore/)
• External dependencies (iconv under Library/)
• Its purpose is to render basic graphics and GUI components on resource-constrained monochrome displays, and to provide a simulator for development off-target.
File structure
• Top-level build: CMakeLists.txt orchestrates builds for embedded and simulator targets.
• Library/ contains iconv for character encoding.
• GUI/inc, GUI/src: core drawing and widget interfaces.
• HMI/inc, HMI/src: input/event engine that drives GUI widgets.
• DemoProc/inc, DemoProc/src: sample application showcasing GUI usage.
• Simulator/: C++/SDL2 project that links GUI & HMI for PC simulation.
• Transplant/MiniDevCore/BSP: hardware abstraction for timers, display, input on embedded boards.
• Documents/ and Images/ provide user guides and API docs (not part of runtime).
README for additional insights
• Core design goals: minimal resource usage, no layers/buffers, direct drawing APIs.
• Simulator originally used wxWidgets, now uses SDL2 via VirtualSDK abstraction.
• Emphasis on portability and low-overhead.
Main components and interactions
a. Components
1. Core GUI Library
2. HMI Interaction Engine
3. Sample App (DemoProc)
4. PC Simulator (SDL2)
5. Hardware Abstraction Layer (BSP)
6. External Iconv Library
7. Build System (CMake)
b. Relationships
• DemoProc and Simulator both link against the core GUI library and HMI engine.
• On PC, GUI/HMI use SDL2 via the Simulator_if layer to emulate display and input.
• Iconv provides text encoding support to the GUI text module.
• CMake drives configuration, selects build targets (embedded vs simulator), and locates external libraries.
c. Architectural patterns
– Layered architecture:
• Presentation layer (GUI library)
• Interaction layer (HMI engine)
• Platform abstraction layer (BSP or Simulator interface)
• Application layer (DemoProc)
– Separation of concerns: core drawing vs input vs platform code vs applications.
d. Technologies
• Language: C (GUI, HMI, BSP), C++ (Simulator)
• Build: CMake, optional Code::Blocks project for Simulator
• External libs: iconv, SDL2
• Documentation in Markdown/PDF
Detailed capture of essential elements
• Build branching in CMake: options for TARGET=EMBEDDED vs TARGET=SIMULATOR.