Skip to main content

SdlWindow

Struct SdlWindow 

Source
pub struct SdlWindow { /* private fields */ }
Expand description

SDL3-owned Vulkan-capable window and input/event source.

Implementations§

Source§

impl SdlWindow

Source

pub fn new(title: &str, width: u32, height: u32) -> Result<Self>

Create a resizable Vulkan-capable SDL3 window.

Source

pub fn new_hidden(title: &str, width: u32, height: u32) -> Result<Self>

Create a hidden Vulkan-capable window for presentation setup.

Source

pub fn required_instance_extensions(&self) -> Result<Vec<String>>

Return the Vulkan instance extensions SDL requires for this window.

Source

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.

Source

pub fn event_pump(&self) -> Result<EventPump>

Obtain SDL’s process-wide event pump for Presenter/UI input.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.