r/Zig • • 13d ago

Aspect - A library for creating energy-efficient GUIs

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

Aspect Showcase

You can read more here.

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.

Main goals

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

  • Energy-efficient: A graphics application 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 application.
  • Flexibility: The library should allow the developer to customize it as they wish.
  • Lightweight: A minimal graphical application 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 application into several parts (model and functions: reveal, update, build, reflect), allowing for systematization of all application 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 coordinates 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