Convert trait method to inherent method

This commit is contained in:
Hanno Braun 2025-03-25 20:26:45 +01:00
parent 21ea140339
commit 7940ec81d4
3 changed files with 6 additions and 9 deletions

View File

@ -9,9 +9,6 @@ pub trait Screen {
/// The window
type Window: HasDisplayHandle + HasWindowHandle + Send + Sync + 'static;
/// Access the size of the screen
fn size(&self) -> ScreenSize;
/// Access the window
fn window(&self) -> Arc<Self::Window>;
}

View File

@ -10,7 +10,7 @@ use crate::{
CameraTuningConfig, DEFAULT_CAMERA_TUNING_CONFIG, InputEvent,
MouseButton,
},
screen::{NormalizedScreenPosition, Screen, ScreenSize},
screen::{NormalizedScreenPosition, ScreenSize},
window::Window,
};

View File

@ -44,12 +44,8 @@ impl Window {
inner: Arc::new(window),
})
}
}
impl Screen for Window {
type Window = winit::window::Window;
fn size(&self) -> ScreenSize {
pub fn size(&self) -> ScreenSize {
let size = self.inner.inner_size();
ScreenSize {
@ -57,6 +53,10 @@ impl Screen for Window {
height: size.height,
}
}
}
impl Screen for Window {
type Window = winit::window::Window;
fn window(&self) -> Arc<Self::Window> {
self.inner.clone()