https://github.com/brisklib/brisk
Cross-platform C++20 GUI framework featuring MVVM architecture, reactive capabilities, and scalable, accelerated GPU rendering.
https://github.com/brisklib/brisk
cpp20 cross-platform-gui gui hardware-acceleration modern-cpp mvvm mvvm-cpp reactive widgets
Last synced: 2 months ago
JSON representation
Cross-platform C++20 GUI framework featuring MVVM architecture, reactive capabilities, and scalable, accelerated GPU rendering.
- Host: GitHub
- URL: https://github.com/brisklib/brisk
- Owner: brisklib
- License: gpl-2.0
- Created: 2024-10-14T20:46:51.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-04-11T20:32:13.000Z (2 months ago)
- Last Synced: 2025-04-11T21:35:32.579Z (2 months ago)
- Topics: cpp20, cross-platform-gui, gui, hardware-acceleration, modern-cpp, mvvm, mvvm-cpp, reactive, widgets
- Language: C++
- Homepage: https://brisklib.com
- Size: 31 MB
- Stars: 224
- Watchers: 5
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-cpp20 - Brisk - platform C++20 GUI framework featuring MVVM architecture, reactive capabilities, and scalable, accelerated GPU rendering. [brisklib.com](https://brisklib.com/) (GUI)
- awesome-cpp20 - Brisk - platform C++20 GUI framework featuring MVVM architecture, reactive capabilities, and scalable, accelerated GPU rendering. [brisklib.com](https://brisklib.com/) (GUI)
README
# Brisk
**Brisk** is a modern, cross-platform C++ GUI framework designed to build responsive, high-performance applications with flexibility and ease.
Initially developed for a graphics-intensive proprietary project with a complex and dynamic GUI.
> [!Note]
> The Brisk library is currently under active development. Breaking changes may occur, and the documentation might not always be up to date. Contributions are always welcome!Recommended reading:
➡️ [Brisk Design and Feature Overview](docs/docs/about.md) ⬅️
[Documentation on docs.brisklib.com](https://docs.brisklib.com)





### Key Features 🌟
- **Declarative GUI**: Enables the creation of complex GUIs in C++ using a flexible declarative syntax.
- **Stateful & Stateless Widgets**: Supports both modes, with powerful binding for efficient state management.
- **Stylesheets**: Offers declarative styles to easily modify the application's look and feel.
- **Hardware-Accelerated Graphics**: Backends include D3D11, D3D12, Vulkan, OpenGL, Metal, and WebGPU.
- **Color Processing**: Supports various color spaces and linear color blending for physically accurate rendering.
- **Font support**: OpenType support, advanced shaping for non-European languages, ligatures, rich text formatting, SVG fonts, emojis, and rendering for RTL and bidirectional text.
- **Modular Architecture**: Core, Graphics, Window, GUI, Network, and Widgets modules for versatile application development.### Code Example
#### Component example
```c++
const NameValueOrderedList textAlignList{ { "Start", TextAlign::Start },
{ "Center", TextAlign::Center },
{ "End", TextAlign::End } };class Example : public Component {
public:
RC build() final {
// rcnew Widget{...} is equivalent to std::shared_ptr(new Widget{...})
return rcnew Widget{
layout = Layout::Vertical,
rcnew Text{
"Switch (widgets/Switch.hpp)",
classes = { "section-header" }, // Widgets can be styled using stylesheets
},rcnew HLayout{
rcnew Widget{
rcnew Switch{
// Bind the switch value to the m_toggled variable (bidirectional)
value = Value{ &m_toggled },
rcnew Text{ "Switch" },
},
},
gapColumn = 10_apx, // CSS Flex-like properties
rcnew Text{
text = Value{ &m_label }, // Text may be dynamic
visible =
Value{ &m_toggled }, // The Switch widget controls the visibility of this text widget
},
},// Button widget
rcnew Button{
rcnew Text{ "Click" },
// Using lifetime() ensures that callbacks will be detached once the Component is deleted
onClick = lifetime() |
[this]() {
// Notify bindings about the change
bindings->assign(m_label) = "Updated text";
},
},// ComboBox widget
rcnew ComboBox{
Value{ &m_textAlignment }, // Bind ComboBox value to an enumeration
notManaged(&textAlignList), // Pass the list of name-value pairs to populate the ComboBox
},// The Builder creates widgets dynamically whenever needed
Builder([this](Widget* target) {
for (int i = 0; i < m_number; ++i) {
target->apply(rcnew Widget{
dimensions = { 40_apx, 40_apx },
});
}
}),
depends = Value{ &m_number }, // Instructs to rebuild this if m_number changes
};
}private:
bool m_toggled = false;
TextAlign m_textAlignment = TextAlign::Start;
std::string m_label = "OK";
float m_progress = 0;
int m_number = 0;
};
```### Screenshots
![]()
![]()
![]()
![]()
![]()
![]()
### Modules
#### **Core**
- **Compression & Basic Cryptography**: Provides data compression and basic cryptographic functions, including hashing algorithms.
- **Dynamic Library Loading**: Loads and interacts with `.dll` or `.so` files dynamically.
- **String Manipulation**: Handles UTF-8, UTF-16, and UTF-32, with text manipulation utilities.
- **Stream I/O**: Input/output operations for handling data streams.
- **Localization Support**: Basic localization and internationalization features for multilingual applications.
- **Logging**: Built-in logging framework for application diagnostics.
- **Reflection**: Supports reflection.
- **Serialization**: Serializes/deserializes data to/from JSON.
- **App-Global Settings**: Manages global application settings.
- **Threading**: Provides task queues for multi-threaded applications.
- **Binding**: Supports value binding, capable of handling multi-threaded environments.#### **Graphics**
- **Color & Colorspaces**: Supports working with colors, including various colorspaces.
- **Geometry**: Provides 2D geometry types like `Rect`, `Point`, `Size`, and 2D matrices for transformations.
- **Canvas & Path**: Supports drawing with paths and Bézier curves.
- **SVG Rasterization**: Renders SVG images into raster formats.
- **Image Processing**: Supports image encoding, decoding, resizing, and manipulation.
- **Font Handling**: Manages fonts, including loading, rendering, caching, and text layout. Supports advanced text shaping (using HarfBuzz) and SVG fonts (emojis).#### **Window**
- **Clipboard**: Provides clipboard access for copy/paste functionality.
- **OS Dialogs**: Native dialogs for file open/save, folder selection, and message boxes.
- **Display Information**: Retrieves and manages display/monitor information from the OS.
- **Buffered rendering** : Brisk supports both buffered rendering, which enables partial repaints, and direct rendering to the window backbuffer.#### **GUI**
- **Widgets**: Includes a wide variety of widgets with CSS-style flex layout.
- **Style Sheets**: Styles your widgets using a stylesheet system that supports property inheritance.
Viewport-relative units are supported (`vh`, `vw`, `vmin`, `vmax)
- **Binding Support**: Data-binding between UI elements and application data. Supports transforming values using a function on-the-fly and compound values (e.g., sums of other values).
- **Stateful and Stateless Modes**: Choose between stateful widgets for persistent state or stateless widgets for easily rebuilding widget subtrees.
- **Drag-and-Drop**: Supports drag-and-drop within the GUI, with the option to attach a C++ object to represent the dragged data.#### **Widgets**
- **Widgets**: Includes buttons, lists, comboboxes, toggle switches, radio buttons, progress bars, sliders, scroll boxes, checkboxes, popup buttons, tabs, tables, spin boxes, dialogs, and more. All public properties are styleable and bindable.
- **Layouts**: Supports CSS flexbox-style layouts.
- **Text Editors**: Provides text editing widgets with LTR and RTL text support.
- **WebGPU**: Ability to render 3D content to the window using the WebGPU API (backed by Google's Dawn), with full support for composition with the UI.### Requirements ⚙️
- **C++20 Compiler**: Brisk requires a C++20-compatible compiler such as MSVC 2022, Clang, XCode, or GCC.
- **Dependency Management**: Uses [vcpkg](https://github.com/microsoft/vcpkg) to manage dependencies across platforms, simplifying the build process. Alternatively, you can download prebuilt binaries.### Platform Support
| | Windows | macOS | Linux |
|---------------------|---------|-------|-------|
| Core Functionality | Beta | Beta | Beta |
| Graphics | Beta | Beta | Beta |
| Window System | Beta | Beta | Beta |
| Widgets | Beta | Beta | Beta |
| Application Support | Alpha | Alpha | N/A |#### OS Support
| | Minimum version |
|---------|---------------------------------|
| Windows | Windows 10, Windows Server 2016 |
| macOS | macOS 11 Big Sur |
| Linux | n/a |#### Graphics Backend Support
| | Backends |
|---------|---------------------------------|
| Windows | D3D11 and WebGPU (D3D12/Vulkan) |
| macOS | WebGPU (Metal) |
| Linux | WebGPU (OpenGL/Vulkan) |### Example Projects
The `examples` directory contains projects that showcase how to use the Brisk library.
For a minimal example, check out the [brisk-helloworld](https://github.com/brisklib/brisk-helloworld) repository.
Example Project Binary Size:
| OS | Static Build, Release (Full Unicode Support) |
|-------------|-----------------------------------------------|
| Windows x64 | **10.1 MB** (D3D11) |
| Linux x64 | **18.2 MB** (WebGPU: Vulkan/OpenGL), stripped |
| macOS x64 | **16.5 MB** (WebGPU: Metal), stripped |These sizes do not include embedded resources (such as fonts).
### Development 💻
Brisk is in active development, and we welcome contributions and feedback from the community to improve and expand the toolkit.
The `main` branch contains the latest features and generally passes all built-in tests ✅. Other branches are reserved for feature development and may be force-pushed.
### License 📜
Brisk is licensed under the **GPL v2.0** or later. However, for those who wish to use Brisk in proprietary or closed-source applications, a **commercial license** is also available. For more details on commercial licensing, please contact us at [[email protected]](mailto:[email protected]).