app_context: Remove useless monitors video modes checking
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m43s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m43s
This commit is contained in:
parent
1aa2dcc55d
commit
8a57094478
1 changed files with 10 additions and 54 deletions
|
@ -14,6 +14,7 @@ use vulkano::{
|
|||
use vulkano_util::{renderer::VulkanoWindowRenderer, window::VulkanoWindows};
|
||||
use winit::{
|
||||
event_loop::EventLoopProxy,
|
||||
monitor::MonitorHandle,
|
||||
window::{Window, WindowId},
|
||||
};
|
||||
|
||||
|
@ -78,61 +79,10 @@ impl ApplicationContext {
|
|||
}
|
||||
}
|
||||
|
||||
/// Récupère les résolutions disponibles du moniteur (méthode utilitaire statique)
|
||||
fn get_monitor_resolutions(window: &Window) -> Vec<(u32, u32)> {
|
||||
// Première tentative : moniteur actuel
|
||||
if let Some(monitor) = window.current_monitor() {
|
||||
let resolutions = Self::extract_resolutions_from_monitor(&monitor);
|
||||
if !resolutions.is_empty() {
|
||||
log::debug!(
|
||||
"Résolutions trouvées via moniteur actuel: {:?}",
|
||||
resolutions
|
||||
);
|
||||
return resolutions;
|
||||
}
|
||||
}
|
||||
|
||||
// Deuxième tentative : tous les moniteurs disponibles
|
||||
log::debug!("Tentative de récupération via tous les moniteurs disponibles...");
|
||||
let mut all_resolutions = Vec::new();
|
||||
|
||||
for monitor in window.available_monitors() {
|
||||
let resolutions = Self::extract_resolutions_from_monitor(&monitor);
|
||||
all_resolutions.extend(resolutions);
|
||||
}
|
||||
|
||||
if !all_resolutions.is_empty() {
|
||||
// Supprime les doublons et trie
|
||||
all_resolutions.sort_unstable();
|
||||
all_resolutions.dedup();
|
||||
all_resolutions.sort_by(|a, b| (b.0 * b.1).cmp(&(a.0 * a.1)));
|
||||
|
||||
log::debug!(
|
||||
"Résolutions trouvées via tous les moniteurs: {:?}",
|
||||
all_resolutions
|
||||
);
|
||||
return all_resolutions;
|
||||
}
|
||||
|
||||
// Aucune résolution détectée - retourne un vecteur vide
|
||||
log::warn!("Aucune résolution détectée pour cette fenêtre");
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
/// Extrait les résolutions d'un moniteur donné
|
||||
fn extract_resolutions_from_monitor(
|
||||
monitor: &winit::monitor::MonitorHandle,
|
||||
) -> Vec<(u32, u32)> {
|
||||
fn extract_resolutions_from_monitor(monitor: MonitorHandle) -> Vec<(u32, u32)> {
|
||||
let video_modes: Vec<_> = monitor.video_modes().collect();
|
||||
|
||||
if video_modes.is_empty() {
|
||||
log::debug!(
|
||||
"Aucun mode vidéo trouvé pour le moniteur {:?}",
|
||||
monitor.name()
|
||||
);
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
let resolutions: Vec<(u32, u32)> = video_modes
|
||||
.into_iter()
|
||||
.map(|mode| {
|
||||
|
@ -141,7 +91,7 @@ impl ApplicationContext {
|
|||
})
|
||||
.collect();
|
||||
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"Modes vidéo trouvés pour {:?}: {:?}",
|
||||
monitor.name(),
|
||||
resolutions
|
||||
|
@ -151,7 +101,13 @@ impl ApplicationContext {
|
|||
|
||||
/// Récupère les résolutions disponibles
|
||||
pub fn get_available_resolutions(&self) -> Vec<(u32, u32)> {
|
||||
self.with_renderer(|renderer| Self::get_monitor_resolutions(renderer.window()))
|
||||
self.with_renderer(|renderer| {
|
||||
renderer
|
||||
.window()
|
||||
.current_monitor()
|
||||
.map(Self::extract_resolutions_from_monitor)
|
||||
.unwrap_or_default()
|
||||
})
|
||||
}
|
||||
|
||||
/// Récupère le delta time actuel depuis le timer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue