All Projects → zenith391 → zgt

zenith391 / zgt

Licence: MIT license
Zig GUI Toolkit: Portable library for making native GUIs in Zig

Programming Languages

Zig
133 projects
HTML
75241 projects

Projects that are alternatives of or similar to zgt

art.zig
An Adaptive Radix Tree ported from c
Stars: ✭ 35 (-83.94%)
Mutual labels:  zig-library, zig-package
zetaframe
lightweight zig game framework.
Stars: ✭ 14 (-93.58%)
Mutual labels:  zig-library, zig-package
zigimg
Zig library for reading and writing different image formats
Stars: ✭ 112 (-48.62%)
Mutual labels:  zig-library
eepp
eepp is an open source cross-platform game and application development framework heavily focused on the development of rich graphical user interfaces.
Stars: ✭ 44 (-79.82%)
Mutual labels:  cross-platform-gui
Cefpython
Python bindings for the Chromium Embedded Framework (CEF)
Stars: ✭ 2,498 (+1045.87%)
Mutual labels:  cross-platform-gui
widgets playground
Showcase example for https://github.com/therecipe/qt
Stars: ✭ 50 (-77.06%)
Mutual labels:  cross-platform-gui
mecha
A parser combinator library for Zig
Stars: ✭ 220 (+0.92%)
Mutual labels:  zig-package
desktoploveblazorweb
A cross-platform desktop application template (mobile support in the future) based on Blazor Server, which uses an in-process ASP.NET Core server + in-process OS WebView component.
Stars: ✭ 57 (-73.85%)
Mutual labels:  cross-platform-gui
DotPurple-App
Bug reports, feature requests, and tool list for DotPurple -- the only cross-platform GUI for the .NET (dotnet) command-line interface (CLI)
Stars: ✭ 20 (-90.83%)
Mutual labels:  cross-platform-gui
Fairygui Unity
A flexible UI framework for Unity
Stars: ✭ 2,007 (+820.64%)
Mutual labels:  cross-platform-gui
sdk
TinyVG software development kit
Stars: ✭ 135 (-38.07%)
Mutual labels:  zig-package
Git Cola
git-cola: The highly caffeinated Git GUI
Stars: ✭ 1,787 (+719.72%)
Mutual labels:  cross-platform-gui
haxe
Qt binding for Haxe | Showcase example for https://github.com/therecipe/qt
Stars: ✭ 21 (-90.37%)
Mutual labels:  cross-platform-gui
zig-args
Simple-to-use argument parser with struct-based config
Stars: ✭ 106 (-51.38%)
Mutual labels:  zig-package
xtd
Free open-source modern C++17 / C++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.
Stars: ✭ 321 (+47.25%)
Mutual labels:  cross-platform-gui
mach-glfw
Ziggified GLFW bindings with 100% API coverage, zero-fuss installation, cross compilation, and more.
Stars: ✭ 186 (-14.68%)
Mutual labels:  zig-package
Qt
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
Stars: ✭ 8,966 (+4012.84%)
Mutual labels:  cross-platform-gui
zbox
termbox like terminal UI library for zig
Stars: ✭ 30 (-86.24%)
Mutual labels:  zig-package
zigdig
naive dns client library in zig
Stars: ✭ 26 (-88.07%)
Mutual labels:  zig-package
zlm
Zig linear mathemathics
Stars: ✭ 67 (-69.27%)
Mutual labels:  zig-package

zgt: a GUI library for Zig

GUIs in Zig, but idiomatic

As of now, zgt is NOT ready for use in production as I'm still making breaking changes


the glorius software in action

Introduction

zgt is a graphical user interface library for Zig. It is mainly intended for creating applications using native controls from the operating system. zgt is a declarative UI library aiming to be easy to write for and versatile.

It has been made with the goal to empower standalone UI applications, integration in games or any other rendering process is a non-goal.

Usage

zgt can be used as any other library using the Zig build package system. It only requires adding this code to your build.zig file (it also manages backend-specific configuration):

try @import("zgt/build.zig").install(exe, "./path/to/zgt");

A simple application using zgt:

const zgt = @import("zgt");
const std = @import("std");

pub fn main() !void {
    try zgt.backend.init();

    var window = try zgt.Window.init();
    try window.set(
        zgt.Column(.{ .spacing = 10 }, .{ // have 10px spacing between each column's element
            zgt.Row(.{ .spacing = 5 }, .{ // have 5px spacing between each row's element
                zgt.Button(.{ .label = "Save", .onclick = buttonClicked }),
                zgt.Button(.{ .label = "Run",  .onclick = buttonClicked })
            }),
            // Expanded means the widget will take all the space it can
            // in the parent container
            zgt.Expanded(
                zgt.TextArea(.{ .text = "Hello World!" })
            )
        })
    );

    window.resize(800, 600);
    window.show();
    zgt.runEventLoop();
}

fn buttonClicked(button: *zgt.Button_Impl) !void {
    std.log.info("You clicked button with text {s}", .{button.getLabel()});
}

It is easy to add something like a button or a text area. The example can already be used to notice a widget's parameters are usually enclosed in anonymous structs (.{ .label = "Save" }). You can also see that simply wrapping a widget with zgt.Expanded( ... ) will tell it to take all the space it can.

Supported platforms

A platform is considered supported only if it can be built from every other OS.

Windows x86_64
Linux x86_64
Linux aarch64 (PinePhone, PineBook...)
WebAssembly
🏃 macOS M1
🏃 macOS aarch64

  • Working and can be cross-compile from all platforms supported by Zig
  • 🏃 Planned

Note: As there's no "official" 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's also the reason Libadwaita won't be adopted, as it's meant for GNOME and GNOME only by disallowing styling and integration with other DEs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].