Guest User

Untitled

a guest
Aug 22nd, 2019
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::marker::PhantomData;
  2.  
  3. struct Object<'a>{
  4. _ps: PhantomData<&'a ()>
  5. }
  6.  
  7. struct Scene<'a>{
  8. objects: Vec<Object<'a>>,
  9. }
  10.  
  11. impl<'a> Scene<'a>{
  12.  
  13. fn load(&'a mut self, loader: fn(scene: &'a mut Scene<'a>)){
  14. loader(self);
  15. }
  16.  
  17. fn new() -> Self {
  18. unimplemented!()
  19. }
  20.  
  21. }
  22.  
  23. fn load<'a>(scene: &'a mut Scene<'a>){
  24.  
  25. // let shader = Shader{id: 1};
  26. // scene.resources.push(Box::new(shader));
  27.  
  28. // let render = SpriteRenderer{shader:
  29. // scene.resources[0].downcast_ref().unwrap()};
  30. // let data = ObjectData{
  31. // resources: &scene.resources,
  32. // scene_event: scene.tx.clone(),
  33. // renderer:Rc::new(render)};
  34. // let object = Object{ data,controller: None};
  35. // scene.objects.push(object);
  36. }
  37.  
  38. fn main() {
  39. let mut scene = Scene::new();
  40. scene.load(load);
  41. }
RAW Paste Data