substitute enqueue() with push_rect()

This commit is contained in:
Alessandro Mauri 2024-12-13 13:51:23 +01:00
parent fb177c03f7
commit 089140e1ed
2 changed files with 8 additions and 56 deletions

View file

@ -42,27 +42,11 @@ fn ElemEvents! Ctx.slider_hor(&ctx, String label, Rect size)
}
}
// Draw the button
// Draw the slider background and handle
Color bg_color = uint_to_rgba(0x0000ffff);
Color handle_color = uint_to_rgba(0x0ff000ff);
Cmd cmd = {
.type = CMD_RECT,
.rect = {
.rect = c_elem.bounds,
.color = bg_color,
},
};
ctx.cmd_queue.enqueue(&cmd)!;
cmd = Cmd{
.type = CMD_RECT,
.rect = {
.rect = c_elem.slider.handle,
.color = handle_color,
},
};
ctx.cmd_queue.enqueue(&cmd)!;
ctx.push_rect(c_elem.bounds, bg_color)!;
ctx.push_rect(c_elem.slider.handle, handle_color)!;
return c_elem.events;
}
@ -117,24 +101,8 @@ fn ElemEvents! Ctx.slider_ver(&ctx, String label, Rect size)
// Draw the button
Color bg_color = uint_to_rgba(0x0000ffff);
Color handle_color = uint_to_rgba(0x0ff000ff);
Cmd cmd = {
.type = CMD_RECT,
.rect = {
.rect = c_elem.bounds,
.color = bg_color,
},
};
ctx.cmd_queue.enqueue(&cmd)!;
cmd = Cmd{
.type = CMD_RECT,
.rect = {
.rect = c_elem.slider.handle,
.color = handle_color,
},
};
ctx.cmd_queue.enqueue(&cmd)!;
ctx.push_rect(c_elem.bounds, bg_color)!;
ctx.push_rect(c_elem.slider.handle, handle_color)!;
return c_elem.events;
}