window opens again but a lot of panicking D:

This commit is contained in:
LunarAkai 2025-07-27 12:15:34 +02:00
commit 4b2d2a9dc4
3 changed files with 36 additions and 21 deletions

View file

@ -5,11 +5,11 @@ use glium::{glutin::surface::WindowSurface, winit::{application::ApplicationHand
use crate::game_plugin::GamePlugin;
pub struct Game {
running: bool,
game_plugin: Option<Box<dyn GamePlugin>>,
window: Option<Window>,
display: Option<glium::Display<WindowSurface>>,
event_loop: EventLoop<()>
pub running: bool,
pub game_plugin: Option<Box<dyn GamePlugin>>,
pub window: Option<Window>,
pub display: Option<glium::Display<WindowSurface>>,
pub event_loop: EventLoop<()>
}
impl Game {
@ -31,7 +31,7 @@ impl Game {
if let Some(ref mut game_plugin) = self.game_plugin {
game_plugin.init();
} else {
todo!("Default Impl init")
//todo!("Default Impl init")
}
let (_window, _display) = return_window(&self.event_loop);
@ -43,7 +43,7 @@ impl Game {
if let Some(ref mut game_plugin) = self.game_plugin {
game_plugin.update();
} else {
todo!("Default Impl update")
//todo!("Default Impl update")
}
}
@ -54,10 +54,10 @@ impl Game {
if let Some(ref mut game_plugin) = self.game_plugin {
game_plugin.render(&mut target);
} else {
todo!("Default Impl render")
//todo!("Default Impl render")
}
target.finish().unwrap();
let _ = &target.finish().unwrap();
}
}
@ -65,7 +65,7 @@ impl Game {
if let Some(ref mut game_plugin) = self.game_plugin {
game_plugin.cleanup();
} else {
todo!("Default Impl cleanup")
//todo!("Default Impl cleanup")
}
}
@ -89,6 +89,7 @@ impl Game {
}
}
impl ApplicationHandler for Game {
fn resumed(&mut self, event_loop: &event_loop::ActiveEventLoop) {
self.window = Some(event_loop.create_window(Window::default_attributes()).unwrap())
@ -120,6 +121,7 @@ impl ApplicationHandler for Game {
}
fn init_event_loop() -> EventLoop<()> {
let event_loop = glium::winit::event_loop::EventLoop::builder()
.build()

View file

@ -8,6 +8,14 @@ use glium::{glutin::surface::WindowSurface, uniform, uniforms, winit::{event::{s
const ENGINE_NAME: &str = "Moonhare Engine";
pub struct CPointer<T>(T);
impl<T> Drop for CPointer<T> {
fn drop(&mut self) {
println!("Dropping")
}
}
// rescaling: position *= factor;
// rotating: new_position = vec2(pos.x * cos(angle) - pos.y * sin(angle), pos.x * sin(single) + pos.y * cos(angle));
// skewing: position.x += position.y * factor;