4 releases

0.1.3 Dec 26, 2022
0.1.2 Dec 26, 2022
0.1.1 Dec 24, 2022
0.1.0 Dec 24, 2022

#325 in Rendering

MIT/Apache

7KB

Rustycan

WARNING: DO NOT USE YET - experimental work in progress. Expect tons of breaking changes, often.

Rustycan is a powerful UI framework for Rust, designed to make it easier than ever to create UIs and update existing UIs for games or apps. Rustycan support immediate-like and retained mode UIs.

It features a variety of advanced effects, including blur, frosted glass, shaders, and animation, as well as accessibility features and the ability to easily style and extend the framework. Additionally, Rustycan supports hot reload, themes, and native controls, allowing for cross-platform development on Android, iOS, Windows, Linux, and the web. It relies on existing frameworks for rendering to achieve its goal of providing developers with an ergonomic and intuitive experience.

Rustycan: the UI framework that can

Demo

TODO

rustycan_ui! {
    Grid (
        cols={sizes=(50 2x 1x) between=40 before_first=10 after_last=20} 
        rows=1s
        children_default_spacing=(1 1 1 2) 
      
        Button.ok "Ok" (
            style=cool_style 
            override_spacing=(10 10 10 10) 
            parent.rows=(1..2) parent.cols=1
        )
        Button.cancel "Cancel" (
            style=cool_style 
            override_spacing=(1 2 3 4)
        )
        Slider.my_slider "Brush Size".brush_size (
            range=(1..100)
            value=50
            override_spacing=(_,_,1x,1x)
        )
    )
}

Centered text followed by two right-aligned buttons:

rustycan_ui! {
    VertStack (
        Label "Hello world" (before=1x after=1x) // center
        HorizStack (
            before_first=1x // right align
            between=10 

            Button "Ok"
            Button "Cancel"
        )
    )
}

Older syntax (likely will not use it, leaving for temporary reference)

rustycan_ui! {
    Grid(
        cols={sizes=(50 2x 1x) between=40 before_first=10 after_last=20} 
        rows=1s
        children_default_spacing=(1 1 1 2)) 
    {
        Button Ok (
            style=cool_style 
            override_spacing=(10 10 10 10) 
            parent.rows=(1..2) parent.cols=1
        ).ok
        Button Cancel (
            style=cool_style 
            override_spacing=(1 2 3 4)
        ).cancel
        Slider "Brush Size".brush_size (
            range=(1..100)
            value=50
            override_spacing=(_,_,1x,1x)
        ).my_slider
    }
}

Goals

Goal Current State
Simple to use WIP
Easy to create UIs and update existing UIs WIP
High performance WIP
Easy to style WIP
Easy to extend WIP
Hot reload WIP
Advanced effects - blur, frosted glass, shaders WIP
Animation WIP
Accessibility WIP
Supports both immediate and retained modes WIP
Themes WIP
Cross-platform on Android, iOS, Windows, Linux, Web WIP
Native controls support WIP

Rustycan aims to achieve the goals above by reimplementing UI syntax and layout algorithms for developer ergonomics (ease of use), while relying on existing frameworks (either low-level or other UI frameworks) for rendering. That enables me to focus on ergonomics instead of reinventing the rendering stack.

License

MIT or Apache 2

No runtime deps