window :3
This commit is contained in:
parent
2673a31b81
commit
4f584b7040
4 changed files with 8 additions and 9 deletions
|
|
@ -27,13 +27,13 @@ impl Default for Window {
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
pub fn init(&mut self) -> Self {
|
pub fn init(&mut self) -> Self {
|
||||||
|
let g_window = Some(moonhare_window::Window::create(self.context));
|
||||||
Self {
|
Self {
|
||||||
context: moonhare_window::WindowRenderContext::OPENGLGLFW,
|
context: moonhare_window::WindowRenderContext::OPENGLGLFW,
|
||||||
glfw_window: Some(moonhare_window::Window::create(self.context)),
|
glfw_window: g_window.clone(),
|
||||||
render_context: match self.glfw_window {
|
render_context: Some(moonhare_graphics::build_context(
|
||||||
Some(window) => Some(moonhare_graphics::build_context(Box::new(window))),
|
g_window.clone().unwrap().glfw_window,
|
||||||
None => moonhare_log::error("No window"),
|
)),
|
||||||
},
|
|
||||||
//Some(moonhare_graphics::build_context(
|
//Some(moonhare_graphics::build_context(
|
||||||
// self.glfw_window.clone().unwrap().glfw_window,
|
// self.glfw_window.clone().unwrap().glfw_window,
|
||||||
//)),
|
//)),
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use glium::{SwapBuffersError, winit::window::Window};
|
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
|
// adopted from the glium repo -> examples -> manual_creation.rs
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Backend {
|
pub struct Backend {
|
||||||
pub gl_window: Rc<RefCell<Box<Window>>>,
|
pub gl_window: Rc<RefCell<PWindow>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl glium::backend::Backend for Backend {
|
unsafe impl glium::backend::Backend for Backend {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use state::InitCell;
|
||||||
|
|
||||||
use crate::color::Color;
|
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;
|
let gl_window = window;
|
||||||
// now building the context
|
// now building the context
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ fn main() {
|
||||||
|
|
||||||
let mut window = Window::default();
|
let mut window = Window::default();
|
||||||
window = Window::init(&mut window);
|
window = Window::init(&mut window);
|
||||||
window.check_integ();
|
|
||||||
world.add_node(Box::new(window));
|
world.add_node(Box::new(window));
|
||||||
game.add_world(world.clone());
|
game.add_world(world.clone());
|
||||||
log::info(format!("{:?}", game));
|
log::info(format!("{:?}", game));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue