diff --git a/crates/moonhare_game/src/nodes/window.rs b/crates/moonhare_game/src/nodes/window.rs index 9164e92..ab82c29 100644 --- a/crates/moonhare_game/src/nodes/window.rs +++ b/crates/moonhare_game/src/nodes/window.rs @@ -27,13 +27,13 @@ impl Default for Window { impl Window { pub fn init(&mut self) -> Self { + let g_window = Some(moonhare_window::Window::create(self.context)); Self { context: moonhare_window::WindowRenderContext::OPENGLGLFW, - glfw_window: Some(moonhare_window::Window::create(self.context)), - render_context: match self.glfw_window { - Some(window) => Some(moonhare_graphics::build_context(Box::new(window))), - None => moonhare_log::error("No window"), - }, + glfw_window: g_window.clone(), + render_context: Some(moonhare_graphics::build_context( + g_window.clone().unwrap().glfw_window, + )), //Some(moonhare_graphics::build_context( // self.glfw_window.clone().unwrap().glfw_window, //)), diff --git a/crates/moonhare_graphics/src/backend.rs b/crates/moonhare_graphics/src/backend.rs index 42aed1f..09ee169 100644 --- a/crates/moonhare_graphics/src/backend.rs +++ b/crates/moonhare_graphics/src/backend.rs @@ -5,12 +5,12 @@ use std::{ }; use glium::{SwapBuffersError, winit::window::Window}; -use moonhare_window::glfw::Context; +use moonhare_window::glfw::{Context, PWindow}; // adopted from the glium repo -> examples -> manual_creation.rs #[derive(Clone)] pub struct Backend { - pub gl_window: Rc>>, + pub gl_window: Rc>, } unsafe impl glium::backend::Backend for Backend { diff --git a/crates/moonhare_graphics/src/lib.rs b/crates/moonhare_graphics/src/lib.rs index fd99e9e..4622343 100644 --- a/crates/moonhare_graphics/src/lib.rs +++ b/crates/moonhare_graphics/src/lib.rs @@ -22,7 +22,7 @@ use state::InitCell; use crate::color::Color; -pub fn build_context(window: Rc>>) -> Rc { +pub fn build_context(window: Rc>) -> Rc { let gl_window = window; // now building the context diff --git a/playground/src/main.rs b/playground/src/main.rs index fa0c2df..453afbb 100644 --- a/playground/src/main.rs +++ b/playground/src/main.rs @@ -13,7 +13,6 @@ fn main() { let mut window = Window::default(); window = Window::init(&mut window); - window.check_integ(); world.add_node(Box::new(window)); game.add_world(world.clone()); log::info(format!("{:?}", game));