jtUI
Vue 般简单的 C++ 桌面 UI 框架。纯 C++20,原生帧渲染,无 Electron,无 JS 桥。runtime 约 15 万行代码,整个 app 就是一个独立的 .exe。
核心能力
原生渲染层 + 现代开发体感,全栈自洽
毛玻璃背景
D2D 1.1 高斯模糊 + tint,macOS Safari 同款视觉,硬件不支持时优雅降级。
Elevation 投影
5 档 box-shadow 语义投影,底层走 CLSID_D2D1Shadow 真高斯模糊。
媒体级 widget
VideoPlayer (MF + D2D) · AudioPlayer (WASAPI < 50ms) · WaveformView · Timeline · LevelMeter。
主题 + i18n
一行 Theme::set(...) / i18n::set_locale(...) 全应用切换,整树 rebuild 即生效。
Tick 动画
60 fps tick 循环,Widget::tick 返回 true 继续,false 停止,自由实现 count-up / ease / draw-in。
任意几何绘制
PaintContext: fill_rect / draw_bezier / fill_polygon / fill_ellipse / push_clip — 任何几何都能画。
Hello jtUI
从 widget 树到事件回调,一份 C++ 文件就跑起一扇硬件加速窗口
#include "jtui/jtui.hpp"
int run_app() {
jtui::Application app;
jtui::WindowOptions options{};
options.title = "Hello jtUI";
options.frameless = true;
options.size = {800.0F, 600.0F};
jtui::Window& window = app.create_window(options);
jtui::theme::Theme::set(jtui::theme::ThemeMode::Dark);
auto root = std::make_unique<jtui::Panel>();
root->set_role(jtui::PanelRole::Base);
root->set_frame({0.0F, 0.0F, 800.0F, 600.0F});
auto title = std::make_unique<jtui::Text>(u8"你好,jtUI");
title->set_font_size(32.0F);
title->set_bold(true);
title->set_color(jtui::Color::from_hex("#FB923C"));
title->set_alignment(jtui::TextAlignment::Center);
title->set_frame({0.0F, 240.0F, 800.0F, 50.0F});
root->append_child(std::move(title));
auto cta = std::make_unique<jtui::Button>("Get started");
cta->set_shape(jtui::ButtonShape::Pill);
cta->set_frame({340.0F, 320.0F, 120.0F, 44.0F});
cta->on_clicked().connect([]() { /* business callback */ });
root->append_child(std::move(cta));
window.set_content(std::move(root));
return app.run();
}40+ widget 开箱即用
basic · common · media 三大目录,覆盖布局到媒体的全部基本形态
10 个品牌 example
每个 example 是一个完整品牌 hero 页,展示框架的不同能力
Tab 切换的所有 widget + VSCode palette / codicons
双行大标题 + 内联 TextRun accent 高亮
5 张几何缩略图 + ease 滑动 + VideoPlayer
VideoPlayer + AudioPlayer + WaveformView 跨 rebuild 保活
毛玻璃 NavBar + count-up 动画 + ScrollView
sparkline + 图表卡片 + 网格背景
代码编辑器 mock + hot-reload 状态卡
贝塞尔流线 + trust 徽章
自定义 clips_self() widget
Sidebar nav + 文件夹网格 + search 筛选