Integration of ECS pattern: Iteration 1
This commit is contained in:
parent
fc81f65a27
commit
8ce620a74b
13 changed files with 727 additions and 135 deletions
|
@ -5,13 +5,6 @@ use std::{
|
|||
};
|
||||
|
||||
use egui_winit_vulkano::Gui;
|
||||
use vulkano::{
|
||||
command_buffer::allocator::StandardCommandBufferAllocator,
|
||||
descriptor_set::allocator::StandardDescriptorSetAllocator,
|
||||
device::{Device, Queue},
|
||||
instance::Instance,
|
||||
memory::allocator::StandardMemoryAllocator,
|
||||
};
|
||||
use vulkano_util::{renderer::VulkanoWindowRenderer, window::VulkanoWindows};
|
||||
use winit::{event_loop::EventLoopProxy, monitor::MonitorHandle, window::WindowId};
|
||||
|
||||
|
@ -19,19 +12,10 @@ use crate::core::{input::InputManager, render::vulkan_context::VulkanContext, ti
|
|||
|
||||
use super::user_event::UserEvent;
|
||||
|
||||
/// Contexte d'application unifié avec Arc<Mutex<>> pour la mutabilité partagée
|
||||
#[derive(Clone)]
|
||||
/// Contexte d'application unifié pour les fonctions liées à la fenêtre
|
||||
pub struct WindowContext {
|
||||
// Données Vulkan (immutables)
|
||||
pub vulkan_context: Arc<VulkanContext>,
|
||||
pub device: Arc<Device>,
|
||||
pub instance: Arc<Instance>,
|
||||
pub graphics_queue: Arc<Queue>,
|
||||
pub compute_queue: Arc<Queue>,
|
||||
pub transfer_queue: Option<Arc<Queue>>,
|
||||
pub memory_allocator: Arc<StandardMemoryAllocator>,
|
||||
pub command_buffer_allocator: Arc<StandardCommandBufferAllocator>,
|
||||
pub descriptor_set_allocator: Arc<StandardDescriptorSetAllocator>,
|
||||
pub event_loop_proxy: EventLoopProxy<UserEvent>,
|
||||
pub window_id: WindowId,
|
||||
|
||||
|
@ -52,19 +36,9 @@ impl WindowContext {
|
|||
event_loop_proxy: EventLoopProxy<UserEvent>,
|
||||
window_id: WindowId,
|
||||
) -> Self {
|
||||
let vulkano_context_inner = vulkan_context.vulkano_context();
|
||||
|
||||
Self {
|
||||
// Données Vulkan
|
||||
vulkan_context: vulkan_context.clone(),
|
||||
device: vulkano_context_inner.device().clone(),
|
||||
instance: vulkano_context_inner.instance().clone(),
|
||||
graphics_queue: vulkano_context_inner.graphics_queue().clone(),
|
||||
compute_queue: vulkano_context_inner.compute_queue().clone(),
|
||||
transfer_queue: vulkano_context_inner.transfer_queue().cloned(),
|
||||
memory_allocator: vulkano_context_inner.memory_allocator().clone(),
|
||||
command_buffer_allocator: vulkan_context.command_buffer_allocator().clone(),
|
||||
descriptor_set_allocator: vulkan_context.descriptor_set_allocator().clone(),
|
||||
vulkan_context,
|
||||
event_loop_proxy,
|
||||
window_id,
|
||||
|
||||
|
@ -76,6 +50,10 @@ impl WindowContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn vulkan_context(&self) -> &VulkanContext {
|
||||
&self.vulkan_context
|
||||
}
|
||||
|
||||
/// Extrait les résolutions d'un moniteur donné
|
||||
fn extract_resolutions_from_monitor(monitor: MonitorHandle) -> Vec<(u32, u32)> {
|
||||
let video_modes: Vec<_> = monitor.video_modes().collect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue