pub struct SdlWindow { /* private fields */ }Expand description
SDL3-owned Vulkan-capable window and input/event source.
Implementations§
Source§impl SdlWindow
impl SdlWindow
Sourcepub fn new(title: &str, width: u32, height: u32) -> Result<Self>
pub fn new(title: &str, width: u32, height: u32) -> Result<Self>
Create a resizable Vulkan-capable SDL3 window.
Create a hidden Vulkan-capable window for presentation setup.
Sourcepub fn required_instance_extensions(&self) -> Result<Vec<String>>
pub fn required_instance_extensions(&self) -> Result<Vec<String>>
Return the Vulkan instance extensions SDL requires for this window.
Sourcepub fn drawable_extent(&self) -> [u32; 2]
pub fn drawable_extent(&self) -> [u32; 2]
Return the drawable pixel extent used by Vulkan presentation.
This deliberately differs from SDL’s logical window size on high-density displays. A zero extent means the window is minimized and must not cause swapchain allocation or acquisition.
Sourcepub fn event_pump(&self) -> Result<EventPump>
pub fn event_pump(&self) -> Result<EventPump>
Obtain SDL’s process-wide event pump for Presenter/UI input.
Sourcepub fn set_text_input_active(&self, active: bool)
pub fn set_text_input_active(&self, active: bool)
Enable or disable platform text input (SDL_StartTextInput /
SDL_StopTextInput). Keep it enabled only while a text widget holds
focus so the OS does not steal key events or show stray IME UI.
Sourcepub fn set_text_input_area(
&self,
x: i32,
y: i32,
w: u32,
h: u32,
cursor_offset: i32,
)
pub fn set_text_input_area( &self, x: i32, y: i32, w: u32, h: u32, cursor_offset: i32, )
Anchor the OS IME candidate window at a physical-pixel rect.
cursor_offset is the caret’s pixel offset from the rect’s left edge.
SDL expects window-logical coordinates, so the rect is divided by the
window’s pixel scale before the call.
Sourcepub fn connected_gamepads(&self) -> Vec<u32>
pub fn connected_gamepads(&self) -> Vec<u32>
Ids of standard-layout gamepads already connected — open each with
SdlWindow::open_gamepad since already-present pads don’t re-emit
GamepadAdded.
Sourcepub fn open_gamepad(&self, id: u32) -> Result<Gamepad>
pub fn open_gamepad(&self, id: u32) -> Result<Gamepad>
Open a connected standard-layout gamepad.
Call with the instance id from a GamepadAdded event and keep the
returned handle alive for as long as the pad stays connected — dropping
it closes the device. Button/axis state arrives through the event pump
as Gamepad* events.