Skip to content
/ zdec Public

A Declarative UI Framework Based on LVGL, written in Zig

License

Notifications You must be signed in to change notification settings

ufbycd/zdec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zdec - Declarative UI Framework

Code Example

    const main_ui = .{
        .{
            d.Id.Button,
            d.Size{ .width = 160, .height = 48 },
            d.Align{ .lv_align = .Center, .y_ofs = -100 },
            d.Text{ .text = "button" },
            d.Bind(.Text, @TypeOf(_model.count), "count: {d}"){ .property = &_model.count },
            struct {
                user_data: *Model,
                pub fn onClicked(event: anytype) void {
                    const the_model = event.getUserData();
                    the_model.add(10);
                }
            }{ .user_data = &_model },
        },
        .{
            d.Id.Slider,
            d.Size{ .width = 240, .height = 16 },
            d.Align{ .lv_align = .Center, .y_ofs = 100 },
            d.Range{ .min = 0, .max = 200 },
            d.Bind(.Value, @TypeOf(_model.count), null){ .property = &_model.count },
        },
    };

    _ = try d.buildUI(lv.Screen.active(), main_ui);

Run Example

zlvgl and zdev are both hosted on github.com and gitee.com

$ git clone https://github.com/ufbycd/zlvgl.git
$ git clone https://github.com/ufbycd/zdec.git

or

$ git clone https://github.com/ufbycd/zlvgl.git
$ git clone https://github.com/ufbycd/zdec.git

then build and run

$ cd zdec
$ zig build run

About

A Declarative UI Framework Based on LVGL, written in Zig

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages