Going to just normalize to a single hardcoded enum of vertex definitions. Seems like quite a backpeddle....
This commit is contained in:
@@ -11,14 +11,12 @@ use std::any::Any;
|
||||
|
||||
|
||||
// I don't think this is going to work without getting into Box'ing
|
||||
pub trait DrawableTest<V, H> where H: Handle {
|
||||
fn get_vertices(&self) -> Vec<V>;
|
||||
pub trait DrawableTest<VTypes: Into<VertexTypes>, H: Handle + DynHash> {
|
||||
fn get_vertices(&self) -> VTypes;
|
||||
fn get_handle(&self) -> H;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mod dynhash {
|
||||
pub mod dynhash {
|
||||
use std::any::Any;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
@@ -73,17 +71,16 @@ mod dynhash {
|
||||
}
|
||||
}
|
||||
use crate::canvas::canvas_frame::dynhash::DynHash;
|
||||
|
||||
|
||||
use crate::VertexTypes;
|
||||
|
||||
|
||||
// CanvasFrameTest will be drawn to by objects implementing DrawableTest
|
||||
pub struct CanvasFrameTest<VTypes> {
|
||||
pub map: HashMap<Box<dyn DynHash>, Vec<VTypes>>,
|
||||
pub map: HashMap<Box<dyn DynHash>, VTypes>,
|
||||
}
|
||||
|
||||
impl<VTypes> CanvasFrameTest<VTypes> {
|
||||
pub fn draw(&mut self, drawable: Vec<VTypes>) {
|
||||
pub fn draw(&mut self, drawable: VTypes) {
|
||||
self.map.insert(Box::new(10), drawable);
|
||||
}
|
||||
}
|
||||
@@ -133,18 +130,6 @@ impl CanvasFrame {
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn draw_test<V : VertexDefinitionAndData, H: Handle, In>(&mut self, drawable: &dyn DrawableTest<V, H, In>) {
|
||||
// let h = drawable.get_handle();
|
||||
//
|
||||
// let v = drawable.get_vertices();
|
||||
//
|
||||
// let v = v.get(0).unwrap();
|
||||
//
|
||||
// // need to fill up the drawables....
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// TODO: Fix this for text and fonts
|
||||
/// Accumulates the drawables collected Vertex2D's
|
||||
|
||||
Reference in New Issue
Block a user