You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
63 lines
1.7 KiB
Content-Type: text/x-zim-wiki
|
|
Wiki-Format: zim 0.4
|
|
Creation-Date: 2020-02-03T23:57:15-08:00
|
|
|
|
====== CanvasFrame ======
|
|
|
|
[[/doc/sfml_rust/canvas/canvas_frame/struct.CanvasFrame.html|Documentation]]
|
|
|
|
===== Details =====
|
|
|
|
Canvas frame is at it's core, an accumulator of meta data to draw to the screen.
|
|
|
|
At the moment it is split up into these groups:
|
|
|
|
* Colored items like non-textured sprites are just a list of triangles, simple vertices.
|
|
@todo
|
|
* Textured are grouped by their texture handle. Currently implemented as a list of lists of vertices. I don't think the vertices need to be grouped by sprite as long as they are triangle lists with texture coords included in the definition
|
|
* Images are just the same as Textured
|
|
* Text is a simple Font->Glyph lookup. XY coords of the font and the ASCII code
|
|
|
|
{{{code: lang="rust" linenumbers="True"
|
|
colored_drawables: Vec<RuntimeVertexDef>
|
|
textured_drawables: HashMap<Arc<CanvasTextureHandle>, Vec<Vec<RuntimeVertexDef>>>
|
|
image_drawables: HashMap<Arc<CanvasImageHandle>, Vec<Vec<RuntimeVertexDef>>>
|
|
text_drawables: HashMap<Arc<CanvasFontHandle>, Vec<GlyphInstance>>
|
|
}}}
|
|
|
|
|
|
===== Future =====
|
|
|
|
I like this immediate interface for this simple style of UI and drawing.
|
|
|
|
@todo finish this
|
|
|
|
Now. The CanvasFrame is closely coupled with the Drawable trait, the object which allows CanvasFrame to ingest all drawable object on a single interface
|
|
|
|
Drawable needs a few things:
|
|
Handle to the Texture or Image it is using
|
|
Vertices describing it
|
|
(vertices will be character data for text)
|
|
Instances?
|
|
|
|
The handle is queiried and then turned into a descriptor set in the draw_commands.
|
|
|
|
|
|
|
|
|
|
--------------------
|
|
|
|
===== Data =====
|
|
|
|
**Borrowed:**
|
|
|
|
**Owns:**
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
|
|
|