展示 HN:Proton – 一个纯 Go GUI 库,零 CGO,API 免疫

2 分•作者: CzaxTanmay•3 个月前
各位 HN 的朋友们, 我一直在开发 Proton,这是一个轻量级的 Go GUI 库,旨在提供原生的桌面开发体验,而无需通常的外部工具链的麻烦。 它构建在 Gio 之上,但完全封装了底层的渲染引擎。公共 API 不暴露任何原始的 Gio 类型,这意味着您的应用程序代码可以免受任何上游的破坏性更改或内部重写的干扰。 主要特点: * **零 CGO**:您可以从任何机器上无缝地交叉编译到 Windows 和 macOS,而无需处理外部编译器工具链。 * **即时模式**:您的绘制函数每帧都会运行。没有状态树,没有 XML,也没有 `setState` 的样板代码。 * **功能齐全**:内置支持 40 多个主题、自定义十六进制/RGB 颜色、布局助手(GrowRow、ResizeSplit)、表格、覆盖层和键盘快捷键。 * **跨平台**:完全相同的代码库可以在 Windows、macOS 和 Android 上运行。 它目前正处于积极开发阶段(v0.2.x)。我非常希望听到您对 API 设计和方法的看法。 GitHub:https://github.com/CzaxStudio/proton 文档:https://protonlib.pages.dev
查看原文
Hey HN,<p>I’ve been working on Proton, a lightweight GUI library for Go designed to offer a native desktop development experience without the usual headaches of external toolchains.<p>It is built on top of Gio, but it completely wraps the underlying rendering engine. The public API exposes no raw Gio types, which means your application code is insulated from any upstream breaking changes or internal rewrites.<p>Key features:<p>Zero CGO: You can cross-compile to Windows and macOS flawlessly from any machine without fighting external compiler toolchains.<p>Immediate Mode: Your draw function runs every frame. No state trees, no XML, and no setState boilerplate.<p>Batteries Included: Built-in support for 40+ themes, custom hex&#x2F;RGB colors, layout helpers (GrowRow, ResizeSplit), tables, overlays, and keyboard shortcuts.<p>Cross-Platform: The exact same codebase runs on Windows, macOS, and Android.<p>It is currently under active development (v0.2.x). I&#x27;d love to hear your thoughts on the API design and approach.<p>GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;CzaxStudio&#x2F;proton" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CzaxStudio&#x2F;proton</a> Documentation: <a href="https:&#x2F;&#x2F;protonlib.pages.dev" rel="nofollow">https:&#x2F;&#x2F;protonlib.pages.dev</a>