// Copy helper files alongside this entry before importing as a package.
easy_ui::Dropdown choice;
easy_ui::ColorPicker picker;
easy_ui::Column column;
easy_data::PositionSnapshot snapshot;
array<string> choices={"Small","Medium","Large"};
bool expanded=true;
uint job=0;
string hash_state="Not requested";
void on_load() {
if(config::enabled()) {
choice.index=uint(config::get_int("size",1));if(choice.index>2)choice.index=1;
expanded=config::get_bool("expanded",true);
}
}
void on_frame() {
column.begin(20,20,260);
vec2 p=column.next(32);choice.header("size",choices,p.x,p.y,column.width);
p=column.next(32);expanded=easy_ui::section("colors","Marker color",expanded,p.x,p.y,column.width);
if(expanded) { p=column.next(234);picker.draw("color",p.x,p.y,column.width); }
p=column.next(32);
if(ui::button("save","Save settings",p.x,p.y,column.width,32)&&config::enabled()) {
config::set_int("size",int(choice.index));config::set_bool("expanded",expanded);
}
p=column.next(32);
if(ui::button("hash","Compute SHA256",p.x,p.y,column.width,32)&&job==0)job=jobs::submit("sha256","Easy Universal");
if(job!=0) {
hash_state=jobs::state(job);
if(hash_state=="complete") { runtime::log(jobs::body(job));jobs::release(job);job=0; }
else if(hash_state=="error") { runtime::log(jobs::error(job));jobs::release(job);job=0; }
}
p=column.next(24);render::text(p.x,p.y,"Task: "+hash_state);
float radius=choice.index==0?12:choice.index==1?24:36;
render::filled_circle(screen::width()*0.75f,screen::height()*0.5f,radius,picker.color);
choice.popup("size-options",choices,20,20,column.width); // LAST: consumes clicks above lower widgets.
}
Easy Universal / Примеры и шаблоны