oa::ui::sdl_events

Module published by the oa::Ui struct.

MdRust public API

Public Functions

pub fn convert_sdl_event( ev: &Event, pixel_scale_x: f32, pixel_scale_y: f32, ) -> Option<UiEvent>
pub fn window_pixel_scale(window: &Window) -> (f32, f32)

Function Documentation

pub fn convert_sdl_event( ev: &Event, pixel_scale_x: f32, pixel_scale_y: f32 ) -> Option<UiEvent>
Convert one SDL3 event into a UiEvent. pixel_scale_x / pixel_scale_y convert logical SDL coordinates to physical pixels. Obtain them with window_pixel_scale before calling this. Returns None for SDL events that have no UI representation (timers, audio device changes, etc.).
pub fn window_pixel_scale(window: &Window) -> ( f32, f32 )
Compute logical→physical pixel scale for one window. Returns (scale_x, scale_y). Both default to 1.0 when the window is zero-size or the query fails.