substitute enqueue() with push_rect()
This commit is contained in:
parent
fb177c03f7
commit
089140e1ed
@ -39,14 +39,7 @@ fn void! Ctx.div_begin(&ctx, String label, Rect size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the background to the draw stack
|
// Add the background to the draw stack
|
||||||
Cmd cmd = {
|
ctx.push_rect(c_elem.bounds, c_elem.div.color_bg)!;
|
||||||
.type = CMD_RECT,
|
|
||||||
.rect = {
|
|
||||||
.rect = c_elem.bounds,
|
|
||||||
.color = c_elem.div.color_bg,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
ctx.cmd_queue.enqueue(&cmd)!;
|
|
||||||
|
|
||||||
// TODO: check active
|
// TODO: check active
|
||||||
// TODO: check resizeable
|
// TODO: check resizeable
|
||||||
@ -95,17 +88,8 @@ fn void! Ctx.div_begin(&ctx, String label, Rect size)
|
|||||||
c_elem.div.origin_r = c_elem.div.origin_c;
|
c_elem.div.origin_r = c_elem.div.origin_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cmd scrl = {
|
ctx.push_rect(vslider, uint_to_rgba(0x999999ff))!;
|
||||||
.type = CMD_RECT,
|
ctx.push_rect(vhandle, uint_to_rgba(0x9999ffff))!;
|
||||||
.rect.rect = vslider,
|
|
||||||
.rect.color = uint_to_rgba(0x999999ff),
|
|
||||||
};
|
|
||||||
ctx.cmd_queue.enqueue(&scrl)!;
|
|
||||||
|
|
||||||
scrl.rect.rect = vhandle;
|
|
||||||
scrl.rect.color = uint_to_rgba(0x9999ffff);
|
|
||||||
ctx.cmd_queue.enqueue(&scrl)!;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
c_elem.div.scroll.on_y = false;
|
c_elem.div.scroll.on_y = false;
|
||||||
}
|
}
|
||||||
|
@ -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 bg_color = uint_to_rgba(0x0000ffff);
|
||||||
Color handle_color = uint_to_rgba(0x0ff000ff);
|
Color handle_color = uint_to_rgba(0x0ff000ff);
|
||||||
|
ctx.push_rect(c_elem.bounds, bg_color)!;
|
||||||
Cmd cmd = {
|
ctx.push_rect(c_elem.slider.handle, handle_color)!;
|
||||||
.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)!;
|
|
||||||
|
|
||||||
return c_elem.events;
|
return c_elem.events;
|
||||||
}
|
}
|
||||||
@ -117,24 +101,8 @@ fn ElemEvents! Ctx.slider_ver(&ctx, String label, Rect size)
|
|||||||
// Draw the button
|
// Draw the button
|
||||||
Color bg_color = uint_to_rgba(0x0000ffff);
|
Color bg_color = uint_to_rgba(0x0000ffff);
|
||||||
Color handle_color = uint_to_rgba(0x0ff000ff);
|
Color handle_color = uint_to_rgba(0x0ff000ff);
|
||||||
|
ctx.push_rect(c_elem.bounds, bg_color)!;
|
||||||
Cmd cmd = {
|
ctx.push_rect(c_elem.slider.handle, handle_color)!;
|
||||||
.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)!;
|
|
||||||
|
|
||||||
return c_elem.events;
|
return c_elem.events;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user