damn, rust borrow checker got tamed >:3
This commit is contained in:
parent
1c75b7ac87
commit
78b5348b92
2 changed files with 18 additions and 12 deletions
|
|
@ -34,16 +34,16 @@ impl Game {
|
|||
|
||||
pub fn run(self) {
|
||||
info("Running Game...");
|
||||
let mut glfw_window_unwrapped: moonhare_window::platforms::glfw_window::GLFWWindow = self.glfw_window.unwrap();
|
||||
let mut glfw_window_unwrapped = self.glfw_window;
|
||||
let mut context: std::rc::Rc<moonhare_graphics::glium::backend::Context>;
|
||||
|
||||
context = moonhare_graphics::build_context(Rc::new(RefCell::new(glfw_window_unwrapped.glfw_window)));
|
||||
context = moonhare_graphics::build_context(glfw_window_unwrapped.clone().unwrap().glfw_window);
|
||||
|
||||
|
||||
let value = glfw_window_unwrapped;
|
||||
let mut value = glfw_window_unwrapped;
|
||||
while self.is_running {
|
||||
// can't move glfwwindow cause i can't implement clone, or idk
|
||||
handle_window_event(value);
|
||||
handle_window_event(value.as_mut().unwrap());
|
||||
render(context.clone());
|
||||
|
||||
// update();
|
||||
|
|
@ -61,9 +61,9 @@ fn default_game_name() -> String {
|
|||
}
|
||||
|
||||
/// Deals with GLFW Window Events (in `monhare_window`)
|
||||
fn handle_window_event(mut glfw_window: GLFWWindow) {
|
||||
glfw_window.glfw_window.glfw.poll_events();
|
||||
for (_, event) in moonhare_window::glfw::flush_messages(&glfw_window.events) {
|
||||
fn handle_window_event(mut glfw_window: &GLFWWindow) {
|
||||
glfw_window.glfw_window.borrow_mut().glfw.poll_events();
|
||||
for (_, event) in moonhare_window::glfw::flush_messages(&glfw_window.events.borrow()) {
|
||||
moonhare_window::platforms::glfw_window::GLFWWindow::handle_window_event(&glfw_window, event);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue