abey79 / vsvg

Fast and portable tools for plotter users
http://whisk.rs
MIT License
107 stars 12 forks source link

Add support for custom `struct` as sketch parameter #66

Closed abey79 closed 9 months ago

abey79 commented 9 months ago

This PR adds support for custom struct (both with named and unnamed fields) to be used as sketch parameter. This is done via the new Widget derive macro:

#[derive(Sketch, Default)]
struct DemoSketch {
    custom_struct: CustomStruct,
}

#[derive(Widget, Default)]
struct CustomStruct {
   #[param(slider, min = 0.0, max = 10.0)]
   my_param: f64,
}

Nesting is supported.

A new ui_demo.rs example is introduced to demonstrate/test all supported types and combinations.