r/raylib • • 2d ago

Aspect - A library based on raylib for creating energy-efficient GUIs in Zig.

I got bored, so I decided to write a small library on Zig for creating simple and energy-efficient graphical apps in retained-mode. I used raylib as a base (it’s sufficient for now, and later I might try rewriting it for Vulkan).

Aspect LineChart component demo

You can read more in repository.

At the time of this post, the library is very crude and not suitable for large projects. I only started writing in Zig in September 2026, so the code quality may be poor. In simple terms, library is in early stage of development.

Main goals

I don’t plan to make this anything serious, but I do adhere to a few points:

  • Energy-efficient: A graphics app should use resources only when absolutely necessary, and use them as little as possible. This is why I chose retained-mode, as it significantly reduces CPU load without slowing down the app.
  • Flexibility: The library should allow the developer to customize it as they wish.
  • Lightweight: A minimal graphical app in Aspect can weight ~68KiB.

Built-in components

The library provides a small set of built-in components, some of the most basic ones: Button, TextField (which still doesn’t function as expected, lol), Selection, ColumnChart, Toggler, and so on.

Interesting

This library divides the entire app into several parts (model and functions: reveal, update, build, reflect), allowing for systematization of all app events and flexible interface control.

Supported Zig versions

The library currently relies on Zig 0.17.0.

Supported OS

The library has been successfully tested on Debian Linux and Windows 11.

What’s next In the near future

I’ll try to implement relative positioning, which will reduce the need to worry about setting absolute positions for each component. Naturally, over time I will add/improve the built-in components.

This post has been translated into English using Google Translate. Text was originally in Russian.

11 Upvotes

0 comments sorted by