getting the canvasframe set up for text

This commit is contained in:
2019-10-07 23:34:11 -07:00
parent e4a9170515
commit 86eb27f86d
5 changed files with 79 additions and 81 deletions

View File

@@ -2,12 +2,15 @@ use crate::util::vertex_3d::{Vertex3D};
use std::sync::Arc;
use std::collections::HashMap;
use crate::canvas::canvas_state::{Drawable, CanvasTextureHandle, CanvasImageHandle};
use crate::canvas::canvas_text::CanvasFontHandle;
use crate::canvas::shader::text_shader::GlyphInstance;
///
pub struct CanvasFrame {
pub colored_drawables: Vec<Vertex3D>,
pub textured_drawables: HashMap<Arc<CanvasTextureHandle>, Vec<Vec<Vertex3D>>>,
pub image_drawables: HashMap<Arc<CanvasImageHandle>, Vec<Vec<Vertex3D>>>,
pub text_drawables: HashMap<Arc<CanvasFontHandle>, Vec<GlyphInstance>>
}
impl CanvasFrame {
@@ -18,9 +21,12 @@ impl CanvasFrame {
colored_drawables: vec![],
textured_drawables: Default::default(),
image_drawables: Default::default(),
text_drawables: Default::default()
}
}
// TODO: Fix this for text and fonts
/// Accumulates the drawables collected Vertex2D's
pub fn draw(&mut self, drawable: &dyn Drawable) {
match drawable.get_texture_handle() {