hmm
This commit is contained in:
parent
e48fff45f0
commit
2673a31b81
5 changed files with 37 additions and 14 deletions
|
|
@ -11,6 +11,9 @@ impl World {
|
|||
Self { nodes: vec![] }
|
||||
}
|
||||
|
||||
pub fn get_nodes(self) -> Vec<Box<dyn Node>> {
|
||||
self.nodes
|
||||
}
|
||||
pub fn add_node(&mut self, node: Box<dyn Node>) {
|
||||
self.nodes.push(node)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,19 +26,34 @@ impl Default for Window {
|
|||
}
|
||||
|
||||
impl Window {
|
||||
fn init(&mut self) -> Self {
|
||||
pub fn init(&mut self) -> Self {
|
||||
Self {
|
||||
context: moonhare_window::WindowRenderContext::OPENGLGLFW,
|
||||
glfw_window: Some(moonhare_window::Window::create(self.context)),
|
||||
render_context: Some(moonhare_graphics::build_context(
|
||||
self.glfw_window.clone().unwrap().glfw_window,
|
||||
)),
|
||||
render_context: match self.glfw_window {
|
||||
Some(window) => Some(moonhare_graphics::build_context(Box::new(window))),
|
||||
None => moonhare_log::error("No window"),
|
||||
},
|
||||
//Some(moonhare_graphics::build_context(
|
||||
// self.glfw_window.clone().unwrap().glfw_window,
|
||||
//)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_integ(&self) {
|
||||
println!("{:?}, {:?}", self.context, self.glfw_window)
|
||||
}
|
||||
|
||||
fn update(&mut self) {
|
||||
handle_window_event(&self.glfw_window.as_mut().unwrap());
|
||||
render(self.render_context.clone().unwrap());
|
||||
match &self.glfw_window {
|
||||
Some(window) => handle_window_event(&window),
|
||||
None => moonhare_log::warn("No Window!"),
|
||||
}
|
||||
|
||||
match &self.render_context {
|
||||
Some(context) => render(context.clone()),
|
||||
None => moonhare_log::warn("No Render Context"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue