Continue new platform/glium implementations

- Assets, asset manager system
- Rendering system trait
- Kick off glium platform implementation
- And more
This commit is contained in:
reo 2025-08-07 17:56:35 +03:00 committed by Emre
parent f7d5c14caf
commit e817abf8ab
18 changed files with 2557 additions and 32 deletions

View file

@ -1,17 +1,24 @@
use std::sync::{Arc, RwLock};
use glium::backend::Facade;
use raidillon_platform::Platform;
use glium::winit::event_loop::EventLoop;
use glium::winit::window::Window;
use glium::backend::glutin::Display;
use glium::glutin::surface::WindowSurface;
use glium::backend::glutin::SimpleWindowBuilder;
use crate::system::{RenderingSystemManager, RenderingSystem};
use winit::event::{Event, WindowEvent};
use crate::GliumAssetManager;
pub struct GliumPlatform {
pub struct GliumPlatform<RS: RenderingSystem> {
event_loop: EventLoop<()>,
window: Window,
display: Display<WindowSurface>,
rendering_system_manager: RenderingSystemManager<RS>,
asset_manager: Arc<RwLock<GliumAssetManager>>,
}
impl Platform for GliumPlatform {
impl<RS: RenderingSystem> Platform for GliumPlatform<RS> {
fn initialize(title: String, width: u32, height: u32) -> Self {
let event_loop = glium::winit::event_loop::EventLoop::builder()
.build()
@ -22,10 +29,32 @@ impl Platform for GliumPlatform {
.with_inner_size(width, height)
.build(&event_loop);
let rendering_system_manager = RenderingSystemManager::new();
let asset_manager = Arc::new(RwLock::new(GliumAssetManager::new(Box::new(display.clone()))));
Self {
event_loop,
window,
display
display,
rendering_system_manager,
asset_manager,
}
}
fn run(self) {
let _ = &self.event_loop.run(move |event, el| {
match event {
Event::WindowEvent { event, .. } => match event {
WindowEvent::CloseRequested => {},
WindowEvent::RedrawRequested => {
}
_ => {},
},
Event::AboutToWait => {
self.window.request_redraw();
}
_ => {},
}
});
}
}