TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Capy – Cross-platform library for making native GUIs in Zig

164 点作者 Sparkenstein将近 3 年前

11 条评论

comex将近 3 年前
There&#x27;s a severe lack of good libraries of this type; all the UI libraries want to invent their own controls and rendering instead.<p>I think this is a shame, demonstrating more than a small amount of NIH. Yes, different platforms have different widgets and different design guidelines, so a cross-platform UI using greatest-common-denominator set of native widgets will never look quite native. But at least text boxes will work the way text boxes should work, with keyboard shortcuts, the special characters menu, IME, the works. That already puts you ahead of most cross-platform UI frameworks that aren&#x27;t browser engines! Menus will work the way menus should work. HiDPI will work (failing to support that is less common these days, but it still happens). Text rendering will look native.<p>With custom rendering, you have to invest a mammoth amount of effort to even approach native platform behavior. Which means that most small UI libraries produce UIs that feel like toys, and even the big ones have an uncanny valley feel. With native controls, even with a relatively small library, you can make a UI that feels fundamentally _usable_.<p>While this project is immature, I hope it has a bright future. If it matures into a high-quality library, I would learn Zig for the sole purpose of using it. I&#x27;m also keeping my eye on libui and libui-ng, similar libraries which are written in C.
评论 #32315767 未加载
评论 #32335170 未加载
评论 #32320453 未加载
评论 #32317167 未加载
ducktective将近 3 年前
Fantastic! This is similar to the C library `libui` since it also acts as a wrapper of native libraries of each platform.<p>If only there was a way to interface to these using some declarative minimal and highly opinionated programming language and paradigm...<p>There is a Janet binding for it but it looks abandoned.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;andlabs&#x2F;libui" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andlabs&#x2F;libui</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;janet-lang&#x2F;janetui" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;janet-lang&#x2F;janetui</a>
tnodir将近 3 年前
Also see <a href="https:&#x2F;&#x2F;github.com&#x2F;frang75&#x2F;nappgui_src" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;frang75&#x2F;nappgui_src</a>
sharikous将近 3 年前
Nice. Is zig easily callable with the C ABI? This could be a really nice thing to have for everybody using a different language too
评论 #32317387 未加载
评论 #32315927 未加载
评论 #32316356 未加载
malkia将近 3 年前
LispWorks GUI is named similarly :) - Capi - <a href="http:&#x2F;&#x2F;www.lispworks.com&#x2F;products&#x2F;capi.html" rel="nofollow">http:&#x2F;&#x2F;www.lispworks.com&#x2F;products&#x2F;capi.html</a> - it just reminded me of it when I&#x27;ve read the name, that&#x27;s all...
mattanimation将近 3 年前
Oh nice, I was literally testing imgui in zig today, but I&#x27;ll have to give this a test too.
nine_k将近 3 年前
Very nice!<p>My only issue is with using literal pixels. With screens that have 3x-4x difference in DPI in wide use, it&#x27;s easy to shoot oneself in the foot and make a GUI that looks indiscernible on a retina screen, or colossal on a low-end laptop screen.<p>I hope this will be addressed in a future version (and that there&#x27;ll be more future versions! and wide adoption!)
评论 #32322096 未加载
评论 #32319553 未加载
rvz将近 3 年前
Great library, however:<p>&gt; Note: As there&#x27;s no &quot;official&quot; GUI library for Linux, GTK 3 has been chosen as it is the one that works and can be configured on the most distros. It&#x27;s also the reason Libadwaita won&#x27;t be adopted, as it&#x27;s meant for GNOME and GNOME only by disallowing styling and integration with other DEs.<p>The never ending unsolvable problems, in-fighting and conflicts that keep plaguing the Linux Desktop has now spread onto aspiring cross-platform GUI libraries to make a compromise to avoid certain integration(s) with other libraries that will limit future functionality if someone decides to use it.<p>This is a solved issue for macOS and Windows, but never Desktop Linux which is a terrible shame for more than 20+ years.
评论 #32317248 未加载
评论 #32317594 未加载
mark_l_watson将近 3 年前
I first read “Capy” as CAPI, LispWork’s proprietary cross platform UI library (that is really very good - I am a LispWorks customer).<p>When designing something like Capy, it would seem like a very good idea to start with something well designed for another language, think about how to support a different programming language, and make whatever changes seem joyful to you, as a developer. I am not suggesting cargo culting, rather appreciate and be inspired by people,solving the same problems.
fassssst将近 3 年前
If you want it to be “native” on Windows then the Windows backend should use controls from Windows App SDK, not GDI.
评论 #32315289 未加载
评论 #32315540 未加载
madeofpalk将近 3 年前
What does &quot;native&quot; even mean? How is this native in a way that HTML - which renders OS-native text input and button widgets - isnt?
评论 #32317492 未加载