CPUX - retained-mode GUI framework

CPUX

Github Link | Crates.io Link

I have used AI to write some parts of the code, but it has been reviewed. The entire documentation is written solely by me. It is not slop.

CPUX is a retained-mode GUI framework that runs on the CPU.

It is designed to be simple and easy to use, as demonstrated by the basic_counter example:

counter code
use cpux::app::{App, AppContext};
use cpux::button::Button;
use cpux::layouts::Column;
use cpux::text::Text;
use cpux::load_font;

fn main() {
    let font = load_font("assets/arial.ttf");

    let mut app = App::new("cpux counter example", 600, 400);

    let mut counter = 0;

    let text1 = Text::new("Hello, GUI!", font.clone()).with_size(32.0);

    let text2 = Text::new("Count: 0", font.clone())
        .with_id("counter_text");

    let button = Button::new("Click Me", font.clone())
        .with_id("add_button");

    let column = Column::new()
        .at(50, 50)
        .with_spacing(25)
        .add(text1)
        .add(text2)
        .add(button);

    app.set_root(column);

    app.run(move |ui: &mut AppContext| {
        if ui.was_clicked("add_button") {
            counter += 1;
            if let Some(text_widget) = ui.find_widget_mut::<Text>("counter_text") {
                text_widget.content = format!("Count: {}", counter);
            }
        }
    });
}

To run the above code:

git clone https://github.com/Pjdur/cpux
cd cpux
cargo run --example basic_counter

Output:

I have documented the code as much as possible, achieving 96.88% coverage (cpux - Rust).

I am welcome to any feedback.