Expand description
Surfaces — widgets that draw themselves.
A Surface paints its box with any yog-gfx call (shaders, buffers,
Draw2D) and may take the pointer: a
casting grid, a graph, a minimap. The tree refers to one by id
(widget::surface, .yui <Surface source="mymod:grid"/>); the code registers the drawing object under
that id with register. An id nothing is registered under draws
nothing.
ⓘ
struct Graph;
impl yog_ui::Surface for Graph {
fn paint(&self, gfx: &GfxContext, rect: Rect) {
gfx.draw2d().rect(rect.x, rect.y, rect.x + rect.w, rect.y + 1.0, 0xFFFFFFFF);
}
}
yog_ui::surface::register("mymod:graph", std::sync::Arc::new(Graph));Enums§
- Pointer
- A pointer event on a surface, in coordinates local to its box (
0,0= top-left corner).
Traits§
- Surface
- What a surface widget draws and how it takes the pointer — see the module docs.
Functions§
- get
- The surface registered under
id. - register
- Makes
surfacewhat<Surface source="id"/>widgets draw (replacing the one registered before). - unregister
- Drops the surface registered under
id.