# StellarX GUI Framework [中文文档](README.md) ------ ![GitHub all releases](https://img.shields.io/github/downloads/Ysm-04/StellarX/total) [![Star GitHub Repo](https://img.shields.io/github/stars/Ysm-04/StellarX.svg?style=social&label=Star%20This%20Repo)](https://github.com/Ysm-04/StellarX) ![Version](https://img.shields.io/badge/Version-2.0.0-brightgreen.svg) ![Download](https://img.shields.io/badge/Download-2.0.0_Release-blue.svg) ![C++](https://img.shields.io/badge/C++-17+-00599C?logo=cplusplus&logoColor=white) ![Windows](https://img.shields.io/badge/Platform-Windows-0078D6?logo=windows) ![EasyX](https://img.shields.io/badge/Based_on-EasyX-00A0EA) ![License](https://img.shields.io/badge/License-MIT-blue.svg) ![Architecture](https://img.shields.io/badge/Architecture-Modular%20OOP-brightgreen) ![CMake](https://img.shields.io/badge/Build-CMake-064F8C?logo=cmake) > **"Bound by Stars, Light as Dust"** — A native C++ GUI framework for Windows platform, featuring extreme lightweight and high modularity. `StellarX` was born from resistance against "overly bloated" modern GUI frameworks. It rejects dependencies that often reach hundreds of MB, long compilation times, and steep learning curves, choosing to return to the essence: solving core desktop application development needs with the most concise code, clearest architecture, and highest efficiency. It is a **pure teaching-level, tool-level framework** designed to help developers deeply understand GUI principles and quickly build lightweight Windows tools. --- ## 📦 Project Structure & Design Philosophy StellarX framework adopts classic **Object-Oriented** and **modular** design with a clear and standardized project structure: ```markdown StellarX/ ├── include/ # Header files directory │ └── StellarX/ # Framework header files │ ├── StellarX.h # Main include header - one-click import of entire framework │ ├── CoreTypes.h # ★ Core ★ - Single source of truth for all enums and structs │ ├── Control.h # Abstract base class - defines unified interface for all controls │ ├── Button.h # Button control │ ├── Window.h # Window management │ ├── Label.h # Label control │ ├── TextBox.h # Text box control │ ├── Canvas.h # Canvas container │ ├── Dialog.h # Dialog control (new in v2.0.0) │ ├── MessageBox.h # Message box factory (new in v2.0.0) │ └── Table.h # Table control ├── src/ # Source files directory │ ├── Control.cpp │ ├── Button.cpp │ ├── Window.cpp │ ├── Label.cpp │ ├── TextBox.cpp │ ├── Canvas.cpp │ ├── Table.cpp │ ├── Dialog.cpp # v2.0.0 new │ └── MessageBox.cpp # v2.0.0 new ├── examples/ # Example code directory │ └── demo.cpp # Basic demonstration ├── docs/ # Documentation directory │ └── CODE_OF_CONDUCT.md # Code of Conduct ├── CMakeLists.txt # CMake build configuration ├── CONTRIBUTING.md # Contribution guide ├── CHANGELOG.md # Changelog ├── Doxyfile # Doxygen configuration ├── LICENSE # MIT License └── README.md # Project description ``` ### **Design Philosophy:** 1. **Single Responsibility Principle (SRP)**: Each class/file is responsible for one thing only. 2. **Dependency Inversion Principle (DIP)**: High-level modules (like `Window`) don't depend on low-level modules (like `Button`), both depend on abstractions (`Control`). 3. **Open/Closed Principle (OCP)**: New controls can be easily extended by inheriting the `Control` base class without modifying existing code. 4. **Consistency**: All controls share unified `draw()` and `handleEvent()` interfaces. ## 🚀 Core Features - **Extreme Lightweight**: Core library compiles to only ~12MB, with zero external dependencies. Generated applications are compact. - **Clear Modular Architecture**: Uses `CoreTypes.h` to uniformly manage all types, eliminating duplicate definitions and greatly improving maintainability. - **Native C++ Performance**: Built directly on EasyX and Win32 API, providing near-native execution efficiency with very low memory footprint (typically <10MB). - **Complete Control System**: Button, Label, TextBox, Canvas, Table, Dialog, and MessageBox factory. - **Highly Customizable**: From control colors, shapes (rectangle, rounded, circle, ellipse) to fill modes and font styles, all have detailed enum support for easy customization. - **Simple & Intuitive API**: Uses classic object-oriented design, code as documentation, low learning curve. - **Standard Project Structure**: Adopts standard include/src separation structure, supports CMake build, easy to integrate and use. - **Enhanced Event System**: v2.0.0 introduces event consumption mechanism, all `handleEvent` methods return `bool` indicating whether event was consumed, supporting finer-grained event propagation control. - **Dialog System**: New complete dialog support, including modal and non-modal dialogs, automatically handling background saving and restoration. ## ⚡ Quick Start (5 Minutes to Get Started) > **🎯 Latest Version Download** > Download pre-compiled library files and header files from [GitHub Releases](https://github.com/Ysm-04/StellarX/releases/latest) for quick integration into your project. ### Environment Requirements - **OS**: Windows 10 or higher - **Compiler**: C++17 supported compiler (e.g., **Visual Studio 2019+**) - **Graphics Library**: [EasyX](https://easyx.cn/) (2022 version or higher, please select the version matching your compiler during installation) - **Build Tool**: CMake 3.12+ (optional, recommended) ### Install EasyX 1. Visit [EasyX official website](https://easyx.cn/) to download the latest version 2. Run the installer, select the version matching your Visual Studio version 3. After installation, no additional configuration is needed, StellarX framework will automatically link EasyX ### Method 1: Using CMake Build (Recommended) 1. **Clone the project**: ```bash git clone https://github.com/Ysm-04/StellarX.git cd StellarX ``` 2. **Generate build system**: ```bash mkdir build cd build cmake .. ``` 3. **Compile the project**: ```bash cmake --build . ``` 4. **Run the example**: ```bash ./examples/Demo ``` ### Method 2: Manual Integration into Existing Project 1. **Copy the include and src directories** to your project 2. **Configure include paths** to ensure the compiler can find the `include/StellarX/` directory 3. **Add all .cpp files** to your project for compilation ### Create Your First StellarX Application ```cpp // Just include this one header to use all features #include "StellarX.h" // Program entry point (use WinMain for better compatibility) int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) { // 1. Create a 640x480 window with white background, titled "My App" Window mainWindow(640, 480, 0, RGB(255, 255, 255), "My First StellarX App"); // 2. Create a button (managed with smart pointer) auto myButton = std::make_unique