A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/capy-ui/capy below:

capy-ui/capy: ๐Ÿ’ปBuild one codebase and get native UI on Windows, Linux and Web

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

Capy targets Zig version 0.14.1, the plan is to return to Nominated Zig versions once a new one is published

Capy is a GUI library for Zig. It is mainly intended for creating applications using native controls from the operating system. Capy 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.

If you're starting a new project, simply clone capy-template and follow build instructions.

Otherwise or for more information, please look in the docs.

You can ask questions and receive updates on the #capy-ui Matrix channel or on the Zig Discord Server (in the #gui-dev channel).

A simple application using capy:

const capy = @import("capy");
const std = @import("std");
pub usingnamespace capy.cross_platform;

pub fn main() !void {
    try capy.init();
    defer capy.deinit();

    var window = try capy.Window.init();
    try window.set(
        capy.column(.{ .spacing = 10 }, .{ // have 10px spacing between each column's element
            capy.row(.{ .spacing = 5 }, .{ // have 5px spacing between each row's element
                capy.button(.{ .label = "Save", .onclick = @ptrCast(&buttonClicked) }),
                capy.button(.{ .label = "Run",  .onclick = @ptrCast(&buttonClicked) })
            }),
            // 'expanded' means the widget will take all the space it can
            // in the parent container
            capy.expanded(
                capy.textArea(.{ .text = "Hello World!" })
            )
        })
    );

    window.setPreferredSize(800, 600);
    window.show();
    capy.runEventLoop();
}

fn buttonClicked(button: *capy.Button) !void {
    std.log.info("You clicked the 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 capy.Expanded( ... ) will tell it to take all the space it can.

Contributing can be as simple as opening an issue and detailling what bug you encountered or what feature you wish to have.
If you want to help the project more directly, you can fork the project and then create a pull request.

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

Legends:

โœ… Windows x86_64
โœ… Windows i386

๐Ÿƒ macOS M1
๐Ÿƒ macOS x86_64

โœ… Linux x86_64
โœ… Linux i386
โœ… Linux aarch64 (PinePhone, PineBook...)

โœ… FreeBSD x86_64

๐Ÿงช Android
๐Ÿƒ iOS

โœ… WebAssembly

Note: As there's no "official" GUI library for Linux, GTK 4 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.

For now, not every platform supports the same components. So here's a list of the ones that are supported:

win32 macOS GTK Android wasm Button โœ… โœ… โœ… โœ… โœ… Canvas โŒ โŒ โœ… โœ… โœ… CheckBox โœ… โŒ โœ… โŒ โŒ Dropdown โœ… โŒ โœ… โŒ โŒ Image โŒ โŒ โœ… โŒ โœ… Label โœ… โœ… โœ… โœ… โœ… Menu โŒ โŒ โŒ โŒ โŒ Navigation โŒ โŒ โŒ โŒ โŒ NavigationSidebar โŒ โŒ โœ… โŒ โŒ Scrollable โœ… โŒ โœ… โŒ โŒ Slider โœ… โŒ โœ… โŒ โœ… Tabs โœ… โŒ โœ… โŒ โŒ TextArea โœ… โŒ โœ… โŒ โŒ TextField โœ… โŒ โœ… โœ… โœ… Window โœ… โœ… โœ… โœ… โœ…

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4