window :3

This commit is contained in:
LunarAkai 2025-08-29 10:25:08 +02:00
commit 4f584b7040
4 changed files with 8 additions and 9 deletions

View file

@ -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,
//)),

View file

@ -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<RefCell<Box<Window>>>,
pub gl_window: Rc<RefCell<PWindow>>,
}
unsafe impl glium::backend::Backend for Backend {

View file

@ -22,7 +22,7 @@ use state::InitCell;
use crate::color::Color;
pub fn build_context(window: Rc<RefCell<Box<Window>>>) -> Rc<Context> {
pub fn build_context(window: Rc<RefCell<PWindow>>) -> Rc<Context> {
let gl_window = window;
// now building the context

View file

@ -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));