diff --git a/Cargo.lock b/Cargo.lock index 820356ed..52561c16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1895,6 +1895,15 @@ dependencies = [ "libloading", ] +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + [[package]] name = "codespan-reporting" version = "0.12.0" @@ -4491,6 +4500,12 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" +[[package]] +name = "rpkg-config" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a2d2f3481209a6b42eec2fbb49063fb4e8d35b57023401495d4fe0f85c817f0" + [[package]] name = "rstar" version = "0.13.0" @@ -4607,6 +4622,98 @@ dependencies = [ "tiny-skia", ] +[[package]] +name = "sdl3" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90c470b564b34e7f9ff0719ed7dc05ec71bc73fa4b28e0750a17b8987cf45f8" +dependencies = [ + "bitflags 2.13.1", + "libc", + "sdl3-image-sys", + "sdl3-mixer-sys", + "sdl3-sys", + "sdl3-ttf-sys", +] + +[[package]] +name = "sdl3-image-src" +version = "3.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9494480b91011c3eff1d15235a30c34f758ac4ee6b0a97579b0291d4fc2c85" + +[[package]] +name = "sdl3-image-sys" +version = "0.7.0+SDL-image-3.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12eec1cd8dcb6be4430976d9b01ae1dcccc674aea5f5ca2bd7ffb2c881ed79d" +dependencies = [ + "cmake", + "pkg-config", + "rpkg-config", + "sdl3-image-src", + "sdl3-sys", + "vcpkg", +] + +[[package]] +name = "sdl3-mixer-src" +version = "3.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd815ae87084588c7dbd027c1667b0a5e21a6b5ae7b22ecb230bc21c7063eca" + +[[package]] +name = "sdl3-mixer-sys" +version = "0.7.0+SDL-mixer-3.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6150136321198ec95cccfb6168d838f114273a7615d21b513e5277c86f7d3aa1" +dependencies = [ + "cmake", + "pkg-config", + "rpkg-config", + "sdl3-mixer-src", + "sdl3-sys", + "vcpkg", +] + +[[package]] +name = "sdl3-src" +version = "3.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bfd475a15a4679b94f6579aed7d52c69f3e04d80e6707712373f12903a2ef91" + +[[package]] +name = "sdl3-sys" +version = "0.7.1+SDL-3.4.16" +dependencies = [ + "cc", + "cmake", + "pkg-config", + "rpkg-config", + "sdl3-src", + "vcpkg", +] + +[[package]] +name = "sdl3-ttf-src" +version = "3.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28923d2ce72ff317d8eb7cec97ddfb8f351c330d7bcbf8c76e91332122c93b3" + +[[package]] +name = "sdl3-ttf-sys" +version = "0.7.1+SDL-ttf-3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d254e537d2d96b3e2d6e8a3dd4850a1361b8689c3d95c6c1dfdc02b091307eef" +dependencies = [ + "cmake", + "pkg-config", + "rpkg-config", + "sdl3-sys", + "sdl3-ttf-src", + "vcpkg", +] + [[package]] name = "self_cell" version = "1.3.0" @@ -4768,6 +4875,7 @@ dependencies = [ "image", "naga", "naga_oil", + "sdl3", "serde", "serde_json", "skate-core", @@ -5398,6 +5506,12 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index e0daac4a..e8a82a77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,3 +27,4 @@ opt-level = 3 [patch.crates-io] bevy_pbr = { path = "vendor/bevy_pbr" } bevy_core_pipeline = { path = "vendor/bevy_core_pipeline" } +sdl3-sys = { path = "vendor/sdl3-sys" } diff --git a/crates/skate-core/src/input/xbox.rs b/crates/skate-core/src/input/xbox.rs index 1e6c946f..ee912b8e 100644 --- a/crates/skate-core/src/input/xbox.rs +++ b/crates/skate-core/src/input/xbox.rs @@ -2,6 +2,7 @@ use super::controller::magnitude; /// Fields of the native Xbox state passed by value to 8296D5F8. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct XboxState { pub buttons: u16, pub triggers: [u8; 2], diff --git a/crates/skate-game/Cargo.toml b/crates/skate-game/Cargo.toml index c661f0a8..601559e6 100644 --- a/crates/skate-game/Cargo.toml +++ b/crates/skate-game/Cargo.toml @@ -35,6 +35,8 @@ image = { version = "=0.25.10", default-features = false, features = ["png", "jp skate-mods = { path = "../skate-mods" } skate-dynamics = { path = "../skate-dynamics" } gltf = { version = "=1.4.1", default-features = true } +# SDL3 gamepad input for every platform, built from source and statically linked. +sdl3 = { version = "=0.20.0", features = ["build-from-source-static"] } [dev-dependencies] naga = { version = "=27.0.3", features = ["wgsl-in"] } diff --git a/crates/skate-game/src/app.rs b/crates/skate-game/src/app.rs index a5189a4b..8d1bed49 100644 --- a/crates/skate-game/src/app.rs +++ b/crates/skate-game/src/app.rs @@ -85,9 +85,10 @@ pub(crate) fn build( }), ..default() }).build().disable::() - // Gameplay and menu navigation both use raw XInput. No game system - // consumes Bevy gamepad events/rumble; its second device backend can - // stall PreUpdate (70.68 ms in the University capture). + // Gameplay and menu navigation both use raw pad states from + // input::platform (SDL3, XInput fallback). No game system consumes + // Bevy gamepad events/rumble; its second device backend can stall + // PreUpdate (70.68 ms in the University capture). .disable::(), ) .insert_resource(bevy::winit::WinitSettings {focused_mode:bevy::winit::UpdateMode::Continuous,unfocused_mode:bevy::winit::UpdateMode::Continuous}) diff --git a/crates/skate-game/src/input.rs b/crates/skate-game/src/input.rs index 9fdad17a..055418e0 100644 --- a/crates/skate-game/src/input.rs +++ b/crates/skate-game/src/input.rs @@ -29,11 +29,46 @@ impl Plugin for InputPlugin { fn build(&self, app: &mut App) { app.init_resource::() .init_resource::() + .add_systems(Startup, start_controllers) .add_systems(PreUpdate, poll_controllers.run_if(crate::graphics_menu::gameplay_active)) .add_systems(FixedUpdate, publish_actions.in_set(SimulationSet::Input)); } } +/// settings/controller.json, e.g. {"paddles": {"right1": "a", "left1": "x"}}. +/// Paddle names are right1, left1, right2, left2 (SDL paddle order); values +/// are names from `platform::BUTTON_NAMES`. +#[derive(serde::Deserialize, Default)] +#[serde(default, deny_unknown_fields)] +struct ControllerSettings { + paddles: std::collections::BTreeMap, +} + +fn start_controllers(config: Res) { + let root = &config.asset_root; + let path = root.parent().unwrap_or(root).join("settings/controller.json"); + match std::fs::read(&path) { + Ok(bytes) => match serde_json::from_slice::(&bytes) { + Ok(settings) => { + let mut masks = [0u16; 4]; + for (paddle, button) in &settings.paddles { + let slot = ["right1", "left1", "right2", "left2"].iter().position(|p| p == paddle); + match (slot, platform::button_mask(button)) { + (Some(slot), Some(mask)) => masks[slot] = mask, + _ => warn!("{}: ignoring paddle mapping {paddle:?} -> {button:?}", path.display()), + } + } + platform::set_paddles(masks); + } + Err(error) => warn!("Invalid controller settings {}: {error}", path.display()), + }, + Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} + Err(error) => warn!("Cannot read controller settings {}: {error}", path.display()), + } + // Start the device backend now rather than stalling the first gameplay frame. + let _ = platform::poll(0); +} + pub(crate) fn poll_controllers(mut input: ResMut,config:Res,net:Option>,windows:Query<&Window>,mut capabilities:Local<[platform::CapabilityCache;4]>) { let previous = input.status; let focused=windows.iter().any(|w|w.focused); @@ -47,7 +82,7 @@ pub(crate) fn poll_controllers(mut input: ResMut,config:Res info!("Controller {index}: raw XInput ready"), + ControllerStatus::Ready => info!("Controller {index}: ready"), ControllerStatus::Unavailable(platform::DeviceError::Disconnected) => { info!("Controller {index}: disconnected"); } diff --git a/crates/skate-game/src/input/platform.rs b/crates/skate-game/src/input/platform.rs index 99ad31d0..b19413a5 100644 --- a/crates/skate-game/src/input/platform.rs +++ b/crates/skate-game/src/input/platform.rs @@ -1,6 +1,49 @@ -//! Windows device transport. Raw signed axes/trigger bytes reach the TU3 -//! converter without Bevy/gilrs deadzones or normalized-axis reconstruction. +//! Device transport. SDL3 gamepads are the default on every platform; each +//! state is re-expressed as the XInput-shaped `XboxState`, so raw signed +//! axes/trigger bytes reach the TU3 converter without Bevy/gilrs deadzones or +//! normalized-axis reconstruction. `SKATE3_INPUT=xinput` selects the original +//! Windows XInput transport, which is also the fallback if SDL cannot start. use skate_core::input::xbox::XboxState; +use std::sync::OnceLock; +use std::sync::atomic::{AtomicU64, Ordering}; + +/// XInput `wButtons` bits, the layout `xbox::convert` consumes. +pub(crate) const BUTTON_NAMES: [(&str, u16); 14] = [ + ("dpad_up", 0x0001), ("dpad_down", 0x0002), ("dpad_left", 0x0004), ("dpad_right", 0x0008), + ("start", 0x0010), ("back", 0x0020), ("left_stick", 0x0040), ("right_stick", 0x0080), + ("left_shoulder", 0x0100), ("right_shoulder", 0x0200), + ("a", 0x1000), ("b", 0x2000), ("x", 0x4000), ("y", 0x8000), +]; + +pub(crate) fn button_mask(name: &str) -> Option { + BUTTON_NAMES.iter().find(|(n, _)| n.eq_ignore_ascii_case(name)).map(|&(_, bit)| bit) +} + +/// XInput has no paddle inputs, so each paddle (right1, left1, right2, left2) +/// is folded into the XInput button mask chosen in settings/controller.json. +static PADDLES: AtomicU64 = AtomicU64::new(0); + +pub(crate) fn set_paddles(masks: [u16; 4]) { + let packed = masks.iter().enumerate().fold(0u64, |acc, (i, &m)| acc | u64::from(m) << (16 * i)); + PADDLES.store(packed, Ordering::Relaxed); +} + +fn paddles() -> [u16; 4] { + let packed = PADDLES.load(Ordering::Relaxed); + std::array::from_fn(|i| (packed >> (16 * i)) as u16) +} + +/// SDL trigger range 0..=32767 back to the XInput byte. SDL expands XInput's +/// byte as b*257 over the full axis, then rescales to 0..=32767, so rounding to +/// nearest returns the original byte exactly. +pub(crate) fn xinput_trigger(value: i16) -> u8 { + ((u32::from(value.max(0) as u16) * 255 + 16383) / 32767) as u8 +} + +/// SDL reports stick Y as positive-down by storing `~y`; invert it the same way. +pub(crate) fn xinput_y(value: i16) -> i16 { + !value +} pub(crate) struct DevicePacket { pub number: u32, @@ -13,8 +56,9 @@ pub(crate) enum DeviceError { Disconnected, State(u32), Capabilities(u32), + /// No device backend could be started. #[cfg(not(windows))] - UnsupportedPlatform, + Unavailable, } /// Device identity is metadata; raw input is still sampled every host frame. @@ -130,15 +174,249 @@ mod windows { } } +mod sdl { + use super::*; + use bevy::log::{info, warn}; + use sdl3::event::Event; + use sdl3::gamepad::{Axis, Button, Gamepad}; + use std::sync::{Mutex, mpsc}; + + /// Polling faster than any pad reports keeps added latency below 1 ms. + const POLL_INTERVAL: std::time::Duration = std::time::Duration::from_millis(1); + /// XINPUT_DEVSUBTYPE_GAMEPAD; SDL only opens devices it maps as gamepads. + const SUBTYPE_GAMEPAD: u8 = 1; + const BUTTONS: [(Button, u16); 14] = [ + (Button::DPadUp, 0x0001), (Button::DPadDown, 0x0002), + (Button::DPadLeft, 0x0004), (Button::DPadRight, 0x0008), + (Button::Start, 0x0010), (Button::Back, 0x0020), + (Button::LeftStick, 0x0040), (Button::RightStick, 0x0080), + (Button::LeftShoulder, 0x0100), (Button::RightShoulder, 0x0200), + (Button::South, 0x1000), (Button::East, 0x2000), + (Button::West, 0x4000), (Button::North, 0x8000), + ]; + const PADDLE_BUTTONS: [Button; 4] = + [Button::RightPaddle1, Button::LeftPaddle1, Button::RightPaddle2, Button::LeftPaddle2]; + + /// Latest (packet number, state) per slot, like XInputGetState's snapshot. + pub(super) struct Shared { + slots: Mutex<[Option<(u32, XboxState)>; 4]>, + } + + struct Slot { + pad: Gamepad, + id: u32, + number: u32, + state: XboxState, + } + + /// SDL must be pumped on the thread that initialised it, while Bevy runs + /// systems on a pool; a dedicated thread owns SDL and publishes snapshots. + pub(super) fn start() -> Result<&'static Shared, String> { + let shared: &'static Shared = Box::leak(Box::new(Shared { slots: Mutex::new([None; 4]) })); + let (ready, started) = mpsc::channel(); + std::thread::Builder::new() + .name("sdl-gamepad".into()) + .spawn(move || run(shared, ready)) + .map_err(|e| e.to_string())?; + started.recv().map_err(|_| "SDL gamepad thread exited".to_string())??; + Ok(shared) + } + + pub(super) fn poll(shared: &Shared, index: usize) -> Result { + let slots = shared.slots.lock().unwrap_or_else(|e| e.into_inner()); + slots[index] + .map(|(number, state)| DevicePacket { number, state, subtype: SUBTYPE_GAMEPAD }) + .ok_or(DeviceError::Disconnected) + } + + fn run(shared: &'static Shared, ready: mpsc::Sender>) { + // The window belongs to winit, so SDL never sees focus; the game + // decides itself when unfocused input is ignored (multiplayer). + sdl3::hint::set("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1"); + let init = (|| { + let context = sdl3::init()?; + let gamepads = context.gamepad()?; + let events = context.event_pump()?; + Ok::<_, sdl3::Error>((context, gamepads, events)) + })(); + let (_context, gamepads, mut events) = match init { + Ok(value) => value, + Err(error) => { + let _ = ready.send(Err(error.to_string())); + return; + } + }; + let _ = ready.send(Ok(())); + info!("Controller input: SDL {}", sdl3::version::version()); + let mut slots: [Option; 4] = Default::default(); + // Devices present at startup are also announced as GamepadAdded. + for id in gamepads.gamepads().unwrap_or_default() { + open(&gamepads, &mut slots, id); + } + loop { + for event in events.poll_iter() { + match event { + Event::GamepadAdded { which, .. } => open(&gamepads, &mut slots, which), + Event::GamepadRemoved { which, .. } => { + for (index, slot) in slots.iter_mut().enumerate() { + if slot.as_ref().is_some_and(|s| s.id == which.raw()) { + *slot = None; + info!("Controller {index}: SDL gamepad removed"); + } + } + } + _ => {} + } + } + let paddles = paddles(); + let mut published = [None; 4]; + for (slot, output) in slots.iter_mut().zip(&mut published) { + let Some(slot) = slot else { continue }; + let state = read(&slot.pad, paddles); + // Mirrors XInput dwPacketNumber: advances only when state changes. + if state != slot.state { + slot.number = slot.number.wrapping_add(1); + slot.state = state; + } + *output = Some((slot.number, state)); + } + *shared.slots.lock().unwrap_or_else(|e| e.into_inner()) = published; + std::thread::sleep(POLL_INTERVAL); + } + } + + fn open(gamepads: &sdl3::GamepadSubsystem, slots: &mut [Option; 4], id: sdl3::joystick::JoystickId) { + if slots.iter().flatten().any(|s| s.id == id.raw()) { + return; + } + let pad = match gamepads.open(id) { + Ok(pad) => pad, + Err(error) => return warn!("SDL gamepad {}: cannot open: {error}", id.raw()), + }; + // XInput-backed pads report their XInput user index as player index; + // keep that slot so the ring light matches, else take the first free one. + let preferred = pad.player_index().map(usize::from).filter(|&i| i < 4 && slots[i].is_none()); + let Some(index) = preferred.or_else(|| slots.iter().position(Option::is_none)) else { + return warn!("SDL gamepad {}: all four controller slots are in use", id.raw()); + }; + info!( + "Controller {index}: SDL gamepad {:?} ({:?}, vendor {:04x} product {:04x}, paddles {}, path {:?})", + pad.name().unwrap_or_default(), + pad.r#type(), + pad.vendor_id().unwrap_or(0), + pad.product_id().unwrap_or(0), + if pad.has_button(Button::RightPaddle1) { "available" } else { "not reported" }, + pad.path().unwrap_or_default(), + ); + slots[index] = Some(Slot { pad, id: id.raw(), number: 0, state: XboxState::default() }); + } + + fn read(pad: &Gamepad, paddles: [u16; 4]) -> XboxState { + let mut buttons = 0; + for (button, bit) in BUTTONS { + if pad.button(button) { + buttons |= bit; + } + } + for (button, mask) in PADDLE_BUTTONS.into_iter().zip(paddles) { + if mask != 0 && pad.button(button) { + buttons |= mask; + } + } + XboxState { + buttons, + triggers: [xinput_trigger(pad.axis(Axis::TriggerLeft)), xinput_trigger(pad.axis(Axis::TriggerRight))], + left: [pad.axis(Axis::LeftX), xinput_y(pad.axis(Axis::LeftY))], + right: [pad.axis(Axis::RightX), xinput_y(pad.axis(Axis::RightY))], + } + } +} + +enum Backend { + Sdl(&'static sdl::Shared), + #[cfg(windows)] + XInput, + #[cfg(not(windows))] + Unavailable, +} + +fn backend() -> &'static Backend { + static BACKEND: OnceLock = OnceLock::new(); + BACKEND.get_or_init(|| { + #[cfg(windows)] + if std::env::var("SKATE3_INPUT").is_ok_and(|v| v.eq_ignore_ascii_case("xinput")) { + bevy::log::info!("Controller input: XInput (SKATE3_INPUT=xinput)"); + return Backend::XInput; + } + match sdl::start() { + Ok(shared) => Backend::Sdl(shared), + #[cfg(windows)] + Err(error) => { + bevy::log::warn!("SDL gamepad input unavailable ({error}); using XInput"); + Backend::XInput + } + #[cfg(not(windows))] + Err(error) => { + bevy::log::error!("SDL gamepad input unavailable: {error}"); + Backend::Unavailable + } + } + }) +} + pub(crate) fn poll_cached( index: usize, cache: &mut CapabilityCache, ) -> Result { assert!(index < 4); - #[cfg(windows)] - return windows::poll(index as u32, cache); - #[cfg(not(windows))] - Err(DeviceError::UnsupportedPlatform) + match backend() { + Backend::Sdl(shared) => { + let _ = cache; + sdl::poll(shared, index) + } + #[cfg(windows)] + Backend::XInput => windows::poll(index as u32, cache), + #[cfg(not(windows))] + Backend::Unavailable => Err(DeviceError::Unavailable), + } +} + +#[cfg(test)] +mod conversion_tests { + use super::*; + + /// SDL's XInput expansion: byte*257-32768 on the full axis, then the + /// gamepad layer rescales -32768..=32767 onto 0..=32767. + fn sdl_trigger(byte: u8) -> i16 { + let axis = i32::from(byte) * 257 - 32768; + ((axis + 32768) * 32767 / 65535) as i16 + } + + #[test] + fn every_trigger_byte_survives_the_sdl_round_trip() { + for byte in 0..=255u8 { + assert_eq!(xinput_trigger(sdl_trigger(byte)), byte); + } + assert_eq!(xinput_trigger(-1), 0); + } + + #[test] + fn stick_y_inversion_restores_xinput_values_without_overflow() { + for y in [i16::MIN, -1, 0, 1, 12345, i16::MAX] { + assert_eq!(xinput_y(!y), y); + } + assert_eq!(xinput_y(i16::MIN), i16::MAX); + } + + #[test] + fn paddle_masks_round_trip_and_names_use_xinput_bits() { + set_paddles([0x1000, 0, 0x0100, 0x8000]); + assert_eq!(paddles(), [0x1000, 0, 0x0100, 0x8000]); + set_paddles([0; 4]); + assert_eq!(button_mask("A"), Some(0x1000)); + assert_eq!(button_mask("left_shoulder"), Some(0x0100)); + assert_eq!(button_mask("guide"), None); + } } #[cfg(test)] diff --git a/docs/hails-additions/03-sdl3-gamepad-input.md b/docs/hails-additions/03-sdl3-gamepad-input.md new file mode 100644 index 00000000..45d0eab1 --- /dev/null +++ b/docs/hails-additions/03-sdl3-gamepad-input.md @@ -0,0 +1,118 @@ +# 3. SDL3 gamepad input + +Implements upstream issue #14 ("Extending Controller support via SDL Gamepad +API"), discussed in PR #9. The Windows XInput transport remains available as a +fallback and for comparison. + +## Motivation + +- One controller API on every platform instead of XInput on Windows plus a + separate backend elsewhere (PR #9 uses gilrs on Linux/macOS). +- SDL3 supports far more controllers (PlayStation, Switch, generic HID) and + exposes features XInput cannot (extra buttons such as back paddles, rumble + on triggers, sensors, lights) for future use. + +## Design + +The gameplay path is unchanged: `skate_core::input::xbox::convert` (the TU3 +conversion with its own dead zone) still receives an XInput-shaped +`XboxState` with raw values. Only the transport in +`crates/skate-game/src/input/platform.rs` changes. + +- **Threading.** SDL must be pumped on the thread that initialised it, while + Bevy runs systems on a pool. A dedicated `sdl-gamepad` thread owns SDL, + polls every 1 ms, and publishes a per-slot snapshot behind a mutex; the + game reads the latest snapshot each frame, exactly as `XInputGetState` + returns the latest state. +- **Conversion back to XInput shape** (exact for XInput-backed devices): + - buttons → XInput `wButtons` bits (`BUTTONS` table); + - stick Y: SDL stores `~y` (positive down), so `xinput_y = !sdl_y` restores + the original value without overflow at the extremes; + - triggers: SDL expands XInput's byte as `b*257` over the full axis, then + rescales to `0..=32767`; rounding to nearest (`(v*255 + 16383) / 32767`) + returns the original byte for all 256 values. +- **Packet number** advances only when the state changes, mirroring XInput's + `dwPacketNumber`. Device subtype is reported as `XINPUT_DEVSUBTYPE_GAMEPAD`. +- **Slots.** A new pad takes its SDL player index if that is 0–3 and free + (SDL reports the XInput user index there, so the ring light matches), + otherwise the first free slot. +- **Paddles.** Optional `settings\controller.json`, + e.g. `{"paddles": {"right1": "a", "left1": "x"}}`, ORs a paddle into an + XInput button bit (names in `platform::BUTTON_NAMES`). +- **Backend selection.** SDL by default. `SKATE3_INPUT=xinput` selects the + original XInput transport (Windows), which is also the automatic fallback + if SDL fails to start. The backend starts at `Startup` so the first + gameplay frame is not stalled. +- **Diagnostics.** Each connection logs name, SDL gamepad type, + vendor/product, paddle availability and SDL driver path, e.g. + `Controller 0: SDL gamepad "Xbox One Elite 2 Controller" (XboxOne, vendor 045e product 0b22, paddles not reported, path "XInput#0")`. + +## Files + +- `crates/skate-game/src/input/platform.rs` — SDL backend, conversions, + backend selection, paddle masks, unit tests. +- `crates/skate-game/src/input.rs` — `start_controllers` startup system + (settings + early backend start); log wording. +- `crates/skate-game/src/app.rs` — comment on why Bevy's `GilrsPlugin` stays + disabled. +- `crates/skate-core/src/input/xbox.rs` — `XboxState` derives + `Clone, Copy, Debug, Default, PartialEq, Eq` (snapshots cross threads). +- `crates/skate-game/Cargo.toml` — `sdl3 = "=0.20.0"` with + `build-from-source-static` (SDL 3.4.16, statically linked, no DLL to ship). +- `scripts/Ensure-CMake.ps1` (new) — finds CMake for the SDL build: uses + `cmake` on PATH, else Visual Studio's bundled copy via `vswhere`, and sets + `CMAKE`. Dot-sourced by `Build.ps1`, `Build-Release.ps1`, + `build-multiplayer-test.ps1`. CI runners already have CMake. +- `vendor/sdl3-sys/` + root `Cargo.toml` `[patch.crates-io]` + `Cargo.lock` — + static C runtime fix, below. + +## Static C runtime (release/CI builds) + +Release packages, CI and the multiplayer test build with `+crt-static` and +static Bevy. The first release-style build failed to link: + +``` +libsdl3_sys-*.rlib(SDL_stdlib.obj) : error LNK2019: unresolved external symbol __imp_modff ... +fatal error LNK1120: 16 unresolved externals +``` + +cmake-rs passes `-MT` for `crt-static`, but SDL's CMake project enables policy +CMP0091, which ignores runtime flags in `CMAKE_C_FLAGS` and applies +`CMAKE_MSVC_RUNTIME_LIBRARY` (default `MultiThreadedDLL`). CMake has no +environment variable for this, and a `CMAKE_TOOLCHAIN_FILE` environment +variable would put cmake-rs into cross-compile mode. + +Fix: `sdl3-sys` 0.7.1+SDL-3.4.16 is vendored unmodified except `build.rs`, +which defines `CMAKE_MSVC_RUNTIME_LIBRARY` from `CARGO_CFG_TARGET_FEATURE` +(`MultiThreaded` with `crt-static`, otherwise `MultiThreadedDLL`; never the +debug CRT). Documented in `vendor/README.md`. Dropping the patch is possible +once cmake-rs or sdl3-sys handle CMP0091 themselves. + +## Verification + +- Unit tests: every trigger byte survives the SDL round trip; stick Y + inversion is exact at `i16::MIN/MAX`; paddle masks and button names; + existing controller tests (10 total in `input::platform` / + `input::controllers`) pass. +- Dev build (`scripts/Build.ps1`) and release-style build + (`+crt-static --no-default-features --target x86_64-pc-windows-msvc`) both + link; the static executable imports no `vcruntime140.dll` / + `api-ms-win-crt-*`. The dev build's SDL CMake cache shows + `MultiThreadedDLL`. +- In play: Xbox Elite Series 2 over Bluetooth LE detected as + `Controller 0 ... ready`; normal skating across several sessions. + +## Known limitations / open questions + +- **Elite paddles are not reported on Windows** with this setup. SDL picks its + XInput driver for the pad ("XInput#0"); the XInput API has no paddles. The + hints `SDL_JOYSTICK_GAMEINPUT=1`, `SDL_JOYSTICK_HIDAPI_XBOX(_ONE)=1` and + `SDL_JOYSTICK_RAWINPUT=0` made no difference; with `SDL_XINPUT_ENABLED=0` + no backend detected the Bluetooth LE pad. The paddle mapping works wherever + SDL does report paddles. +- Controller type is detected but only logged; carrying it into the game (for + button prompts, per-model defaults) is future work. Nintendo layouts keep + SDL's positional mapping on purpose. +- Linux/macOS: the backend is platform-neutral but was only built and tested + on Windows here. +- The SDL build adds about 1¾ minutes to a clean build and needs CMake. diff --git a/scripts/Build-Release.ps1 b/scripts/Build-Release.ps1 index 1118c70b..7d85ccc2 100644 --- a/scripts/Build-Release.ps1 +++ b/scripts/Build-Release.ps1 @@ -2,6 +2,7 @@ param([string]$TargetDirectory = (Join-Path (Split-Path $PSScriptRoot -Parent) ' $ProjectRoot = Split-Path $PSScriptRoot -Parent $ErrorActionPreference = 'Stop' . (Join-Path $PSScriptRoot 'Ensure-WindowsSdk.ps1') +. (Join-Path $PSScriptRoot 'Ensure-CMake.ps1') . (Join-Path $PSScriptRoot 'PowerShellCompat.ps1') Push-Location $ProjectRoot try { diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index ad94866d..798dd8e3 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -8,6 +8,7 @@ param( # Do NOT pass --no-default-features here — that static-links Bevy and takes many minutes. $ProjectRoot = Split-Path $PSScriptRoot -Parent $ErrorActionPreference = 'Stop' +. (Join-Path $PSScriptRoot 'Ensure-CMake.ps1') $sw = [Diagnostics.Stopwatch]::StartNew() Push-Location $ProjectRoot try { diff --git a/scripts/Ensure-CMake.ps1 b/scripts/Ensure-CMake.ps1 new file mode 100644 index 00000000..f9142a21 --- /dev/null +++ b/scripts/Ensure-CMake.ps1 @@ -0,0 +1,16 @@ +# Locate CMake for the statically linked SDL3 build (sdl3-sys build-from-source). +# CI runners have cmake on PATH; local installs often only have Visual Studio's copy. +$ErrorActionPreference = 'Stop' +if ($env:CMAKE -and (Test-Path -LiteralPath $env:CMAKE)) { return } +if (Get-Command cmake -ErrorAction SilentlyContinue) { return } + +$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' +if (Test-Path -LiteralPath $vswhere) { + $cmake = & $vswhere -latest -products * -find 'Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' | + Select-Object -First 1 + if ($cmake -and (Test-Path -LiteralPath $cmake)) { + $env:CMAKE = $cmake + return + } +} +throw 'CMake is required to build SDL3. Install CMake, or the "C++ CMake tools for Windows" Visual Studio component.' diff --git a/scripts/build-multiplayer-test.ps1 b/scripts/build-multiplayer-test.ps1 index ced6a720..48ce89bd 100644 --- a/scripts/build-multiplayer-test.ps1 +++ b/scripts/build-multiplayer-test.ps1 @@ -1,5 +1,6 @@ param([string]$OutputDirectory = 'bin/multiplayer') $ErrorActionPreference = 'Stop' +. (Join-Path $PSScriptRoot 'Ensure-CMake.ps1') $workspace = Split-Path -Parent $PSScriptRoot Set-Location -LiteralPath $workspace $output = [IO.Path]::GetFullPath((Join-Path $workspace $OutputDirectory)) diff --git a/vendor/README.md b/vendor/README.md index 55c26d56..e360dca0 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -95,3 +95,15 @@ Upstream references reviewed September 6, 2026: When upgrading Bevy, reassess this patch and rerun the GPU test, stationary and moving-camera benchmarks, and visual comparison. Do not assume an unchanged private renderer implementation across engine versions. + +## SDL3 static C runtime + +`sdl3-sys` is vendored from crates.io 0.7.1+SDL-3.4.16 with its original license. +The only change is in `build.rs`: when building SDL from source for an MSVC target, +it defines `CMAKE_MSVC_RUNTIME_LIBRARY` to match the C runtime Rust links +(`MultiThreaded` with `+crt-static`, as release packages and CI use; otherwise +`MultiThreadedDLL`). SDL's CMake project enables policy CMP0091, which ignores +the `-MT` flag cmake-rs adds, so without this the static-CRT link fails with +unresolved `__imp_*` CRT symbols. Development builds (`scripts/Build.ps1`) are +unaffected. When upgrading `sdl3`/`sdl3-sys`, re-vendor and reapply this change, +or drop it if upstream cmake-rs/sdl3-sys handle the runtime themselves. diff --git a/vendor/sdl3-sys/.cargo-ok b/vendor/sdl3-sys/.cargo-ok new file mode 100644 index 00000000..5f8b7958 --- /dev/null +++ b/vendor/sdl3-sys/.cargo-ok @@ -0,0 +1 @@ +{"v":1} \ No newline at end of file diff --git a/vendor/sdl3-sys/.cargo_vcs_info.json b/vendor/sdl3-sys/.cargo_vcs_info.json new file mode 100644 index 00000000..62143d73 --- /dev/null +++ b/vendor/sdl3-sys/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "f2d5bb9c7e9c0007f2cdb2c04e8235bcbc161053" + }, + "path_in_vcs": "sdl3-sys" +} \ No newline at end of file diff --git a/vendor/sdl3-sys/Cargo.lock b/vendor/sdl3-sys/Cargo.lock new file mode 100644 index 00000000..dc6a4624 --- /dev/null +++ b/vendor/sdl3-sys/Cargo.lock @@ -0,0 +1,180 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" + +[[package]] +name = "cc" +version = "1.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1" +dependencies = [ + "shlex", +] + +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "rpkg-config" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a2d2f3481209a6b42eec2fbb49063fb4e8d35b57023401495d4fe0f85c817f0" + +[[package]] +name = "sdl3-src" +version = "3.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bfd475a15a4679b94f6579aed7d52c69f3e04d80e6707712373f12903a2ef91" + +[[package]] +name = "sdl3-sys" +version = "0.7.1+SDL-3.4.16" +dependencies = [ + "ash", + "cc", + "cmake", + "libc", + "pkg-config", + "rpkg-config", + "sdl3-src", + "vcpkg", + "windows-sys", + "x11", + "x11-dl", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] diff --git a/vendor/sdl3-sys/Cargo.toml b/vendor/sdl3-sys/Cargo.toml new file mode 100644 index 00000000..a062c30d --- /dev/null +++ b/vendor/sdl3-sys/Cargo.toml @@ -0,0 +1,204 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2024" +rust-version = "1.85" +name = "sdl3-sys" +version = "0.7.1+SDL-3.4.16" +authors = ["Maia S Ravn "] +build = "build.rs" +links = "SDL3" +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Low level Rust bindings for SDL 3" +documentation = "https://docs.rs/sdl3-sys" +readme = "README.md" +keywords = [ + "sdl", + "windowing", + "graphics", + "multimedia", + "gamedev", +] +categories = [ + "external-ffi-bindings", + "rendering", + "game-development", + "multimedia", + "no-std", +] +license = "Zlib" +repository = "https://codeberg.org/maia/sdl3-sys-rs" + +[package.metadata.docs.rs] +all-features = true + +[features] +assert-level-debug = [] +assert-level-disabled = [] +assert-level-paranoid = [] +assert-level-release = [] +build-from-source = [ + "dep:cc", + "dep:cmake", + "dep:rpkg-config", + "dep:sdl3-src", +] +build-from-source-static = [ + "build-from-source", + "link-static", +] +debug-impls = [] +default = [ + "use-pkg-config", + "use-vcpkg", +] +display-impls = [] +link-framework = [] +link-static = [] +metadata = [] +nightly = [] +no-default-subsystems = [ + "no-sdl-audio", + "no-sdl-video", + "no-sdl-gpu", + "no-sdl-render", + "no-sdl-camera", + "no-sdl-joystick", + "no-sdl-haptic", + "no-sdl-hidapi", + "no-sdl-power", + "no-sdl-sensor", + "no-sdl-dialog", + "no-sdl-tray", +] +no-link = [] +no-sdl-asan = [] +no-sdl-audio = [] +no-sdl-camera = [] +no-sdl-ccache = [] +no-sdl-dialog = [] +no-sdl-gpu = [] +no-sdl-gpu-dxvk = [] +no-sdl-haptic = [] +no-sdl-hidapi = [] +no-sdl-joystick = [] +no-sdl-lean-and-mean = [] +no-sdl-libc = [] +no-sdl-power = [] +no-sdl-render = [] +no-sdl-rpath = [] +no-sdl-sensor = [] +no-sdl-tray = [] +no-sdl-unix-console-build = [] +no-sdl-video = [] +only-metadata = [ + "metadata", + "no-link", +] +sdl-asan = [] +sdl-audio = [] +sdl-camera = ["sdl-video"] +sdl-ccache = [] +sdl-dialog = [] +sdl-gpu = ["sdl-video"] +sdl-gpu-dxvk = [] +sdl-haptic = [] +sdl-hidapi = [] +sdl-joystick = [] +sdl-lean-and-mean = [] +sdl-libc = [] +sdl-power = [] +sdl-render = ["sdl-video"] +sdl-rpath = [] +sdl-sensor = [] +sdl-tray = [] +sdl-unix-console-build = [] +sdl-video = [] +target-gdk = [] +use-ash-v0-38 = ["dep:ash-v0-38"] +use-libc-v0-2 = ["dep:libc-v0-2"] +use-pkg-config = ["dep:pkg-config"] +use-vcpkg = ["dep:vcpkg"] +use-windows-sys-v0-59 = ["dep:windows-sys-v0-59"] +use-windows-sys-v0-60 = ["use-windows-sys-v0-59"] +use-x11-dl-v2 = ["dep:x11-dl-v2"] +use-x11-v2 = ["dep:x11-v2"] + +[lib] +name = "sdl3_sys" +path = "src/lib.rs" + +[[example]] +name = "demo-01-snake" +path = "examples/demo-01-snake.rs" + +[[example]] +name = "minimal" +path = "examples/minimal.rs" + +[dependencies.ash-v0-38] +version = "0.38" +optional = true +default-features = false +package = "ash" + +[dependencies.libc-v0-2] +version = "0.2" +optional = true +default-features = false +package = "libc" + +[dependencies.windows-sys-v0-59] +version = ">=0.59, <=0.61" +features = ["Win32_UI_WindowsAndMessaging"] +optional = true +package = "windows-sys" + +[dependencies.x11-dl-v2] +version = "2.21" +optional = true +package = "x11-dl" + +[dependencies.x11-v2] +version = "2.21" +optional = true +package = "x11" + +[dev-dependencies] + +[build-dependencies.cc] +version = "1.2" +optional = true + +[build-dependencies.cmake] +version = "0.1" +optional = true + +[build-dependencies.pkg-config] +version = "0.3" +optional = true + +[build-dependencies.rpkg-config] +version = "0.1.2" +optional = true + +[build-dependencies.sdl3-src] +version = "=3.4.16" +optional = true + +[build-dependencies.vcpkg] +version = "0.2" +optional = true diff --git a/vendor/sdl3-sys/Cargo.toml.orig b/vendor/sdl3-sys/Cargo.toml.orig new file mode 100644 index 00000000..e1a65012 --- /dev/null +++ b/vendor/sdl3-sys/Cargo.toml.orig @@ -0,0 +1,204 @@ +[package] +name = "sdl3-sys" +version = "0.7.1+SDL-3.4.16" +edition = "2024" +rust-version = "1.85" +authors = ["Maia S Ravn "] +license = "Zlib" +description = "Low level Rust bindings for SDL 3" +repository = "https://codeberg.org/maia/sdl3-sys-rs" +documentation = "https://docs.rs/sdl3-sys" +keywords = ["sdl", "windowing", "graphics", "multimedia", "gamedev"] +categories = [ + "external-ffi-bindings", + "rendering", + "game-development", + "multimedia", + "no-std", +] +links = "SDL3" + +[features] +default = ["use-pkg-config", "use-vcpkg"] + +# Build and link SDL 3 from source instead of linking a pre-existing library +build-from-source = ["dep:cc", "dep:cmake", "dep:rpkg-config", "dep:sdl3-src"] + +# Build and link a static SDL library from source +build-from-source-static = ["build-from-source", "link-static"] + +# Link SDL as a static library. The default is to link a shared/dynamic library. +link-static = [] + +# Link SDL as an Apple framework. The link-static feature has no effect if this is enabled. +link-framework = [] + +# Don't link anything, and provide linking flags via Cargo metadata. +no-link = [] + +# When building from source, use the `SDL_UNIX_CONSOLE_BUILD` flag to disable the X11 dependency +# and build a console-only version of SDL. This has no effect when not building from source. +sdl-unix-console-build = [] +no-sdl-unix-console-build = [] + +# Use pkg-config to get link flags for SDL. Only used when not building from source. +# This has no effect if the link-framework feature is enabled. +use-pkg-config = ["dep:pkg-config"] + +# Use vcpkg to get link flags for SDL. Only used when not building from source. +# The link-static feature has no effect when using vcpkg. +# This has no effect if the link-framework feature is enabled. +use-vcpkg = ["dep:vcpkg"] + +# Enable APIs that require Microsoft's Game Development Kit (GDK). +# (This is not related to Gnome's GDK) +target-gdk = [] + +# These are mutually exlusive; if more than one is enabled, the former in the list is used +# (so e.g. disabled overrides release). If none are selected, either release or debug will +# be enabled based on the build profile +assert-level-disabled = [] +assert-level-release = [] +assert-level-debug = [] +assert-level-paranoid = [] + +# Implement the Debug trait for applicable types +debug-impls = [] + +# Implement the Display trait for applicable types +display-impls = [] + +# Enable metadata +metadata = [] +only-metadata = ["metadata", "no-link"] + +# Enable nightly features +nightly = [] + +# Optional integrations +use-ash-v0-38 = ["dep:ash-v0-38"] +use-libc-v0-2 = ["dep:libc-v0-2"] +use-windows-sys-v0-59 = ["dep:windows-sys-v0-59"] +use-x11-v2 = ["dep:x11-v2"] +use-x11-dl-v2 = ["dep:x11-dl-v2"] + +# Retained for backwards compatibility +use-windows-sys-v0-60 = ["use-windows-sys-v0-59"] + +# Subsystems to enable when building from source. +# By default, everything is autodetected and enabled if available +no-default-subsystems = [ + "no-sdl-audio", + "no-sdl-video", + "no-sdl-gpu", + "no-sdl-render", + "no-sdl-camera", + "no-sdl-joystick", + "no-sdl-haptic", + "no-sdl-hidapi", + "no-sdl-power", + "no-sdl-sensor", + "no-sdl-dialog", + "no-sdl-tray", +] +sdl-audio = [] +sdl-video = [] +sdl-gpu = ["sdl-video"] +sdl-render = ["sdl-video"] +sdl-camera = ["sdl-video"] +sdl-joystick = [] +sdl-haptic = [] +sdl-hidapi = [] +sdl-power = [] +sdl-sensor = [] +sdl-dialog = [] +sdl-tray = [] +no-sdl-audio = [] +no-sdl-video = [] +no-sdl-gpu = [] +no-sdl-render = [] +no-sdl-camera = [] +no-sdl-joystick = [] +no-sdl-haptic = [] +no-sdl-hidapi = [] +no-sdl-power = [] +no-sdl-sensor = [] +no-sdl-dialog = [] +no-sdl-tray = [] + +# Misc CMake options for when building from source +sdl-asan = [] +sdl-ccache = [] +sdl-libc = [] +sdl-rpath = [] +no-sdl-asan = [] +no-sdl-ccache = [] +no-sdl-libc = [] +no-sdl-rpath = [] + +# Not currently used by SDL, retained for backwards compatibility +sdl-gpu-dxvk = [] +no-sdl-gpu-dxvk = [] + +# Define SDL_LEAN_AND_MEAN when compiling SDL (disabled by default) +sdl-lean-and-mean = [] +no-sdl-lean-and-mean = [] + +[package.metadata.docs.rs] +all-features = true + +[dependencies.ash-v0-38] +package = "ash" +version = "0.38" +default-features = false +optional = true + +[dependencies.libc-v0-2] +package = "libc" +version = "0.2" +default-features = false +optional = true + +[dependencies.windows-sys-v0-59] +package = "windows-sys" +version = ">=0.59, <=0.61" +optional = true +features = ["Win32_UI_WindowsAndMessaging"] + +[dependencies.x11-v2] +package = "x11" +version = "2.21" +optional = true + +[dependencies.x11-dl-v2] +package = "x11-dl" +version = "2.21" +optional = true + +[build-dependencies.cc] +version = "1.2" +optional = true + +[build-dependencies.cmake] +version = "0.1" +optional = true + +[build-dependencies.pkg-config] +version = "0.3" +optional = true + +[build-dependencies.rpkg-config] +version = "0.1.2" +optional = true + +[build-dependencies.sdl3-src] +version = "=3.4.16" +path = "../sdl3-src" +optional = true + +[build-dependencies.vcpkg] +version = "0.2" +optional = true + +[dev-dependencies] +sdl3-main = { path = "../sdl3-main" } diff --git a/vendor/sdl3-sys/ChangeLog.md b/vendor/sdl3-sys/ChangeLog.md new file mode 100644 index 00000000..e029d293 --- /dev/null +++ b/vendor/sdl3-sys/ChangeLog.md @@ -0,0 +1,134 @@ +# Changes + +- 0.7.1: + - Make non-exhaustive marker fields public so that `..Default::default()` can be used with + initialization syntax. (`#[non_exhaustive]` can't be used with FFI structs) + +- 0.7.0: + - Update SDL to 3.4.16 + - Make all event structs non-exhaustive, because SDL may add fields to them in the future. + If you need to construct an event struct yourself, you can use `Default::default()`. + +- 0.6.8: + - Update SDL to 3.4.14 + +- 0.6.7: + - Update SDL to 3.4.12 + +- 0.6.6: + - Update SDL to 3.4.10 + - Enable `use-pkg-config` and `use-vcpkg` features by default + - Replace use of deprecated `cdecl` and `stdcall` ABIs with equivalent non-deprecated ones + - Fix Android builds being built for the wrong arch (Thanks to Archee) + +- 0.6.5: + - Update SDL to 3.4.8 (hotfix) + +- 0.6.4: + - Update SDL to 3.4.6 + +- 0.6.3: + - Add features for selecting which subsystems to include when building from source + +- 0.6.2: + - Update SDL to 3.4.4 + - Require exact version match for source crate when building from source (fix for Android) + +- 0.6.1: + - Update SDL to 3.4.2 + - Add `new` and `value` assoc function/method for groups (ids, enums, etc) + - impl Display for ids under the `display-impls` feature + - Add metadata for structs and unions + +- 0.6.0: + - Update SDL to 3.4.0 + - Make IDs and flag types newtypes + - Add metadata + - Remove deprecated aliases + - Change return type of `SDL_Vulkan_GetVkGetInstanceProcAddr` + - Make some functions safe and/or const + - Add `SDL_Event::event_type()` + - Add `display-impls` feature + - MSRV 1.85 + +- 0.5.12 + - Update SDL to 3.2.30 + - Fix copying the built library when cross compiling + +- 0.5.11 + - Update SDL to 3.2.28 + +- 0.5.10 + - Update SDL to 3.2.26 + +- 0.5.9 + - Fix copy/paste error in 0.5.8 that prevented building from source from working + (Thanks to Hudson Regis) + +- 0.5.8: + - Fix compiling for Windows and Android when building from source + (Thanks to Andrew Minnich and abnormalmaps) + - Add support for SDL_LEAN_AND_MEAN + +- 0.5.7: + - Fix docs.rs docs + +- 0.5.6: + - Update SDL to 3.2.24 + - Fix an issue where creating symlinks after a build could fail + - Support windows-sys 0.61 (compatible with 0.59 and 0.60) + +- 0.5.5: + - Update SDL to 3.2.22 + +- 0.5.4: + - Update SDL to 3.2.20 + +- 0.5.3: + - Update SDL to 3.2.18 + - Copy built library to top level target dir on all targets, not just Windows. + +- 0.5.2: + - Update SDL to 3.2.16 + +- 0.5.1: + - Update SDL to 3.2.14 + - Add deprecation warning to padding fields. These shouldn't be accessed directly; + use `..Default::default()` to init them with struct update syntax. + +- 0.5.0: + - Update SDL to 3.2.12 + +- 0.4.9: + - Revert SDL to 3.2.10 to fix semver break in 0.4.8. + +- 0.4.8 (yanked): + - Update SDL to 3.2.12 (reverted in 0.4.9; moved to sdl3-sys 0.5) + - Add `no-link` feature + - Add more SDL CMake features for use when building from source + - On Apple targets, look for frameworks in `~/Library/Frameworks` too + +- 0.4.7: + - Update SDL to 3.2.10 + - Derive `PartialEq`/`Eq`/`Hash` traits for applicable types + +- 0.4.6: + - Update SDL to 3.2.8 + +- 0.4.5: + - Update SDL to 3.2.6 + +- 0.4.4: + - Update SDL to 3.2.4 + +- 0.4.3: + - Update SDL to 3.2.2 + +- 0.4.2: + - Add homebrew to library search path on macos (fix for Apple Silicon) + +- 0.4.1: + - Fix linking on Fedora and other Linux distros that use lib64 + +- 0.4.0: + - First stable release of SDL 3 diff --git a/vendor/sdl3-sys/LICENSE.md b/vendor/sdl3-sys/LICENSE.md new file mode 100644 index 00000000..e7a1e1b2 --- /dev/null +++ b/vendor/sdl3-sys/LICENSE.md @@ -0,0 +1,19 @@ +zlib License + +(C) 2024-2025 Maia S Ravn + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. diff --git a/vendor/sdl3-sys/README.md b/vendor/sdl3-sys/README.md new file mode 100644 index 00000000..86956562 --- /dev/null +++ b/vendor/sdl3-sys/README.md @@ -0,0 +1,206 @@ +# sdl3-sys: Low level Rust bindings for SDL 3 + +These are low level Rust bindings for SDL, the [Simple DirectMedia Layer](https://libsdl.org). +This version of `sdl3-sys` has bindings for SDL versions `3.2.0` to `3.4.16`, inclusive. + +`sdl3-sys` works out of the box on any target that SDL 3 supports and doesn't require anything +else if the SDL library is installed or otherwise available. On targets that support it you can +use `pkg-config` or `vcpkg` to locate the SDL library if required (see below). + +If the SDL library isn't already available, you have the option of building it from source as +part of the build (see below), which requires CMake, a C compiler, and any dependencies that SDL +needs to build on your target. +Builds for web are supported via Emscripten (`wasm32-unknown-emscripten`). + +SDL 3's callback API can be used via the [`sdl3-main`](https://crates.io/crates/sdl3-main) crate. + +> ⓘ *Most of the docs are generated directly from the original C headers, which documents how* +> *SDL works in C. Using it from Rust might work differently in some cases.* +> *For example, macros in C are usually translated to constants or constant* +> *functions in Rust, but the docs may still refer to them as macros.* +> *Documentation specific to these Rust bindings are tagged with `sdl3-sys`.* + +[Browse the API at docs.rs!](https://docs.rs/sdl3-sys) + +## Related crates + +### Add-ons and satellite libraries + +- [`sdl3-main`](https://crates.io/crates/sdl3-main): Tools for using SDL's main and callback interface +- [`sdl3-image-sys`](https://crates.io/crates/sdl3-image-sys): Bindings for SDL3_image +- [`sdl3-mixer-sys`](https://crates.io/crates/sdl3-mixer-sys): Bindings for SDL3_mixer +- [`sdl3-net-sys`](https://crates.io/crates/sdl3-net-sys): Bindings for SDL3_net +- [`sdl3-sound-sys`](https://crates.io/crates/sdl3-sound-sys): Bindings for SDL_sound 3 +- [`sdl3-ttf-sys`](https://crates.io/crates/sdl3-ttf-sys): Bindings for SDL3_ttf + +Other satellite libraries aren't stable yet, and will be released as they're available. + +### Higher level bindings using `sdl3-sys` + +- [`sdl3`](https://crates.io/crates/sdl3): An evolution of the `sdl2` crate + +## Usage + +`sdl3-sys` is compatible with SDL version `3.1.3` or later. +Some APIs require later versions; you can check availability in the documentation. +The latest available stable release is recommended. + +By default, `sdl3-sys` will attempt to link to a dynamic/shared library named +`SDL3` in the default library search path, using the usual platform specific naming +convention for libraries. You can change this behaviour with the following feature flags. + +| Feature | Description | +| ------- | ----------- | +| `use-pkg-config` | Use `pkg-config` to find and link the SDL 3 library (enabled by default). | +| `use-vcpkg` | Use `vcpkg` to find and link the SDL 3 library (enabled by default). | +| `build-from-source` | Build and link SDL 3 from source. You need CMake, a C compiler, and any dependencies SDL needs to build for your target. See below for details. | +| `build-from-source-static` | Shortcut for enabling both the `build-from-source` and `link-static` features. This should no longer be necessary. | +| `link-framework` | Link to a framework on Apple targets. This currently requires `SDL3.xcframework` to be located at `~/Library/Frameworks` or `/Library/Frameworks`. The built executable has to be put in a signed app bundle to be able to run. | +| `link-static` | Link SDL statically. SDL doesn't recommend doing this.
  • On targets that only support static linking, such as emscripten, you don't have to enable this feature.
  • On Apple targets, this currently requires frameworks that should be optional.
| +| `no-link` | Don't link anything, and provide linking flags via Cargo metadata so you can do manual linking if desired. | + +### Building from source + +Typically it's better to use a prebuilt SDL library and simply configure `sdl3-sys` to use that if required (see above), +but sometimes building from source can be convenient. Building from source needs CMake, a C compiler, and any +dependencies SDL needs to build for your target. + +- For many platforms, including Windows and macOS, this is just the standard OS SDK. +- For builds for the web, you need the [Emscripten SDK](https://emscripten.org/). Make sure that is activated + and build for the `wasm32-unknown-emscripten` target. Emscripten builds of SDL are always statically linked. +- Building for Linux needs [many libraries](https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md) + for full support, but you can leave out anything you don't need. + +When building from source with the `build-from-source` feature flag, you can enable the features +below to configure the build. They have no effect when not building from source. +Most of them correspond to SDL CMake variables. You can prefix them with `no-` to disable them, +e.g. `no-sdl-libc` to not link with the system C library. If you both enable and disable a +feature, enable takes precedence. + +Most of these features only work on some targets; don't enable them unless you need them. + +| Feature | Description | +| ------------------------ | ----------- | +| `sdl-asan` | Compile SDL with Address Sanitizer. | +| `sdl-ccache` | Compile SDL with Ccache. | +| `sdl-lean-and-mean` | Define SDL_LEAN_AND_MEAN when building SDL (disabled by default). | +| `sdl-libc` | Link SDL with system C library (default). Use `no-sdl-libc` to disable. | +| `sdl-rpath` | Set RPATH when linking SDL (default on some targets). Use `no-sdl-rpath` to disable. | +| `sdl-unix-console-build` | Allow building SDL without X11 or Wayland support on Linux and other targets that usually use X11/Wayland. By default, SDL requires either X11 or Wayland on these targets as a sanity check. | + +#### Subsystems + +These features are only used when building from source. + +By default, subsystems are autodetected at build time and all available subsystems are enabled. If you +want more control over which subsystems are enabled, you can use these features. Prefix `no-` to a +feature name to disable the subsytem associated with that feature. + +As before, positive features override negative features, so e.g. enabling both the `no-sdl-audio` and +`sdl-audio` features will enable the audio subsystem. You can use the `no-default-subsystems` feature +to disable all subsystems by default, so for example, if you enable both of the `no-default-subsystems` +and `sdl-audio` features, only the audio subsystem will be enabled, and all other subsystems disabled. + +APIs for disabled subsystems are still available, but will fail if initialized/used. + +If you want a really slimmed down (but less capable) SDL, also see the `sdl-lean-and-mean` feature. + +| Feature | Description | +| -------------- | ----------- | +| `no-default-subsystems` | Disable all subsystems by default. Combine this with the features for the subsystems you want below to enable only those subsystems. | +| `sdl-audio` | Enable the Audio subsystem | +| `sdl-video` | Enable the Video subsystem | +| `sdl-gpu` | Enable the GPU subsystem (implies `sdl-video`) | +| `sdl-render` | Enable the Render subsystem (implies `sdl-video`) | +| `sdl-camera` | Enable the Camera subsystem (implies `sdl-video`) | +| `sdl-joystick` | Enable the Joystick subsystem | +| `sdl-haptic` | Enable the Haptic subsystem | +| `sdl-hidapi` | Enable the HIDAPI subsystem | +| `sdl-power` | Enable the Power subsystem | +| `sdl-sensor` | Enable the Sensor subsystem | +| `sdl-dialog` | Enable the Dialog subsystem | +| `sdl-tray` | Enable the Tray subsystem | + +### Target specific features + +These features are always available, but only make sense for some targets. + +| Feature | Description | +| ------- | ----------- | +| `target-gdk` | Enable APIs that require Microsoft's Game Development Kit (GDK). (This is not related to Gnome's GDK.) | + +### Optional integrations + +These features are always available, but some of them only make sense for some targets. + +`sdl3-sys` can use definitions from other crates for some foreign types that it needs, +e.g. for Vulkan types. By default it'll use opaque structs or pointers to opaque structs +for these types unless otherwise specified. + +| Feature | Description | +| ------- | ----------- | +| `use-ash-v0-38` | Use Vulkan types from the `ash` crate (v0.38). | +| `use-libc-v0-2` | Use `wchar_t` type from the `libc` crate (v0.2). By default `sdl3-sys` will alias `wchar_t` to `u16` on Windows and `u32` otherwise. | +| `use-windows-sys-*` | Use Windows types from the `windows-sys` crate.
  • `use-windows-sys-v0-59`: v0.59 or compatible (currently 0.59..=0.61)
| +| `use-x11-v2` | Use X11 types from the `x11` crate (v2). | +| `use-x11-dl-v2` | Use X11 types from the `x11-dl` crate (v2). | + +### Assert level + +These features are always available. + +You can set the default assertion level for SDL using the `assert-level-*` features. +This affects the assert macros in the `assert` module and the value of the `SDL_ASSERT_LEVEL` +constant. + +If no `assert-level-*` features are enabled, `assert-level-debug` will be enabled by default +for debug builds, and `assert-level-release` otherwise. + +These features are mutually exclusive. Features higher in this list override later ones. + +| Feature | Description | +| ------- | ----------- | +| `assert-level-disabled` | 0: All SDL assertion macros are disabled. | +| `assert-level-release` | 1: Release settings: `SDL_assert` disabled, `SDL_assert_release` enabled. | +| `assert-level-debug` | 2: Debug settings: `SDL_assert` and `SDL_assert_release` enabled. | +| `assert-level-paranoid` | 3: Paranoid settings: All SDL assertion macros enabled, including `SDL_assert_paranoid`. | + +### Other features + +These features are always available. + +| Feature | Description | +| ------- | ----------- | +| `debug-impls` | Implement the `Debug` trait for most SDL types. | +| `display-impls` | Implement the `Display` trait for applicable SDL types. | +| `metadata` | Enable metadata. Also see `only-metadata`. | +| `only-metadata` | Shortcut for enabling both the `metadata` and `no-link` features. Recommended when you need metadata but don't need to call into SDL, e.g. for build scripts. | +| `nightly` | Enable features that need the nightly compiler. This enables the `VaList` type, as well as enabling some intrinsics. | + +## Recent changes + +- 0.7.1: + - Make non-exhaustive marker fields public so that `..Default::default()` can be used with + initialization syntax. (`#[non_exhaustive]` can't be used with FFI structs) + +- 0.7.0: + - Update SDL to 3.4.16 + - Make all event structs non-exhaustive, because SDL may add fields to them in the future. + If you need to construct an event struct yourself, you can use `Default::default()`. + +- 0.6.8: + - Update SDL to 3.4.14 + +- 0.6.7: + - Update SDL to 3.4.12 + +- 0.6.6: + - Update SDL to 3.4.10 + - Enable `use-pkg-config` and `use-vcpkg` features by default + - Replace use of deprecated `cdecl` and `stdcall` ABIs with equivalent non-deprecated ones + - Fix Android builds being built for the wrong arch (Thanks to Archee) + +- 0.6.5: + - Update SDL to 3.4.8 (hotfix) + +See ChangeLog.md for older changes diff --git a/vendor/sdl3-sys/build-common.rs b/vendor/sdl3-sys/build-common.rs new file mode 100644 index 00000000..2799c61e --- /dev/null +++ b/vendor/sdl3-sys/build-common.rs @@ -0,0 +1,604 @@ +// to edit this file, please edit `build-common.rs` in the repo root and run generate-and-check.sh +// other copies of this file will get overwritten + +use std::{collections::BTreeMap, env, error::Error, fs::read_to_string, sync::OnceLock}; + +#[cfg(feature = "build-from-source")] +type BuildConfig = cmake::Config; +#[cfg(not(feature = "build-from-source"))] +type BuildConfig = (); + +#[allow(unused)] +macro_rules! cmake_vars { + ($config:ident => $($cvar:ident),* $(,)?) => { + $( + let cvar = stringify!($cvar); + if env::var_os(format!("CARGO_FEATURE_NO_{cvar}")).is_some() { + $config.define(cvar, "OFF"); + } + if env::var_os(format!("CARGO_FEATURE_{cvar}")).is_some() { + $config.define(cvar, "ON"); + } + )* + } +} + +#[derive(Clone, Copy, PartialEq, Eq)] +enum LinkKind { + Default, + Static, +} + +#[derive(Debug)] +enum LinkFlag { + SearchLib(String), + SearchFramework(String), + Lib(String), + StaticLib(String), + Framework(String), + #[allow(dead_code)] + WeakFramework(String), +} + +#[derive(Default)] +struct LinkFlags(Vec); + +impl LinkFlags { + fn search_lib(&mut self, s: impl ToString) { + self.0.push(LinkFlag::SearchLib(s.to_string())); + } + + fn search_framework(&mut self, s: impl ToString) { + self.0.push(LinkFlag::SearchFramework(s.to_string())); + } + + fn link_lib(&mut self, s: impl ToString) { + self.0.push(LinkFlag::Lib(s.to_string())); + } + + fn link_static_lib(&mut self, s: impl ToString) { + self.0.push(LinkFlag::StaticLib(s.to_string())); + } + + fn link_framework(&mut self, s: impl ToString) { + self.0.push(LinkFlag::Framework(s.to_string())); + } + + #[allow(dead_code)] + fn link_weak_framework(&mut self, s: impl ToString) { + self.0.push(LinkFlag::WeakFramework(s.to_string())); + } + + fn send_to_cargo_link_flags(self) { + for flag in self.0.iter() { + match flag { + LinkFlag::SearchLib(path) => { + println!("cargo::rustc-link-search=native={path}"); + } + LinkFlag::SearchFramework(path) => { + println!("cargo::rustc-link-search=framework={path}"); + } + LinkFlag::Lib(lib) => { + println!("cargo::rustc-link-lib={lib}"); + } + LinkFlag::StaticLib(lib) => { + println!("cargo::rustc-link-lib=static={lib}"); + } + LinkFlag::Framework(lib) | LinkFlag::WeakFramework(lib) => { + // FIXME: rust doesn't support weak linking to frameworks for normal crates + println!("cargo::rustc-link-lib=framework={lib}"); + } + } + } + } + + fn send_to_cargo_metadata(self) { + let mut search_libs = String::new(); + let mut search_frameworks = String::new(); + let mut libs = String::new(); + let mut static_libs = String::new(); + let mut frameworks = String::new(); + let mut weak_frameworks = String::new(); + let mut clang = String::new(); + let sep = ';'; + for flag in self.0.iter() { + match flag { + LinkFlag::SearchLib(path) => { + assert!( + !path.contains(sep), + "library search path contains `{sep}`: {path}" + ); + if !search_libs.is_empty() { + search_libs.push(sep); + } + search_libs.push_str(path); + if !clang.is_empty() { + clang.push(sep); + } + clang.push_str("-L"); + clang.push_str(path); + } + LinkFlag::SearchFramework(path) => { + assert!( + !path.contains(sep), + "framework search path contains `{sep}`: {path}" + ); + if !search_frameworks.is_empty() { + search_frameworks.push(sep); + } + search_frameworks.push_str(path); + if !clang.is_empty() { + clang.push(sep); + } + clang.push_str("-F"); + clang.push_str(path); + } + LinkFlag::Lib(lib) => { + assert!(!lib.contains(sep), "library name contains `{sep}`: {lib}"); + if !libs.is_empty() { + libs.push(sep); + } + libs.push_str(lib); + if !clang.is_empty() { + clang.push(sep); + } + clang.push_str("-l"); + clang.push_str(lib); + } + LinkFlag::StaticLib(lib) => { + assert!( + !lib.contains(sep), + "static library name contains `{sep}`: {lib}" + ); + if !static_libs.is_empty() { + static_libs.push(sep); + } + static_libs.push_str(lib); + if !clang.is_empty() { + clang.push(sep); + } + clang.push_str("-Wl,-Bstatic"); + clang.push(sep); + clang.push_str("-l"); + clang.push(sep); + clang.push_str(lib); + clang.push(sep); + clang.push_str("-Wl,-Bdynamic"); + } + LinkFlag::Framework(lib) => { + assert!(!lib.contains(sep), "framework name contains `{sep}`: {lib}"); + if !frameworks.is_empty() { + frameworks.push(sep); + } + frameworks.push_str(lib); + if !clang.is_empty() { + clang.push(sep); + } + clang.push_str("-framework"); + clang.push(sep); + clang.push_str(lib); + } + LinkFlag::WeakFramework(lib) => { + assert!( + !lib.contains(sep), + "weak framework name contains `{sep}`: {lib}" + ); + if !weak_frameworks.is_empty() { + weak_frameworks.push(sep); + } + weak_frameworks.push_str(lib); + if !clang.is_empty() { + clang.push(sep); + } + clang.push_str("-weak_framework"); + clang.push(sep); + clang.push_str(lib); + } + } + } + println!("cargo::metadata=LINK_FLAGS_SEARCH_LIBS={search_libs}"); + println!("cargo::metadata=LINK_FLAGS_SEARCH_FRAMEWORKS={search_frameworks}"); + println!("cargo::metadata=LINK_FLAGS_LIBS={libs}"); + println!("cargo::metadata=LINK_FLAGS_STATIC_LIBS={static_libs}"); + println!("cargo::metadata=LINK_FLAGS_FRAMEWORKS={frameworks}"); + println!("cargo::metadata=LINK_FLAGS_WEAK_FRAMEWORKS={weak_frameworks}"); + println!("cargo::metadata=LINK_FLAGS_CLANG={clang}"); + } +} + +fn config(key: &str) -> &str { + struct Config { + map: BTreeMap, + } + + static CONFIG: OnceLock = OnceLock::new(); + + CONFIG + .get_or_init(|| { + let config_file = "config.txt"; + let config = read_to_string(config_file) + .unwrap_or_else(|e| panic!("error reading {config_file}: {e}")); + let mut map = BTreeMap::new(); + for line in config.lines() { + let (key, value) = line + .split_once(":") + .unwrap_or_else(|| panic!("invalid config line: `{line}`")); + let (key, value) = (key.trim(), value.trim()); + if let Some(prev) = map.insert(key.to_owned(), value.to_owned()) { + panic!("config key `{key}` already set to `{prev}`, new value `{value}`"); + } + } + Config { map } + }) + .map + .get(key) + .unwrap_or_else(|| panic!("config key {key} not set")) +} + +#[cfg(all(feature = "build-from-source", not(feature = "link-static")))] +// based on find_cargo_target_dir from sdl2-sys +fn top_level_cargo_target_dir() -> std::path::PathBuf { + use std::path::PathBuf; + let pkg_name = env::var("CARGO_PKG_NAME").unwrap(); + let out_dir = env::var_os("OUT_DIR").unwrap(); + let mut target = PathBuf::from(&out_dir); + let pop = |target: &mut PathBuf| assert!(target.pop(), "malformed OUT_DIR: {:?}", out_dir); + while !target + .file_name() + .unwrap() + .to_string_lossy() + .contains(&pkg_name) + { + pop(&mut target); + } + pop(&mut target); + pop(&mut target); + target +} + +#[cfg(all(feature = "build-from-source", not(feature = "link-framework")))] +fn find_and_output_cmake_dir_metadata(out_dir: &std::path::Path) -> Result<(), Box> { + use std::path::{Path, PathBuf}; + fn try_dir(dir: &Path) -> bool { + if dir + .join(format!("{}Config.cmake", config("lib_name"))) + .exists() + { + println!("cargo::metadata=CMAKE_DIR={}", dir.display()); + true + } else { + false + } + } + let lib_name = config("lib_name"); + if try_dir(&out_dir.join(PathBuf::from_iter(["lib", "cmake", lib_name]))) + || try_dir(&out_dir.join(PathBuf::from_iter(["lib64", "cmake", lib_name]))) + || try_dir(&out_dir.join("cmake")) + { + Ok(()) + } else { + Err(format!("cmake dir not found in {}", out_dir.display()).into()) + } +} + +fn build( + f: impl FnOnce(&mut BuildConfig) -> Result<(), Box>, +) -> Result<(), Box> { + let _ = &f; + + if cfg!(feature = "no-link") || env::var("DOCS_RS").is_ok() { + // don't build/link with no-link feature or on docs.rs + } else { + let do_link = !cfg!(feature = "no-link"); + let mut link_flags = LinkFlags::default(); + + let link_kind = if cfg!(feature = "link-static") { + LinkKind::Static + } else { + LinkKind::Default + }; + + let lib_name = config("lib_name"); + + #[cfg(feature = "build-from-source")] + { + use rpkg_config::{Link, PkgConfig}; + use std::path::Path; + + let package_name = config("package_name"); + + let mut build_config = BuildConfig::new(SOURCE_DIR); + + // workaround for android builds being built for the wrong arch + // TODO: find out why cmake/cc does the wrong thing + if env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" { + let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + let (abi, processor) = match target_arch.as_str() { + "aarch64" => ("arm64-v8a", "arm64"), + "arm" => ("armeabi-v7a", "arm"), + "x86_64" => ("x86_64", "x86_64"), + "x86" => ("x86", "x86"), + other => (other, other), + }; + build_config.define("ANDROID_ABI", abi); + build_config.define("CMAKE_SYSTEM_NAME", "Android"); + build_config.define("CMAKE_SYSTEM_PROCESSOR", processor); + } + + f(&mut build_config)?; + let out_dir = build_config.build(); + println!("cargo::metadata=OUT_DIR={}", out_dir.display()); + + if let Ok(cfg) = PkgConfig::open( + &out_dir.join(format!("lib/pkgconfig/{package_name}.pc")), + ) + .or_else(|_| { + PkgConfig::open(&out_dir.join(format!("lib64/pkgconfig/{package_name}.pc"))) + }) { + for link in cfg.libs_with_private(cfg!(feature = "link-static"))? { + match link { + Link::SearchLib(path) => { + link_flags.search_lib(path.display()); + } + + Link::SearchFramework(path) => { + link_flags.search_framework(path.display()); + } + + Link::Lib(path) => { + if path == Path::new(lib_name) { + match link_kind { + LinkKind::Static => { + if env::var("CARGO_CFG_TARGET_ENV").unwrap() == "msvc" { + link_flags + .link_static_lib(format!("{lib_name}-static")); + } else { + link_flags.link_static_lib(path.display()); + } + } + LinkKind::Default => { + link_flags.link_lib(path.display()); + } + } + } else { + link_flags.link_lib(path.display()); + } + } + + Link::Framework(path) => { + link_flags.link_framework(path.display()); + } + + Link::WeakFramework(path) => { + link_flags.link_weak_framework(path.display()); + } + + _ => (), + }; + } + } else if LINK_FRAMEWORK { + link_flags.search_framework(out_dir.display()); + link_flags.link_framework(lib_name); + } else { + link_flags.search_lib(out_dir.display()); + link_flags.search_lib(format!("{}/lib", out_dir.display())); + link_flags.search_lib(format!("{}/lib64", out_dir.display())); + match link_kind { + LinkKind::Static => link_flags.link_static_lib(lib_name), + LinkKind::Default => link_flags.link_lib(lib_name), + } + } + + #[cfg(not(feature = "link-framework"))] + find_and_output_cmake_dir_metadata(&out_dir)?; + + #[cfg(not(feature = "link-static"))] + { + // copy built library to top level target dir + let toplevel = top_level_cargo_target_dir(); + + #[cfg(feature = "link-framework")] + { + let wanted_framework = format!("{lib_name}.framework"); + if let Ok(rd) = std::fs::read_dir(out_dir) { + for entry in rd { + let entry = entry?; + if entry.file_name().to_str() == Some(&wanted_framework) { + // the framework is a directory so we can't just copy it as a file + + let target = toplevel.join(&wanted_framework); + let _ = std::fs::remove_file(&target); + + #[cfg(unix)] + { + std::os::unix::fs::symlink(entry.path(), &target)?; + } + #[cfg(windows)] + { + // this will likely fail, but let's try + let _ = + std::os::windows::fs::symlink_dir(entry.path(), &target); + } + + break; + } + } + } + } + #[cfg(not(feature = "link-framework"))] + { + let wanted_dylib_base = format!("lib{lib_name}"); + let wanted_so_base = format!("lib{lib_name}.so"); + let wanted_dll = format!("{lib_name}.dll"); + let mut got_dylib = None; + let mut got_so = None; + + let mut get_dylib = |entry: &std::fs::DirEntry| { + if let Some((true, _, _)) = got_dylib { + return true; + } + if let Some(filename) = entry.file_name().to_str() { + if let Some(dlext) = filename.strip_prefix(&wanted_dylib_base) { + if let Some(dlext) = dlext.strip_suffix(".dylib") { + if let Some(dlext) = dlext.strip_prefix('.') { + if dlext.parse::().is_ok() { + got_dylib = + Some((true, entry.path(), filename.to_owned())); + return true; + } + } + } + } + } + false + }; + + let mut get_so = |entry: &std::fs::DirEntry| { + if let Some((true, _, _)) = got_so { + return true; + } + if let Some(filename) = entry.file_name().to_str() { + if let Some(soext) = filename.strip_prefix(&wanted_so_base) { + if let Some(soext) = soext.strip_prefix('.') { + if soext.parse::().is_ok() { + got_so = Some((true, entry.path(), filename.to_owned())); + return true; + } + } else if soext.is_empty() { + got_so = Some((false, entry.path(), filename.to_owned())); + } + } + } + false + }; + + if let Ok(rd) = std::fs::read_dir(out_dir.join("lib64")) { + for entry in rd { + if get_so(&entry?) { + break; + } + } + } + if let Ok(rd) = std::fs::read_dir(out_dir.join("lib")) { + for entry in rd { + let entry = entry?; + get_dylib(&entry); + get_so(&entry); + } + } + if let Some((_, dl_path, dl_fn)) = got_dylib { + std::fs::copy(dl_path, toplevel.join(&dl_fn))?; + } + if let Some((_, so_path, so_fn)) = got_so { + std::fs::copy(so_path, toplevel.join(&so_fn))?; + } + if let Ok(rd) = std::fs::read_dir(out_dir.join("bin")) { + for entry in rd { + let entry = entry?; + if entry.file_name().to_str() == Some(&wanted_dll) { + std::fs::copy(entry.path(), toplevel.join(&wanted_dll))?; + break; + } + } + } + } + } + } + #[cfg(not(feature = "build-from-source"))] + { + if LINK_FRAMEWORK { + // FIXME: rust doesn't support linking to xcframeworks + let home = env::var("HOME"); + let link_search = |name| { + if let Ok(home) = home { + link_flags.search_framework(format!( + "{home}/Library/Frameworks/{lib_name}.xcframework/{name}" + )); + } + link_flags.search_framework(format!( + "/Library/Frameworks/{lib_name}.xcframework/{name}" + )); + }; + if env::var("CARGO_CFG_TARGET_OS").unwrap() == "macos" { + link_search("macos-arm64_x86_64"); + } else if env::var("CARGO_CFG_TARGET_OS").unwrap() == "ios" { + // as of rust 1.91 target_abi="sim" will move to target_env="sim" + if env::var("CARGO_CFG_TARGET_ABI").unwrap() == "sim" + || env::var("CARGO_CFG_TARGET_ENV").unwrap() == "sim" + { + link_search("ios-arm64_x86_64-simulator"); + } else { + link_search("ios-arm64"); + } + } else if env::var("CARGO_CFG_TARGET_OS").unwrap() == "tvos" { + // as of rust 1.91 target_abi="sim" will move to target_env="sim" + if env::var("CARGO_CFG_TARGET_ABI").unwrap() == "sim" + || env::var("CARGO_CFG_TARGET_ENV").unwrap() == "sim" + { + link_search("tvos-arm64_x86_64-simulator"); + } else { + link_search("tvos-arm64"); + } + } + link_flags.link_framework(lib_name); + } else { + #[allow(unused_mut)] + let mut handled = false; + + #[cfg(feature = "use-pkg-config")] + if !handled { + if let Ok(lib) = pkg_config::Config::new() + .statik(cfg!(feature = "link-static")) + .atleast_version(config("lib_min_version")) + .probe(config("package_name")) + { + handled = true; + for path in lib.link_paths.iter() { + link_flags.search_lib(path.display()); + } + for path in lib.framework_paths.iter() { + link_flags.search_framework(path.display()); + } + for s in lib.libs.iter() { + if s == lib_name { + match link_kind { + LinkKind::Static => link_flags.link_static_lib(s), + LinkKind::Default => link_flags.link_lib(s), + } + } else { + link_flags.link_lib(s); + } + } + for s in lib.frameworks.iter() { + link_flags.link_framework(s); + } + } + } + + #[cfg(feature = "use-vcpkg")] + if !handled { + handled = vcpkg::find_package(config("package_name")).is_ok(); + } + + if !handled { + // yolo + if cfg!(target_os = "macos") { + link_flags.search_lib("/opt/homebrew/lib"); + } + match link_kind { + LinkKind::Static => link_flags.link_static_lib(lib_name), + LinkKind::Default => link_flags.link_lib(lib_name), + } + } + } + } + + if do_link { + link_flags.send_to_cargo_link_flags(); + } else { + link_flags.send_to_cargo_metadata(); + } + } + + Ok(()) +} diff --git a/vendor/sdl3-sys/build.rs b/vendor/sdl3-sys/build.rs new file mode 100644 index 00000000..7c8fef06 --- /dev/null +++ b/vendor/sdl3-sys/build.rs @@ -0,0 +1,79 @@ +#[cfg(feature = "build-from-source")] +const SOURCE_DIR: &str = sdl3_src::SOURCE_DIR; + +const LINK_FRAMEWORK: bool = cfg!(feature = "link-framework"); + +include!("build-common.rs"); + +fn main() -> Result<(), Box> { + build(|config| { + let _ = config; + #[cfg(feature = "build-from-source")] + { + #[cfg(feature = "sdl-lean-and-mean")] + { + let mut build = cc::Build::new(); + build.define("SDL_LEAN_AND_MEAN", "1"); + config.init_c_cfg(build); + } + + config.define("SDL_EXAMPLES", "OFF"); + config.define("SDL_REVISION", sdl3_src::REVISION); + config.define("SDL_TESTS", "OFF"); + + // skate3rust patch: SDL's CMake project uses policy CMP0091, so the + // -MT that cmake-rs adds for crt-static is ignored and SDL links the + // DLL CRT (unresolved __imp_* symbols in static-CRT builds). Select + // the runtime Rust links: never the debug CRT, static iff crt-static. + if env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") { + let static_crt = env::var("CARGO_CFG_TARGET_FEATURE") + .is_ok_and(|features| features.split(',').any(|f| f == "crt-static")); + config.define( + "CMAKE_MSVC_RUNTIME_LIBRARY", + if static_crt { "MultiThreaded" } else { "MultiThreadedDLL" }, + ); + } + + if LINK_FRAMEWORK { + config.define("SDL_FRAMEWORK", "ON"); + } else if cfg!(feature = "link-static") { + config.define("SDL_STATIC", "ON"); + } + + cmake_vars! { config => + SDL_ASAN, + SDL_CCACHE, + SDL_LIBC, + SDL_RPATH, + SDL_UNIX_CONSOLE_BUILD, + SDL_AUDIO, + SDL_VIDEO, + SDL_GPU, + SDL_RENDER, + SDL_CAMERA, + SDL_JOYSTICK, + SDL_HAPTIC, + SDL_HIDAPI, + SDL_POWER, + SDL_SENSOR, + SDL_DIALOG, + SDL_TRAY, + } + } + Ok(()) + })?; + + let enabled_assert_levels = cfg!(feature = "assert-level-disabled") as usize + + cfg!(feature = "assert-level-release") as usize + + cfg!(feature = "assert-level-debug") as usize + + cfg!(feature = "assert-level-paranoid") as usize; + if enabled_assert_levels == 0 { + if env::var("DEBUG").unwrap() == "true" { + println!(r#"cargo::rustc-cfg=feature="assert-level-debug""#); + } else { + println!(r#"cargo::rustc-cfg=feature="assert-level-release""#); + } + } + + Ok(()) +} diff --git a/vendor/sdl3-sys/config.txt b/vendor/sdl3-sys/config.txt new file mode 100644 index 00000000..c20abf6a --- /dev/null +++ b/vendor/sdl3-sys/config.txt @@ -0,0 +1,11 @@ +package_name: sdl3 +lib_name: SDL3 +lib_rev_name: SDL +lib_min_version: 3.1.3 +lib_dir: SDL +include_dir: include/SDL3 +version_header: SDL_version.h +headers_prefix: SDL_ +sym_prefix: SDL_ +define_prefix: SDL_ +hint_prop_prefix: SDL_ diff --git a/vendor/sdl3-sys/examples/demo-01-snake.rs b/vendor/sdl3-sys/examples/demo-01-snake.rs new file mode 100644 index 00000000..5ad6e963 --- /dev/null +++ b/vendor/sdl3-sys/examples/demo-01-snake.rs @@ -0,0 +1,397 @@ +// This is a Rust port of examples/demo/01-snake from SDL. +// +// While it uses some Rust concepts, it's not intended to be idiomatic Rust, +// but rather a close translation of the original. +// +// Like the original example, this code is public domain. +// +// original description: +// +// Logic implementation of the Snake game. It is designed to efficiently +// represent the state of the game in memory. +// +// This code is public domain. Feel free to use it for any purpose! + +use core::{ffi::c_char, mem::transmute, ptr::null_mut}; +use std::sync::Mutex; + +use sdl3_main::{AppResult, app_event, app_init, app_iterate, app_quit}; + +// You can `use sdl3_sys::everything::*` if you don't want to specify everything explicitly +use sdl3_sys::{ + events::{SDL_EVENT_KEY_DOWN, SDL_EVENT_QUIT, SDL_Event}, + init::{ + SDL_INIT_VIDEO, SDL_Init, SDL_PROP_APP_METADATA_COPYRIGHT_STRING, + SDL_PROP_APP_METADATA_CREATOR_STRING, SDL_PROP_APP_METADATA_TYPE_STRING, + SDL_PROP_APP_METADATA_URL_STRING, SDL_SetAppMetadata, SDL_SetAppMetadataProperty, + }, + pixels::SDL_ALPHA_OPAQUE, + rect::SDL_FRect, + render::{ + SDL_CreateWindowAndRenderer, SDL_DestroyRenderer, SDL_RenderClear, SDL_RenderFillRect, + SDL_RenderPresent, SDL_Renderer, SDL_SetRenderDrawColor, + }, + scancode::{ + SDL_SCANCODE_DOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_LEFT, SDL_SCANCODE_Q, SDL_SCANCODE_R, + SDL_SCANCODE_RIGHT, SDL_SCANCODE_UP, SDL_Scancode, + }, + stdinc::SDL_rand, + timer::SDL_GetTicks, + video::{SDL_DestroyWindow, SDL_Window, SDL_WindowFlags}, +}; + +const STEP_RATE_IN_MILLISECONDS: u32 = 125; +const SNAKE_BLOCK_SIZE_IN_PIXELS: i32 = 24; +const SDL_WINDOW_WIDTH: i32 = SNAKE_BLOCK_SIZE_IN_PIXELS * SNAKE_GAME_WIDTH as i32; +const SDL_WINDOW_HEIGHT: i32 = SNAKE_BLOCK_SIZE_IN_PIXELS * SNAKE_GAME_HEIGHT as i32; + +const SNAKE_GAME_WIDTH: i8 = 24; +const SNAKE_GAME_HEIGHT: i8 = 18; +const SNAKE_MATRIX_SIZE: u16 = SNAKE_GAME_WIDTH as u16 * SNAKE_GAME_HEIGHT as u16; +const SNAKE_ARRAY_SIZE: usize = + ((SNAKE_MATRIX_SIZE + 1) * SNAKE_CELL_MAX_BITS).div_ceil(8) as usize; + +const THREE_BITS: u16 = (1_u16 << SNAKE_CELL_MAX_BITS) - 1; +const fn shift(x: i8, y: i8) -> (usize, u16) { + let shift = (x as u16 + (y as u16 * SNAKE_GAME_WIDTH as u16)) * SNAKE_CELL_MAX_BITS; + ((shift / 8) as usize, shift % 8) +} + +#[derive(Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +enum SnakeCell { + Nothing, + SRight, + SUp, + SLeft, + SDown, + Food, +} + +impl TryFrom for SnakeCell { + type Error = &'static str; + + fn try_from(value: u8) -> Result { + const MAX: u8 = SnakeCell::Food as u8; + if value <= MAX { + Ok(unsafe { transmute::(value) }) + } else { + Err("value out of range") + } + } +} + +pub const SNAKE_CELL_MAX_BITS: u16 = ((SnakeCell::Food as u8).ilog2() + 1) as u16; + +#[derive(Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +enum SnakeDirection { + Right, + Up, + Left, + Down, +} + +struct SnakeContext { + cells: [u8; SNAKE_ARRAY_SIZE], + head_xpos: i8, + head_ypos: i8, + tail_xpos: i8, + tail_ypos: i8, + next_dir: SnakeDirection, + inhibit_tail_step: u8, + occupied_cells: u16, +} + +struct AppState { + window: *mut SDL_Window, + renderer: *mut SDL_Renderer, + snake_ctx: SnakeContext, + last_step: u64, +} + +impl Drop for AppState { + fn drop(&mut self) { + unsafe { + if !self.renderer.is_null() { + SDL_DestroyRenderer(self.renderer); + } + if !self.window.is_null() { + SDL_DestroyWindow(self.window); + } + } + } +} + +unsafe impl Send for AppState {} + +impl AppState { + fn new() -> Self { + Self { + window: null_mut(), + renderer: null_mut(), + snake_ctx: SnakeContext::new(), + last_step: 0, + } + } +} + +fn set_rect_xy(r: &mut SDL_FRect, x: i16, y: i16) { + r.x = (x as i32 * SNAKE_BLOCK_SIZE_IN_PIXELS) as f32; + r.y = (y as i32 * SNAKE_BLOCK_SIZE_IN_PIXELS) as f32; +} + +fn wrap_around(val: &mut i8, max: i8) { + if *val < 0 { + *val = max - 1; + } else if *val > max - 1 { + *val = 0 + } +} + +impl SnakeContext { + fn new() -> Self { + let mut ctx = Self { + cells: [0; SNAKE_ARRAY_SIZE], + head_xpos: SNAKE_GAME_WIDTH / 2, + head_ypos: SNAKE_GAME_HEIGHT / 2, + tail_xpos: SNAKE_GAME_WIDTH / 2, + tail_ypos: SNAKE_GAME_HEIGHT / 2, + next_dir: SnakeDirection::Right, + inhibit_tail_step: 4, + occupied_cells: 3, + }; + ctx.put_cell_at(ctx.tail_xpos, ctx.tail_ypos, SnakeCell::SRight); + for _ in 0..4 { + ctx.new_food_pos(); + ctx.occupied_cells += 1; + } + ctx + } + + fn cell_at(&self, x: i8, y: i8) -> SnakeCell { + let (bi, adjust) = shift(x, y); + let range = u16::from_ne_bytes([self.cells[bi], self.cells[bi + 1]]); + ((range >> adjust) as u8 & THREE_BITS as u8) + .try_into() + .unwrap() + } + + fn put_cell_at(&mut self, x: i8, y: i8, ct: SnakeCell) { + let (bi, adjust) = shift(x, y); + let mut range = u16::from_ne_bytes([self.cells[bi], self.cells[bi + 1]]); + range &= !(THREE_BITS << adjust); // clear bits + range |= (ct as u16 & THREE_BITS) << adjust; + [self.cells[bi], self.cells[bi + 1]] = range.to_ne_bytes(); + } + + fn are_cells_full(&self) -> bool { + self.occupied_cells == SNAKE_GAME_WIDTH as u16 * SNAKE_GAME_HEIGHT as u16 + } + + fn new_food_pos(&mut self) { + loop { + let (x, y) = unsafe { + ( + SDL_rand(SNAKE_GAME_WIDTH as i32) as i8, + SDL_rand(SNAKE_GAME_HEIGHT as i32) as i8, + ) + }; + if self.cell_at(x, y) == SnakeCell::Nothing { + self.put_cell_at(x, y, SnakeCell::Food); + break; + } + } + } + + fn redir(&mut self, dir: SnakeDirection) { + let ct = self.cell_at(self.head_xpos, self.head_ypos); + if (dir == SnakeDirection::Right && ct != SnakeCell::SLeft) + || (dir == SnakeDirection::Up && ct != SnakeCell::SDown) + || (dir == SnakeDirection::Left && ct != SnakeCell::SRight) + || (dir == SnakeDirection::Down && ct != SnakeCell::SUp) + { + self.next_dir = dir + } + } + + fn step(&mut self) { + let dir_as_cell: SnakeCell = (self.next_dir as u8 + 1).try_into().unwrap(); + self.inhibit_tail_step -= 1; + + // Move tail forward + if self.inhibit_tail_step == 0 { + self.inhibit_tail_step += 1; + let ct = self.cell_at(self.tail_xpos, self.tail_ypos); + self.put_cell_at(self.tail_xpos, self.tail_ypos, SnakeCell::Nothing); + match ct { + SnakeCell::SRight => self.tail_xpos += 1, + SnakeCell::SUp => self.tail_ypos -= 1, + SnakeCell::SLeft => self.tail_xpos -= 1, + SnakeCell::SDown => self.tail_ypos += 1, + _ => (), + } + wrap_around(&mut self.tail_xpos, SNAKE_GAME_WIDTH); + wrap_around(&mut self.tail_ypos, SNAKE_GAME_HEIGHT); + } + + // Move head forward + let prev_xpos = self.head_xpos; + let prev_ypos = self.head_ypos; + match self.next_dir { + SnakeDirection::Right => self.head_xpos += 1, + SnakeDirection::Up => self.head_ypos -= 1, + SnakeDirection::Left => self.head_xpos -= 1, + SnakeDirection::Down => self.head_ypos += 1, + } + wrap_around(&mut self.head_xpos, SNAKE_GAME_WIDTH); + wrap_around(&mut self.head_ypos, SNAKE_GAME_HEIGHT); + + // Collisions + let ct = self.cell_at(self.head_xpos, self.head_ypos); + if ct != SnakeCell::Nothing && ct != SnakeCell::Food { + *self = Self::new(); + return; + } + self.put_cell_at(prev_xpos, prev_ypos, dir_as_cell); + self.put_cell_at(self.head_xpos, self.head_ypos, dir_as_cell); + if ct == SnakeCell::Food { + if self.are_cells_full() { + *self = Self::new(); + return; + } + self.new_food_pos(); + self.inhibit_tail_step += 1; + self.occupied_cells += 1; + } + } + + fn handle_key_event(&mut self, key_code: SDL_Scancode) -> AppResult { + match key_code { + SDL_SCANCODE_ESCAPE | SDL_SCANCODE_Q => return AppResult::Success, + SDL_SCANCODE_R => *self = Self::new(), + SDL_SCANCODE_RIGHT => self.redir(SnakeDirection::Right), + SDL_SCANCODE_UP => self.redir(SnakeDirection::Up), + SDL_SCANCODE_LEFT => self.redir(SnakeDirection::Left), + SDL_SCANCODE_DOWN => self.redir(SnakeDirection::Down), + _ => (), + } + AppResult::Continue + } +} + +#[app_iterate] +fn app_iterate(app: &mut AppState) -> AppResult { + let ctx = &mut app.snake_ctx; + let mut r = SDL_FRect { + x: 0.0, + y: 0.0, + w: SNAKE_BLOCK_SIZE_IN_PIXELS as f32, + h: SNAKE_BLOCK_SIZE_IN_PIXELS as f32, + }; + unsafe { + let now = SDL_GetTicks(); + + // run game logic if we're at or past the time to run it. + // if we're _really_ behind the time to run it, run it + // several times. + while (now - app.last_step) >= STEP_RATE_IN_MILLISECONDS as u64 { + ctx.step(); + app.last_step += STEP_RATE_IN_MILLISECONDS as u64; + } + + SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); + SDL_RenderClear(app.renderer); + + for j in 0..SNAKE_GAME_HEIGHT { + for i in 0..SNAKE_GAME_WIDTH { + let ct = ctx.cell_at(i, j); + if ct == SnakeCell::Nothing { + continue; + } + set_rect_xy(&mut r, i as _, j as _); + if ct == SnakeCell::Food { + SDL_SetRenderDrawColor(app.renderer, 80, 80, 255, SDL_ALPHA_OPAQUE); + } else { + // body + SDL_SetRenderDrawColor(app.renderer, 0, 128, 0, SDL_ALPHA_OPAQUE); + } + SDL_RenderFillRect(app.renderer, &r); + } + } + + SDL_SetRenderDrawColor(app.renderer, 255, 255, 0, SDL_ALPHA_OPAQUE); // head + set_rect_xy(&mut r, ctx.head_xpos as _, ctx.head_ypos as _); + SDL_RenderFillRect(app.renderer, &r); + SDL_RenderPresent(app.renderer); + AppResult::Continue + } +} + +const EXTENDED_METADATA: &[(*const c_char, *const c_char)] = &[ + ( + SDL_PROP_APP_METADATA_URL_STRING, + c"https://examples.libsdl.org/SDL3/demo/01-snake/".as_ptr(), + ), + (SDL_PROP_APP_METADATA_CREATOR_STRING, c"SDL team".as_ptr()), + ( + SDL_PROP_APP_METADATA_COPYRIGHT_STRING, + c"Placed in the public domain".as_ptr(), + ), + (SDL_PROP_APP_METADATA_TYPE_STRING, c"game".as_ptr()), +]; + +#[app_init] +fn app_init() -> Option>> { + unsafe { + if !SDL_SetAppMetadata( + c"Example Snake game (Rust port)".as_ptr(), + c"1.0".as_ptr(), + c"com.example.Snake".as_ptr(), + ) { + return None; + } + + for (key, value) in EXTENDED_METADATA.iter().copied() { + if !SDL_SetAppMetadataProperty(key, value) { + return None; + } + } + + if !SDL_Init(SDL_INIT_VIDEO) { + return None; + } + + let mut app = AppState::new(); + + if !SDL_CreateWindowAndRenderer( + c"examples/demo/snake".as_ptr(), + SDL_WINDOW_WIDTH, + SDL_WINDOW_HEIGHT, + SDL_WindowFlags(0), + &mut app.window, + &mut app.renderer, + ) { + return None; + } + + app.snake_ctx = SnakeContext::new(); + app.last_step = SDL_GetTicks(); + + Some(Box::new(Mutex::new(app))) + } +} + +#[app_event] +fn app_event(app: &mut AppState, event: &SDL_Event) -> AppResult { + unsafe { + match event.event_type() { + SDL_EVENT_QUIT => AppResult::Success, + SDL_EVENT_KEY_DOWN => app.snake_ctx.handle_key_event(event.key.scancode), + _ => AppResult::Continue, + } + } +} + +#[app_quit] +fn app_quit() {} diff --git a/vendor/sdl3-sys/examples/minimal.rs b/vendor/sdl3-sys/examples/minimal.rs new file mode 100644 index 00000000..eb421c62 --- /dev/null +++ b/vendor/sdl3-sys/examples/minimal.rs @@ -0,0 +1,15 @@ +use core::ffi::CStr; +use sdl3_sys::{ + error::SDL_GetError, + init::{SDL_INIT_VIDEO, SDL_Init, SDL_Quit}, +}; + +fn main() -> Result<(), &'static CStr> { + if unsafe { SDL_Init(SDL_INIT_VIDEO) } { + println!("Successfully initialized SDL!"); + unsafe { SDL_Quit() }; + Ok(()) + } else { + Err(unsafe { CStr::from_ptr(SDL_GetError()) }) + } +} diff --git a/vendor/sdl3-sys/src/generated/assert.rs b/vendor/sdl3-sys/src/generated/assert.rs new file mode 100644 index 00000000..971f9a41 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/assert.rs @@ -0,0 +1,899 @@ +//! A helpful assertion macro! +//! +//! SDL assertions operate like your usual `assert` macro, but with some added +//! features: +//! +//! - It uses a trick with the `sizeof` operator, so disabled assertions +//! vaporize out of the compiled code, but variables only referenced in the +//! assertion won't trigger compiler warnings about being unused. +//! - It is safe to use with a dangling-else: `if (x) SDL_assert(y); else +//! do_something();` +//! - It works the same everywhere, instead of counting on various platforms' +//! compiler and C runtime to behave. +//! - It provides multiple levels of assertion ([`SDL_assert`], [`SDL_assert_release`], +//! [`SDL_assert_paranoid`]) instead of a single all-or-nothing option. +//! - It offers a variety of responses when an assertion fails (retry, trigger +//! the debugger, abort the program, ignore the failure once, ignore it for +//! the rest of the program's run). +//! - It tries to show the user a dialog by default, if possible, but the app +//! can provide a callback to handle assertion failures however they like. +//! - It lets failed assertions be retried. Perhaps you had a network failure +//! and just want to retry the test after plugging your network cable back +//! in? You can. +//! - It lets the user ignore an assertion failure, if there's a harmless +//! problem that one can continue past. +//! - It lets the user mark an assertion as ignored for the rest of the +//! program's run; if there's a harmless problem that keeps popping up. +//! - It provides statistics and data on all failed assertions to the app. +//! - It allows the default assertion handler to be controlled with environment +//! variables, in case an automated script needs to control it. +//! - It can be used as an aid to Clang's static analysis; it will treat SDL +//! assertions as universally true (under the assumption that you are serious +//! about the asserted claims and that your debug builds will detect when +//! these claims were wrong). This can help the analyzer avoid false +//! positives. +//! +//! To use it: compile a debug build and just sprinkle around tests to check +//! your code! + +use super::stdinc::*; + +apply_cfg!(#[cfg(doc)] => { + /// The level of assertion aggressiveness. + /// + /// This value changes depending on compiler options and other preprocessor + /// defines. + /// + /// It is currently one of the following values, but future SDL releases might + /// add more: + /// + /// - 0: All SDL assertion macros are disabled. + /// - 1: Release settings: [`SDL_assert`] disabled, [`SDL_assert_release`] enabled. + /// - 2: Debug settings: [`SDL_assert`] and [`SDL_assert_release`] enabled. + /// - 3: Paranoid settings: All SDL assertion macros enabled, including + /// [`SDL_assert_paranoid`]. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_ASSERT_LEVEL: ::core::primitive::i32 = 1; + +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(any(all(not(not(debug_assertions)), any(/* always disabled: __GNUC__ */)), debug_assertions, debug_assertions))] => { + }); + + apply_cfg!(#[cfg(not(any(all(not(not(debug_assertions)), any(/* always disabled: __GNUC__ */)), debug_assertions, debug_assertions)))] => { + }); + +}); + +apply_cfg!(#[cfg(doc)] => { + /// Attempt to tell an attached debugger to pause. + /// + /// This allows an app to programmatically halt ("break") the debugger as if it + /// had hit a breakpoint, allowing the developer to examine program state, etc. + /// + /// This is a macro--not a function--so that the debugger breaks on the source + /// code line that used [`SDL_TriggerBreakpoint`] and not in some random guts of + /// SDL. [`SDL_assert`] uses this macro for the same reason. + /// + /// If the program is not running under a debugger, [`SDL_TriggerBreakpoint`] will + /// likely terminate the app, possibly without warning. If the current platform + /// isn't supported, this macro is left undefined. + /// + /// ## Thread safety + /// It is safe to call this macro from any thread. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[inline(always)] + pub unsafe fn SDL_TriggerBreakpoint() { + crate::breakpoint() + } +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(all(windows, target_env = "msvc"))] => { + #[inline(always)] + pub unsafe fn SDL_TriggerBreakpoint() { + crate::breakpoint() + } + }); + + apply_cfg!(#[cfg(not(all(windows, target_env = "msvc")))] => { + #[inline(always)] + pub unsafe fn SDL_TriggerBreakpoint() { + crate::breakpoint() + } + }); + +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(doc)] => { + // [sdl3-sys-gen] skipped constant value define `SDL_ASSERT_FILE` + +}); + +apply_cfg!(#[cfg(not(doc))] => { + // [sdl3-sys-gen] skipped constant value define `SDL_ASSERT_FILE` + +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(all(not(any(/* always disabled: __clang__ */)), all(windows, target_env = "msvc")))] => { + }); + + apply_cfg!(#[cfg(not(all(not(any(/* always disabled: __clang__ */)), all(windows, target_env = "msvc"))))] => { + }); + +}); + +#[cfg(all(not(doc), feature = "assert-level-disabled"))] +pub const SDL_ASSERT_LEVEL: ::core::primitive::i32 = 0; +#[cfg(all( + not(any(doc, feature = "assert-level-disabled")), + feature = "assert-level-release" +))] +pub const SDL_ASSERT_LEVEL: ::core::primitive::i32 = 1; +#[cfg(all( + not(any( + doc, + feature = "assert-level-disabled", + feature = "assert-level-release" + )), + feature = "assert-level-debug" +))] +pub const SDL_ASSERT_LEVEL: ::core::primitive::i32 = 2; +#[cfg(all( + not(any( + doc, + feature = "assert-level-disabled", + feature = "assert-level-release", + feature = "assert-level-debug" + )), + feature = "assert-level-paranoid" +))] +pub const SDL_ASSERT_LEVEL: ::core::primitive::i32 = 3; + +/// The macro used when an assertion is disabled. +/// +/// This isn't for direct use by apps, but this is the code that is inserted +/// when an [`SDL_assert`] is disabled (perhaps in a release build). +/// +/// The code does nothing, but wraps `condition` in a sizeof operator, which +/// generates no code and has no side effects, but avoid compiler warnings +/// about unused variables, and still checks syntax even when disabled. +/// +/// ## Parameters +/// - `condition`: the condition to assert (but not actually run here). +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[doc(hidden)] +#[macro_export] +macro_rules! SDL_disabled_assert { + ($condition:expr) => {{ + if false { + let _ = $condition; + } + }}; +} +#[doc(inline)] +pub use SDL_disabled_assert; + +/// Possible outcomes from a triggered assertion. +/// +/// When an enabled assertion triggers, it may call the assertion handler +/// (possibly one provided by the app via [`SDL_SetAssertionHandler`]), which will +/// return one of these values, possibly after asking the user. +/// +/// Then SDL will respond based on this outcome (loop around to retry the +/// condition, try to break in a debugger, kill the program, or ignore the +/// problem). +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`RETRY`](SDL_AssertState::RETRY) | [`SDL_ASSERTION_RETRY`] | Retry the assert immediately. | +/// | [`BREAK`](SDL_AssertState::BREAK) | [`SDL_ASSERTION_BREAK`] | Make the debugger trigger a breakpoint. | +/// | [`ABORT`](SDL_AssertState::ABORT) | [`SDL_ASSERTION_ABORT`] | Terminate the program. | +/// | [`IGNORE`](SDL_AssertState::IGNORE) | [`SDL_ASSERTION_IGNORE`] | Ignore the assert. | +/// | [`ALWAYS_IGNORE`](SDL_AssertState::ALWAYS_IGNORE) | [`SDL_ASSERTION_ALWAYS_IGNORE`] | Ignore the assert from now on. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_AssertState(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_AssertState { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_AssertState) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_AssertState) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_AssertState { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::RETRY => "SDL_ASSERTION_RETRY", + Self::BREAK => "SDL_ASSERTION_BREAK", + Self::ABORT => "SDL_ASSERTION_ABORT", + Self::IGNORE => "SDL_ASSERTION_IGNORE", + Self::ALWAYS_IGNORE => "SDL_ASSERTION_ALWAYS_IGNORE", + + _ => return write!(f, "SDL_AssertState({})", self.0), + }) + } +} + +impl SDL_AssertState { + /// Retry the assert immediately. + pub const RETRY: Self = Self((0 as ::core::ffi::c_int)); + /// Make the debugger trigger a breakpoint. + pub const BREAK: Self = Self((1 as ::core::ffi::c_int)); + /// Terminate the program. + pub const ABORT: Self = Self((2 as ::core::ffi::c_int)); + /// Ignore the assert. + pub const IGNORE: Self = Self((3 as ::core::ffi::c_int)); + /// Ignore the assert from now on. + pub const ALWAYS_IGNORE: Self = Self((4 as ::core::ffi::c_int)); +} + +/// Retry the assert immediately. +pub const SDL_ASSERTION_RETRY: SDL_AssertState = SDL_AssertState::RETRY; +/// Make the debugger trigger a breakpoint. +pub const SDL_ASSERTION_BREAK: SDL_AssertState = SDL_AssertState::BREAK; +/// Terminate the program. +pub const SDL_ASSERTION_ABORT: SDL_AssertState = SDL_AssertState::ABORT; +/// Ignore the assert. +pub const SDL_ASSERTION_IGNORE: SDL_AssertState = SDL_AssertState::IGNORE; +/// Ignore the assert from now on. +pub const SDL_ASSERTION_ALWAYS_IGNORE: SDL_AssertState = SDL_AssertState::ALWAYS_IGNORE; + +impl SDL_AssertState { + /// Initialize a `SDL_AssertState` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_AssertState { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_AssertState { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::assert::METADATA_SDL_AssertState; +} + +/// Information about an assertion failure. +/// +/// This structure is filled in with information about a triggered assertion, +/// used by the assertion handler, then added to the assertion report. This is +/// returned as a linked list from [`SDL_GetAssertionReport()`]. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_AssertData { + /// true if app should always continue when assertion is triggered. + pub always_ignore: ::core::primitive::bool, + /// Number of times this assertion has been triggered. + pub trigger_count: ::core::ffi::c_uint, + /// A string of this assert's test code. + pub condition: *const ::core::ffi::c_char, + /// The source file where this assert lives. + pub filename: *const ::core::ffi::c_char, + /// The line in `filename` where this assert lives. + pub linenum: ::core::ffi::c_int, + /// The name of the function where this assert lives. + pub function: *const ::core::ffi::c_char, + /// next item in the linked list. + pub next: *const SDL_AssertData, +} + +impl ::core::default::Default for SDL_AssertData { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Never call this directly. + /// + /// Use the [`SDL_assert`] macros instead. + /// + /// ## Parameters + /// - `data`: assert data structure. + /// - `func`: function name. + /// - `file`: file name. + /// - `line`: line number. + /// + /// ## Return value + /// Returns assert state. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReportAssertion( + data: *mut SDL_AssertData, + func: *const ::core::ffi::c_char, + file: *const ::core::ffi::c_char, + line: ::core::ffi::c_int, + ) -> SDL_AssertState; +} + +apply_cfg!(#[cfg(doc)] => { + /// The macro used when an assertion triggers a breakpoint. + /// + /// This isn't for direct use by apps; use [`SDL_assert`] or [`SDL_TriggerBreakpoint`] + /// instead. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[inline(always)] + pub unsafe fn SDL_AssertBreakpoint() { + unsafe { SDL_TriggerBreakpoint() } + } +}); + +apply_cfg!(#[cfg(not(doc))] => { + #[inline(always)] + pub unsafe fn SDL_AssertBreakpoint() { + unsafe { SDL_TriggerBreakpoint() } + } + +}); + +/// The macro used when an assertion is enabled. +/// +/// This isn't for direct use by apps, but this is the code that is inserted +/// when an [`SDL_assert`] is enabled. +/// +/// The `do {} while(0)` avoids dangling else problems: +/// +/// ```c +/// if (x) SDL_assert(y); else blah(); +/// ``` +/// +/// ... without the do/while, the "else" could attach to this macro's "if". We +/// try to handle just the minimum we need here in a macro...the loop, the +/// static vars, and break points. The heavy lifting is handled in +/// [`SDL_ReportAssertion()`]. +/// +/// ## Parameters +/// - `condition`: the condition to assert. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[doc(hidden)] +#[macro_export] +macro_rules! SDL_enabled_assert { + ($condition:expr) => {{ + while !$condition { + // Yes, this is wildly unsafe, but it's fine! :thisisfine: + // - SDL uses a mutex to protect access to SDL_AssertData + // - The static mut can only be accessed through the pointer that's passed to SDL + let assert_data = { + $crate::__const_c_str!(CONDITION = ::core::stringify!($condition)); + static mut SDL_ASSERT_DATA: $crate::assert::SDL_AssertData = + $crate::assert::SDL_AssertData { + always_ignore: false, + trigger_count: 0, + condition: CONDITION.as_ptr(), + filename: ::core::ptr::null(), + linenum: 0, + function: ::core::ptr::null(), + next: ::core::ptr::null(), + }; + &raw mut SDL_ASSERT_DATA + }; + const LOCATION: &::core::panic::Location = ::core::panic::Location::caller(); + $crate::__const_c_str!(FILENAME = LOCATION.file()); + match unsafe { + $crate::assert::SDL_ReportAssertion( + assert_data, + b"???\0".as_ptr().cast::<::core::ffi::c_char>(), + FILENAME.as_ptr(), + LOCATION.line() as ::core::ffi::c_int, + ) + } { + $crate::assert::SDL_ASSERTION_RETRY => continue, + $crate::assert::SDL_ASSERTION_BREAK => unsafe { + $crate::assert::SDL_AssertBreakpoint() + }, + _ => (), + } + break; + } + }}; +} +#[doc(inline)] +pub use SDL_enabled_assert; + +apply_cfg!(#[cfg(doc)] => { + /// An assertion test that is normally performed only in debug builds. + /// + /// This macro is enabled when the [`SDL_ASSERT_LEVEL`] is >= 2, otherwise it is + /// disabled. This is meant to only do these tests in debug builds, so they can + /// tend to be more expensive, and they are meant to bring everything to a halt + /// when they fail, with the programmer there to assess the problem. + /// + /// In short: you can sprinkle these around liberally and assume they will + /// evaporate out of the build when building for end-users. + /// + /// When assertions are disabled, this wraps `condition` in a `sizeof` + /// operator, which means any function calls and side effects will not run, but + /// the compiler will not complain about any otherwise-unused variables that + /// are only referenced in the assertion. + /// + /// One can set the environment variable "SDL_ASSERT" to one of several strings + /// ("abort", "break", "retry", "ignore", "always_ignore") to force a default + /// behavior, which may be desirable for automation purposes. If your platform + /// requires GUI interfaces to happen on the main thread but you're debugging + /// an assertion in a background thread, it might be desirable to set this to + /// "break" so that your debugger takes control as soon as assert is triggered, + /// instead of risking a bad UI interaction (deadlock, etc) in the application. + /// + /// ## Parameters + /// - `condition`: boolean value to test. + /// + /// ## Thread safety + /// It is safe to call this macro from any thread. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert; + + /// An assertion test that is performed even in release builds. + /// + /// This macro is enabled when the [`SDL_ASSERT_LEVEL`] is >= 1, otherwise it is + /// disabled. This is meant to be for tests that are cheap to make and + /// extremely unlikely to fail; generally it is frowned upon to have an + /// assertion failure in a release build, so these assertions generally need to + /// be of more than life-and-death importance if there's a chance they might + /// trigger. You should almost always consider handling these cases more + /// gracefully than an assert allows. + /// + /// When assertions are disabled, this wraps `condition` in a `sizeof` + /// operator, which means any function calls and side effects will not run, but + /// the compiler will not complain about any otherwise-unused variables that + /// are only referenced in the assertion. + /// + /// One can set the environment variable "SDL_ASSERT" to one of several strings + /// ("abort", "break", "retry", "ignore", "always_ignore") to force a default + /// behavior, which may be desirable for automation purposes. If your platform + /// requires GUI interfaces to happen on the main thread but you're debugging + /// an assertion in a background thread, it might be desirable to set this to + /// "break" so that your debugger takes control as soon as assert is triggered, + /// instead of risking a bad UI interaction (deadlock, etc) in the application. + /// * + /// + /// ## Parameters + /// - `condition`: boolean value to test. + /// + /// ## Thread safety + /// It is safe to call this macro from any thread. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_release { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_release; + + /// An assertion test that is performed only when built with paranoid settings. + /// + /// This macro is enabled when the [`SDL_ASSERT_LEVEL`] is >= 3, otherwise it is + /// disabled. This is a higher level than both release and debug, so these + /// tests are meant to be expensive and only run when specifically looking for + /// extremely unexpected failure cases in a special build. + /// + /// When assertions are disabled, this wraps `condition` in a `sizeof` + /// operator, which means any function calls and side effects will not run, but + /// the compiler will not complain about any otherwise-unused variables that + /// are only referenced in the assertion. + /// + /// One can set the environment variable "SDL_ASSERT" to one of several strings + /// ("abort", "break", "retry", "ignore", "always_ignore") to force a default + /// behavior, which may be desirable for automation purposes. If your platform + /// requires GUI interfaces to happen on the main thread but you're debugging + /// an assertion in a background thread, it might be desirable to set this to + /// "break" so that your debugger takes control as soon as assert is triggered, + /// instead of risking a bad UI interaction (deadlock, etc) in the application. + /// + /// ## Parameters + /// - `condition`: boolean value to test. + /// + /// ## Thread safety + /// It is safe to call this macro from any thread. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_paranoid { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_paranoid; +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(feature = "assert-level-disabled")] => { + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_release { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_release; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_paranoid { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_paranoid; + }); + + apply_cfg!(#[cfg(not(feature = "assert-level-disabled"))] => { + apply_cfg!(#[cfg(feature = "assert-level-release")] => { + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_release { + ($condition:expr) => { $crate::assert::SDL_enabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_release; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_paranoid { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_paranoid; + }); + + apply_cfg!(#[cfg(not(feature = "assert-level-release"))] => { + apply_cfg!(#[cfg(feature = "assert-level-debug")] => { + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert { + ($condition:expr) => { $crate::assert::SDL_enabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_release { + ($condition:expr) => { $crate::assert::SDL_enabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_release; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_paranoid { + ($condition:expr) => { $crate::assert::SDL_disabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_paranoid; + }); + + apply_cfg!(#[cfg(not(feature = "assert-level-debug"))] => { + apply_cfg!(#[cfg(feature = "assert-level-paranoid")] => { + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert { + ($condition:expr) => { $crate::assert::SDL_enabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_release { + ($condition:expr) => { $crate::assert::SDL_enabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_release; + + #[doc(hidden)] + #[macro_export] + macro_rules! SDL_assert_paranoid { + ($condition:expr) => { $crate::assert::SDL_enabled_assert!($condition) }; + } + #[doc(inline)] + pub use SDL_assert_paranoid; + }); + + apply_cfg!(#[cfg(not(feature = "assert-level-paranoid"))] => { + ::core::compile_error!("Unknown assertion level."); + }); + + }); + + }); + + }); + +}); + +/// An assertion test that is always performed. +/// +/// This macro is always enabled no matter what [`SDL_ASSERT_LEVEL`] is set to. You +/// almost never want to use this, as it could trigger on an end-user's system, +/// crashing your program. +/// +/// One can set the environment variable "SDL_ASSERT" to one of several strings +/// ("abort", "break", "retry", "ignore", "always_ignore") to force a default +/// behavior, which may be desirable for automation purposes. If your platform +/// requires GUI interfaces to happen on the main thread but you're debugging +/// an assertion in a background thread, it might be desirable to set this to +/// "break" so that your debugger takes control as soon as assert is triggered, +/// instead of risking a bad UI interaction (deadlock, etc) in the application. +/// +/// ## Parameters +/// - `condition`: boolean value to test. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[doc(hidden)] +#[macro_export] +macro_rules! SDL_assert_always { + ($condition:expr) => { + $crate::assert::SDL_enabled_assert!($condition) + }; +} +#[doc(inline)] +pub use SDL_assert_always; + +/// A callback that fires when an SDL assertion fails. +/// +/// ## Parameters +/// - `data`: a pointer to the [`SDL_AssertData`] structure corresponding to the +/// current assertion. +/// - `userdata`: what was passed as `userdata` to [`SDL_SetAssertionHandler()`]. +/// +/// ## Return value +/// Returns an [`SDL_AssertState`] value indicating how to handle the failure. +/// +/// ## Thread safety +/// This callback may be called from any thread that triggers an +/// assert at any time. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_AssertionHandler = ::core::option::Option< + unsafe extern "C" fn( + data: *const SDL_AssertData, + userdata: *mut ::core::ffi::c_void, + ) -> SDL_AssertState, +>; + +unsafe extern "C" { + /// Set an application-defined assertion handler. + /// + /// This function allows an application to show its own assertion UI and/or + /// force the response to an assertion failure. If the application doesn't + /// provide this, SDL will try to do the right thing, popping up a + /// system-specific GUI dialog, and probably minimizing any fullscreen windows. + /// + /// This callback may fire from any thread, but it runs wrapped in a mutex, so + /// it will only fire from one thread at a time. + /// + /// This callback is NOT reset to SDL's internal handler upon [`SDL_Quit()`]! + /// + /// ## Parameters + /// - `handler`: the [`SDL_AssertionHandler`] function to call when an assertion + /// fails or NULL for the default handler. + /// - `userdata`: a pointer that is passed to `handler`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAssertionHandler`] + pub fn SDL_SetAssertionHandler( + handler: SDL_AssertionHandler, + userdata: *mut ::core::ffi::c_void, + ); +} + +unsafe extern "C" { + /// Get the default assertion handler. + /// + /// This returns the function pointer that is called by default when an + /// assertion is triggered. This is an internal function provided by SDL, that + /// is used for assertions when [`SDL_SetAssertionHandler()`] hasn't been used to + /// provide a different function. + /// + /// ## Return value + /// Returns the default [`SDL_AssertionHandler`] that is called when an assert + /// triggers. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAssertionHandler`] + pub fn SDL_GetDefaultAssertionHandler() -> SDL_AssertionHandler; +} + +unsafe extern "C" { + /// Get the current assertion handler. + /// + /// This returns the function pointer that is called when an assertion is + /// triggered. This is either the value last passed to + /// [`SDL_SetAssertionHandler()`], or if no application-specified function is set, + /// is equivalent to calling [`SDL_GetDefaultAssertionHandler()`]. + /// + /// The parameter `puserdata` is a pointer to a void*, which will store the + /// "userdata" pointer that was passed to [`SDL_SetAssertionHandler()`]. This value + /// will always be NULL for the default handler. If you don't care about this + /// data, it is safe to pass a NULL pointer to this function to ignore it. + /// + /// ## Parameters + /// - `puserdata`: pointer which is filled with the "userdata" pointer that + /// was passed to [`SDL_SetAssertionHandler()`]. + /// + /// ## Return value + /// Returns the [`SDL_AssertionHandler`] that is called when an assert triggers. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAssertionHandler`] + pub fn SDL_GetAssertionHandler( + puserdata: *mut *mut ::core::ffi::c_void, + ) -> SDL_AssertionHandler; +} + +unsafe extern "C" { + /// Get a list of all assertion failures. + /// + /// This function gets all assertions triggered since the last call to + /// [`SDL_ResetAssertionReport()`], or the start of the program. + /// + /// The proper way to examine this data looks something like this: + /// + /// ```c + /// const SDL_AssertData *item = SDL_GetAssertionReport(); + /// while (item) { + /// printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", + /// item->condition, item->function, item->filename, + /// item->linenum, item->trigger_count, + /// item->always_ignore ? "yes" : "no"); + /// item = item->next; + /// } + /// ``` + /// + /// ## Return value + /// Returns a list of all failed assertions or NULL if the list is empty. This + /// memory should not be modified or freed by the application. This + /// pointer remains valid until the next call to [`SDL_Quit()`] or + /// [`SDL_ResetAssertionReport()`]. + /// + /// ## Thread safety + /// This function is not thread safe. Other threads calling + /// [`SDL_ResetAssertionReport()`] simultaneously, may render the + /// returned pointer invalid. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ResetAssertionReport`] + pub fn SDL_GetAssertionReport() -> *const SDL_AssertData; +} + +unsafe extern "C" { + /// Clear the list of all assertion failures. + /// + /// This function will clear the list of all assertions triggered up to that + /// point. Immediately following this call, [`SDL_GetAssertionReport`] will return + /// no items. In addition, any previously-triggered assertions will be reset to + /// a trigger_count of zero, and their always_ignore state will be false. + /// + /// ## Thread safety + /// This function is not thread safe. Other threads triggering an + /// assertion, or simultaneously calling this function may cause + /// memory leaks or crashes. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAssertionReport`] + pub fn SDL_ResetAssertionReport(); +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/asyncio.rs b/vendor/sdl3-sys/src/generated/asyncio.rs new file mode 100644 index 00000000..924c0dfe --- /dev/null +++ b/vendor/sdl3-sys/src/generated/asyncio.rs @@ -0,0 +1,773 @@ +//! SDL offers a way to perform I/O asynchronously. This allows an app to read +//! or write files without waiting for data to actually transfer; the functions +//! that request I/O never block while the request is fulfilled. +//! +//! Instead, the data moves in the background and the app can check for results +//! at their leisure. +//! +//! This is more complicated than just reading and writing files in a +//! synchronous way, but it can allow for more efficiency, and never having +//! framerate drops as the hard drive catches up, etc. +//! +//! The general usage pattern for async I/O is: +//! +//! - Create one or more [`SDL_AsyncIOQueue`] objects. +//! - Open files with [`SDL_AsyncIOFromFile`]. +//! - Start I/O tasks to the files with [`SDL_ReadAsyncIO`] or [`SDL_WriteAsyncIO`], +//! putting those tasks into one of the queues. +//! - Later on, use [`SDL_GetAsyncIOResult`] on a queue to see if any task is +//! finished without blocking. Tasks might finish in any order with success +//! or failure. +//! - When all your tasks are done, close the file with [`SDL_CloseAsyncIO`]. This +//! also generates a task, since it might flush data to disk! +//! +//! This all works, without blocking, in a single thread, but one can also wait +//! on a queue in a background thread, sleeping until new results have arrived: +//! +//! - Call [`SDL_WaitAsyncIOResult`] from one or more threads to efficiently block +//! until new tasks complete. +//! - When shutting down, call [`SDL_SignalAsyncIOQueue`] to unblock any sleeping +//! threads despite there being no new tasks completed. +//! +//! And, of course, to match the synchronous [`SDL_LoadFile`], we offer +//! [`SDL_LoadFileAsync`] as a convenience function. This will handle allocating a +//! buffer, slurping in the file data, and null-terminating it; you still check +//! for results later. +//! +//! Behind the scenes, SDL will use newer, efficient APIs on platforms that +//! support them: Linux's io_uring and Windows 11's IoRing, for example. If +//! those technologies aren't available, SDL will offload the work to a thread +//! pool that will manage otherwise-synchronous loads without blocking the app. +//! +//! ## Best Practices +//! +//! Simple non-blocking I/O--for an app that just wants to pick up data +//! whenever it's ready without losing framerate waiting on disks to spin--can +//! use whatever pattern works well for the program. In this case, simply call +//! [`SDL_ReadAsyncIO`], or maybe [`SDL_LoadFileAsync`], as needed. Once a frame, call +//! [`SDL_GetAsyncIOResult`] to check for any completed tasks and deal with the +//! data as it arrives. +//! +//! If two separate pieces of the same program need their own I/O, it is legal +//! for each to create their own queue. This will prevent either piece from +//! accidentally consuming the other's completed tasks. Each queue does require +//! some amount of resources, but it is not an overwhelming cost. Do not make a +//! queue for each task, however. It is better to put many tasks into a single +//! queue. They will be reported in order of completion, not in the order they +//! were submitted, so it doesn't generally matter what order tasks are +//! started. +//! +//! One async I/O queue can be shared by multiple threads, or one thread can +//! have more than one queue, but the most efficient way--if ruthless +//! efficiency is the goal--is to have one queue per thread, with multiple +//! threads working in parallel, and attempt to keep each queue loaded with +//! tasks that are both started by and consumed by the same thread. On modern +//! platforms that can use newer interfaces, this can keep data flowing as +//! efficiently as possible all the way from storage hardware to the app, with +//! no contention between threads for access to the same queue. +//! +//! Written data is not guaranteed to make it to physical media by the time a +//! closing task is completed, unless [`SDL_CloseAsyncIO`] is called with its +//! `flush` parameter set to true, which is to say that a successful result +//! here can still result in lost data during an unfortunately-timed power +//! outage if not flushed. However, flushing will take longer and may be +//! unnecessary, depending on the app's needs. + +use super::stdinc::*; + +/// Types of asynchronous I/O tasks. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`READ`](SDL_AsyncIOTaskType::READ) | [`SDL_ASYNCIO_TASK_READ`] | A read operation. | +/// | [`WRITE`](SDL_AsyncIOTaskType::WRITE) | [`SDL_ASYNCIO_TASK_WRITE`] | A write operation. | +/// | [`CLOSE`](SDL_AsyncIOTaskType::CLOSE) | [`SDL_ASYNCIO_TASK_CLOSE`] | A close operation. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_AsyncIOTaskType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_AsyncIOTaskType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_AsyncIOTaskType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_AsyncIOTaskType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_AsyncIOTaskType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::READ => "SDL_ASYNCIO_TASK_READ", + Self::WRITE => "SDL_ASYNCIO_TASK_WRITE", + Self::CLOSE => "SDL_ASYNCIO_TASK_CLOSE", + + _ => return write!(f, "SDL_AsyncIOTaskType({})", self.0), + }) + } +} + +impl SDL_AsyncIOTaskType { + /// A read operation. + pub const READ: Self = Self((0 as ::core::ffi::c_int)); + /// A write operation. + pub const WRITE: Self = Self((1 as ::core::ffi::c_int)); + /// A close operation. + pub const CLOSE: Self = Self((2 as ::core::ffi::c_int)); +} + +/// A read operation. +pub const SDL_ASYNCIO_TASK_READ: SDL_AsyncIOTaskType = SDL_AsyncIOTaskType::READ; +/// A write operation. +pub const SDL_ASYNCIO_TASK_WRITE: SDL_AsyncIOTaskType = SDL_AsyncIOTaskType::WRITE; +/// A close operation. +pub const SDL_ASYNCIO_TASK_CLOSE: SDL_AsyncIOTaskType = SDL_AsyncIOTaskType::CLOSE; + +impl SDL_AsyncIOTaskType { + /// Initialize a `SDL_AsyncIOTaskType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_AsyncIOTaskType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_AsyncIOTaskType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::asyncio::METADATA_SDL_AsyncIOTaskType; +} + +/// Possible outcomes of an asynchronous I/O task. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`COMPLETE`](SDL_AsyncIOResult::COMPLETE) | [`SDL_ASYNCIO_COMPLETE`] | request was completed without error | +/// | [`FAILURE`](SDL_AsyncIOResult::FAILURE) | [`SDL_ASYNCIO_FAILURE`] | request failed for some reason; check [`SDL_GetError()`]! | +/// | [`CANCELED`](SDL_AsyncIOResult::CANCELED) | [`SDL_ASYNCIO_CANCELED`] | request was canceled before completing. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_AsyncIOResult(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_AsyncIOResult { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_AsyncIOResult) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_AsyncIOResult) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_AsyncIOResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::COMPLETE => "SDL_ASYNCIO_COMPLETE", + Self::FAILURE => "SDL_ASYNCIO_FAILURE", + Self::CANCELED => "SDL_ASYNCIO_CANCELED", + + _ => return write!(f, "SDL_AsyncIOResult({})", self.0), + }) + } +} + +impl SDL_AsyncIOResult { + /// request was completed without error + pub const COMPLETE: Self = Self((0 as ::core::ffi::c_int)); + /// request failed for some reason; check [`SDL_GetError()`]! + pub const FAILURE: Self = Self((1 as ::core::ffi::c_int)); + /// request was canceled before completing. + pub const CANCELED: Self = Self((2 as ::core::ffi::c_int)); +} + +/// request was completed without error +pub const SDL_ASYNCIO_COMPLETE: SDL_AsyncIOResult = SDL_AsyncIOResult::COMPLETE; +/// request failed for some reason; check [`SDL_GetError()`]! +pub const SDL_ASYNCIO_FAILURE: SDL_AsyncIOResult = SDL_AsyncIOResult::FAILURE; +/// request was canceled before completing. +pub const SDL_ASYNCIO_CANCELED: SDL_AsyncIOResult = SDL_AsyncIOResult::CANCELED; + +impl SDL_AsyncIOResult { + /// Initialize a `SDL_AsyncIOResult` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_AsyncIOResult { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_AsyncIOResult { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::asyncio::METADATA_SDL_AsyncIOResult; +} + +/// Information about a completed asynchronous I/O request. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_AsyncIOOutcome { + /// what generated this task. This pointer will be invalid if it was closed! + pub asyncio: *mut SDL_AsyncIO, + /// What sort of task was this? Read, write, etc? + pub r#type: SDL_AsyncIOTaskType, + /// the result of the work (success, failure, cancellation). + pub result: SDL_AsyncIOResult, + /// buffer where data was read/written. + pub buffer: *mut ::core::ffi::c_void, + /// offset in the [`SDL_AsyncIO`] where data was read/written. + pub offset: Uint64, + /// number of bytes the task was to read/write. + pub bytes_requested: Uint64, + /// actual number of bytes that were read/written. + pub bytes_transferred: Uint64, + /// pointer provided by the app when starting the task + pub userdata: *mut ::core::ffi::c_void, +} + +impl ::core::default::Default for SDL_AsyncIOOutcome { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Use this function to create a new [`SDL_AsyncIO`] object for reading from + /// and/or writing to a named file. + /// + /// The `mode` string understands the following values: + /// + /// - "r": Open a file for reading only. It must exist. + /// - "w": Open a file for writing only. It will create missing files or + /// truncate existing ones. + /// - "r+": Open a file for update both reading and writing. The file must + /// exist. + /// - "w+": Create an empty file for both reading and writing. If a file with + /// the same name already exists its content is erased and the file is + /// treated as a new empty file. + /// + /// There is no "b" mode, as there is only "binary" style I/O, and no "a" mode + /// for appending, since you specify the position when starting a task. + /// + /// This function supports Unicode filenames, but they must be encoded in UTF-8 + /// format, regardless of the underlying operating system. + /// + /// This call is _not_ asynchronous; it will open the file before returning, + /// under the assumption that doing so is generally a fast operation. Future + /// reads and writes to the opened file will be async, however. + /// + /// ## Parameters + /// - `file`: a UTF-8 string representing the filename to open. + /// - `mode`: an ASCII string representing the mode to be used for opening + /// the file. + /// + /// ## Return value + /// Returns a pointer to the [`SDL_AsyncIO`] structure that is created or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseAsyncIO`] + /// - [`SDL_ReadAsyncIO`] + /// - [`SDL_WriteAsyncIO`] + pub fn SDL_AsyncIOFromFile( + file: *const ::core::ffi::c_char, + mode: *const ::core::ffi::c_char, + ) -> *mut SDL_AsyncIO; +} + +unsafe extern "C" { + /// Use this function to get the size of the data stream in an [`SDL_AsyncIO`]. + /// + /// This call is _not_ asynchronous; it assumes that obtaining this info is a + /// non-blocking operation in most reasonable cases. + /// + /// ## Parameters + /// - `asyncio`: the [`SDL_AsyncIO`] to get the size of the data stream from. + /// + /// ## Return value + /// Returns the size of the data stream in the [`SDL_IOStream`] on success or a + /// negative error code on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetAsyncIOSize(asyncio: *mut SDL_AsyncIO) -> Sint64; +} + +unsafe extern "C" { + /// Start an async read. + /// + /// This function reads up to `size` bytes from `offset` position in the data + /// source to the area pointed at by `ptr`. This function may read less bytes + /// than requested. + /// + /// This function returns as quickly as possible; it does not wait for the read + /// to complete. On a successful return, this work will continue in the + /// background. If the work begins, even failure is asynchronous: a failing + /// return value from this function only means the work couldn't start at all. + /// + /// `ptr` must remain available until the work is done, and may be accessed by + /// the system at any time until then. Do not allocate it on the stack, as this + /// might take longer than the life of the calling function to complete! + /// + /// An [`SDL_AsyncIOQueue`] must be specified. The newly-created task will be added + /// to it when it completes its work. + /// + /// ## Parameters + /// - `asyncio`: a pointer to an [`SDL_AsyncIO`] structure. + /// - `ptr`: a pointer to a buffer to read data into. + /// - `offset`: the position to start reading in the data source. + /// - `size`: the number of bytes to read from the data source. + /// - `queue`: a queue to add the new [`SDL_AsyncIO`] to. + /// - `userdata`: an app-defined pointer that will be provided with the task + /// results. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WriteAsyncIO`] + /// - [`SDL_CreateAsyncIOQueue`] + pub fn SDL_ReadAsyncIO( + asyncio: *mut SDL_AsyncIO, + ptr: *mut ::core::ffi::c_void, + offset: Uint64, + size: Uint64, + queue: *mut SDL_AsyncIOQueue, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Start an async write. + /// + /// This function writes `size` bytes from `offset` position in the data source + /// to the area pointed at by `ptr`. + /// + /// This function returns as quickly as possible; it does not wait for the + /// write to complete. On a successful return, this work will continue in the + /// background. If the work begins, even failure is asynchronous: a failing + /// return value from this function only means the work couldn't start at all. + /// + /// `ptr` must remain available until the work is done, and may be accessed by + /// the system at any time until then. Do not allocate it on the stack, as this + /// might take longer than the life of the calling function to complete! + /// + /// An [`SDL_AsyncIOQueue`] must be specified. The newly-created task will be added + /// to it when it completes its work. + /// + /// ## Parameters + /// - `asyncio`: a pointer to an [`SDL_AsyncIO`] structure. + /// - `ptr`: a pointer to a buffer to write data from. + /// - `offset`: the position to start writing to the data source. + /// - `size`: the number of bytes to write to the data source. + /// - `queue`: a queue to add the new [`SDL_AsyncIO`] to. + /// - `userdata`: an app-defined pointer that will be provided with the task + /// results. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ReadAsyncIO`] + /// - [`SDL_CreateAsyncIOQueue`] + pub fn SDL_WriteAsyncIO( + asyncio: *mut SDL_AsyncIO, + ptr: *mut ::core::ffi::c_void, + offset: Uint64, + size: Uint64, + queue: *mut SDL_AsyncIOQueue, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Close and free any allocated resources for an async I/O object. + /// + /// Closing a file is _also_ an asynchronous task! If a write failure were to + /// happen during the closing process, for example, the task results will + /// report it as usual. + /// + /// Closing a file that has been written to does not guarantee the data has + /// made it to physical media; it may remain in the operating system's file + /// cache, for later writing to disk. This means that a successfully-closed + /// file can be lost if the system crashes or loses power in this small window. + /// To prevent this, call this function with the `flush` parameter set to true. + /// This will make the operation take longer, and perhaps increase system load + /// in general, but a successful result guarantees that the data has made it to + /// physical storage. Don't use this for temporary files, caches, and + /// unimportant data, and definitely use it for crucial irreplaceable files, + /// like game saves. + /// + /// This function guarantees that the close will happen after any other pending + /// tasks to `asyncio`, so it's safe to open a file, start several operations, + /// close the file immediately, then check for all results later. This function + /// will not block until the tasks have completed. + /// + /// Once this function returns true, `asyncio` is no longer valid, regardless + /// of any future outcomes. Any completed tasks might still contain this + /// pointer in their [`SDL_AsyncIOOutcome`] data, in case the app was using this + /// value to track information, but it should not be used again. + /// + /// If this function returns false, the close wasn't started at all, and it's + /// safe to attempt to close again later. + /// + /// An [`SDL_AsyncIOQueue`] must be specified. The newly-created task will be added + /// to it when it completes its work. + /// + /// ## Parameters + /// - `asyncio`: a pointer to an [`SDL_AsyncIO`] structure to close. + /// - `flush`: true if data should sync to disk before the task completes. + /// - `queue`: a queue to add the new [`SDL_AsyncIO`] to. + /// - `userdata`: an app-defined pointer that will be provided with the task + /// results. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but two + /// threads should not attempt to close the same object. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CloseAsyncIO( + asyncio: *mut SDL_AsyncIO, + flush: ::core::primitive::bool, + queue: *mut SDL_AsyncIOQueue, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create a task queue for tracking multiple I/O operations. + /// + /// Async I/O operations are assigned to a queue when started. The queue can be + /// checked for completed tasks thereafter. + /// + /// ## Return value + /// Returns a new task queue object or NULL if there was an error; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyAsyncIOQueue`] + /// - [`SDL_GetAsyncIOResult`] + /// - [`SDL_WaitAsyncIOResult`] + pub fn SDL_CreateAsyncIOQueue() -> *mut SDL_AsyncIOQueue; +} + +unsafe extern "C" { + /// Destroy a previously-created async I/O task queue. + /// + /// If there are still tasks pending for this queue, this call will block until + /// those tasks are finished. All those tasks will be deallocated. Their + /// results will be lost to the app. + /// + /// Any pending reads from [`SDL_LoadFileAsync()`] that are still in this queue + /// will have their buffers deallocated by this function, to prevent a memory + /// leak. + /// + /// Once this function is called, the queue is no longer valid and should not + /// be used, including by other threads that might access it while destruction + /// is blocking on pending tasks. + /// + /// Do not destroy a queue that still has threads waiting on it through + /// [`SDL_WaitAsyncIOResult()`]. You can call [`SDL_SignalAsyncIOQueue()`] first to + /// unblock those threads, and take measures (such as [`SDL_WaitThread()`]) to make + /// sure they have finished their wait and won't wait on the queue again. + /// + /// ## Parameters + /// - `queue`: the task queue to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, so long as + /// no other thread is waiting on the queue with + /// [`SDL_WaitAsyncIOResult`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DestroyAsyncIOQueue(queue: *mut SDL_AsyncIOQueue); +} + +unsafe extern "C" { + /// Query an async I/O task queue for completed tasks. + /// + /// If a task assigned to this queue has finished, this will return true and + /// fill in `outcome` with the details of the task. If no task in the queue has + /// finished, this function will return false. This function does not block. + /// + /// If a task has completed, this function will free its resources and the task + /// pointer will no longer be valid. The task will be removed from the queue. + /// + /// It is safe for multiple threads to call this function on the same queue at + /// once; a completed task will only go to one of the threads. + /// + /// ## Parameters + /// - `queue`: the async I/O task queue to query. + /// - `outcome`: details of a finished task will be written here. May not be + /// NULL. + /// + /// ## Return value + /// Returns true if a task has completed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WaitAsyncIOResult`] + pub fn SDL_GetAsyncIOResult( + queue: *mut SDL_AsyncIOQueue, + outcome: *mut SDL_AsyncIOOutcome, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Block until an async I/O task queue has a completed task. + /// + /// This function puts the calling thread to sleep until there a task assigned + /// to the queue that has finished. + /// + /// If a task assigned to the queue has finished, this will return true and + /// fill in `outcome` with the details of the task. If no task in the queue has + /// finished, this function will return false. + /// + /// If a task has completed, this function will free its resources and the task + /// pointer will no longer be valid. The task will be removed from the queue. + /// + /// It is safe for multiple threads to call this function on the same queue at + /// once; a completed task will only go to one of the threads. + /// + /// Note that by the nature of various platforms, more than one waiting thread + /// may wake to handle a single task, but only one will obtain it, so + /// `timeoutMS` is a _maximum_ wait time, and this function may return false + /// sooner. + /// + /// This function may return false if there was a system error, the OS + /// inadvertently awoke multiple threads, or if [`SDL_SignalAsyncIOQueue()`] was + /// called to wake up all waiting threads without a finished task. + /// + /// A timeout can be used to specify a maximum wait time, but rather than + /// polling, it is possible to have a timeout of -1 to wait forever, and use + /// [`SDL_SignalAsyncIOQueue()`] to wake up the waiting threads later. + /// + /// ## Parameters + /// - `queue`: the async I/O task queue to wait on. + /// - `outcome`: details of a finished task will be written here. May not be + /// NULL. + /// - `timeoutMS`: the maximum time to wait, in milliseconds, or -1 to wait + /// indefinitely. + /// + /// ## Return value + /// Returns true if task has completed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SignalAsyncIOQueue`] + pub fn SDL_WaitAsyncIOResult( + queue: *mut SDL_AsyncIOQueue, + outcome: *mut SDL_AsyncIOOutcome, + timeoutMS: Sint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Wake up any threads that are blocking in [`SDL_WaitAsyncIOResult()`]. + /// + /// This will unblock any threads that are sleeping in a call to + /// [`SDL_WaitAsyncIOResult`] for the specified queue, and cause them to return + /// from that function. + /// + /// This can be useful when destroying a queue to make sure nothing is touching + /// it indefinitely. In this case, once this call completes, the caller should + /// take measures to make sure any previously-blocked threads have returned + /// from their wait and will not touch the queue again (perhaps by setting a + /// flag to tell the threads to terminate and then using [`SDL_WaitThread()`] to + /// make sure they've done so). + /// + /// ## Parameters + /// - `queue`: the async I/O task queue to signal. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WaitAsyncIOResult`] + pub fn SDL_SignalAsyncIOQueue(queue: *mut SDL_AsyncIOQueue); +} + +unsafe extern "C" { + /// Load all the data from a file path, asynchronously. + /// + /// This function returns as quickly as possible; it does not wait for the read + /// to complete. On a successful return, this work will continue in the + /// background. If the work begins, even failure is asynchronous: a failing + /// return value from this function only means the work couldn't start at all. + /// + /// The data is allocated with a zero byte at the end (null terminated) for + /// convenience. This extra byte is not included in SDL_AsyncIOOutcome's + /// bytes_transferred value. + /// + /// This function will allocate the buffer to contain the file. It must be + /// deallocated by calling [`SDL_free()`] on SDL_AsyncIOOutcome's buffer field + /// after completion. + /// + /// An [`SDL_AsyncIOQueue`] must be specified. The newly-created task will be added + /// to it when it completes its work. + /// + /// ## Parameters + /// - `file`: the path to read all available data from. + /// - `queue`: a queue to add the new [`SDL_AsyncIO`] to. + /// - `userdata`: an app-defined pointer that will be provided with the task + /// results. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadFile_IO`] + pub fn SDL_LoadFileAsync( + file: *const ::core::ffi::c_char, + queue: *mut SDL_AsyncIOQueue, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +/// The asynchronous I/O operation structure. +/// +/// This operates as an opaque handle. One can then request read or write +/// operations on it. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AsyncIOFromFile`] +#[repr(C)] +pub struct SDL_AsyncIO { + _opaque: [::core::primitive::u8; 0], +} + +/// A queue of completed asynchronous I/O tasks. +/// +/// When starting an asynchronous operation, you specify a queue for the new +/// task. A queue can be asked later if any tasks in it have completed, +/// allowing an app to manage multiple pending tasks in one place, in whatever +/// order they complete. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateAsyncIOQueue`] +/// - [`SDL_ReadAsyncIO`] +/// - [`SDL_WriteAsyncIO`] +/// - [`SDL_GetAsyncIOResult`] +/// - [`SDL_WaitAsyncIOResult`] +#[repr(C)] +pub struct SDL_AsyncIOQueue { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/atomic.rs b/vendor/sdl3-sys/src/generated/atomic.rs new file mode 100644 index 00000000..4815c29e --- /dev/null +++ b/vendor/sdl3-sys/src/generated/atomic.rs @@ -0,0 +1,696 @@ +//! Atomic operations. +//! +//! IMPORTANT: If you are not an expert in concurrent lockless programming, you +//! should not be using any functions in this file. You should be protecting +//! your data structures with full mutexes instead. +//! +//! ***Seriously, here be dragons!*** +//! +//! You can find out a little more about lockless programming and the subtle +//! issues that can arise here: +//! +//! +//! There's also lots of good information here: +//! +//! - +//! - +//! +//! These operations may or may not actually be implemented using processor +//! specific atomic operations. When possible they are implemented as true +//! processor specific atomic operations. When that is not possible the are +//! implemented using locks that *do* use the available atomic operations. +//! +//! All of the atomic operations that modify memory are full memory barriers. + +use super::stdinc::*; + +/// An atomic spinlock. +/// +/// The atomic locks are efficient spinlocks using CPU instructions, but are +/// vulnerable to starvation and can spin forever if a thread holding a lock +/// has been terminated. For this reason you should minimize the code executed +/// inside an atomic lock and never do expensive things like API or system +/// calls while holding them. +/// +/// They are also vulnerable to starvation if the thread holding the lock is +/// lower priority than other threads and doesn't get scheduled. In general you +/// should use mutexes instead, since they have better performance and +/// contention behavior. +/// +/// The atomic locks are not safe to lock recursively. +/// +/// Porting Note: The spin lock functions and type are required and can not be +/// emulated because they are used in the atomic emulation code. +#[repr(transparent)] +#[derive(Default)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_SpinLock(pub ::core::ffi::c_int); + +impl SDL_SpinLock { + /// Initialize a `SDL_SpinLock` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_SpinLock { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::atomic::METADATA_SDL_SpinLock; +} + +unsafe extern "C" { + /// Try to lock a spin lock by setting it to a non-zero value. + /// + /// ***Please note that spinlocks are dangerous if you don't know what you're + /// doing. Please be careful using any sort of spinlock!*** + /// + /// ## Parameters + /// - `lock`: a pointer to a lock variable. + /// + /// ## Return value + /// Returns true if the lock succeeded, false if the lock is already held. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockSpinlock`] + /// - [`SDL_UnlockSpinlock`] + pub fn SDL_TryLockSpinlock(lock: *mut SDL_SpinLock) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Lock a spin lock by setting it to a non-zero value. + /// + /// ***Please note that spinlocks are dangerous if you don't know what you're + /// doing. Please be careful using any sort of spinlock!*** + /// + /// ## Parameters + /// - `lock`: a pointer to a lock variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_TryLockSpinlock`] + /// - [`SDL_UnlockSpinlock`] + pub fn SDL_LockSpinlock(lock: *mut SDL_SpinLock); +} + +unsafe extern "C" { + /// Unlock a spin lock by setting it to 0. + /// + /// Always returns immediately. + /// + /// ***Please note that spinlocks are dangerous if you don't know what you're + /// doing. Please be careful using any sort of spinlock!*** + /// + /// ## Parameters + /// - `lock`: a pointer to a lock variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockSpinlock`] + /// - [`SDL_TryLockSpinlock`] + pub fn SDL_UnlockSpinlock(lock: *mut SDL_SpinLock); +} + +apply_cfg!(#[cfg(doc)] => { + /// Mark a compiler barrier. + /// + /// A compiler barrier prevents the compiler from reordering reads and writes + /// to globally visible variables across the call. + /// + /// This macro only prevents the compiler from reordering reads and writes, it + /// does not prevent the CPU from reordering reads and writes. However, all of + /// the atomic operations that modify memory are full memory barriers. + /// + /// ## Thread safety + /// Obviously this macro is safe to use from any thread at any + /// time, but if you find yourself needing this, you are probably + /// dealing with some very sensitive code; be careful! + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[inline(always)] + pub fn SDL_CompilerBarrier() { + ::core::sync::atomic::compiler_fence(::core::sync::atomic::Ordering::SeqCst) + } +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(all(not(any(/* always disabled: __clang__ */)), all(windows, target_env = "msvc")))] => { + // pragma `intrinsic(_ReadWriteBarrier)` + #[inline(always)] + pub fn SDL_CompilerBarrier() { + ::core::sync::atomic::compiler_fence(::core::sync::atomic::Ordering::SeqCst) + } + }); + + apply_cfg!(#[cfg(not(all(not(any(/* always disabled: __clang__ */)), all(windows, target_env = "msvc"))))] => { + apply_cfg!(#[cfg(any(not(target_os = "emscripten"), doc))] => { + #[inline(always)] + pub fn SDL_CompilerBarrier() { + ::core::sync::atomic::compiler_fence(::core::sync::atomic::Ordering::SeqCst) + } + }); + + apply_cfg!(#[cfg(any(doc, target_os = "emscripten"))] => { + #[inline(always)] + pub fn SDL_CompilerBarrier() { + ::core::sync::atomic::compiler_fence(::core::sync::atomic::Ordering::SeqCst) + } + }); + + }); + +}); + +#[inline(always)] +pub fn SDL_MemoryBarrierRelease() { + ::core::sync::atomic::fence(::core::sync::atomic::Ordering::Release) +} + +unsafe extern "C" { + /// Insert a memory release barrier (function version). + /// + /// Please refer to [`SDL_MemoryBarrierRelease`] for details. This is a function + /// version, which might be useful if you need to use this functionality from a + /// scripting language, etc. Also, some of the macro versions call this + /// function behind the scenes, where more heavy lifting can happen inside of + /// SDL. Generally, though, an app written in C/C++/etc should use the macro + /// version, as it will be more efficient. + /// + /// ## Thread safety + /// Obviously this function is safe to use from any thread at any + /// time, but if you find yourself needing this, you are probably + /// dealing with some very sensitive code; be careful! + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MemoryBarrierRelease`] + pub fn SDL_MemoryBarrierReleaseFunction(); +} + +#[inline(always)] +pub fn SDL_MemoryBarrierAcquire() { + ::core::sync::atomic::fence(::core::sync::atomic::Ordering::Acquire) +} + +unsafe extern "C" { + /// Insert a memory acquire barrier (function version). + /// + /// Please refer to [`SDL_MemoryBarrierRelease`] for details. This is a function + /// version, which might be useful if you need to use this functionality from a + /// scripting language, etc. Also, some of the macro versions call this + /// function behind the scenes, where more heavy lifting can happen inside of + /// SDL. Generally, though, an app written in C/C++/etc should use the macro + /// version, as it will be more efficient. + /// + /// ## Thread safety + /// Obviously this function is safe to use from any thread at any + /// time, but if you find yourself needing this, you are probably + /// dealing with some very sensitive code; be careful! + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MemoryBarrierAcquire`] + pub fn SDL_MemoryBarrierAcquireFunction(); +} + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(all(any(any(target_arch = "powerpc", target_arch = "powerpc64"), any(target_arch = "powerpc", target_arch = "powerpc64")), any(/* always disabled: __GNUC__ */)))] => { + }); + + apply_cfg!(#[cfg(not(all(any(any(target_arch = "powerpc", target_arch = "powerpc64"), any(target_arch = "powerpc", target_arch = "powerpc64")), any(/* always disabled: __GNUC__ */))))] => { + }); + +}); + +apply_cfg!(#[cfg(doc)] => { + /// A macro to insert a CPU-specific "pause" instruction into the program. + /// + /// This can be useful in busy-wait loops, as it serves as a hint to the CPU as + /// to the program's intent; some CPUs can use this to do more efficient + /// processing. On some platforms, this doesn't do anything, so using this + /// macro might just be a harmless no-op. + /// + /// Note that if you are busy-waiting, there are often more-efficient + /// approaches with other synchronization primitives: mutexes, semaphores, + /// condition variables, etc. + /// + /// ## Thread safety + /// This macro is safe to use from any thread. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + #[inline(always)] + pub fn SDL_CPUPauseInstruction() { + ::core::hint::spin_loop(); + } +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(all(any(any(/* always disabled: __GNUC__ */), any(/* always disabled: __clang__ */)), any(target_arch = "x86", target_arch = "x86_64"), not(target_arch = "arm64ec")))] => { + #[inline(always)] + pub fn SDL_CPUPauseInstruction() { + ::core::hint::spin_loop(); + } + }); + + apply_cfg!(#[cfg(not(all(any(any(/* always disabled: __GNUC__ */), any(/* always disabled: __clang__ */)), any(target_arch = "x86", target_arch = "x86_64"), not(target_arch = "arm64ec"))))] => { + #[inline(always)] + pub fn SDL_CPUPauseInstruction() { + ::core::hint::spin_loop(); + } + }); + +}); + +/// A type representing an atomic integer value. +/// +/// This can be used to manage a value that is synchronized across multiple +/// CPUs without a race condition; when an app sets a value with +/// [`SDL_SetAtomicInt`] all other threads, regardless of the CPU it is running on, +/// will see that value when retrieved with [`SDL_GetAtomicInt`], regardless of CPU +/// caches, etc. +/// +/// This is also useful for atomic compare-and-swap operations: a thread can +/// change the value as long as its current value matches expectations. When +/// done in a loop, one can guarantee data consistency across threads without a +/// lock (but the usual warnings apply: if you don't know what you're doing, or +/// you don't do it carefully, you can confidently cause any number of +/// disasters with this, so in most cases, you _should_ use a mutex instead of +/// this!). +/// +/// This is a struct so people don't accidentally use numeric operations on it +/// directly. You have to use SDL atomic functions. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CompareAndSwapAtomicInt`] +/// - [`SDL_GetAtomicInt`] +/// - [`SDL_SetAtomicInt`] +/// - [`SDL_AddAtomicInt`] +#[repr(C)] +#[derive(Default)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_AtomicInt { + pub value: ::core::ffi::c_int, +} + +unsafe extern "C" { + /// Set an atomic variable to a new value if it is currently an old value. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicInt`] variable to be modified. + /// - `oldval`: the old value. + /// - `newval`: the new value. + /// + /// ## Return value + /// Returns true if the atomic variable was set, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAtomicInt`] + /// - [`SDL_SetAtomicInt`] + pub fn SDL_CompareAndSwapAtomicInt( + a: *mut SDL_AtomicInt, + oldval: ::core::ffi::c_int, + newval: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an atomic variable to a value. + /// + /// This function also acts as a full memory barrier. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicInt`] variable to be modified. + /// - `v`: the desired value. + /// + /// ## Return value + /// Returns the previous value of the atomic variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAtomicInt`] + pub fn SDL_SetAtomicInt(a: *mut SDL_AtomicInt, v: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the value of an atomic variable. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicInt`] variable. + /// + /// ## Return value + /// Returns the current value of an atomic variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAtomicInt`] + pub fn SDL_GetAtomicInt(a: *mut SDL_AtomicInt) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Add to an atomic variable. + /// + /// This function also acts as a full memory barrier. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicInt`] variable to be modified. + /// - `v`: the desired value to add. + /// + /// ## Return value + /// Returns the previous value of the atomic variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AtomicDecRef`] + /// - [`SDL_AtomicIncRef`] + pub fn SDL_AddAtomicInt(a: *mut SDL_AtomicInt, v: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +/// Increment an atomic variable used as a reference count. +/// +/// ***Note: If you don't know what this macro is for, you shouldn't use it!*** +/// +/// ## Parameters +/// - `a`: a pointer to an [`SDL_AtomicInt`] to increment. +/// +/// ## Return value +/// Returns the previous value of the atomic variable. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AtomicDecRef`] +#[inline(always)] +pub unsafe fn SDL_AtomicIncRef(a: *mut SDL_AtomicInt) -> ::core::ffi::c_int { + unsafe { SDL_AddAtomicInt(a, 1) } +} + +/// Decrement an atomic variable used as a reference count. +/// +/// ***Note: If you don't know what this macro is for, you shouldn't use it!*** +/// +/// ## Parameters +/// - `a`: a pointer to an [`SDL_AtomicInt`] to decrement. +/// +/// ## Return value +/// Returns true if the variable reached zero after decrementing, false +/// otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AtomicIncRef`] +#[inline(always)] +pub unsafe fn SDL_AtomicDecRef(a: *mut SDL_AtomicInt) -> ::core::primitive::bool { + (unsafe { SDL_AddAtomicInt(a, -1_i32) } == 1_i32) +} + +/// A type representing an atomic unsigned 32-bit value. +/// +/// This can be used to manage a value that is synchronized across multiple +/// CPUs without a race condition; when an app sets a value with +/// [`SDL_SetAtomicU32`] all other threads, regardless of the CPU it is running on, +/// will see that value when retrieved with [`SDL_GetAtomicU32`], regardless of CPU +/// caches, etc. +/// +/// This is also useful for atomic compare-and-swap operations: a thread can +/// change the value as long as its current value matches expectations. When +/// done in a loop, one can guarantee data consistency across threads without a +/// lock (but the usual warnings apply: if you don't know what you're doing, or +/// you don't do it carefully, you can confidently cause any number of +/// disasters with this, so in most cases, you _should_ use a mutex instead of +/// this!). +/// +/// This is a struct so people don't accidentally use numeric operations on it +/// directly. You have to use SDL atomic functions. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CompareAndSwapAtomicU32`] +/// - [`SDL_GetAtomicU32`] +/// - [`SDL_SetAtomicU32`] +#[repr(C)] +#[derive(Default)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_AtomicU32 { + pub value: Uint32, +} + +unsafe extern "C" { + /// Set an atomic variable to a new value if it is currently an old value. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicU32`] variable to be modified. + /// - `oldval`: the old value. + /// - `newval`: the new value. + /// + /// ## Return value + /// Returns true if the atomic variable was set, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAtomicU32`] + /// - [`SDL_SetAtomicU32`] + pub fn SDL_CompareAndSwapAtomicU32( + a: *mut SDL_AtomicU32, + oldval: Uint32, + newval: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an atomic variable to a value. + /// + /// This function also acts as a full memory barrier. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicU32`] variable to be modified. + /// - `v`: the desired value. + /// + /// ## Return value + /// Returns the previous value of the atomic variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAtomicU32`] + pub fn SDL_SetAtomicU32(a: *mut SDL_AtomicU32, v: Uint32) -> Uint32; +} + +unsafe extern "C" { + /// Get the value of an atomic variable. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicU32`] variable. + /// + /// ## Return value + /// Returns the current value of an atomic variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAtomicU32`] + pub fn SDL_GetAtomicU32(a: *mut SDL_AtomicU32) -> Uint32; +} + +unsafe extern "C" { + /// Add to an atomic variable. + /// + /// This function also acts as a full memory barrier. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to an [`SDL_AtomicU32`] variable to be modified. + /// - `v`: the desired value to add or subtract. + /// + /// ## Return value + /// Returns the previous value of the atomic variable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_AddAtomicU32(a: *mut SDL_AtomicU32, v: ::core::ffi::c_int) -> Uint32; +} + +unsafe extern "C" { + /// Set a pointer to a new value if it is currently an old value. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to a pointer. + /// - `oldval`: the old pointer value. + /// - `newval`: the new pointer value. + /// + /// ## Return value + /// Returns true if the pointer was set, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CompareAndSwapAtomicInt`] + /// - [`SDL_GetAtomicPointer`] + /// - [`SDL_SetAtomicPointer`] + pub fn SDL_CompareAndSwapAtomicPointer( + a: *mut *mut ::core::ffi::c_void, + oldval: *mut ::core::ffi::c_void, + newval: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a pointer to a value atomically. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to a pointer. + /// - `v`: the desired pointer value. + /// + /// ## Return value + /// Returns the previous value of the pointer. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CompareAndSwapAtomicPointer`] + /// - [`SDL_GetAtomicPointer`] + pub fn SDL_SetAtomicPointer( + a: *mut *mut ::core::ffi::c_void, + v: *mut ::core::ffi::c_void, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Get the value of a pointer atomically. + /// + /// ***Note: If you don't know what this function is for, you shouldn't use + /// it!*** + /// + /// ## Parameters + /// - `a`: a pointer to a pointer. + /// + /// ## Return value + /// Returns the current value of a pointer. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CompareAndSwapAtomicPointer`] + /// - [`SDL_SetAtomicPointer`] + pub fn SDL_GetAtomicPointer(a: *mut *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/audio.rs b/vendor/sdl3-sys/src/generated/audio.rs new file mode 100644 index 00000000..a7a7d59a --- /dev/null +++ b/vendor/sdl3-sys/src/generated/audio.rs @@ -0,0 +1,3086 @@ +//! Audio functionality for the SDL library. +//! +//! All audio in SDL3 revolves around [`SDL_AudioStream`]. Whether you want to play +//! or record audio, convert it, stream it, buffer it, or mix it, you're going +//! to be passing it through an audio stream. +//! +//! Audio streams are quite flexible; they can accept any amount of data at a +//! time, in any supported format, and output it as needed in any other format, +//! even if the data format changes on either side halfway through. +//! +//! An app opens an audio device and binds any number of audio streams to it, +//! feeding more data to the streams as available. When the device needs more +//! data, it will pull it from all bound streams and mix them together for +//! playback. +//! +//! Audio streams can also use an app-provided callback to supply data +//! on-demand, which maps pretty closely to the SDL2 audio model. +//! +//! SDL also provides a simple .WAV loader in [`SDL_LoadWAV`] (and [`SDL_LoadWAV_IO`] +//! if you aren't reading from a file) as a basic means to load sound data into +//! your program. +//! +//! ## Logical audio devices +//! +//! In SDL3, opening a physical device (like a SoundBlaster 16 Pro) gives you a +//! logical device ID that you can bind audio streams to. In almost all cases, +//! logical devices can be used anywhere in the API that a physical device is +//! normally used. However, since each device opening generates a new logical +//! device, different parts of the program (say, a VoIP library, or +//! text-to-speech framework, or maybe some other sort of mixer on top of SDL) +//! can have their own device opens that do not interfere with each other; each +//! logical device will mix its separate audio down to a single buffer, fed to +//! the physical device, behind the scenes. As many logical devices as you like +//! can come and go; SDL will only have to open the physical device at the OS +//! level once, and will manage all the logical devices on top of it +//! internally. +//! +//! One other benefit of logical devices: if you don't open a specific physical +//! device, instead opting for the default, SDL can automatically migrate those +//! logical devices to different hardware as circumstances change: a user +//! plugged in headphones? The system default changed? SDL can transparently +//! migrate the logical devices to the correct physical device seamlessly and +//! keep playing; the app doesn't even have to know it happened if it doesn't +//! want to. +//! +//! ## Simplified audio +//! +//! As a simplified model for when a single source of audio is all that's +//! needed, an app can use [`SDL_OpenAudioDeviceStream`], which is a single +//! function to open an audio device, create an audio stream, bind that stream +//! to the newly-opened device, and (optionally) provide a callback for +//! obtaining audio data. When using this function, the primary interface is +//! the [`SDL_AudioStream`] and the device handle is mostly hidden away; destroying +//! a stream created through this function will also close the device, stream +//! bindings cannot be changed, etc. One other quirk of this is that the device +//! is started in a _paused_ state and must be explicitly resumed; this is +//! partially to offer a clean migration for SDL2 apps and partially because +//! the app might have to do more setup before playback begins; in the +//! non-simplified form, nothing will play until a stream is bound to a device, +//! so they start _unpaused_. +//! +//! ## Channel layouts +//! +//! Audio data passing through SDL is uncompressed PCM data, interleaved. One +//! can provide their own decompression through an MP3, etc, decoder, but SDL +//! does not provide this directly. Each interleaved channel of data is meant +//! to be in a specific order. +//! +//! Abbreviations: +//! +//! - FRONT = single mono speaker +//! - FL = front left speaker +//! - FR = front right speaker +//! - FC = front center speaker +//! - BL = back left speaker +//! - BR = back right speaker +//! - SR = surround right speaker +//! - SL = surround left speaker +//! - BC = back center speaker +//! - LFE = low-frequency speaker +//! +//! These are listed in the order they are laid out in memory, so "FL, FR" +//! means "the front left speaker is laid out in memory first, then the front +//! right, then it repeats for the next audio frame". +//! +//! - 1 channel (mono) layout: FRONT +//! - 2 channels (stereo) layout: FL, FR +//! - 3 channels (2.1) layout: FL, FR, LFE +//! - 4 channels (quad) layout: FL, FR, BL, BR +//! - 5 channels (4.1) layout: FL, FR, LFE, BL, BR +//! - 6 channels (5.1) layout: FL, FR, FC, LFE, BL, BR (last two can also be +//! SL, SR) +//! - 7 channels (6.1) layout: FL, FR, FC, LFE, BC, SL, SR +//! - 8 channels (7.1) layout: FL, FR, FC, LFE, BL, BR, SL, SR +//! +//! This is the same order as DirectSound expects, but applied to all +//! platforms; SDL will swizzle the channels as necessary if a platform expects +//! something different. +//! +//! [`SDL_AudioStream`] can also be provided channel maps to change this ordering +//! to whatever is necessary, in other audio processing scenarios. + +use super::stdinc::*; + +use super::error::*; + +use super::mutex::*; + +use super::properties::*; + +use super::iostream::*; + +/// Mask of bits in an [`SDL_AudioFormat`] that contains the format bit size. +/// +/// Generally one should use [`SDL_AUDIO_BITSIZE`] instead of this macro directly. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_AUDIO_MASK_BITSIZE: ::core::primitive::u32 = 255_u32; + +/// Mask of bits in an [`SDL_AudioFormat`] that contain the floating point flag. +/// +/// Generally one should use [`SDL_AUDIO_ISFLOAT`] instead of this macro directly. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_AUDIO_MASK_FLOAT: ::core::primitive::u32 = 256_u32; + +/// Mask of bits in an [`SDL_AudioFormat`] that contain the bigendian flag. +/// +/// Generally one should use [`SDL_AUDIO_ISBIGENDIAN`] or [`SDL_AUDIO_ISLITTLEENDIAN`] +/// instead of this macro directly. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_AUDIO_MASK_BIG_ENDIAN: ::core::primitive::u32 = 4096_u32; + +/// Mask of bits in an [`SDL_AudioFormat`] that contain the signed data flag. +/// +/// Generally one should use [`SDL_AUDIO_ISSIGNED`] instead of this macro directly. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_AUDIO_MASK_SIGNED: ::core::primitive::u32 = 32768_u32; + +/// Audio format. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AUDIO_BITSIZE`] +/// - [`SDL_AUDIO_BYTESIZE`] +/// - [`SDL_AUDIO_ISINT`] +/// - [`SDL_AUDIO_ISFLOAT`] +/// - [`SDL_AUDIO_ISBIGENDIAN`] +/// - [`SDL_AUDIO_ISLITTLEENDIAN`] +/// - [`SDL_AUDIO_ISSIGNED`] +/// - [`SDL_AUDIO_ISUNSIGNED`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_AudioFormat::UNKNOWN) | [`SDL_AUDIO_UNKNOWN`] | Unspecified audio format | +/// | [`U8`](SDL_AudioFormat::U8) | [`SDL_AUDIO_U8`] | Unsigned 8-bit samples | +/// | [`S8`](SDL_AudioFormat::S8) | [`SDL_AUDIO_S8`] | Signed 8-bit samples | +/// | [`S16LE`](SDL_AudioFormat::S16LE) | [`SDL_AUDIO_S16LE`] | Signed 16-bit samples | +/// | [`S16BE`](SDL_AudioFormat::S16BE) | [`SDL_AUDIO_S16BE`] | As above, but big-endian byte order | +/// | [`S32LE`](SDL_AudioFormat::S32LE) | [`SDL_AUDIO_S32LE`] | 32-bit integer samples | +/// | [`S32BE`](SDL_AudioFormat::S32BE) | [`SDL_AUDIO_S32BE`] | As above, but big-endian byte order | +/// | [`F32LE`](SDL_AudioFormat::F32LE) | [`SDL_AUDIO_F32LE`] | 32-bit floating point samples | +/// | [`F32BE`](SDL_AudioFormat::F32BE) | [`SDL_AUDIO_F32BE`] | As above, but big-endian byte order | +/// | [`S16`](SDL_AudioFormat::S16) | [`SDL_AUDIO_S16`] | (target dependent) | +/// | [`S32`](SDL_AudioFormat::S32) | [`SDL_AUDIO_S32`] | (target dependent) | +/// | [`F32`](SDL_AudioFormat::F32) | [`SDL_AUDIO_F32`] | (target dependent) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_AudioFormat(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_AudioFormat { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_AudioFormat) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_AudioFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_AudioFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_AUDIO_UNKNOWN", + Self::U8 => "SDL_AUDIO_U8", + Self::S8 => "SDL_AUDIO_S8", + Self::S16LE => "SDL_AUDIO_S16LE", + Self::S16BE => "SDL_AUDIO_S16BE", + Self::S32LE => "SDL_AUDIO_S32LE", + Self::S32BE => "SDL_AUDIO_S32BE", + Self::F32LE => "SDL_AUDIO_F32LE", + Self::F32BE => "SDL_AUDIO_F32BE", + Self::S16 => "SDL_AUDIO_S16", + Self::S32 => "SDL_AUDIO_S32", + Self::F32 => "SDL_AUDIO_F32", + Self::S16 => "SDL_AUDIO_S16", + Self::S32 => "SDL_AUDIO_S32", + Self::F32 => "SDL_AUDIO_F32", + + _ => return write!(f, "SDL_AudioFormat({})", self.0), + }) + } +} + +impl SDL_AudioFormat { + /// Unspecified audio format + pub const UNKNOWN: Self = Self((0x0000 as ::core::ffi::c_uint)); + /// Unsigned 8-bit samples + pub const U8: Self = Self((0x0008 as ::core::ffi::c_uint)); + /// Signed 8-bit samples + pub const S8: Self = Self((0x8008 as ::core::ffi::c_uint)); + /// Signed 16-bit samples + pub const S16LE: Self = Self((0x8010 as ::core::ffi::c_uint)); + /// As above, but big-endian byte order + pub const S16BE: Self = Self((0x9010 as ::core::ffi::c_uint)); + /// 32-bit integer samples + pub const S32LE: Self = Self((0x8020 as ::core::ffi::c_uint)); + /// As above, but big-endian byte order + pub const S32BE: Self = Self((0x9020 as ::core::ffi::c_uint)); + /// 32-bit floating point samples + pub const F32LE: Self = Self((0x8120 as ::core::ffi::c_uint)); + /// As above, but big-endian byte order + pub const F32BE: Self = Self((0x9120 as ::core::ffi::c_uint)); + #[cfg(target_endian = "little")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const S16: Self = SDL_AUDIO_S16LE; + #[cfg(target_endian = "little")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const S32: Self = SDL_AUDIO_S32LE; + #[cfg(target_endian = "little")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const F32: Self = SDL_AUDIO_F32LE; + #[cfg(not(target_endian = "little"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const S16: Self = SDL_AUDIO_S16BE; + #[cfg(not(target_endian = "little"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const S32: Self = SDL_AUDIO_S32BE; + #[cfg(not(target_endian = "little"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const F32: Self = SDL_AUDIO_F32BE; +} + +/// Unspecified audio format +pub const SDL_AUDIO_UNKNOWN: SDL_AudioFormat = SDL_AudioFormat::UNKNOWN; +/// Unsigned 8-bit samples +pub const SDL_AUDIO_U8: SDL_AudioFormat = SDL_AudioFormat::U8; +/// Signed 8-bit samples +pub const SDL_AUDIO_S8: SDL_AudioFormat = SDL_AudioFormat::S8; +/// Signed 16-bit samples +pub const SDL_AUDIO_S16LE: SDL_AudioFormat = SDL_AudioFormat::S16LE; +/// As above, but big-endian byte order +pub const SDL_AUDIO_S16BE: SDL_AudioFormat = SDL_AudioFormat::S16BE; +/// 32-bit integer samples +pub const SDL_AUDIO_S32LE: SDL_AudioFormat = SDL_AudioFormat::S32LE; +/// As above, but big-endian byte order +pub const SDL_AUDIO_S32BE: SDL_AudioFormat = SDL_AudioFormat::S32BE; +/// 32-bit floating point samples +pub const SDL_AUDIO_F32LE: SDL_AudioFormat = SDL_AudioFormat::F32LE; +/// As above, but big-endian byte order +pub const SDL_AUDIO_F32BE: SDL_AudioFormat = SDL_AudioFormat::F32BE; +#[cfg(target_endian = "little")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_AUDIO_S16: SDL_AudioFormat = SDL_AudioFormat::S16; +#[cfg(target_endian = "little")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_AUDIO_S32: SDL_AudioFormat = SDL_AudioFormat::S32; +#[cfg(target_endian = "little")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_AUDIO_F32: SDL_AudioFormat = SDL_AudioFormat::F32; +#[cfg(not(target_endian = "little"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_AUDIO_S16: SDL_AudioFormat = SDL_AudioFormat::S16; +#[cfg(not(target_endian = "little"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_AUDIO_S32: SDL_AudioFormat = SDL_AudioFormat::S32; +#[cfg(not(target_endian = "little"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_AUDIO_F32: SDL_AudioFormat = SDL_AudioFormat::F32; + +impl SDL_AudioFormat { + /// Initialize a `SDL_AudioFormat` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_AudioFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_AudioFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::audio::METADATA_SDL_AudioFormat; +} + +/// Define an [`SDL_AudioFormat`] value. +/// +/// SDL does not support custom audio formats, so this macro is not of much use +/// externally, but it can be illustrative as to what the various bits of an +/// [`SDL_AudioFormat`] mean. +/// +/// For example, [`SDL_AUDIO_S32LE`] looks like this: +/// +/// ```c +/// SDL_DEFINE_AUDIO_FORMAT(1, 0, 0, 32) +/// ``` +/// +/// ## Parameters +/// - `signed`: 1 for signed data, 0 for unsigned data. +/// - `bigendian`: 1 for bigendian data, 0 for littleendian data. +/// - `flt`: 1 for floating point data, 0 for integer data. +/// - `size`: number of bits per sample. +/// +/// ## Return value +/// Returns a format value in the style of [`SDL_AudioFormat`]. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_DEFINE_AUDIO_FORMAT( + signed_: ::core::primitive::bool, + bigendian: ::core::primitive::bool, + flt: ::core::primitive::bool, + size: ::core::primitive::u8, +) -> SDL_AudioFormat { + SDL_AudioFormat( + ((((((((signed_) as Uint16) << 15) | (((bigendian) as Uint16) << 12)) + | (((flt) as Uint16) << 8)) as ::core::primitive::u32) + | (((size as ::core::ffi::c_int) as ::core::primitive::u32) & SDL_AUDIO_MASK_BITSIZE)) + as ::core::ffi::c_uint), + ) +} + +/// Retrieve the size, in bits, from an [`SDL_AudioFormat`]. +/// +/// For example, `SDL_AUDIO_BITSIZE(SDL_AUDIO_S16)` returns 16. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns data size in bits. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_BITSIZE(x: SDL_AudioFormat) -> ::core::ffi::c_uint { + (x.0 & SDL_AUDIO_MASK_BITSIZE) +} + +/// Retrieve the size, in bytes, from an [`SDL_AudioFormat`]. +/// +/// For example, `SDL_AUDIO_BYTESIZE(SDL_AUDIO_S16)` returns 2. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns data size in bytes. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_BYTESIZE(x: SDL_AudioFormat) -> ::core::ffi::c_uint { + (SDL_AUDIO_BITSIZE(x) / 8_u32) +} + +/// Determine if an [`SDL_AudioFormat`] represents floating point data. +/// +/// For example, `SDL_AUDIO_ISFLOAT(SDL_AUDIO_S16)` returns 0. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns non-zero if format is floating point, zero otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_ISFLOAT(x: SDL_AudioFormat) -> ::core::primitive::bool { + ((x.0 & SDL_AUDIO_MASK_FLOAT) != 0) +} + +/// Determine if an [`SDL_AudioFormat`] represents bigendian data. +/// +/// For example, `SDL_AUDIO_ISBIGENDIAN(SDL_AUDIO_S16LE)` returns 0. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns non-zero if format is bigendian, zero otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_ISBIGENDIAN(x: SDL_AudioFormat) -> ::core::primitive::bool { + ((x.0 & SDL_AUDIO_MASK_BIG_ENDIAN) != 0) +} + +/// Determine if an [`SDL_AudioFormat`] represents littleendian data. +/// +/// For example, `SDL_AUDIO_ISLITTLEENDIAN(SDL_AUDIO_S16BE)` returns 0. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns non-zero if format is littleendian, zero otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_ISLITTLEENDIAN(x: SDL_AudioFormat) -> ::core::primitive::bool { + !(SDL_AUDIO_ISBIGENDIAN(x)) +} + +/// Determine if an [`SDL_AudioFormat`] represents signed data. +/// +/// For example, `SDL_AUDIO_ISSIGNED(SDL_AUDIO_U8)` returns 0. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns non-zero if format is signed, zero otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_ISSIGNED(x: SDL_AudioFormat) -> ::core::primitive::bool { + ((x.0 & SDL_AUDIO_MASK_SIGNED) != 0) +} + +/// Determine if an [`SDL_AudioFormat`] represents integer data. +/// +/// For example, `SDL_AUDIO_ISINT(SDL_AUDIO_F32)` returns 0. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns non-zero if format is integer, zero otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_ISINT(x: SDL_AudioFormat) -> ::core::primitive::bool { + !(SDL_AUDIO_ISFLOAT(x)) +} + +/// Determine if an [`SDL_AudioFormat`] represents unsigned data. +/// +/// For example, `SDL_AUDIO_ISUNSIGNED(SDL_AUDIO_S16)` returns 0. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioFormat`] value. +/// +/// ## Return value +/// Returns non-zero if format is unsigned, zero otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_ISUNSIGNED(x: SDL_AudioFormat) -> ::core::primitive::bool { + !(SDL_AUDIO_ISSIGNED(x)) +} + +/// SDL Audio Device instance IDs. +/// +/// Zero is used to signify an invalid/null device. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DEFAULT_PLAYBACK`](SDL_AudioDeviceID::DEFAULT_PLAYBACK) | [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] | A value used to request a default playback audio device. Several functions that require an [`SDL_AudioDeviceID`] will accept this value to signify the app just wants the system to choose a default device instead of the app providing a specific one. \since This macro is available since SDL 3.2.0. | +/// | [`DEFAULT_RECORDING`](SDL_AudioDeviceID::DEFAULT_RECORDING) | [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`] | A value used to request a default recording audio device. Several functions that require an [`SDL_AudioDeviceID`] will accept this value to signify the app just wants the system to choose a default device instead of the app providing a specific one. \since This macro is available since SDL 3.2.0. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_AudioDeviceID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_AudioDeviceID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_AudioDeviceID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_AudioDeviceID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_AudioDeviceID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_AudioDeviceID { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::DEFAULT_PLAYBACK => "SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK", + Self::DEFAULT_RECORDING => "SDL_AUDIO_DEVICE_DEFAULT_RECORDING", + + _ => return write!(f, "SDL_AudioDeviceID({})", self.0), + }) + } +} + +impl SDL_AudioDeviceID { + /// A value used to request a default playback audio device. + /// + /// Several functions that require an [`SDL_AudioDeviceID`] will accept this value + /// to signify the app just wants the system to choose a default device instead + /// of the app providing a specific one. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const DEFAULT_PLAYBACK: Self = Self((0xffffffff as Uint32)); + /// A value used to request a default recording audio device. + /// + /// Several functions that require an [`SDL_AudioDeviceID`] will accept this value + /// to signify the app just wants the system to choose a default device instead + /// of the app providing a specific one. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const DEFAULT_RECORDING: Self = Self((0xfffffffe as Uint32)); +} + +/// A value used to request a default playback audio device. +/// +/// Several functions that require an [`SDL_AudioDeviceID`] will accept this value +/// to signify the app just wants the system to choose a default device instead +/// of the app providing a specific one. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK: SDL_AudioDeviceID = + SDL_AudioDeviceID::DEFAULT_PLAYBACK; +/// A value used to request a default recording audio device. +/// +/// Several functions that require an [`SDL_AudioDeviceID`] will accept this value +/// to signify the app just wants the system to choose a default device instead +/// of the app providing a specific one. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_AUDIO_DEVICE_DEFAULT_RECORDING: SDL_AudioDeviceID = + SDL_AudioDeviceID::DEFAULT_RECORDING; + +impl SDL_AudioDeviceID { + /// Initialize a `SDL_AudioDeviceID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_AudioDeviceID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_AudioDeviceID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::audio::METADATA_SDL_AudioDeviceID; +} + +/// Format specifier for audio data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AudioFormat`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_AudioSpec { + /// Audio data format + pub format: SDL_AudioFormat, + /// Number of channels: 1 mono, 2 stereo, etc + pub channels: ::core::ffi::c_int, + /// sample rate: sample frames per second + pub freq: ::core::ffi::c_int, +} + +/// Calculate the size of each audio frame (in bytes) from an [`SDL_AudioSpec`]. +/// +/// This reports on the size of an audio sample frame: stereo Sint16 data (2 +/// channels of 2 bytes each) would be 4 bytes per frame, for example. +/// +/// ## Parameters +/// - `x`: an [`SDL_AudioSpec`] to query. +/// +/// ## Return value +/// Returns the number of bytes used per sample frame. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_AUDIO_FRAMESIZE(x: SDL_AudioSpec) -> ::core::ffi::c_uint { + (SDL_AUDIO_BYTESIZE(x.format) * (x.channels as ::core::ffi::c_uint)) +} + +unsafe extern "C" { + /// Use this function to get the number of built-in audio drivers. + /// + /// This function returns a hardcoded number. This never returns a negative + /// value; if there are no drivers compiled into this build of SDL, this + /// function returns zero. The presence of a driver in this list does not mean + /// it will function, it just means SDL is capable of interacting with that + /// interface. For example, a build of SDL might have esound support, but if + /// there's no esound server available, SDL's esound driver would fail if used. + /// + /// By default, SDL tries all drivers, in its preferred order, until one is + /// found to be usable. + /// + /// ## Return value + /// Returns the number of built-in audio drivers. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioDriver`] + pub fn SDL_GetNumAudioDrivers() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Use this function to get the name of a built in audio driver. + /// + /// The list of audio drivers is given in the order that they are normally + /// initialized by default; the drivers that seem more reasonable to choose + /// first (as far as the SDL developers believe) are earlier in the list. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "alsa", + /// "coreaudio" or "wasapi". These never have Unicode characters, and are not + /// meant to be proper names. + /// + /// ## Parameters + /// - `index`: the index of the audio driver; the value ranges from 0 to + /// [`SDL_GetNumAudioDrivers()`] - 1. + /// + /// ## Return value + /// Returns the name of the audio driver at the requested index, or NULL if an + /// invalid index was specified. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumAudioDrivers`] + pub fn SDL_GetAudioDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the name of the current audio driver. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "alsa", + /// "coreaudio" or "wasapi". These never have Unicode characters, and are not + /// meant to be proper names. + /// + /// ## Return value + /// Returns the name of the current audio driver or NULL if no driver has been + /// initialized. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetCurrentAudioDriver() -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get a list of currently-connected audio playback devices. + /// + /// This returns of list of available devices that play sound, perhaps to + /// speakers or headphones ("playback" devices). If you want devices that + /// record audio, like a microphone ("recording" devices), use + /// [`SDL_GetAudioRecordingDevices()`] instead. + /// + /// This only returns a list of physical devices; it will not have any device + /// IDs returned by [`SDL_OpenAudioDevice()`]. + /// + /// If this function returns NULL, to signify an error, `*count` will be set to + /// zero. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of devices returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of device instance IDs or NULL on error; call + /// [`SDL_GetError()`] for more information. This should be freed with + /// [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenAudioDevice`] + /// - [`SDL_GetAudioRecordingDevices`] + pub fn SDL_GetAudioPlaybackDevices(count: *mut ::core::ffi::c_int) -> *mut SDL_AudioDeviceID; +} + +unsafe extern "C" { + /// Get a list of currently-connected audio recording devices. + /// + /// This returns of list of available devices that record audio, like a + /// microphone ("recording" devices). If you want devices that play sound, + /// perhaps to speakers or headphones ("playback" devices), use + /// [`SDL_GetAudioPlaybackDevices()`] instead. + /// + /// This only returns a list of physical devices; it will not have any device + /// IDs returned by [`SDL_OpenAudioDevice()`]. + /// + /// If this function returns NULL, to signify an error, `*count` will be set to + /// zero. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of devices returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of device instance IDs, or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenAudioDevice`] + /// - [`SDL_GetAudioPlaybackDevices`] + pub fn SDL_GetAudioRecordingDevices(count: *mut ::core::ffi::c_int) -> *mut SDL_AudioDeviceID; +} + +unsafe extern "C" { + /// Get the human-readable name of a specific audio device. + /// + /// **WARNING**: this function will work with [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] + /// and [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`], returning the current default + /// physical devices' names. However, as the default device may change at any + /// time, it is likely better to show a generic name to the user, like "System + /// default audio device" or perhaps "default \[currently %s\]". Do not store + /// this name to disk to reidentify the device in a later run of the program, + /// as the default might change in general, and the string will be the name of + /// a specific device and not the abstract system default. + /// + /// ## Parameters + /// - `devid`: the instance ID of the device to query. + /// + /// ## Return value + /// Returns the name of the audio device, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioPlaybackDevices`] + /// - [`SDL_GetAudioRecordingDevices`] + pub fn SDL_GetAudioDeviceName(devid: SDL_AudioDeviceID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the current audio format of a specific audio device. + /// + /// For an opened device, this will report the format the device is currently + /// using. If the device isn't yet opened, this will report the device's + /// preferred format (or a reasonable default if this can't be determined). + /// + /// You may also specify [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] or + /// [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`] here, which is useful for getting a + /// reasonable recommendation before opening the system-recommended default + /// device. + /// + /// You can also use this to request the current device buffer size. This is + /// specified in sample frames and represents the amount of data SDL will feed + /// to the physical hardware in each chunk. This can be converted to + /// milliseconds of audio with the following equation: + /// + /// `ms = (int) ((((Sint64) frames) * 1000) / spec.freq);` + /// + /// Buffer size is only important if you need low-level control over the audio + /// playback timing. Most apps do not need this. + /// + /// ## Parameters + /// - `devid`: the instance ID of the device to query. + /// - `spec`: on return, will be filled with device details. + /// - `sample_frames`: pointer to store device buffer size, in sample frames. + /// Can be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetAudioDeviceFormat( + devid: SDL_AudioDeviceID, + spec: *mut SDL_AudioSpec, + sample_frames: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current channel map of an audio device. + /// + /// Channel maps are optional; most things do not need them, instead passing + /// data in the [order that SDL expects](CategoryAudio#channel-layouts). + /// + /// Audio devices usually have no remapping applied. This is represented by + /// returning NULL, and does not signify an error. + /// + /// ## Parameters + /// - `devid`: the instance ID of the device to query. + /// - `count`: On output, set to number of channels in the map. Can be NULL. + /// + /// ## Return value + /// Returns an array of the current channel mapping, with as many elements as + /// the current output spec's channels, or NULL if default. This + /// should be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamInputChannelMap`] + pub fn SDL_GetAudioDeviceChannelMap( + devid: SDL_AudioDeviceID, + count: *mut ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Open a specific audio device. + /// + /// You can open both playback and recording devices through this function. + /// Playback devices will take data from bound audio streams, mix it, and send + /// it to the hardware. Recording devices will feed any bound audio streams + /// with a copy of any incoming data. + /// + /// An opened audio device starts out with no audio streams bound. To start + /// audio playing, bind a stream and supply audio data to it. Unlike SDL2, + /// there is no audio callback; you only bind audio streams and make sure they + /// have data flowing into them (however, you can simulate SDL2's semantics + /// fairly closely by using [`SDL_OpenAudioDeviceStream`] instead of this + /// function). + /// + /// If you don't care about opening a specific device, pass a `devid` of either + /// [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] or + /// [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`]. In this case, SDL will try to pick + /// the most reasonable default, and may also switch between physical devices + /// seamlessly later, if the most reasonable default changes during the + /// lifetime of this opened device (user changed the default in the OS's system + /// preferences, the default got unplugged so the system jumped to a new + /// default, the user plugged in headphones on a mobile device, etc). Unless + /// you have a good reason to choose a specific device, this is probably what + /// you want. + /// + /// You may request a specific format for the audio device, but there is no + /// promise the device will honor that request for several reasons. As such, + /// it's only meant to be a hint as to what data your app will provide. Audio + /// streams will accept data in whatever format you specify and manage + /// conversion for you as appropriate. [`SDL_GetAudioDeviceFormat`] can tell you + /// the preferred format for the device before opening and the actual format + /// the device is using after opening. + /// + /// It's legal to open the same device ID more than once; each successful open + /// will generate a new logical [`SDL_AudioDeviceID`] that is managed separately + /// from others on the same physical device. This allows libraries to open a + /// device separately from the main app and bind its own streams without + /// conflicting. + /// + /// It is also legal to open a device ID returned by a previous call to this + /// function; doing so just creates another logical device on the same physical + /// device. This may be useful for making logical groupings of audio streams. + /// + /// This function returns the opened device ID on success. This is a new, + /// unique [`SDL_AudioDeviceID`] that represents a logical device. + /// + /// Some backends might offer arbitrary devices (for example, a networked audio + /// protocol that can connect to an arbitrary server). For these, as a change + /// from SDL2, you should open a default device ID and use an SDL hint to + /// specify the target if you care, or otherwise let the backend figure out a + /// reasonable default. Most backends don't offer anything like this, and often + /// this would be an end user setting an environment variable for their custom + /// need, and not something an application should specifically manage. + /// + /// When done with an audio device, possibly at the end of the app's life, one + /// should call [`SDL_CloseAudioDevice()`] on the returned device id. + /// + /// ## Parameters + /// - `devid`: the device instance id to open, or + /// [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] or + /// [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`] for the most reasonable + /// default device. + /// - `spec`: the requested device configuration. Can be NULL to use + /// reasonable defaults. + /// + /// ## Return value + /// Returns the device ID on success or 0 on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseAudioDevice`] + /// - [`SDL_GetAudioDeviceFormat`] + pub fn SDL_OpenAudioDevice( + devid: SDL_AudioDeviceID, + spec: *const SDL_AudioSpec, + ) -> SDL_AudioDeviceID; +} + +unsafe extern "C" { + /// Determine if an audio device is physical (instead of logical). + /// + /// An [`SDL_AudioDeviceID`] that represents physical hardware is a physical + /// device; there is one for each piece of hardware that SDL can see. Logical + /// devices are created by calling [`SDL_OpenAudioDevice`] or + /// [`SDL_OpenAudioDeviceStream`], and while each is associated with a physical + /// device, there can be any number of logical devices on one physical device. + /// + /// For the most part, logical and physical IDs are interchangeable--if you try + /// to open a logical device, SDL understands to assign that effort to the + /// underlying physical device, etc. However, it might be useful to know if an + /// arbitrary device ID is physical or logical. This function reports which. + /// + /// This function may return either true or false for invalid device IDs. + /// + /// ## Parameters + /// - `devid`: the device ID to query. + /// + /// ## Return value + /// Returns true if devid is a physical device, false if it is logical. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_IsAudioDevicePhysical(devid: SDL_AudioDeviceID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine if an audio device is a playback device (instead of recording). + /// + /// This function may return either true or false for invalid device IDs. + /// + /// ## Parameters + /// - `devid`: the device ID to query. + /// + /// ## Return value + /// Returns true if devid is a playback device, false if it is recording. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_IsAudioDevicePlayback(devid: SDL_AudioDeviceID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to pause audio playback on a specified device. + /// + /// This function pauses audio processing for a given device. Any bound audio + /// streams will not progress, and no audio will be generated. Pausing one + /// device does not prevent other unpaused devices from running. + /// + /// Unlike in SDL2, audio devices start in an _unpaused_ state, since an app + /// has to bind a stream before any audio will flow. Pausing a paused device is + /// a legal no-op. + /// + /// Pausing a device can be useful to halt all audio without unbinding all the + /// audio streams. This might be useful while a game is paused, or a level is + /// loading, etc. + /// + /// Physical devices can not be paused or unpaused, only logical devices + /// created through [`SDL_OpenAudioDevice()`] can be. + /// + /// ## Parameters + /// - `devid`: a device opened by [`SDL_OpenAudioDevice()`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ResumeAudioDevice`] + /// - [`SDL_AudioDevicePaused`] + pub fn SDL_PauseAudioDevice(devid: SDL_AudioDeviceID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to unpause audio playback on a specified device. + /// + /// This function unpauses audio processing for a given device that has + /// previously been paused with [`SDL_PauseAudioDevice()`]. Once unpaused, any + /// bound audio streams will begin to progress again, and audio can be + /// generated. + /// + /// Unlike in SDL2, audio devices start in an _unpaused_ state, since an app + /// has to bind a stream before any audio will flow. Unpausing an unpaused + /// device is a legal no-op. + /// + /// Physical devices can not be paused or unpaused, only logical devices + /// created through [`SDL_OpenAudioDevice()`] can be. + /// + /// ## Parameters + /// - `devid`: a device opened by [`SDL_OpenAudioDevice()`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AudioDevicePaused`] + /// - [`SDL_PauseAudioDevice`] + pub fn SDL_ResumeAudioDevice(devid: SDL_AudioDeviceID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to query if an audio device is paused. + /// + /// Unlike in SDL2, audio devices start in an _unpaused_ state, since an app + /// has to bind a stream before any audio will flow. + /// + /// Physical devices can not be paused or unpaused, only logical devices + /// created through [`SDL_OpenAudioDevice()`] can be. Physical and invalid device + /// IDs will report themselves as unpaused here. + /// + /// ## Parameters + /// - `devid`: a device opened by [`SDL_OpenAudioDevice()`]. + /// + /// ## Return value + /// Returns true if device is valid and paused, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PauseAudioDevice`] + /// - [`SDL_ResumeAudioDevice`] + pub fn SDL_AudioDevicePaused(devid: SDL_AudioDeviceID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the gain of an audio device. + /// + /// The gain of a device is its volume; a larger gain means a louder output, + /// with a gain of zero being silence. + /// + /// Audio devices default to a gain of 1.0f (no change in output). + /// + /// Physical devices may not have their gain changed, only logical devices, and + /// this function will always return -1.0f when used on physical devices. + /// + /// ## Parameters + /// - `devid`: the audio device to query. + /// + /// ## Return value + /// Returns the gain of the device or -1.0f on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioDeviceGain`] + pub fn SDL_GetAudioDeviceGain(devid: SDL_AudioDeviceID) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Change the gain of an audio device. + /// + /// The gain of a device is its volume; a larger gain means a louder output, + /// with a gain of zero being silence. + /// + /// Audio devices default to a gain of 1.0f (no change in output). + /// + /// Physical devices may not have their gain changed, only logical devices, and + /// this function will always return false when used on physical devices. While + /// it might seem attractive to adjust several logical devices at once in this + /// way, it would allow an app or library to interfere with another portion of + /// the program's otherwise-isolated devices. + /// + /// This is applied, along with any per-audiostream gain, during playback to + /// the hardware, and can be continuously changed to create various effects. On + /// recording devices, this will adjust the gain before passing the data into + /// an audiostream; that recording audiostream can then adjust its gain further + /// when outputting the data elsewhere, if it likes, but that second gain is + /// not applied until the data leaves the audiostream again. + /// + /// ## Parameters + /// - `devid`: the audio device on which to change gain. + /// - `gain`: the gain. 1.0f is no change, 0.0f is silence. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioDeviceGain`] + pub fn SDL_SetAudioDeviceGain( + devid: SDL_AudioDeviceID, + gain: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Close a previously-opened audio device. + /// + /// The application should close open audio devices once they are no longer + /// needed. + /// + /// This function may block briefly while pending audio data is played by the + /// hardware, so that applications don't drop the last buffer of data they + /// supplied if terminating immediately afterwards. + /// + /// ## Parameters + /// - `devid`: an audio device id previously returned by + /// [`SDL_OpenAudioDevice()`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenAudioDevice`] + pub fn SDL_CloseAudioDevice(devid: SDL_AudioDeviceID); +} + +unsafe extern "C" { + /// Bind a list of audio streams to an audio device. + /// + /// Audio data will flow through any bound streams. For a playback device, data + /// for all bound streams will be mixed together and fed to the device. For a + /// recording device, a copy of recorded data will be provided to each bound + /// stream. + /// + /// Audio streams can only be bound to an open device. This operation is + /// atomic--all streams bound in the same call will start processing at the + /// same time, so they can stay in sync. Also: either all streams will be bound + /// or none of them will be. + /// + /// It is an error to bind an already-bound stream; it must be explicitly + /// unbound first. + /// + /// Binding a stream to a device will set its output format for playback + /// devices, and its input format for recording devices, so they match the + /// device's settings. The caller is welcome to change the other end of the + /// stream's format at any time with [`SDL_SetAudioStreamFormat()`]. If the other + /// end of the stream's format has never been set (the audio stream was created + /// with a NULL audio spec), this function will set it to match the device + /// end's format. + /// + /// ## Parameters + /// - `devid`: an audio device to bind a stream to. + /// - `streams`: an array of audio streams to bind. + /// - `num_streams`: number streams listed in the `streams` array. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindAudioStreams`] + /// - [`SDL_UnbindAudioStream`] + /// - [`SDL_GetAudioStreamDevice`] + pub fn SDL_BindAudioStreams( + devid: SDL_AudioDeviceID, + streams: *const *mut SDL_AudioStream, + num_streams: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Bind a single audio stream to an audio device. + /// + /// This is a convenience function, equivalent to calling + /// `SDL_BindAudioStreams(devid, &stream, 1)`. + /// + /// ## Parameters + /// - `devid`: an audio device to bind a stream to. + /// - `stream`: an audio stream to bind to a device. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindAudioStreams`] + /// - [`SDL_UnbindAudioStream`] + /// - [`SDL_GetAudioStreamDevice`] + pub fn SDL_BindAudioStream( + devid: SDL_AudioDeviceID, + stream: *mut SDL_AudioStream, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unbind a list of audio streams from their audio devices. + /// + /// The streams being unbound do not all have to be on the same device. All + /// streams on the same device will be unbound atomically (data will stop + /// flowing through all unbound streams on the same device at the same time). + /// + /// Unbinding a stream that isn't bound to a device is a legal no-op. + /// + /// ## Parameters + /// - `streams`: an array of audio streams to unbind. Can be NULL or contain + /// NULL. + /// - `num_streams`: number streams listed in the `streams` array. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindAudioStreams`] + pub fn SDL_UnbindAudioStreams( + streams: *const *mut SDL_AudioStream, + num_streams: ::core::ffi::c_int, + ); +} + +unsafe extern "C" { + /// Unbind a single audio stream from its audio device. + /// + /// This is a convenience function, equivalent to calling + /// `SDL_UnbindAudioStreams(&stream, 1)`. + /// + /// ## Parameters + /// - `stream`: an audio stream to unbind from a device. Can be NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindAudioStream`] + pub fn SDL_UnbindAudioStream(stream: *mut SDL_AudioStream); +} + +unsafe extern "C" { + /// Query an audio stream for its currently-bound device. + /// + /// This reports the logical audio device that an audio stream is currently + /// bound to. + /// + /// If not bound, or invalid, this returns zero, which is not a valid device + /// ID. + /// + /// ## Parameters + /// - `stream`: the audio stream to query. + /// + /// ## Return value + /// Returns the bound audio device, or 0 if not bound or invalid. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindAudioStream`] + /// - [`SDL_BindAudioStreams`] + pub fn SDL_GetAudioStreamDevice(stream: *mut SDL_AudioStream) -> SDL_AudioDeviceID; +} + +unsafe extern "C" { + /// Create a new audio stream. + /// + /// Note that `src_spec` or `dst_spec` may be NULL, but any attempts to + /// put or get data from an audio stream will fail until it has valid + /// specs assigned to both ends of the stream. Specs can be assigned later + /// through [`SDL_SetAudioStreamFormat()`], or binding the stream to an audio + /// device (which will set the format of only the input or output, + /// depending on what kind of device the stream was bound to). + /// + /// ## Parameters + /// - `src_spec`: the format details of the input audio. May be NULL. + /// - `dst_spec`: the format details of the output audio. May be NULL. + /// + /// ## Return value + /// Returns a new audio stream on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PutAudioStreamData`] + /// - [`SDL_GetAudioStreamData`] + /// - [`SDL_GetAudioStreamAvailable`] + /// - [`SDL_FlushAudioStream`] + /// - [`SDL_ClearAudioStream`] + /// - [`SDL_SetAudioStreamFormat`] + /// - [`SDL_DestroyAudioStream`] + pub fn SDL_CreateAudioStream( + src_spec: *const SDL_AudioSpec, + dst_spec: *const SDL_AudioSpec, + ) -> *mut SDL_AudioStream; +} + +unsafe extern "C" { + /// Get the properties associated with an audio stream. + /// + /// The application can hang any data it wants here, but the following + /// properties are understood by SDL: + /// + /// - [`SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN`]\: if true (the default), the + /// stream be automatically cleaned up when the audio subsystem quits. If set + /// to false, the streams will persist beyond that. This property is ignored + /// for streams created through [`SDL_OpenAudioDeviceStream()`], and will always + /// be cleaned up. Streams that are not cleaned up will still be unbound from + /// devices when the audio subsystem quits. This property was added in SDL + /// 3.4.0. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetAudioStreamProperties(stream: *mut SDL_AudioStream) -> SDL_PropertiesID; +} + +pub const SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.audiostream.auto_cleanup".as_ptr(); + +unsafe extern "C" { + /// Query the current format of an audio stream. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to query. + /// - `src_spec`: where to store the input audio format; ignored if NULL. + /// - `dst_spec`: where to store the output audio format; ignored if NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamFormat`] + pub fn SDL_GetAudioStreamFormat( + stream: *mut SDL_AudioStream, + src_spec: *mut SDL_AudioSpec, + dst_spec: *mut SDL_AudioSpec, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Change the input and output formats of an audio stream. + /// + /// Future calls to and [`SDL_GetAudioStreamAvailable`] and [`SDL_GetAudioStreamData`] + /// will reflect the new format, and future calls to [`SDL_PutAudioStreamData`] + /// must provide data in the new input formats. + /// + /// Data that was previously queued in the stream will still be operated on in + /// the format that was current when it was added, which is to say you can put + /// the end of a sound file in one format to a stream, change formats for the + /// next sound file, and start putting that new data while the previous sound + /// file is still queued, and everything will still play back correctly. + /// + /// If a stream is bound to a device, then the format of the side of the stream + /// bound to a device cannot be changed (src_spec for recording devices, + /// dst_spec for playback devices). Attempts to make a change to this side will + /// be ignored, but this will not report an error. The other side's format can + /// be changed. + /// + /// `src_spec` and `dst_spec` may each be NULL; a NULL spec signals not to + /// change the current format for that side of the stream. + /// + /// ## Parameters + /// - `stream`: the stream the format is being changed. + /// - `src_spec`: the new format of the audio input; if NULL, it is not + /// changed. + /// - `dst_spec`: the new format of the audio output; if NULL, it is not + /// changed. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioStreamFormat`] + /// - [`SDL_SetAudioStreamFrequencyRatio`] + pub fn SDL_SetAudioStreamFormat( + stream: *mut SDL_AudioStream, + src_spec: *const SDL_AudioSpec, + dst_spec: *const SDL_AudioSpec, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the frequency ratio of an audio stream. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to query. + /// + /// ## Return value + /// Returns the frequency ratio of the stream or 0.0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamFrequencyRatio`] + pub fn SDL_GetAudioStreamFrequencyRatio(stream: *mut SDL_AudioStream) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Change the frequency ratio of an audio stream. + /// + /// The frequency ratio is used to adjust the rate at which input data is + /// consumed. Changing this effectively modifies the speed and pitch of the + /// audio. A value greater than 1.0f will play the audio faster, and at a + /// higher pitch. A value less than 1.0f will play the audio slower, and at a + /// lower pitch. 1.0f means play at normal speed. + /// + /// This is applied during [`SDL_GetAudioStreamData`], and can be continuously + /// changed to create various effects. + /// + /// ## Parameters + /// - `stream`: the stream on which the frequency ratio is being changed. + /// - `ratio`: the frequency ratio. 1.0 is normal speed. Must be between 0.01 + /// and 100. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioStreamFrequencyRatio`] + /// - [`SDL_SetAudioStreamFormat`] + pub fn SDL_SetAudioStreamFrequencyRatio( + stream: *mut SDL_AudioStream, + ratio: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the gain of an audio stream. + /// + /// The gain of a stream is its volume; a larger gain means a louder output, + /// with a gain of zero being silence. + /// + /// Audio streams default to a gain of 1.0f (no change in output). + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to query. + /// + /// ## Return value + /// Returns the gain of the stream or -1.0f on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamGain`] + pub fn SDL_GetAudioStreamGain(stream: *mut SDL_AudioStream) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Change the gain of an audio stream. + /// + /// The gain of a stream is its volume; a larger gain means a louder output, + /// with a gain of zero being silence. + /// + /// Audio streams default to a gain of 1.0f (no change in output). + /// + /// This is applied during [`SDL_GetAudioStreamData`], and can be continuously + /// changed to create various effects. + /// + /// ## Parameters + /// - `stream`: the stream on which the gain is being changed. + /// - `gain`: the gain. 1.0f is no change, 0.0f is silence. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioStreamGain`] + pub fn SDL_SetAudioStreamGain( + stream: *mut SDL_AudioStream, + gain: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current input channel map of an audio stream. + /// + /// Channel maps are optional; most things do not need them, instead passing + /// data in the [order that SDL expects](CategoryAudio#channel-layouts). + /// + /// Audio streams default to no remapping applied. This is represented by + /// returning NULL, and does not signify an error. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to query. + /// - `count`: On output, set to number of channels in the map. Can be NULL. + /// + /// ## Return value + /// Returns an array of the current channel mapping, with as many elements as + /// the current output spec's channels, or NULL if default. This + /// should be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamInputChannelMap`] + pub fn SDL_GetAudioStreamInputChannelMap( + stream: *mut SDL_AudioStream, + count: *mut ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the current output channel map of an audio stream. + /// + /// Channel maps are optional; most things do not need them, instead passing + /// data in the [order that SDL expects](CategoryAudio#channel-layouts). + /// + /// Audio streams default to no remapping applied. This is represented by + /// returning NULL, and does not signify an error. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to query. + /// - `count`: On output, set to number of channels in the map. Can be NULL. + /// + /// ## Return value + /// Returns an array of the current channel mapping, with as many elements as + /// the current output spec's channels, or NULL if default. This + /// should be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamInputChannelMap`] + pub fn SDL_GetAudioStreamOutputChannelMap( + stream: *mut SDL_AudioStream, + count: *mut ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Set the current input channel map of an audio stream. + /// + /// Channel maps are optional; most things do not need them, instead passing + /// data in the [order that SDL expects](CategoryAudio#channel-layouts). + /// + /// The input channel map reorders data that is added to a stream via + /// [`SDL_PutAudioStreamData`]. Future calls to [`SDL_PutAudioStreamData`] must provide + /// data in the new channel order. + /// + /// Each item in the array represents an input channel, and its value is the + /// channel that it should be remapped to. To reverse a stereo signal's left + /// and right values, you'd have an array of `{ 1, 0 }`. It is legal to remap + /// multiple channels to the same thing, so `{ 1, 1 }` would duplicate the + /// right channel to both channels of a stereo signal. An element in the + /// channel map set to -1 instead of a valid channel will mute that channel, + /// setting it to a silence value. + /// + /// You cannot change the number of channels through a channel map, just + /// reorder/mute them. + /// + /// Data that was previously queued in the stream will still be operated on in + /// the order that was current when it was added, which is to say you can put + /// the end of a sound file in one order to a stream, change orders for the + /// next sound file, and start putting that new data while the previous sound + /// file is still queued, and everything will still play back correctly. + /// + /// Audio streams default to no remapping applied. Passing a NULL channel map + /// is legal, and turns off remapping. + /// + /// SDL will copy the channel map; the caller does not have to save this array + /// after this call. + /// + /// If `count` is not equal to the current number of channels in the audio + /// stream's format, this will fail. This is a safety measure to make sure a + /// race condition hasn't changed the format while this call is setting the + /// channel map. + /// + /// Unlike attempting to change the stream's format, the input channel map on a + /// stream bound to a recording device is permitted to change at any time; any + /// data added to the stream from the device after this call will have the new + /// mapping, but previously-added data will still have the prior mapping. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to change. + /// - `chmap`: the new channel map, NULL to reset to default. + /// - `count`: The number of channels in the map. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. Don't change the + /// stream's format to have a different number of channels from a + /// different thread at the same time, though! + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamOutputChannelMap`] + pub fn SDL_SetAudioStreamInputChannelMap( + stream: *mut SDL_AudioStream, + chmap: *const ::core::ffi::c_int, + count: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the current output channel map of an audio stream. + /// + /// Channel maps are optional; most things do not need them, instead passing + /// data in the [order that SDL expects](CategoryAudio#channel-layouts). + /// + /// The output channel map reorders data that is leaving a stream via + /// [`SDL_GetAudioStreamData`]. + /// + /// Each item in the array represents an input channel, and its value is the + /// channel that it should be remapped to. To reverse a stereo signal's left + /// and right values, you'd have an array of `{ 1, 0 }`. It is legal to remap + /// multiple channels to the same thing, so `{ 1, 1 }` would duplicate the + /// right channel to both channels of a stereo signal. An element in the + /// channel map set to -1 instead of a valid channel will mute that channel, + /// setting it to a silence value. + /// + /// You cannot change the number of channels through a channel map, just + /// reorder/mute them. + /// + /// The output channel map can be changed at any time, as output remapping is + /// applied during [`SDL_GetAudioStreamData`]. + /// + /// Audio streams default to no remapping applied. Passing a NULL channel map + /// is legal, and turns off remapping. + /// + /// SDL will copy the channel map; the caller does not have to save this array + /// after this call. + /// + /// If `count` is not equal to the current number of channels in the audio + /// stream's format, this will fail. This is a safety measure to make sure a + /// race condition hasn't changed the format while this call is setting the + /// channel map. + /// + /// Unlike attempting to change the stream's format, the output channel map on + /// a stream bound to a recording device is permitted to change at any time; + /// any data added to the stream after this call will have the new mapping, but + /// previously-added data will still have the prior mapping. When the channel + /// map doesn't match the hardware's channel layout, SDL will convert the data + /// before feeding it to the device for playback. + /// + /// ## Parameters + /// - `stream`: the [`SDL_AudioStream`] to change. + /// - `chmap`: the new channel map, NULL to reset to default. + /// - `count`: The number of channels in the map. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as it holds + /// a stream-specific mutex while running. Don't change the + /// stream's format to have a different number of channels from a + /// a different thread at the same time, though! + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamInputChannelMap`] + pub fn SDL_SetAudioStreamOutputChannelMap( + stream: *mut SDL_AudioStream, + chmap: *const ::core::ffi::c_int, + count: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Add data to the stream. + /// + /// This data must match the format/channels/samplerate specified in the latest + /// call to [`SDL_SetAudioStreamFormat`], or the format specified when creating the + /// stream if it hasn't been changed. + /// + /// Note that this call simply copies the unconverted data for later. This is + /// different than SDL2, where data was converted during the Put call and the + /// Get call would just dequeue the previously-converted data. + /// + /// ## Parameters + /// - `stream`: the stream the audio data is being added to. + /// - `buf`: a pointer to the audio data to add. + /// - `len`: the number of bytes to write to the stream. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but if the + /// stream has a callback set, the caller might need to manage + /// extra locking. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClearAudioStream`] + /// - [`SDL_FlushAudioStream`] + /// - [`SDL_GetAudioStreamData`] + /// - [`SDL_GetAudioStreamQueued`] + pub fn SDL_PutAudioStreamData( + stream: *mut SDL_AudioStream, + buf: *const ::core::ffi::c_void, + len: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +/// A callback that fires for completed [`SDL_PutAudioStreamDataNoCopy()`] data. +/// +/// When using [`SDL_PutAudioStreamDataNoCopy()`] to provide data to an +/// [`SDL_AudioStream`], it's not safe to dispose of the data until the stream has +/// completely consumed it. Often times it's difficult to know exactly when +/// this has happened. +/// +/// This callback fires once when the stream no longer needs the buffer, +/// allowing the app to easily free or reuse it. +/// +/// ## Parameters +/// - `userdata`: an opaque pointer provided by the app for their personal +/// use. +/// - `buf`: the pointer provided to [`SDL_PutAudioStreamDataNoCopy()`]. +/// - `buflen`: the size of buffer, in bytes, provided to +/// [`SDL_PutAudioStreamDataNoCopy()`]. +/// +/// ## Thread safety +/// This callbacks may run from any thread, so if you need to +/// protect shared data, you should use [`SDL_LockAudioStream`] to +/// serialize access; this lock will be held before your callback +/// is called, so your callback does not need to manage the lock +/// explicitly. +/// +/// ## Availability +/// This datatype is available since SDL 3.4.0. +/// +/// ## See also +/// - [`SDL_SetAudioStreamGetCallback`] +/// - [`SDL_SetAudioStreamPutCallback`] +pub type SDL_AudioStreamDataCompleteCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + buf: *const ::core::ffi::c_void, + buflen: ::core::ffi::c_int, + ), +>; + +unsafe extern "C" { + /// Add external data to an audio stream without copying it. + /// + /// Unlike [`SDL_PutAudioStreamData()`], this function does not make a copy of the + /// provided data, instead storing the provided pointer. This means that the + /// put operation does not need to allocate and copy the data, but the original + /// data must remain available until the stream is done with it, either by + /// being read from the stream in its entirety, or a call to + /// [`SDL_ClearAudioStream()`] or [`SDL_DestroyAudioStream()`]. + /// + /// The data must match the format/channels/samplerate specified in the latest + /// call to [`SDL_SetAudioStreamFormat`], or the format specified when creating the + /// stream if it hasn't been changed. + /// + /// An optional callback may be provided, which is called when the stream no + /// longer needs the data. Once this callback fires, the stream will not access + /// the data again. This callback will fire for any reason the data is no + /// longer needed, including clearing or destroying the stream. + /// + /// Note that there is still an allocation to store tracking information, so + /// this function is more efficient for larger blocks of data. If you're + /// planning to put a few samples at a time, it will be more efficient to use + /// [`SDL_PutAudioStreamData()`], which allocates and buffers in blocks. + /// + /// ## Parameters + /// - `stream`: the stream the audio data is being added to. + /// - `buf`: a pointer to the audio data to add. + /// - `len`: the number of bytes to add to the stream. + /// - `callback`: the callback function to call when the data is no longer + /// needed by the stream. May be NULL. + /// - `userdata`: an opaque pointer provided to the callback for its own + /// personal use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but if the + /// stream has a callback set, the caller might need to manage + /// extra locking. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_ClearAudioStream`] + /// - [`SDL_FlushAudioStream`] + /// - [`SDL_GetAudioStreamData`] + /// - [`SDL_GetAudioStreamQueued`] + pub fn SDL_PutAudioStreamDataNoCopy( + stream: *mut SDL_AudioStream, + buf: *const ::core::ffi::c_void, + len: ::core::ffi::c_int, + callback: SDL_AudioStreamDataCompleteCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Add data to the stream with each channel in a separate array. + /// + /// This data must match the format/channels/samplerate specified in the latest + /// call to [`SDL_SetAudioStreamFormat`], or the format specified when creating the + /// stream if it hasn't been changed. + /// + /// The data will be interleaved and queued. Note that [`SDL_AudioStream`] only + /// operates on interleaved data, so this is simply a convenience function for + /// easily queueing data from sources that provide separate arrays. There is no + /// equivalent function to retrieve planar data. + /// + /// The arrays in `channel_buffers` are ordered as they are to be interleaved; + /// the first array will be the first sample in the interleaved data. Any + /// individual array may be NULL; in this case, silence will be interleaved for + /// that channel. + /// + /// `num_channels` specifies how many arrays are in `channel_buffers`. This can + /// be used as a safety to prevent overflow, in case the stream format has + /// changed elsewhere. If more channels are specified than the current input + /// spec, they are ignored. If less channels are specified, the missing arrays + /// are treated as if they are NULL (silence is written to those channels). If + /// the count is -1, SDL will assume the array count matches the current input + /// spec. + /// + /// Note that `num_samples` is the number of _samples per array_. This can also + /// be thought of as the number of _sample frames_ to be queued. A value of 1 + /// with stereo arrays will queue two samples to the stream. This is different + /// than [`SDL_PutAudioStreamData`], which wants the size of a single array in + /// bytes. + /// + /// ## Parameters + /// - `stream`: the stream the audio data is being added to. + /// - `channel_buffers`: a pointer to an array of arrays, one array per + /// channel. + /// - `num_channels`: the number of arrays in `channel_buffers` or -1. + /// - `num_samples`: the number of _samples_ per array to write to the + /// stream. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but if the + /// stream has a callback set, the caller might need to manage + /// extra locking. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_ClearAudioStream`] + /// - [`SDL_FlushAudioStream`] + /// - [`SDL_GetAudioStreamData`] + /// - [`SDL_GetAudioStreamQueued`] + pub fn SDL_PutAudioStreamPlanarData( + stream: *mut SDL_AudioStream, + channel_buffers: *const *const ::core::ffi::c_void, + num_channels: ::core::ffi::c_int, + num_samples: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get converted/resampled data from the stream. + /// + /// The input/output data format/channels/samplerate is specified when creating + /// the stream, and can be changed after creation by calling + /// [`SDL_SetAudioStreamFormat`]. + /// + /// Note that any conversion and resampling necessary is done during this call, + /// and [`SDL_PutAudioStreamData`] simply queues unconverted data for later. This + /// is different than SDL2, where that work was done while inputting new data + /// to the stream and requesting the output just copied the converted data. + /// + /// ## Parameters + /// - `stream`: the stream the audio is being requested from. + /// - `buf`: a buffer to fill with audio data. + /// - `len`: the maximum number of bytes to fill. + /// + /// ## Return value + /// Returns the number of bytes read from the stream or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but if the + /// stream has a callback set, the caller might need to manage + /// extra locking. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClearAudioStream`] + /// - [`SDL_GetAudioStreamAvailable`] + /// - [`SDL_PutAudioStreamData`] + pub fn SDL_GetAudioStreamData( + stream: *mut SDL_AudioStream, + buf: *mut ::core::ffi::c_void, + len: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of converted/resampled bytes available. + /// + /// The stream may be buffering data behind the scenes until it has enough to + /// resample correctly, so this number might be lower than what you expect, or + /// even be zero. Add more data or flush the stream if you need the data now. + /// + /// If the stream has so much data that it would overflow an int, the return + /// value is clamped to a maximum value, but no queued data is lost; if there + /// are gigabytes of data queued, the app might need to read some of it with + /// [`SDL_GetAudioStreamData`] before this function's return value is no longer + /// clamped. + /// + /// ## Parameters + /// - `stream`: the audio stream to query. + /// + /// ## Return value + /// Returns the number of converted/resampled bytes available or -1 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioStreamData`] + /// - [`SDL_PutAudioStreamData`] + pub fn SDL_GetAudioStreamAvailable(stream: *mut SDL_AudioStream) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of bytes currently queued. + /// + /// This is the number of bytes put into a stream as input, not the number that + /// can be retrieved as output. Because of several details, it's not possible + /// to calculate one number directly from the other. If you need to know how + /// much usable data can be retrieved right now, you should use + /// [`SDL_GetAudioStreamAvailable()`] and not this function. + /// + /// Note that audio streams can change their input format at any time, even if + /// there is still data queued in a different format, so the returned byte + /// count will not necessarily match the number of _sample frames_ available. + /// Users of this API should be aware of format changes they make when feeding + /// a stream and plan accordingly. + /// + /// Queued data is not converted until it is consumed by + /// [`SDL_GetAudioStreamData`], so this value should be representative of the exact + /// data that was put into the stream. + /// + /// If the stream has so much data that it would overflow an int, the return + /// value is clamped to a maximum value, but no queued data is lost; if there + /// are gigabytes of data queued, the app might need to read some of it with + /// [`SDL_GetAudioStreamData`] before this function's return value is no longer + /// clamped. + /// + /// ## Parameters + /// - `stream`: the audio stream to query. + /// + /// ## Return value + /// Returns the number of bytes queued or -1 on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PutAudioStreamData`] + /// - [`SDL_ClearAudioStream`] + pub fn SDL_GetAudioStreamQueued(stream: *mut SDL_AudioStream) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Tell the stream that you're done sending data, and anything being buffered + /// should be converted/resampled and made available immediately. + /// + /// It is legal to add more data to a stream after flushing, but there may be + /// audio gaps in the output. Generally this is intended to signal the end of + /// input, so the complete output becomes available. + /// + /// ## Parameters + /// - `stream`: the audio stream to flush. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PutAudioStreamData`] + pub fn SDL_FlushAudioStream(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear any pending data in the stream. + /// + /// This drops any queued data, so there will be nothing to read from the + /// stream until more is added. + /// + /// ## Parameters + /// - `stream`: the audio stream to clear. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioStreamAvailable`] + /// - [`SDL_GetAudioStreamData`] + /// - [`SDL_GetAudioStreamQueued`] + /// - [`SDL_PutAudioStreamData`] + pub fn SDL_ClearAudioStream(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to pause audio playback on the audio device associated + /// with an audio stream. + /// + /// This function pauses audio processing for a given device. Any bound audio + /// streams will not progress, and no audio will be generated. Pausing one + /// device does not prevent other unpaused devices from running. + /// + /// Pausing a device can be useful to halt all audio without unbinding all the + /// audio streams. This might be useful while a game is paused, or a level is + /// loading, etc. + /// + /// ## Parameters + /// - `stream`: the audio stream associated with the audio device to pause. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ResumeAudioStreamDevice`] + pub fn SDL_PauseAudioStreamDevice(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to unpause audio playback on the audio device associated + /// with an audio stream. + /// + /// This function unpauses audio processing for a given device that has + /// previously been paused. Once unpaused, any bound audio streams will begin + /// to progress again, and audio can be generated. + /// + /// [`SDL_OpenAudioDeviceStream`] opens audio devices in a paused state, so this + /// function call is required for audio playback to begin on such devices. + /// + /// ## Parameters + /// - `stream`: the audio stream associated with the audio device to resume. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PauseAudioStreamDevice`] + pub fn SDL_ResumeAudioStreamDevice(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to query if an audio device associated with a stream is + /// paused. + /// + /// Unlike in SDL2, audio devices start in an _unpaused_ state, since an app + /// has to bind a stream before any audio will flow. + /// + /// ## Parameters + /// - `stream`: the audio stream associated with the audio device to query. + /// + /// ## Return value + /// Returns true if device is valid and paused, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PauseAudioStreamDevice`] + /// - [`SDL_ResumeAudioStreamDevice`] + pub fn SDL_AudioStreamDevicePaused(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Lock an audio stream for serialized access. + /// + /// Each [`SDL_AudioStream`] has an internal mutex it uses to protect its data + /// structures from threading conflicts. This function allows an app to lock + /// that mutex, which could be useful if registering callbacks on this stream. + /// + /// One does not need to lock a stream to use in it most cases, as the stream + /// manages this lock internally. However, this lock is held during callbacks, + /// which may run from arbitrary threads at any time, so if an app needs to + /// protect shared data during those callbacks, locking the stream guarantees + /// that the callback is not running while the lock is held. + /// + /// As this is just a wrapper over [`SDL_LockMutex`] for an internal lock; it has + /// all the same attributes (recursive locks are allowed, etc). + /// + /// ## Parameters + /// - `stream`: the audio stream to lock. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UnlockAudioStream`] + pub fn SDL_LockAudioStream(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unlock an audio stream for serialized access. + /// + /// This unlocks an audio stream after a call to [`SDL_LockAudioStream`]. + /// + /// ## Parameters + /// - `stream`: the audio stream to unlock. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// You should only call this from the same thread that + /// previously called [`SDL_LockAudioStream`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockAudioStream`] + pub fn SDL_UnlockAudioStream(stream: *mut SDL_AudioStream) -> ::core::primitive::bool; +} + +/// A callback that fires when data passes through an [`SDL_AudioStream`]. +/// +/// Apps can (optionally) register a callback with an audio stream that is +/// called when data is added with [`SDL_PutAudioStreamData`], or requested with +/// [`SDL_GetAudioStreamData`]. +/// +/// Two values are offered here: one is the amount of additional data needed to +/// satisfy the immediate request (which might be zero if the stream already +/// has enough data queued) and the other is the total amount being requested. +/// In a Get call triggering a Put callback, these values can be different. In +/// a Put call triggering a Get callback, these values are always the same. +/// +/// Byte counts might be slightly overestimated due to buffering or resampling, +/// and may change from call to call. +/// +/// This callback is not required to do anything. Generally this is useful for +/// adding/reading data on demand, and the app will often put/get data as +/// appropriate, but the system goes on with the data currently available to it +/// if this callback does nothing. +/// +/// Do not call [`SDL_DestroyAudioStream()`] on `stream` during this callback. +/// +/// ## Parameters +/// - `stream`: the SDL audio stream associated with this callback. +/// - `additional_amount`: the amount of data, in bytes, that is needed right +/// now. +/// - `total_amount`: the total amount of data requested, in bytes, that is +/// requested or available. +/// - `userdata`: an opaque pointer provided by the app for their personal +/// use. +/// +/// ## Thread safety +/// This callbacks may run from any thread, so if you need to +/// protect shared data, you should use [`SDL_LockAudioStream`] to +/// serialize access; this lock will be held before your callback +/// is called, so your callback does not need to manage the lock +/// explicitly. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetAudioStreamGetCallback`] +/// - [`SDL_SetAudioStreamPutCallback`] +pub type SDL_AudioStreamCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + stream: *mut SDL_AudioStream, + additional_amount: ::core::ffi::c_int, + total_amount: ::core::ffi::c_int, + ), +>; + +unsafe extern "C" { + /// Set a callback that runs when data is requested from an audio stream. + /// + /// This callback is called _before_ data is obtained from the stream, giving + /// the callback the chance to add more on-demand. + /// + /// The callback can (optionally) call [`SDL_PutAudioStreamData()`] to add more + /// audio to the stream during this call; if needed, the request that triggered + /// this callback will obtain the new data immediately. + /// + /// The callback's `additional_amount` argument is roughly how many bytes of + /// _unconverted_ data (in the stream's input format) is needed by the caller, + /// although this may overestimate a little for safety. This takes into account + /// how much is already in the stream and only asks for any extra necessary to + /// resolve the request, which means the callback may be asked for zero bytes, + /// and a different amount on each call. + /// + /// The callback is not required to supply exact amounts; it is allowed to + /// supply too much or too little or none at all. The caller will get what's + /// available, up to the amount they requested, regardless of this callback's + /// outcome. + /// + /// Clearing or flushing an audio stream does not call this callback. + /// + /// This function obtains the stream's lock, which means any existing callback + /// (get or put) in progress will finish running before setting the new + /// callback. + /// + /// Setting a NULL function turns off the callback. + /// + /// ## Parameters + /// - `stream`: the audio stream to set the new callback on. + /// - `callback`: the new callback function to call when data is requested + /// from the stream. + /// - `userdata`: an opaque pointer provided to the callback for its own + /// personal use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. This only fails if `stream` is NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamPutCallback`] + pub fn SDL_SetAudioStreamGetCallback( + stream: *mut SDL_AudioStream, + callback: SDL_AudioStreamCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a callback that runs when data is added to an audio stream. + /// + /// This callback is called _after_ the data is added to the stream, giving the + /// callback the chance to obtain it immediately. + /// + /// The callback can (optionally) call [`SDL_GetAudioStreamData()`] to obtain audio + /// from the stream during this call. + /// + /// The callback's `additional_amount` argument is how many bytes of + /// _converted_ data (in the stream's output format) was provided by the + /// caller, although this may underestimate a little for safety. This value + /// might be less than what is currently available in the stream, if data was + /// already there, and might be less than the caller provided if the stream + /// needs to keep a buffer to aid in resampling. Which means the callback may + /// be provided with zero bytes, and a different amount on each call. + /// + /// The callback may call [`SDL_GetAudioStreamAvailable`] to see the total amount + /// currently available to read from the stream, instead of the total provided + /// by the current call. + /// + /// The callback is not required to obtain all data. It is allowed to read less + /// or none at all. Anything not read now simply remains in the stream for + /// later access. + /// + /// Clearing or flushing an audio stream does not call this callback. + /// + /// This function obtains the stream's lock, which means any existing callback + /// (get or put) in progress will finish running before setting the new + /// callback. + /// + /// Setting a NULL function turns off the callback. + /// + /// ## Parameters + /// - `stream`: the audio stream to set the new callback on. + /// - `callback`: the new callback function to call when data is added to the + /// stream. + /// - `userdata`: an opaque pointer provided to the callback for its own + /// personal use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. This only fails if `stream` is NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAudioStreamGetCallback`] + pub fn SDL_SetAudioStreamPutCallback( + stream: *mut SDL_AudioStream, + callback: SDL_AudioStreamCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Free an audio stream. + /// + /// This will release all allocated data, including any audio that is still + /// queued. You do not need to manually clear the stream first. + /// + /// If this stream was bound to an audio device, it is unbound during this + /// call. If this stream was created with [`SDL_OpenAudioDeviceStream`], the audio + /// device that was opened alongside this stream's creation will be closed, + /// too. + /// + /// ## Parameters + /// - `stream`: the audio stream to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateAudioStream`] + pub fn SDL_DestroyAudioStream(stream: *mut SDL_AudioStream); +} + +unsafe extern "C" { + /// Convenience function for straightforward audio init for the common case. + /// + /// If all your app intends to do is provide a single source of PCM audio, this + /// function allows you to do all your audio setup in a single call. + /// + /// This is also intended to be a clean means to migrate apps from SDL2. + /// + /// This function will open an audio device, create a stream and bind it. + /// Unlike other methods of setup, the audio device will be closed when this + /// stream is destroyed, so the app can treat the returned [`SDL_AudioStream`] as + /// the only object needed to manage audio playback. + /// + /// Also unlike other functions, the audio device begins paused. This is to map + /// more closely to SDL2-style behavior, since there is no extra step here to + /// bind a stream to begin audio flowing. The audio device should be resumed + /// with [`SDL_ResumeAudioStreamDevice()`]. + /// + /// This function works with both playback and recording devices. + /// + /// The `spec` parameter represents the app's side of the audio stream. That + /// is, for recording audio, this will be the output format, and for playing + /// audio, this will be the input format. If spec is NULL, the system will + /// choose the format, and the app can use [`SDL_GetAudioStreamFormat()`] to obtain + /// this information later. + /// + /// If you don't care about opening a specific audio device, you can (and + /// probably _should_), use [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] for playback and + /// [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`] for recording. + /// + /// One can optionally provide a callback function; if NULL, the app is + /// expected to queue audio data for playback (or unqueue audio data if + /// capturing). Otherwise, the callback will begin to fire once the device is + /// unpaused. + /// + /// Destroying the returned stream with [`SDL_DestroyAudioStream`] will also close + /// the audio device associated with this stream. + /// + /// ## Parameters + /// - `devid`: an audio device to open, or [`SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK`] + /// or [`SDL_AUDIO_DEVICE_DEFAULT_RECORDING`]. + /// - `spec`: the audio stream's data format. Can be NULL. + /// - `callback`: a callback where the app will provide new data for + /// playback, or receive new data for recording. Can be NULL, + /// in which case the app will need to call + /// [`SDL_PutAudioStreamData`] or [`SDL_GetAudioStreamData`] as + /// necessary. + /// - `userdata`: app-controlled pointer passed to callback. Can be NULL. + /// Ignored if callback is NULL. + /// + /// ## Return value + /// Returns an audio stream on success, ready to use, or NULL on failure; call + /// [`SDL_GetError()`] for more information. When done with this stream, + /// call [`SDL_DestroyAudioStream`] to free resources and close the + /// device. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAudioStreamDevice`] + /// - [`SDL_ResumeAudioStreamDevice`] + pub fn SDL_OpenAudioDeviceStream( + devid: SDL_AudioDeviceID, + spec: *const SDL_AudioSpec, + callback: SDL_AudioStreamCallback, + userdata: *mut ::core::ffi::c_void, + ) -> *mut SDL_AudioStream; +} + +/// A callback that fires when data is about to be fed to an audio device. +/// +/// This is useful for accessing the final mix, perhaps for writing a +/// visualizer or applying a final effect to the audio data before playback. +/// +/// This callback should run as quickly as possible and not block for any +/// significant time, as this callback delays submission of data to the audio +/// device, which can cause audio playback problems. +/// +/// The postmix callback _must_ be able to handle any audio data format +/// specified in `spec`, which can change between callbacks if the audio device +/// changed. However, this only covers frequency and channel count; data is +/// always provided here in [`SDL_AUDIO_F32`] format. +/// +/// The postmix callback runs _after_ logical device gain and audiostream gain +/// have been applied, which is to say you can make the output data louder at +/// this point than the gain settings would suggest. +/// +/// ## Parameters +/// - `userdata`: a pointer provided by the app through +/// [`SDL_SetAudioPostmixCallback`], for its own use. +/// - `spec`: the current format of audio that is to be submitted to the +/// audio device. +/// - `buffer`: the buffer of audio samples to be submitted. The callback can +/// inspect and/or modify this data. +/// - `buflen`: the size of `buffer` in bytes. +/// +/// ## Thread safety +/// This will run from a background thread owned by SDL. The +/// application is responsible for locking resources the callback +/// touches that need to be protected. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetAudioPostmixCallback`] +pub type SDL_AudioPostmixCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + spec: *const SDL_AudioSpec, + buffer: *mut ::core::ffi::c_float, + buflen: ::core::ffi::c_int, + ), +>; + +unsafe extern "C" { + /// Set a callback that fires when data is about to be fed to an audio device. + /// + /// This is useful for accessing the final mix, perhaps for writing a + /// visualizer or applying a final effect to the audio data before playback. + /// + /// The buffer is the final mix of all bound audio streams on an opened device; + /// this callback will fire regularly for any device that is both opened and + /// unpaused. If there is no new data to mix, either because no streams are + /// bound to the device or all the streams are empty, this callback will still + /// fire with the entire buffer set to silence. + /// + /// This callback is allowed to make changes to the data; the contents of the + /// buffer after this call is what is ultimately passed along to the hardware. + /// + /// The callback is always provided the data in float format (values from -1.0f + /// to 1.0f), but the number of channels or sample rate may be different than + /// the format the app requested when opening the device; SDL might have had to + /// manage a conversion behind the scenes, or the playback might have jumped to + /// new physical hardware when a system default changed, etc. These details may + /// change between calls. Accordingly, the size of the buffer might change + /// between calls as well. + /// + /// This callback can run at any time, and from any thread; if you need to + /// serialize access to your app's data, you should provide and use a mutex or + /// other synchronization device. + /// + /// All of this to say: there are specific needs this callback can fulfill, but + /// it is not the simplest interface. Apps should generally provide audio in + /// their preferred format through an [`SDL_AudioStream`] and let SDL handle the + /// difference. + /// + /// This function is extremely time-sensitive; the callback should do the least + /// amount of work possible and return as quickly as it can. The longer the + /// callback runs, the higher the risk of audio dropouts or other problems. + /// + /// This function will block until the audio device is in between iterations, + /// so any existing callback that might be running will finish before this + /// function sets the new callback and returns. + /// + /// Setting a NULL callback function disables any previously-set callback. + /// + /// ## Parameters + /// - `devid`: the ID of an opened audio device. + /// - `callback`: a callback function to be called. Can be NULL. + /// - `userdata`: app-controlled pointer passed to callback. Can be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetAudioPostmixCallback( + devid: SDL_AudioDeviceID, + callback: SDL_AudioPostmixCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Load the audio data of a WAVE file into memory. + /// + /// Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to + /// be valid pointers. The entire data portion of the file is then loaded into + /// memory and decoded if necessary. + /// + /// Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and + /// 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and + /// A-law and mu-law (8 bits). Other formats are currently unsupported and + /// cause an error. + /// + /// If this function succeeds, the return value is zero and the pointer to the + /// audio data allocated by the function is written to `audio_buf` and its + /// length in bytes to `audio_len`. The [`SDL_AudioSpec`] members `freq`, + /// `channels`, and `format` are set to the values of the audio data in the + /// buffer. + /// + /// It's necessary to use [`SDL_free()`] to free the audio data returned in + /// `audio_buf` when it is no longer used. + /// + /// Because of the underspecification of the .WAV format, there are many + /// problematic files in the wild that cause issues with strict decoders. To + /// provide compatibility with these files, this decoder is lenient in regards + /// to the truncation of the file, the fact chunk, and the size of the RIFF + /// chunk. The hints [`SDL_HINT_WAVE_RIFF_CHUNK_SIZE`], + /// [`SDL_HINT_WAVE_TRUNCATION`], and [`SDL_HINT_WAVE_FACT_CHUNK`] can be used to + /// tune the behavior of the loading process. + /// + /// Any file that is invalid (due to truncation, corruption, or wrong values in + /// the headers), too big, or unsupported causes an error. Additionally, any + /// critical I/O error from the data source will terminate the loading process + /// with an error. The function returns NULL on error and in all cases (with + /// the exception of `src` being NULL), an appropriate error message will be + /// set. + /// + /// It is required that the data source supports seeking. + /// + /// Example: + /// + /// ```c + /// SDL_LoadWAV_IO(SDL_IOFromFile("sample.wav", "rb"), true, &spec, &buf, &len); + /// ``` + /// + /// Note that the [`SDL_LoadWAV`] function does this same thing for you, but in a + /// less messy way: + /// + /// ```c + /// SDL_LoadWAV("sample.wav", &spec, &buf, &len); + /// ``` + /// + /// ## Parameters + /// - `src`: the data source for the WAVE data. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// - `spec`: a pointer to an [`SDL_AudioSpec`] that will be set to the WAVE + /// data's format details on successful return. + /// - `audio_buf`: a pointer filled with the audio data, allocated by the + /// function. + /// - `audio_len`: a pointer filled with the length of the audio data buffer + /// in bytes. + /// + /// ## Return value + /// Returns true on success. `audio_buf` will be filled with a pointer to an + /// allocated buffer containing the audio data, and `audio_len` is + /// filled with the length of that audio buffer in bytes. + /// + /// ```text + /// This function returns false if the .WAV file cannot be opened, + /// uses an unknown data format, or is corrupt; call SDL_GetError() + /// for more information. + /// + /// When the application is done with the data returned in + /// `audio_buf`, it should call SDL_free() to dispose of it. + /// ``` + /// + /// \threadsafety It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_free`] + /// - [`SDL_LoadWAV`] + pub fn SDL_LoadWAV_IO( + src: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + spec: *mut SDL_AudioSpec, + audio_buf: *mut *mut Uint8, + audio_len: *mut Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Loads a WAV from a file path. + /// + /// This is a convenience function that is effectively the same as: + /// + /// ```c + /// SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), true, spec, audio_buf, audio_len); + /// ``` + /// + /// ## Parameters + /// - `path`: the file path of the WAV file to open. + /// - `spec`: a pointer to an [`SDL_AudioSpec`] that will be set to the WAVE + /// data's format details on successful return. + /// - `audio_buf`: a pointer filled with the audio data, allocated by the + /// function. + /// - `audio_len`: a pointer filled with the length of the audio data buffer + /// in bytes. + /// + /// ## Return value + /// Returns true on success. `audio_buf` will be filled with a pointer to an + /// allocated buffer containing the audio data, and `audio_len` is + /// filled with the length of that audio buffer in bytes. + /// + /// ```text + /// This function returns false if the .WAV file cannot be opened, + /// uses an unknown data format, or is corrupt; call SDL_GetError() + /// for more information. + /// + /// When the application is done with the data returned in + /// `audio_buf`, it should call SDL_free() to dispose of it. + /// ``` + /// + /// \threadsafety It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_free`] + /// - [`SDL_LoadWAV_IO`] + pub fn SDL_LoadWAV( + path: *const ::core::ffi::c_char, + spec: *mut SDL_AudioSpec, + audio_buf: *mut *mut Uint8, + audio_len: *mut Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Mix audio data in a specified format. + /// + /// This takes an audio buffer `src` of `len` bytes of `format` data and mixes + /// it into `dst`, performing addition, volume adjustment, and overflow + /// clipping. The buffer pointed to by `dst` must also be `len` bytes of + /// `format` data. + /// + /// This is provided for convenience -- you can mix your own audio data. + /// + /// Do not use this function for mixing together more than two streams of + /// sample data. The output from repeated application of this function may be + /// distorted by clipping, because there is no accumulator with greater range + /// than the input (not to mention this being an inefficient way of doing it). + /// + /// It is a common misconception that this function is required to write audio + /// data to an output stream in an audio callback. While you can do that, + /// [`SDL_MixAudio()`] is really only needed when you're mixing a single audio + /// stream with a volume adjustment. + /// + /// ## Parameters + /// - `dst`: the destination for the mixed audio. + /// - `src`: the source audio buffer to be mixed. + /// - `format`: the [`SDL_AudioFormat`] structure representing the desired audio + /// format. + /// - `len`: the length of the audio buffer in bytes. + /// - `volume`: ranges from 0.0 - 1.0, and should be set to 1.0 for full + /// audio volume. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_MixAudio( + dst: *mut Uint8, + src: *const Uint8, + format: SDL_AudioFormat, + len: Uint32, + volume: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Convert some audio data of one format to another format. + /// + /// Please note that this function is for convenience, but should not be used + /// to resample audio in blocks, as it will introduce audio artifacts on the + /// boundaries. You should only use this function if you are converting audio + /// data in its entirety in one call. If you want to convert audio in smaller + /// chunks, use an [`SDL_AudioStream`], which is designed for this situation. + /// + /// Internally, this function creates and destroys an [`SDL_AudioStream`] on each + /// use, so it's also less efficient than using one directly, if you need to + /// convert multiple times. + /// + /// ## Parameters + /// - `src_spec`: the format details of the input audio. + /// - `src_data`: the audio data to be converted. + /// - `src_len`: the len of src_data. + /// - `dst_spec`: the format details of the output audio. + /// - `dst_data`: will be filled with a pointer to converted audio data, + /// which should be freed with [`SDL_free()`]. On error, it will be + /// NULL. + /// - `dst_len`: will be filled with the len of dst_data. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ConvertAudioSamples( + src_spec: *const SDL_AudioSpec, + src_data: *const Uint8, + src_len: ::core::ffi::c_int, + dst_spec: *const SDL_AudioSpec, + dst_data: *mut *mut Uint8, + dst_len: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the human readable name of an audio format. + /// + /// ## Parameters + /// - `format`: the audio format to query. + /// + /// ## Return value + /// Returns the human readable name of the specified audio format or + /// "SDL_AUDIO_UNKNOWN" if the format isn't recognized. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetAudioFormatName(format: SDL_AudioFormat) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the appropriate memset value for silencing an audio format. + /// + /// The value returned by this function can be used as the second argument to + /// memset (or [`SDL_memset`]) to set an audio buffer in a specific format to + /// silence. + /// + /// ## Parameters + /// - `format`: the audio data format to query. + /// + /// ## Return value + /// Returns a byte value that can be passed to memset. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_GetSilenceValueForFormat(format: SDL_AudioFormat) -> ::core::ffi::c_int; +} + +/// The opaque handle that represents an audio stream. +/// +/// [`SDL_AudioStream`] is an audio conversion interface. +/// +/// - It can handle resampling data in chunks without generating artifacts, +/// when it doesn't have the complete buffer available. +/// - It can handle incoming data in any variable size. +/// - It can handle input/output format changes on the fly. +/// - It can remap audio channels between inputs and outputs. +/// - You push data as you have it, and pull it when you need it; the +/// stream will buffer data as needed. +/// - It can also function as a basic audio data queue even if you just have +/// sound that needs to pass from one place to another. +/// - You can hook callbacks up to them when more data is added or requested, +/// to manage data on-the-fly. +/// +/// Audio streams are the core of the SDL3 audio interface. You create one or +/// more of them, bind them to an opened audio device, and feed data to them +/// (or for recording, consume data from them). +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateAudioStream`] +#[repr(C)] +pub struct SDL_AudioStream { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/bits.rs b/vendor/sdl3-sys/src/generated/bits.rs new file mode 100644 index 00000000..7fdb0d45 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/bits.rs @@ -0,0 +1,60 @@ +//! Functions for fiddling with bits and bitmasks. + +use super::stdinc::*; + +/// Get the index of the most significant (set) bit in a 32-bit number. +/// +/// This operation can also be stated as "count leading zeroes" and "log base 2". +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `x`: the 32-bit value to examine. +/// +/// ## Return value +/// Returns the index of the most significant bit, or -1 if the value is 0. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_MostSignificantBitIndex32(x: Uint32) -> ::core::ffi::c_int { + 31 - (x.leading_zeros() as ::core::ffi::c_int) +} + +/// Determine if a unsigned 32-bit value has exactly one bit set. +/// +/// If there are no bits set (`x` is zero), or more than one bit set, this +/// returns false. If any one bit is exclusively set, this returns true. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `x`: the 32-bit value to examine. +/// +/// ## Return value +/// Returns true if exactly one bit is set in `x`, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_HasExactlyOneBitSet32(x: Uint32) -> ::core::primitive::bool { + if ((x != 0) && !((x & (x - 1_u32)) != 0)) { + return true; + } + return false; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/blendmode.rs b/vendor/sdl3-sys/src/generated/blendmode.rs new file mode 100644 index 00000000..47d28334 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/blendmode.rs @@ -0,0 +1,598 @@ +//! Blend modes decide how two colors will mix together. There are both +//! standard modes for basic needs and a means to create custom modes, +//! dictating what sort of math to do on what color components. + +use super::stdinc::*; + +/// A set of blend modes used in drawing operations. +/// +/// These predefined blend modes are supported everywhere. +/// +/// Additional values may be obtained from [`SDL_ComposeCustomBlendMode`]. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ComposeCustomBlendMode`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_BlendMode::NONE) | [`SDL_BLENDMODE_NONE`] | no blending: dstRGBA = srcRGBA | +/// | [`BLEND`](SDL_BlendMode::BLEND) | [`SDL_BLENDMODE_BLEND`] | alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA)) | +/// | [`BLEND_PREMULTIPLIED`](SDL_BlendMode::BLEND_PREMULTIPLIED) | [`SDL_BLENDMODE_BLEND_PREMULTIPLIED`] | pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA)) | +/// | [`ADD`](SDL_BlendMode::ADD) | [`SDL_BLENDMODE_ADD`] | additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA | +/// | [`ADD_PREMULTIPLIED`](SDL_BlendMode::ADD_PREMULTIPLIED) | [`SDL_BLENDMODE_ADD_PREMULTIPLIED`] | pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA | +/// | [`MOD`](SDL_BlendMode::MOD) | [`SDL_BLENDMODE_MOD`] | color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA | +/// | [`MUL`](SDL_BlendMode::MUL) | [`SDL_BLENDMODE_MUL`] | color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA | +/// | [`INVALID`](SDL_BlendMode::INVALID) | [`SDL_BLENDMODE_INVALID`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_BlendMode(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_BlendMode { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_BlendMode) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_BlendMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_BlendMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_BlendMode(")?; + let all_bits = all_bits | Self::NONE.0; + if (Self::NONE != 0 || self.0 == 0) && *self & Self::NONE == Self::NONE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NONE")?; + } + let all_bits = all_bits | Self::BLEND.0; + if (Self::BLEND != 0 || self.0 == 0) && *self & Self::BLEND == Self::BLEND { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BLEND")?; + } + let all_bits = all_bits | Self::BLEND_PREMULTIPLIED.0; + if (Self::BLEND_PREMULTIPLIED != 0 || self.0 == 0) + && *self & Self::BLEND_PREMULTIPLIED == Self::BLEND_PREMULTIPLIED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BLEND_PREMULTIPLIED")?; + } + let all_bits = all_bits | Self::ADD.0; + if (Self::ADD != 0 || self.0 == 0) && *self & Self::ADD == Self::ADD { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ADD")?; + } + let all_bits = all_bits | Self::ADD_PREMULTIPLIED.0; + if (Self::ADD_PREMULTIPLIED != 0 || self.0 == 0) + && *self & Self::ADD_PREMULTIPLIED == Self::ADD_PREMULTIPLIED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ADD_PREMULTIPLIED")?; + } + let all_bits = all_bits | Self::MOD.0; + if (Self::MOD != 0 || self.0 == 0) && *self & Self::MOD == Self::MOD { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MOD")?; + } + let all_bits = all_bits | Self::MUL.0; + if (Self::MUL != 0 || self.0 == 0) && *self & Self::MUL == Self::MUL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MUL")?; + } + let all_bits = all_bits | Self::INVALID.0; + if (Self::INVALID != 0 || self.0 == 0) && *self & Self::INVALID == Self::INVALID { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INVALID")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_BlendMode { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_BlendMode { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_BlendMode { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_BlendMode { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_BlendMode { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_BlendMode { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_BlendMode { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_BlendMode { + /// no blending: dstRGBA = srcRGBA + pub const NONE: Self = Self((0x00000000 as Uint32)); + /// alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA)) + pub const BLEND: Self = Self((0x00000001 as Uint32)); + /// pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA)) + pub const BLEND_PREMULTIPLIED: Self = Self((0x00000010 as Uint32)); + /// additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA + pub const ADD: Self = Self((0x00000002 as Uint32)); + /// pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA + pub const ADD_PREMULTIPLIED: Self = Self((0x00000020 as Uint32)); + /// color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA + pub const MOD: Self = Self((0x00000004 as Uint32)); + /// color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA + pub const MUL: Self = Self((0x00000008 as Uint32)); + pub const INVALID: Self = Self((0x7fffffff as Uint32)); +} + +/// no blending: dstRGBA = srcRGBA +pub const SDL_BLENDMODE_NONE: SDL_BlendMode = SDL_BlendMode::NONE; +/// alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA)) +pub const SDL_BLENDMODE_BLEND: SDL_BlendMode = SDL_BlendMode::BLEND; +/// pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA)) +pub const SDL_BLENDMODE_BLEND_PREMULTIPLIED: SDL_BlendMode = SDL_BlendMode::BLEND_PREMULTIPLIED; +/// additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA +pub const SDL_BLENDMODE_ADD: SDL_BlendMode = SDL_BlendMode::ADD; +/// pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA +pub const SDL_BLENDMODE_ADD_PREMULTIPLIED: SDL_BlendMode = SDL_BlendMode::ADD_PREMULTIPLIED; +/// color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA +pub const SDL_BLENDMODE_MOD: SDL_BlendMode = SDL_BlendMode::MOD; +/// color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA +pub const SDL_BLENDMODE_MUL: SDL_BlendMode = SDL_BlendMode::MUL; +pub const SDL_BLENDMODE_INVALID: SDL_BlendMode = SDL_BlendMode::INVALID; + +impl SDL_BlendMode { + /// Initialize a `SDL_BlendMode` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_BlendMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_BlendMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::blendmode::METADATA_SDL_BlendMode; +} + +/// The blend operation used when combining source and destination pixel +/// components. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`ADD`](SDL_BlendOperation::ADD) | [`SDL_BLENDOPERATION_ADD`] | dst + src: supported by all renderers | +/// | [`SUBTRACT`](SDL_BlendOperation::SUBTRACT) | [`SDL_BLENDOPERATION_SUBTRACT`] | src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan | +/// | [`REV_SUBTRACT`](SDL_BlendOperation::REV_SUBTRACT) | [`SDL_BLENDOPERATION_REV_SUBTRACT`] | dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan | +/// | [`MINIMUM`](SDL_BlendOperation::MINIMUM) | [`SDL_BLENDOPERATION_MINIMUM`] | min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan | +/// | [`MAXIMUM`](SDL_BlendOperation::MAXIMUM) | [`SDL_BLENDOPERATION_MAXIMUM`] | max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_BlendOperation(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_BlendOperation { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_BlendOperation) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_BlendOperation) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_BlendOperation { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::ADD => "SDL_BLENDOPERATION_ADD", + Self::SUBTRACT => "SDL_BLENDOPERATION_SUBTRACT", + Self::REV_SUBTRACT => "SDL_BLENDOPERATION_REV_SUBTRACT", + Self::MINIMUM => "SDL_BLENDOPERATION_MINIMUM", + Self::MAXIMUM => "SDL_BLENDOPERATION_MAXIMUM", + + _ => return write!(f, "SDL_BlendOperation({})", self.0), + }) + } +} + +impl SDL_BlendOperation { + /// dst + src: supported by all renderers + pub const ADD: Self = Self((0x1 as ::core::ffi::c_int)); + /// src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan + pub const SUBTRACT: Self = Self((0x2 as ::core::ffi::c_int)); + /// dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan + pub const REV_SUBTRACT: Self = Self((0x3 as ::core::ffi::c_int)); + /// min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan + pub const MINIMUM: Self = Self((0x4 as ::core::ffi::c_int)); + /// max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan + pub const MAXIMUM: Self = Self((0x5 as ::core::ffi::c_int)); +} + +/// dst + src: supported by all renderers +pub const SDL_BLENDOPERATION_ADD: SDL_BlendOperation = SDL_BlendOperation::ADD; +/// src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan +pub const SDL_BLENDOPERATION_SUBTRACT: SDL_BlendOperation = SDL_BlendOperation::SUBTRACT; +/// dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan +pub const SDL_BLENDOPERATION_REV_SUBTRACT: SDL_BlendOperation = SDL_BlendOperation::REV_SUBTRACT; +/// min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan +pub const SDL_BLENDOPERATION_MINIMUM: SDL_BlendOperation = SDL_BlendOperation::MINIMUM; +/// max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan +pub const SDL_BLENDOPERATION_MAXIMUM: SDL_BlendOperation = SDL_BlendOperation::MAXIMUM; + +impl SDL_BlendOperation { + /// Initialize a `SDL_BlendOperation` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_BlendOperation { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_BlendOperation { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::blendmode::METADATA_SDL_BlendOperation; +} + +/// The normalized factor used to multiply pixel components. +/// +/// The blend factors are multiplied with the pixels from a drawing operation +/// (src) and the pixels from the render target (dst) before the blend +/// operation. The comma-separated factors listed above are always applied in +/// the component order red, green, blue, and alpha. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`ZERO`](SDL_BlendFactor::ZERO) | [`SDL_BLENDFACTOR_ZERO`] | 0, 0, 0, 0 | +/// | [`ONE`](SDL_BlendFactor::ONE) | [`SDL_BLENDFACTOR_ONE`] | 1, 1, 1, 1 | +/// | [`SRC_COLOR`](SDL_BlendFactor::SRC_COLOR) | [`SDL_BLENDFACTOR_SRC_COLOR`] | srcR, srcG, srcB, srcA | +/// | [`ONE_MINUS_SRC_COLOR`](SDL_BlendFactor::ONE_MINUS_SRC_COLOR) | [`SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR`] | 1-srcR, 1-srcG, 1-srcB, 1-srcA | +/// | [`SRC_ALPHA`](SDL_BlendFactor::SRC_ALPHA) | [`SDL_BLENDFACTOR_SRC_ALPHA`] | srcA, srcA, srcA, srcA | +/// | [`ONE_MINUS_SRC_ALPHA`](SDL_BlendFactor::ONE_MINUS_SRC_ALPHA) | [`SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA`] | 1-srcA, 1-srcA, 1-srcA, 1-srcA | +/// | [`DST_COLOR`](SDL_BlendFactor::DST_COLOR) | [`SDL_BLENDFACTOR_DST_COLOR`] | dstR, dstG, dstB, dstA | +/// | [`ONE_MINUS_DST_COLOR`](SDL_BlendFactor::ONE_MINUS_DST_COLOR) | [`SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR`] | 1-dstR, 1-dstG, 1-dstB, 1-dstA | +/// | [`DST_ALPHA`](SDL_BlendFactor::DST_ALPHA) | [`SDL_BLENDFACTOR_DST_ALPHA`] | dstA, dstA, dstA, dstA | +/// | [`ONE_MINUS_DST_ALPHA`](SDL_BlendFactor::ONE_MINUS_DST_ALPHA) | [`SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA`] | 1-dstA, 1-dstA, 1-dstA, 1-dstA | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_BlendFactor(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_BlendFactor { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_BlendFactor) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_BlendFactor) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_BlendFactor { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::ZERO => "SDL_BLENDFACTOR_ZERO", + Self::ONE => "SDL_BLENDFACTOR_ONE", + Self::SRC_COLOR => "SDL_BLENDFACTOR_SRC_COLOR", + Self::ONE_MINUS_SRC_COLOR => "SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR", + Self::SRC_ALPHA => "SDL_BLENDFACTOR_SRC_ALPHA", + Self::ONE_MINUS_SRC_ALPHA => "SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA", + Self::DST_COLOR => "SDL_BLENDFACTOR_DST_COLOR", + Self::ONE_MINUS_DST_COLOR => "SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR", + Self::DST_ALPHA => "SDL_BLENDFACTOR_DST_ALPHA", + Self::ONE_MINUS_DST_ALPHA => "SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA", + + _ => return write!(f, "SDL_BlendFactor({})", self.0), + }) + } +} + +impl SDL_BlendFactor { + /// 0, 0, 0, 0 + pub const ZERO: Self = Self((0x1 as ::core::ffi::c_int)); + /// 1, 1, 1, 1 + pub const ONE: Self = Self((0x2 as ::core::ffi::c_int)); + /// srcR, srcG, srcB, srcA + pub const SRC_COLOR: Self = Self((0x3 as ::core::ffi::c_int)); + /// 1-srcR, 1-srcG, 1-srcB, 1-srcA + pub const ONE_MINUS_SRC_COLOR: Self = Self((0x4 as ::core::ffi::c_int)); + /// srcA, srcA, srcA, srcA + pub const SRC_ALPHA: Self = Self((0x5 as ::core::ffi::c_int)); + /// 1-srcA, 1-srcA, 1-srcA, 1-srcA + pub const ONE_MINUS_SRC_ALPHA: Self = Self((0x6 as ::core::ffi::c_int)); + /// dstR, dstG, dstB, dstA + pub const DST_COLOR: Self = Self((0x7 as ::core::ffi::c_int)); + /// 1-dstR, 1-dstG, 1-dstB, 1-dstA + pub const ONE_MINUS_DST_COLOR: Self = Self((0x8 as ::core::ffi::c_int)); + /// dstA, dstA, dstA, dstA + pub const DST_ALPHA: Self = Self((0x9 as ::core::ffi::c_int)); + /// 1-dstA, 1-dstA, 1-dstA, 1-dstA + pub const ONE_MINUS_DST_ALPHA: Self = Self((0xa as ::core::ffi::c_int)); +} + +/// 0, 0, 0, 0 +pub const SDL_BLENDFACTOR_ZERO: SDL_BlendFactor = SDL_BlendFactor::ZERO; +/// 1, 1, 1, 1 +pub const SDL_BLENDFACTOR_ONE: SDL_BlendFactor = SDL_BlendFactor::ONE; +/// srcR, srcG, srcB, srcA +pub const SDL_BLENDFACTOR_SRC_COLOR: SDL_BlendFactor = SDL_BlendFactor::SRC_COLOR; +/// 1-srcR, 1-srcG, 1-srcB, 1-srcA +pub const SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: SDL_BlendFactor = + SDL_BlendFactor::ONE_MINUS_SRC_COLOR; +/// srcA, srcA, srcA, srcA +pub const SDL_BLENDFACTOR_SRC_ALPHA: SDL_BlendFactor = SDL_BlendFactor::SRC_ALPHA; +/// 1-srcA, 1-srcA, 1-srcA, 1-srcA +pub const SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: SDL_BlendFactor = + SDL_BlendFactor::ONE_MINUS_SRC_ALPHA; +/// dstR, dstG, dstB, dstA +pub const SDL_BLENDFACTOR_DST_COLOR: SDL_BlendFactor = SDL_BlendFactor::DST_COLOR; +/// 1-dstR, 1-dstG, 1-dstB, 1-dstA +pub const SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: SDL_BlendFactor = + SDL_BlendFactor::ONE_MINUS_DST_COLOR; +/// dstA, dstA, dstA, dstA +pub const SDL_BLENDFACTOR_DST_ALPHA: SDL_BlendFactor = SDL_BlendFactor::DST_ALPHA; +/// 1-dstA, 1-dstA, 1-dstA, 1-dstA +pub const SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: SDL_BlendFactor = + SDL_BlendFactor::ONE_MINUS_DST_ALPHA; + +impl SDL_BlendFactor { + /// Initialize a `SDL_BlendFactor` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_BlendFactor { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_BlendFactor { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::blendmode::METADATA_SDL_BlendFactor; +} + +unsafe extern "C" { + /// Compose a custom blend mode for renderers. + /// + /// The functions [`SDL_SetRenderDrawBlendMode`] and [`SDL_SetTextureBlendMode`] accept + /// the [`SDL_BlendMode`] returned by this function if the renderer supports it. + /// + /// A blend mode controls how the pixels from a drawing operation (source) get + /// combined with the pixels from the render target (destination). First, the + /// components of the source and destination pixels get multiplied with their + /// blend factors. Then, the blend operation takes the two products and + /// calculates the result that will get stored in the render target. + /// + /// Expressed in pseudocode, it would look like this: + /// + /// ```c + /// dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor); + /// dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor); + /// ``` + /// + /// Where the functions `colorOperation(src, dst)` and `alphaOperation(src, + /// dst)` can return one of the following: + /// + /// - `src + dst` + /// - `src - dst` + /// - `dst - src` + /// - `min(src, dst)` + /// - `max(src, dst)` + /// + /// The red, green, and blue components are always multiplied with the first, + /// second, and third components of the [`SDL_BlendFactor`], respectively. The + /// fourth component is not used. + /// + /// The alpha component is always multiplied with the fourth component of the + /// [`SDL_BlendFactor`]. The other components are not used in the alpha + /// calculation. + /// + /// Support for these blend modes varies for each renderer. To check if a + /// specific [`SDL_BlendMode`] is supported, create a renderer and pass it to + /// either [`SDL_SetRenderDrawBlendMode`] or [`SDL_SetTextureBlendMode`]. They will + /// return with an error if the blend mode is not supported. + /// + /// This list describes the support of custom blend modes for each renderer. + /// All renderers support the four blend modes listed in the [`SDL_BlendMode`] + /// enumeration. + /// + /// - **direct3d**: Supports all operations with all factors. However, some + /// factors produce unexpected results with [`SDL_BLENDOPERATION_MINIMUM`] and + /// [`SDL_BLENDOPERATION_MAXIMUM`]. + /// - **direct3d11**: Same as Direct3D 9. + /// - **opengl**: Supports the [`SDL_BLENDOPERATION_ADD`] operation with all + /// factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly here. + /// - **opengles2**: Supports the [`SDL_BLENDOPERATION_ADD`], + /// [`SDL_BLENDOPERATION_SUBTRACT`], [`SDL_BLENDOPERATION_REV_SUBTRACT`] + /// operations with all factors. + /// - **psp**: No custom blend mode support. + /// - **software**: No custom blend mode support. + /// + /// Some renderers do not provide an alpha component for the default render + /// target. The [`SDL_BLENDFACTOR_DST_ALPHA`] and + /// [`SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA`] factors do not have an effect in this + /// case. + /// + /// ## Parameters + /// - `srcColorFactor`: the [`SDL_BlendFactor`] applied to the red, green, and + /// blue components of the source pixels. + /// - `dstColorFactor`: the [`SDL_BlendFactor`] applied to the red, green, and + /// blue components of the destination pixels. + /// - `colorOperation`: the [`SDL_BlendOperation`] used to combine the red, + /// green, and blue components of the source and + /// destination pixels. + /// - `srcAlphaFactor`: the [`SDL_BlendFactor`] applied to the alpha component of + /// the source pixels. + /// - `dstAlphaFactor`: the [`SDL_BlendFactor`] applied to the alpha component of + /// the destination pixels. + /// - `alphaOperation`: the [`SDL_BlendOperation`] used to combine the alpha + /// component of the source and destination pixels. + /// + /// ## Return value + /// Returns an [`SDL_BlendMode`] that represents the chosen factors and + /// operations. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderDrawBlendMode`] + /// - [`SDL_GetRenderDrawBlendMode`] + /// - [`SDL_SetTextureBlendMode`] + /// - [`SDL_GetTextureBlendMode`] + pub safe fn SDL_ComposeCustomBlendMode( + srcColorFactor: SDL_BlendFactor, + dstColorFactor: SDL_BlendFactor, + colorOperation: SDL_BlendOperation, + srcAlphaFactor: SDL_BlendFactor, + dstAlphaFactor: SDL_BlendFactor, + alphaOperation: SDL_BlendOperation, + ) -> SDL_BlendMode; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/camera.rs b/vendor/sdl3-sys/src/generated/camera.rs new file mode 100644 index 00000000..5f2ef21f --- /dev/null +++ b/vendor/sdl3-sys/src/generated/camera.rs @@ -0,0 +1,800 @@ +//! Video capture for the SDL library. +//! +//! This API lets apps read input from video sources, like webcams. Camera +//! devices can be enumerated, queried, and opened. Once opened, it will +//! provide [`SDL_Surface`] objects as new frames of video come in. These surfaces +//! can be uploaded to an [`SDL_Texture`] or processed as pixels in memory. +//! +//! Several platforms will alert the user if an app tries to access a camera, +//! and some will present a UI asking the user if your application should be +//! allowed to obtain images at all, which they can deny. A successfully opened +//! camera will not provide images until permission is granted. Applications, +//! after opening a camera device, can see if they were granted access by +//! either polling with the [`SDL_GetCameraPermissionState()`] function, or waiting +//! for an [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] or [`SDL_EVENT_CAMERA_DEVICE_DENIED`] +//! event. Platforms that don't have any user approval process will report +//! approval immediately. +//! +//! Note that SDL cameras only provide video as individual frames; they will +//! not provide full-motion video encoded in a movie file format, although an +//! app is free to encode the acquired frames into any format it likes. It also +//! does not provide audio from the camera hardware through this API; not only +//! do many webcams not have microphones at all, many people--from streamers to +//! people on Zoom calls--will want to use a separate microphone regardless of +//! the camera. In any case, recorded audio will be available through SDL's +//! audio API no matter what hardware provides the microphone. +//! +//! ## Camera gotchas +//! +//! Consumer-level camera hardware tends to take a little while to warm up, +//! once the device has been opened. Generally most camera apps have some sort +//! of UI to take a picture (a button to snap a pic while a preview is showing, +//! some sort of multi-second countdown for the user to pose, like a photo +//! booth), which puts control in the users' hands, or they are intended to +//! stay on for long times (Pokemon Go, etc). +//! +//! It's not uncommon that a newly-opened camera will provide a couple of +//! completely black frames, maybe followed by some under-exposed images. If +//! taking a single frame automatically, or recording video from a camera's +//! input without the user initiating it from a preview, it could be wise to +//! drop the first several frames (if not the first several _seconds_ worth of +//! frames!) before using images from a camera. + +use super::stdinc::*; + +use super::error::*; + +use super::pixels::*; + +use super::properties::*; + +use super::surface::*; + +/// This is a unique ID for a camera device for the time it is connected to the +/// system, and is never reused for the lifetime of the application. +/// +/// If the device is disconnected and reconnected, it will get a new ID. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetCameras`] +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_CameraID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_CameraID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_CameraID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_CameraID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_CameraID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_CameraID { + /// Initialize a `SDL_CameraID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_CameraID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_CameraID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::camera::METADATA_SDL_CameraID; +} + +/// The details of an output format for a camera device. +/// +/// Cameras often support multiple formats; each one will be encapsulated in +/// this struct. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetCameraSupportedFormats`] +/// - [`SDL_GetCameraFormat`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_CameraSpec { + /// Frame format + pub format: SDL_PixelFormat, + /// Frame colorspace + pub colorspace: SDL_Colorspace, + /// Frame width + pub width: ::core::ffi::c_int, + /// Frame height + pub height: ::core::ffi::c_int, + /// Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) + pub framerate_numerator: ::core::ffi::c_int, + /// Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds) + pub framerate_denominator: ::core::ffi::c_int, +} + +/// The position of camera in relation to system device. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetCameraPosition`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_CameraPosition::UNKNOWN) | [`SDL_CAMERA_POSITION_UNKNOWN`] | | +/// | [`FRONT_FACING`](SDL_CameraPosition::FRONT_FACING) | [`SDL_CAMERA_POSITION_FRONT_FACING`] | | +/// | [`BACK_FACING`](SDL_CameraPosition::BACK_FACING) | [`SDL_CAMERA_POSITION_BACK_FACING`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_CameraPosition(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_CameraPosition { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_CameraPosition) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_CameraPosition) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_CameraPosition { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_CAMERA_POSITION_UNKNOWN", + Self::FRONT_FACING => "SDL_CAMERA_POSITION_FRONT_FACING", + Self::BACK_FACING => "SDL_CAMERA_POSITION_BACK_FACING", + + _ => return write!(f, "SDL_CameraPosition({})", self.0), + }) + } +} + +impl SDL_CameraPosition { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const FRONT_FACING: Self = Self((1 as ::core::ffi::c_int)); + pub const BACK_FACING: Self = Self((2 as ::core::ffi::c_int)); +} + +pub const SDL_CAMERA_POSITION_UNKNOWN: SDL_CameraPosition = SDL_CameraPosition::UNKNOWN; +pub const SDL_CAMERA_POSITION_FRONT_FACING: SDL_CameraPosition = SDL_CameraPosition::FRONT_FACING; +pub const SDL_CAMERA_POSITION_BACK_FACING: SDL_CameraPosition = SDL_CameraPosition::BACK_FACING; + +impl SDL_CameraPosition { + /// Initialize a `SDL_CameraPosition` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_CameraPosition { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_CameraPosition { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::camera::METADATA_SDL_CameraPosition; +} + +/// The current state of a request for camera access. +/// +/// ## Availability +/// This enum is available since SDL 3.4.0. +/// +/// ## See also +/// - [`SDL_GetCameraPermissionState`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DENIED`](SDL_CameraPermissionState::DENIED) | [`SDL_CAMERA_PERMISSION_STATE_DENIED`] | | +/// | [`PENDING`](SDL_CameraPermissionState::PENDING) | [`SDL_CAMERA_PERMISSION_STATE_PENDING`] | | +/// | [`APPROVED`](SDL_CameraPermissionState::APPROVED) | [`SDL_CAMERA_PERMISSION_STATE_APPROVED`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_CameraPermissionState(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_CameraPermissionState { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_CameraPermissionState) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_CameraPermissionState) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_CameraPermissionState { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::DENIED => "SDL_CAMERA_PERMISSION_STATE_DENIED", + Self::PENDING => "SDL_CAMERA_PERMISSION_STATE_PENDING", + Self::APPROVED => "SDL_CAMERA_PERMISSION_STATE_APPROVED", + + _ => return write!(f, "SDL_CameraPermissionState({})", self.0), + }) + } +} + +impl SDL_CameraPermissionState { + pub const DENIED: Self = Self((-1_i32 as ::core::ffi::c_int)); + pub const PENDING: Self = Self((0_i32 as ::core::ffi::c_int)); + pub const APPROVED: Self = Self((1_i32 as ::core::ffi::c_int)); +} + +pub const SDL_CAMERA_PERMISSION_STATE_DENIED: SDL_CameraPermissionState = + SDL_CameraPermissionState::DENIED; +pub const SDL_CAMERA_PERMISSION_STATE_PENDING: SDL_CameraPermissionState = + SDL_CameraPermissionState::PENDING; +pub const SDL_CAMERA_PERMISSION_STATE_APPROVED: SDL_CameraPermissionState = + SDL_CameraPermissionState::APPROVED; + +impl SDL_CameraPermissionState { + /// Initialize a `SDL_CameraPermissionState` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_CameraPermissionState { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_CameraPermissionState { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::camera::METADATA_SDL_CameraPermissionState; +} + +unsafe extern "C" { + /// Use this function to get the number of built-in camera drivers. + /// + /// This function returns a hardcoded number. This never returns a negative + /// value; if there are no drivers compiled into this build of SDL, this + /// function returns zero. The presence of a driver in this list does not mean + /// it will function, it just means SDL is capable of interacting with that + /// interface. For example, a build of SDL might have v4l2 support, but if + /// there's no kernel support available, SDL's v4l2 driver would fail if used. + /// + /// By default, SDL tries all drivers, in its preferred order, until one is + /// found to be usable. + /// + /// ## Return value + /// Returns the number of built-in camera drivers. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCameraDriver`] + pub fn SDL_GetNumCameraDrivers() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Use this function to get the name of a built in camera driver. + /// + /// The list of camera drivers is given in the order that they are normally + /// initialized by default; the drivers that seem more reasonable to choose + /// first (as far as the SDL developers believe) are earlier in the list. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "v4l2", + /// "coremedia" or "android". These never have Unicode characters, and are not + /// meant to be proper names. + /// + /// ## Parameters + /// - `index`: the index of the camera driver; the value ranges from 0 to + /// [`SDL_GetNumCameraDrivers()`] - 1. + /// + /// ## Return value + /// Returns the name of the camera driver at the requested index, or NULL if + /// an invalid index was specified. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumCameraDrivers`] + pub fn SDL_GetCameraDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the name of the current camera driver. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "v4l2", + /// "coremedia" or "android". These never have Unicode characters, and are not + /// meant to be proper names. + /// + /// ## Return value + /// Returns the name of the current camera driver or NULL if no driver has + /// been initialized. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetCurrentCameraDriver() -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get a list of currently connected camera devices. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of cameras returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of camera instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenCamera`] + pub fn SDL_GetCameras(count: *mut ::core::ffi::c_int) -> *mut SDL_CameraID; +} + +unsafe extern "C" { + /// Get the list of native formats/sizes a camera supports. + /// + /// This returns a list of all formats and frame sizes that a specific camera + /// can offer. This is useful if your app can accept a variety of image formats + /// and sizes and so want to find the optimal spec that doesn't require + /// conversion. + /// + /// This function isn't strictly required; if you call [`SDL_OpenCamera`] with a + /// NULL spec, SDL will choose a native format for you, and if you instead + /// specify a desired format, it will transparently convert to the requested + /// format on your behalf. + /// + /// If `count` is not NULL, it will be filled with the number of elements in + /// the returned array. + /// + /// Note that it's legal for a camera to supply an empty list. This is what + /// will happen on Emscripten builds, since that platform won't tell _anything_ + /// about available cameras until you've opened one, and won't even tell if + /// there _is_ a camera until the user has given you permission to check + /// through a scary warning popup. + /// + /// ## Parameters + /// - `instance_id`: the camera device instance ID. + /// - `count`: a pointer filled in with the number of elements in the list, + /// may be NULL. + /// + /// ## Return value + /// Returns a NULL terminated array of pointers to [`SDL_CameraSpec`] or NULL on + /// failure; call [`SDL_GetError()`] for more information. This is a + /// single allocation that should be freed with [`SDL_free()`] when it is + /// no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCameras`] + /// - [`SDL_OpenCamera`] + pub fn SDL_GetCameraSupportedFormats( + instance_id: SDL_CameraID, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut SDL_CameraSpec; +} + +unsafe extern "C" { + /// Get the human-readable device name for a camera. + /// + /// ## Parameters + /// - `instance_id`: the camera device instance ID. + /// + /// ## Return value + /// Returns a human-readable device name or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCameras`] + pub fn SDL_GetCameraName(instance_id: SDL_CameraID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the position of the camera in relation to the system. + /// + /// Most platforms will report UNKNOWN, but mobile devices, like phones, can + /// often make a distinction between cameras on the front of the device (that + /// points towards the user, for taking "selfies") and cameras on the back (for + /// filming in the direction the user is facing). + /// + /// ## Parameters + /// - `instance_id`: the camera device instance ID. + /// + /// ## Return value + /// Returns the position of the camera on the system hardware. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCameras`] + pub fn SDL_GetCameraPosition(instance_id: SDL_CameraID) -> SDL_CameraPosition; +} + +unsafe extern "C" { + /// Open a video recording device (a "camera"). + /// + /// You can open the device with any reasonable spec, and if the hardware can't + /// directly support it, it will convert data seamlessly to the requested + /// format. This might incur overhead, including scaling of image data. + /// + /// If you would rather accept whatever format the device offers, you can pass + /// a NULL spec here and it will choose one for you (and you can use + /// SDL_Surface's conversion/scaling functions directly if necessary). + /// + /// You can call [`SDL_GetCameraFormat()`] to get the actual data format if passing + /// a NULL spec here. You can see the exact specs a device can support without + /// conversion with [`SDL_GetCameraSupportedFormats()`]. + /// + /// SDL will not attempt to emulate framerate; it will try to set the hardware + /// to the rate closest to the requested speed, but it won't attempt to limit + /// or duplicate frames artificially; call [`SDL_GetCameraFormat()`] to see the + /// actual framerate of the opened the device, and check your timestamps if + /// this is crucial to your app! + /// + /// Note that the camera is not usable until the user approves its use! On some + /// platforms, the operating system will prompt the user to permit access to + /// the camera, and they can choose Yes or No at that point. Until they do, the + /// camera will not be usable. The app should either wait for an + /// [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] (or [`SDL_EVENT_CAMERA_DEVICE_DENIED`]) event, + /// or poll [`SDL_GetCameraPermissionState()`] occasionally until it returns + /// non-zero. On platforms that don't require explicit user approval (and + /// perhaps in places where the user previously permitted access), the approval + /// event might come immediately, but it might come seconds, minutes, or hours + /// later! + /// + /// ## Parameters + /// - `instance_id`: the camera device instance ID. + /// - `spec`: the desired format for data the device will provide. Can be + /// NULL. + /// + /// ## Return value + /// Returns an [`SDL_Camera`] object or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCameras`] + /// - [`SDL_GetCameraFormat`] + pub fn SDL_OpenCamera( + instance_id: SDL_CameraID, + spec: *const SDL_CameraSpec, + ) -> *mut SDL_Camera; +} + +unsafe extern "C" { + /// Query if camera access has been approved by the user. + /// + /// Cameras will not function between when the device is opened by the app and + /// when the user permits access to the hardware. On some platforms, this + /// presents as a popup dialog where the user has to explicitly approve access; + /// on others the approval might be implicit and not alert the user at all. + /// + /// This function can be used to check the status of that approval. It will + /// return [`SDL_CAMERA_PERMISSION_STATE_PENDING`] if waiting for user response, + /// [`SDL_CAMERA_PERMISSION_STATE_APPROVED`] if the camera is approved for use, and + /// [`SDL_CAMERA_PERMISSION_STATE_DENIED`] if the user denied access. + /// + /// Instead of polling with this function, you can wait for a + /// [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] (or [`SDL_EVENT_CAMERA_DEVICE_DENIED`]) event + /// in the standard SDL event loop, which is guaranteed to be sent once when + /// permission to use the camera is decided. + /// + /// If a camera is declined, there's nothing to be done but call + /// [`SDL_CloseCamera()`] to dispose of it. + /// + /// ## Parameters + /// - `camera`: the opened camera device to query. + /// + /// ## Return value + /// Returns an [`SDL_CameraPermissionState`] value indicating if access is + /// granted, or [`SDL_CAMERA_PERMISSION_STATE_PENDING`] if the decision + /// is still pending. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenCamera`] + /// - [`SDL_CloseCamera`] + pub fn SDL_GetCameraPermissionState(camera: *mut SDL_Camera) -> SDL_CameraPermissionState; +} + +unsafe extern "C" { + /// Get the instance ID of an opened camera. + /// + /// ## Parameters + /// - `camera`: an [`SDL_Camera`] to query. + /// + /// ## Return value + /// Returns the instance ID of the specified camera on success or 0 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenCamera`] + pub fn SDL_GetCameraID(camera: *mut SDL_Camera) -> SDL_CameraID; +} + +unsafe extern "C" { + /// Get the properties associated with an opened camera. + /// + /// ## Parameters + /// - `camera`: the [`SDL_Camera`] obtained from [`SDL_OpenCamera()`]. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetCameraProperties(camera: *mut SDL_Camera) -> SDL_PropertiesID; +} + +unsafe extern "C" { + /// Get the spec that a camera is using when generating images. + /// + /// Note that this might not be the native format of the hardware, as SDL might + /// be converting to this format behind the scenes. + /// + /// If the system is waiting for the user to approve access to the camera, as + /// some platforms require, this will return false, but this isn't necessarily + /// a fatal error; you should either wait for an + /// [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] (or [`SDL_EVENT_CAMERA_DEVICE_DENIED`]) event, + /// or poll [`SDL_GetCameraPermissionState()`] occasionally until it returns + /// non-zero. + /// + /// ## Parameters + /// - `camera`: opened camera device. + /// - `spec`: the [`SDL_CameraSpec`] to be initialized by this function. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenCamera`] + pub fn SDL_GetCameraFormat( + camera: *mut SDL_Camera, + spec: *mut SDL_CameraSpec, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Acquire a frame. + /// + /// The frame is a memory pointer to the image data, whose size and format are + /// given by the spec requested when opening the device. + /// + /// This is a non blocking API. If there is a frame available, a non-NULL + /// surface is returned, and timestampNS will be filled with a non-zero value. + /// + /// Note that an error case can also return NULL, but a NULL by itself is + /// normal and just signifies that a new frame is not yet available. Note that + /// even if a camera device fails outright (a USB camera is unplugged while in + /// use, etc), SDL will send an event separately to notify the app, but + /// continue to provide blank frames at ongoing intervals until + /// [`SDL_CloseCamera()`] is called, so real failure here is almost always an out + /// of memory condition. + /// + /// After use, the frame should be released with [`SDL_ReleaseCameraFrame()`]. If + /// you don't do this, the system may stop providing more video! + /// + /// Do not call [`SDL_DestroySurface()`] on the returned surface! It must be given + /// back to the camera subsystem with SDL_ReleaseCameraFrame! + /// + /// If the system is waiting for the user to approve access to the camera, as + /// some platforms require, this will return NULL (no frames available); you + /// should either wait for an [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] (or + /// [`SDL_EVENT_CAMERA_DEVICE_DENIED`]) event, or poll + /// [`SDL_GetCameraPermissionState()`] occasionally until it returns non-zero. + /// + /// ## Parameters + /// - `camera`: opened camera device. + /// - `timestampNS`: a pointer filled in with the frame's timestamp, or 0 on + /// error. Can be NULL. + /// + /// ## Return value + /// Returns a new frame of video on success, NULL if none is currently + /// available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ReleaseCameraFrame`] + pub fn SDL_AcquireCameraFrame( + camera: *mut SDL_Camera, + timestampNS: *mut Uint64, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Release a frame of video acquired from a camera. + /// + /// Let the back-end re-use the internal buffer for camera. + /// + /// This function _must_ be called only on surface objects returned by + /// [`SDL_AcquireCameraFrame()`]. This function should be called as quickly as + /// possible after acquisition, as SDL keeps a small FIFO queue of surfaces for + /// video frames; if surfaces aren't released in a timely manner, SDL may drop + /// upcoming video frames from the camera. + /// + /// If the app needs to keep the surface for a significant time, they should + /// make a copy of it and release the original. + /// + /// The app should not use the surface again after calling this function; + /// assume the surface is freed and the pointer is invalid. + /// + /// ## Parameters + /// - `camera`: opened camera device. + /// - `frame`: the video frame surface to release. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AcquireCameraFrame`] + pub fn SDL_ReleaseCameraFrame(camera: *mut SDL_Camera, frame: *mut SDL_Surface); +} + +unsafe extern "C" { + /// Use this function to shut down camera processing and close the camera + /// device. + /// + /// ## Parameters + /// - `camera`: opened camera device. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but no + /// thread may reference `device` once this function is called. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenCamera`] + pub fn SDL_CloseCamera(camera: *mut SDL_Camera); +} + +/// The opaque structure used to identify an opened SDL camera. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Camera { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/clipboard.rs b/vendor/sdl3-sys/src/generated/clipboard.rs new file mode 100644 index 00000000..33ebb7b1 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/clipboard.rs @@ -0,0 +1,370 @@ +//! SDL provides access to the system clipboard, both for reading information +//! from other processes and publishing information of its own. +//! +//! This is not just text! SDL apps can access and publish data by mimetype. +//! +//! ## Basic use (text) +//! +//! Obtaining and publishing simple text to the system clipboard is as easy as +//! calling [`SDL_GetClipboardText()`] and [`SDL_SetClipboardText()`], respectively. +//! These deal with C strings in UTF-8 encoding. Data transmission and encoding +//! conversion is completely managed by SDL. +//! +//! ## Clipboard callbacks (data other than text) +//! +//! Things get more complicated when the clipboard contains something other +//! than text. Not only can the system clipboard contain data of any type, in +//! some cases it can contain the same data in different formats! For example, +//! an image painting app might let the user copy a graphic to the clipboard, +//! and offers it in .BMP, .JPG, or .PNG format for other apps to consume. +//! +//! Obtaining clipboard data ("pasting") like this is a matter of calling +//! [`SDL_GetClipboardData()`] and telling it the mimetype of the data you want. +//! But how does one know if that format is available? [`SDL_HasClipboardData()`] +//! can report if a specific mimetype is offered, and +//! [`SDL_GetClipboardMimeTypes()`] can provide the entire list of mimetypes +//! available, so the app can decide what to do with the data and what formats +//! it can support. +//! +//! Setting the clipboard ("copying") to arbitrary data is done with +//! [`SDL_SetClipboardData`]. The app does not provide the data in this call, but +//! rather the mimetypes it is willing to provide and a callback function. +//! During the callback, the app will generate the data. This allows massive +//! data sets to be provided to the clipboard, without any data being copied +//! before it is explicitly requested. More specifically, it allows an app to +//! offer data in multiple formats without providing a copy of all of them +//! upfront. If the app has an image that it could provide in PNG or JPG +//! format, it doesn't have to encode it to either of those unless and until +//! something tries to paste it. +//! +//! ## Primary Selection +//! +//! The X11 and Wayland video targets have a concept of the "primary selection" +//! in addition to the usual clipboard. This is generally highlighted (but not +//! explicitly copied) text from various apps. SDL offers APIs for this through +//! [`SDL_GetPrimarySelectionText()`] and [`SDL_SetPrimarySelectionText()`]. SDL offers +//! these APIs on platforms without this concept, too, but only so far that it +//! will keep a copy of a string that the app sets for later retrieval; the +//! operating system will not ever attempt to change the string externally if +//! it doesn't support a primary selection. + +use super::stdinc::*; + +use super::error::*; + +unsafe extern "C" { + /// Put UTF-8 text into the clipboard. + /// + /// ## Parameters + /// - `text`: the text to store in the clipboard. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetClipboardText`] + /// - [`SDL_HasClipboardText`] + pub fn SDL_SetClipboardText(text: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get UTF-8 text from the clipboard. + /// + /// This function returns an empty string if there is not enough memory left + /// for a copy of the clipboard's content. + /// + /// ## Return value + /// Returns the clipboard text on success or an empty string on failure; call + /// [`SDL_GetError()`] for more information. This should be freed with + /// [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasClipboardText`] + /// - [`SDL_SetClipboardText`] + pub fn SDL_GetClipboardText() -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Query whether the clipboard exists and contains a non-empty text string. + /// + /// ## Return value + /// Returns true if the clipboard has text, or false if it does not. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetClipboardText`] + /// - [`SDL_SetClipboardText`] + pub fn SDL_HasClipboardText() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Put UTF-8 text into the primary selection. + /// + /// ## Parameters + /// - `text`: the text to store in the primary selection. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPrimarySelectionText`] + /// - [`SDL_HasPrimarySelectionText`] + pub fn SDL_SetPrimarySelectionText(text: *const ::core::ffi::c_char) + -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get UTF-8 text from the primary selection. + /// + /// This function returns an empty string if there is not enough memory left + /// for a copy of the primary selection's content. + /// + /// ## Return value + /// Returns the primary selection text on success or an empty string on + /// failure; call [`SDL_GetError()`] for more information. This should be + /// freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasPrimarySelectionText`] + /// - [`SDL_SetPrimarySelectionText`] + pub fn SDL_GetPrimarySelectionText() -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Query whether the primary selection exists and contains a non-empty text + /// string. + /// + /// ## Return value + /// Returns true if the primary selection has text, or false if it does not. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPrimarySelectionText`] + /// - [`SDL_SetPrimarySelectionText`] + pub fn SDL_HasPrimarySelectionText() -> ::core::primitive::bool; +} + +/// Callback function that will be called when data for the specified mime-type +/// is requested by the OS. +/// +/// The callback function is called with NULL as the mime_type when the +/// clipboard is cleared or new data is set. The clipboard is automatically +/// cleared in [`SDL_Quit()`]. +/// +/// ## Parameters +/// - `userdata`: a pointer to the provided user data. +/// - `mime_type`: the requested mime-type. +/// - `size`: a pointer filled in with the length of the returned data. +/// +/// ## Return value +/// Returns a pointer to the data for the provided mime-type. Returning NULL +/// or setting the length to 0 will cause zero length data to be sent +/// to the "receiver", which should be able to handle this. The +/// returned data will not be freed, so it needs to be retained and +/// dealt with internally. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetClipboardData`] +pub type SDL_ClipboardDataCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + mime_type: *const ::core::ffi::c_char, + size: *mut ::core::primitive::usize, + ) -> *const ::core::ffi::c_void, +>; + +/// Callback function that will be called when the clipboard is cleared, or +/// when new data is set. +/// +/// ## Parameters +/// - `userdata`: a pointer to the provided user data. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetClipboardData`] +pub type SDL_ClipboardCleanupCallback = + ::core::option::Option; + +unsafe extern "C" { + /// Offer clipboard data to the OS. + /// + /// Tell the operating system that the application is offering clipboard data + /// for each of the provided mime-types. Once another application requests the + /// data the callback function will be called, allowing it to generate and + /// respond with the data for the requested mime-type. + /// + /// The size of text data does not include any terminator, and the text does + /// not need to be null-terminated (e.g., you can directly copy a portion of a + /// document). + /// + /// ## Parameters + /// - `callback`: a function pointer to the function that provides the + /// clipboard data. + /// - `cleanup`: a function pointer to the function that cleans up the + /// clipboard data. + /// - `userdata`: an opaque pointer that will be forwarded to the callbacks. + /// - `mime_types`: a list of mime-types that are being offered. SDL copies + /// the given list. + /// - `num_mime_types`: the number of mime-types in the mime_types list. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClearClipboardData`] + /// - [`SDL_GetClipboardData`] + /// - [`SDL_HasClipboardData`] + pub fn SDL_SetClipboardData( + callback: SDL_ClipboardDataCallback, + cleanup: SDL_ClipboardCleanupCallback, + userdata: *mut ::core::ffi::c_void, + mime_types: *const *const ::core::ffi::c_char, + num_mime_types: ::core::primitive::usize, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear the clipboard data. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetClipboardData`] + pub fn SDL_ClearClipboardData() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the data from the clipboard for a given mime type. + /// + /// The size of text data does not include the terminator, but the text is + /// guaranteed to be null-terminated. + /// + /// ## Parameters + /// - `mime_type`: the mime type to read from the clipboard. + /// - `size`: a pointer filled in with the length of the returned data. + /// + /// ## Return value + /// Returns the retrieved data buffer or NULL on failure; call [`SDL_GetError()`] + /// for more information. This should be freed with [`SDL_free()`] when it + /// is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasClipboardData`] + /// - [`SDL_SetClipboardData`] + pub fn SDL_GetClipboardData( + mime_type: *const ::core::ffi::c_char, + size: *mut ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Query whether there is data in the clipboard for the provided mime type. + /// + /// ## Parameters + /// - `mime_type`: the mime type to check for data. + /// + /// ## Return value + /// Returns true if data exists in the clipboard for the provided mime type, + /// false if it does not. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetClipboardData`] + /// - [`SDL_GetClipboardData`] + pub fn SDL_HasClipboardData(mime_type: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Retrieve the list of mime types available in the clipboard. + /// + /// ## Parameters + /// - `num_mime_types`: a pointer filled with the number of mime types, may + /// be NULL. + /// + /// ## Return value + /// Returns a null-terminated array of strings with mime types, or NULL on + /// failure; call [`SDL_GetError()`] for more information. This should be + /// freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetClipboardData`] + pub fn SDL_GetClipboardMimeTypes( + num_mime_types: *mut ::core::primitive::usize, + ) -> *mut *mut ::core::ffi::c_char; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/cpuinfo.rs b/vendor/sdl3-sys/src/generated/cpuinfo.rs new file mode 100644 index 00000000..cf4d6964 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/cpuinfo.rs @@ -0,0 +1,399 @@ +//! CPU feature detection for SDL. +//! +//! These functions are largely concerned with reporting if the system has +//! access to various SIMD instruction sets, but also has other important info +//! to share, such as system RAM size and number of logical CPU cores. +//! +//! CPU instruction set checks, like [`SDL_HasSSE()`] and [`SDL_HasNEON()`], are +//! available on all platforms, even if they don't make sense (an ARM processor +//! will never have SSE and an x86 processor will never have NEON, for example, +//! but these functions still exist and will simply return false in these +//! cases). + +use super::stdinc::*; + +/// A guess for the cacheline size used for padding. +/// +/// Most x86 processors have a 64 byte cache line. The 64-bit PowerPC +/// processors have a 128 byte cache line. We use the larger value to be +/// generally safe. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_CACHELINE_SIZE: ::core::primitive::i32 = 128; + +unsafe extern "C" { + /// Get the number of logical CPU cores available. + /// + /// ## Return value + /// Returns the total number of logical CPU cores. On CPUs that include + /// technologies such as hyperthreading, the number of logical cores + /// may be more than the number of physical cores. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetNumLogicalCPUCores() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Determine the L1 cache line size of the CPU. + /// + /// This is useful for determining multi-threaded structure padding or SIMD + /// prefetch sizes. + /// + /// ## Return value + /// Returns the L1 cache line size of the CPU, in bytes. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetCPUCacheLineSize() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Determine whether the CPU has AltiVec features. + /// + /// This always returns false on CPUs that aren't using PowerPC instruction + /// sets. + /// + /// ## Return value + /// Returns true if the CPU has AltiVec features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_HasAltiVec() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has MMX features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has MMX features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_HasMMX() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has SSE features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has SSE features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasSSE2`] + /// - [`SDL_HasSSE3`] + /// - [`SDL_HasSSE41`] + /// - [`SDL_HasSSE42`] + pub fn SDL_HasSSE() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has SSE2 features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has SSE2 features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasSSE`] + /// - [`SDL_HasSSE3`] + /// - [`SDL_HasSSE41`] + /// - [`SDL_HasSSE42`] + pub fn SDL_HasSSE2() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has SSE3 features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has SSE3 features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasSSE`] + /// - [`SDL_HasSSE2`] + /// - [`SDL_HasSSE41`] + /// - [`SDL_HasSSE42`] + pub fn SDL_HasSSE3() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has SSE4.1 features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has SSE4.1 features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasSSE`] + /// - [`SDL_HasSSE2`] + /// - [`SDL_HasSSE3`] + /// - [`SDL_HasSSE42`] + pub fn SDL_HasSSE41() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has SSE4.2 features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has SSE4.2 features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasSSE`] + /// - [`SDL_HasSSE2`] + /// - [`SDL_HasSSE3`] + /// - [`SDL_HasSSE41`] + pub fn SDL_HasSSE42() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has AVX features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has AVX features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasAVX2`] + /// - [`SDL_HasAVX512F`] + pub fn SDL_HasAVX() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has AVX2 features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has AVX2 features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasAVX`] + /// - [`SDL_HasAVX512F`] + pub fn SDL_HasAVX2() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has AVX-512F (foundation) features. + /// + /// This always returns false on CPUs that aren't using Intel instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has AVX-512F features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasAVX`] + /// - [`SDL_HasAVX2`] + pub fn SDL_HasAVX512F() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has ARM SIMD (ARMv6) features. + /// + /// This is different from ARM NEON, which is a different instruction set. + /// + /// This always returns false on CPUs that aren't using ARM instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has ARM SIMD features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasNEON`] + pub fn SDL_HasARMSIMD() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has NEON (ARM SIMD) features. + /// + /// This always returns false on CPUs that aren't using ARM instruction sets. + /// + /// ## Return value + /// Returns true if the CPU has ARM NEON features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_HasNEON() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has LSX (LOONGARCH SIMD) features. + /// + /// This always returns false on CPUs that aren't using LOONGARCH instruction + /// sets. + /// + /// ## Return value + /// Returns true if the CPU has LOONGARCH LSX features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_HasLSX() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determine whether the CPU has LASX (LOONGARCH SIMD) features. + /// + /// This always returns false on CPUs that aren't using LOONGARCH instruction + /// sets. + /// + /// ## Return value + /// Returns true if the CPU has LOONGARCH LASX features or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_HasLASX() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the amount of RAM configured in the system. + /// + /// ## Return value + /// Returns the amount of RAM configured in the system in MiB. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSystemRAM() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report the alignment this system needs for SIMD allocations. + /// + /// This will return the minimum number of bytes to which a pointer must be + /// aligned to be compatible with SIMD instructions on the current machine. For + /// example, if the machine supports SSE only, it will return 16, but if it + /// supports AVX-512F, it'll return 64 (etc). This only reports values for + /// instruction sets SDL knows about, so if your SDL build doesn't have + /// [`SDL_HasAVX512F()`], then it might return 16 for the SSE support it sees and + /// not 64 for the AVX-512 instructions that exist but SDL doesn't know about. + /// Plan accordingly. + /// + /// ## Return value + /// Returns the alignment in bytes needed for available, known SIMD + /// instructions. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_aligned_alloc`] + /// - [`SDL_aligned_free`] + pub fn SDL_GetSIMDAlignment() -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Report the size of a page of memory. + /// + /// Different platforms might have different memory page sizes. In current + /// times, 4 kilobytes is not unusual, but newer systems are moving to larger + /// page sizes, and esoteric platforms might have any unexpected size. + /// + /// Note that this function can return 0, which means SDL can't determine the + /// page size on this platform. It will _not_ set an error string to be + /// retrieved with [`SDL_GetError()`] in this case! In this case, defaulting to + /// 4096 is often a reasonable option. + /// + /// ## Return value + /// Returns the size of a single page of memory, in bytes, or 0 if SDL can't + /// determine this information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetSystemPageSize() -> ::core::ffi::c_int; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/dialog.rs b/vendor/sdl3-sys/src/generated/dialog.rs new file mode 100644 index 00000000..032db020 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/dialog.rs @@ -0,0 +1,452 @@ +//! File dialog support. +//! +//! SDL offers file dialogs, to let users select files with native GUI +//! interfaces. There are "open" dialogs, "save" dialogs, and folder selection +//! dialogs. The app can control some details, such as filtering to specific +//! files, or whether multiple files can be selected by the user. +//! +//! Note that launching a file dialog is a non-blocking operation; control +//! returns to the app immediately, and a callback is called later (possibly in +//! another thread) when the user makes a choice. + +use super::stdinc::*; + +use super::error::*; + +use super::properties::*; + +use super::video::*; + +/// An entry for filters for file dialogs. +/// +/// `name` is a user-readable label for the filter (for example, "Office +/// document"). +/// +/// `pattern` is a semicolon-separated list of file extensions (for example, +/// "doc;docx"). File extensions may only contain alphanumeric characters, +/// hyphens, underscores and periods. Alternatively, the whole string can be a +/// single asterisk ("*"), which serves as an "All files" filter. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_DialogFileCallback`] +/// - [`SDL_ShowOpenFileDialog`] +/// - [`SDL_ShowSaveFileDialog`] +/// - [`SDL_ShowOpenFolderDialog`] +/// - [`SDL_ShowFileDialogWithProperties`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_DialogFileFilter { + pub name: *const ::core::ffi::c_char, + pub pattern: *const ::core::ffi::c_char, +} + +impl ::core::default::Default for SDL_DialogFileFilter { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// Callback used by file dialog functions. +/// +/// The specific usage is described in each function. +/// +/// If `filelist` is: +/// +/// - NULL, an error occurred. Details can be obtained with [`SDL_GetError()`]. +/// - A pointer to NULL, the user either didn't choose any file or canceled the +/// dialog. +/// - A pointer to non-`NULL`, the user chose one or more files. The argument +/// is a null-terminated array of pointers to UTF-8 encoded strings, each +/// containing a path. +/// +/// The filelist argument should not be freed; it will automatically be freed +/// when the callback returns. +/// +/// The filter argument is the index of the filter that was selected, or -1 if +/// no filter was selected or if the platform or method doesn't support +/// fetching the selected filter. +/// +/// In Android, the `filelist` are `content://` URIs. They should be opened +/// using [`SDL_IOFromFile()`] with appropriate modes. This applies both to open +/// and save file dialog. +/// +/// ## Parameters +/// - `userdata`: an app-provided pointer, for the callback's use. +/// - `filelist`: the file(s) chosen by the user. +/// - `filter`: index of the selected filter. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_DialogFileFilter`] +/// - [`SDL_ShowOpenFileDialog`] +/// - [`SDL_ShowSaveFileDialog`] +/// - [`SDL_ShowOpenFolderDialog`] +/// - [`SDL_ShowFileDialogWithProperties`] +pub type SDL_DialogFileCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + filelist: *const *const ::core::ffi::c_char, + filter: ::core::ffi::c_int, + ), +>; + +unsafe extern "C" { + /// Displays a dialog that lets the user select a file on their filesystem. + /// + /// This is an asynchronous function; it will return immediately, and the + /// result will be passed to the callback. + /// + /// The callback will be invoked with a null-terminated list of files the user + /// chose. The list will be empty if the user canceled the dialog, and it will + /// be NULL if an error occurred. + /// + /// Note that the callback may be called from a different thread than the one + /// the function was invoked on. + /// + /// Depending on the platform, the user may be allowed to input paths that + /// don't yet exist. + /// + /// On Linux, dialogs may require XDG Portals, which requires DBus, which + /// requires an event-handling loop. Apps that do not use SDL to handle events + /// should add a call to [`SDL_PumpEvents`] in their main loop. + /// + /// ## Parameters + /// - `callback`: a function pointer to be invoked when the user selects a + /// file and accepts, or cancels the dialog, or an error + /// occurs. + /// - `userdata`: an optional pointer to pass extra data to the callback when + /// it will be invoked. + /// - `window`: the window that the dialog should be modal for, may be NULL. + /// Not all platforms support this option. + /// - `filters`: a list of filters, may be NULL. See the + /// [`SDL_DialogFileFilter`](SDL_DialogFileFilter#code-examples) + /// documentation for examples\]. Not all platforms support this + /// option, and platforms that do support it may allow the user + /// to ignore the filters. If non-NULL, it must remain valid at + /// least until the callback is invoked. + /// - `nfilters`: the number of filters. Ignored if filters is NULL. + /// - `default_location`: the default folder or file to start the dialog at, + /// may be NULL. Not all platforms support this option. + /// - `allow_many`: if non-zero, the user will be allowed to select multiple + /// entries. Not all platforms support this option. + /// + /// ## Thread safety + /// This function should be called only from the main thread. The + /// callback may be invoked from the same thread or from a + /// different one, depending on the OS's constraints. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DialogFileCallback`] + /// - [`SDL_DialogFileFilter`] + /// - [`SDL_ShowSaveFileDialog`] + /// - [`SDL_ShowOpenFolderDialog`] + /// - [`SDL_ShowFileDialogWithProperties`] + pub fn SDL_ShowOpenFileDialog( + callback: SDL_DialogFileCallback, + userdata: *mut ::core::ffi::c_void, + window: *mut SDL_Window, + filters: *const SDL_DialogFileFilter, + nfilters: ::core::ffi::c_int, + default_location: *const ::core::ffi::c_char, + allow_many: ::core::primitive::bool, + ); +} + +unsafe extern "C" { + /// Displays a dialog that lets the user choose a new or existing file on their + /// filesystem. + /// + /// This is an asynchronous function; it will return immediately, and the + /// result will be passed to the callback. + /// + /// The callback will be invoked with a null-terminated list of files the user + /// chose. The list will be empty if the user canceled the dialog, and it will + /// be NULL if an error occurred. + /// + /// Note that the callback may be called from a different thread than the one + /// the function was invoked on. + /// + /// The chosen file may or may not already exist. + /// + /// On Linux, dialogs may require XDG Portals, which requires DBus, which + /// requires an event-handling loop. Apps that do not use SDL to handle events + /// should add a call to [`SDL_PumpEvents`] in their main loop. + /// + /// ## Parameters + /// - `callback`: a function pointer to be invoked when the user selects a + /// file and accepts, or cancels the dialog, or an error + /// occurs. + /// - `userdata`: an optional pointer to pass extra data to the callback when + /// it will be invoked. + /// - `window`: the window that the dialog should be modal for, may be NULL. + /// Not all platforms support this option. + /// - `filters`: a list of filters, may be NULL. Not all platforms support + /// this option, and platforms that do support it may allow the + /// user to ignore the filters. If non-NULL, it must remain + /// valid at least until the callback is invoked. + /// - `nfilters`: the number of filters. Ignored if filters is NULL. + /// - `default_location`: the default folder or file to start the dialog at, + /// may be NULL. Not all platforms support this option. + /// + /// ## Thread safety + /// This function should be called only from the main thread. The + /// callback may be invoked from the same thread or from a + /// different one, depending on the OS's constraints. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DialogFileCallback`] + /// - [`SDL_DialogFileFilter`] + /// - [`SDL_ShowOpenFileDialog`] + /// - [`SDL_ShowOpenFolderDialog`] + /// - [`SDL_ShowFileDialogWithProperties`] + pub fn SDL_ShowSaveFileDialog( + callback: SDL_DialogFileCallback, + userdata: *mut ::core::ffi::c_void, + window: *mut SDL_Window, + filters: *const SDL_DialogFileFilter, + nfilters: ::core::ffi::c_int, + default_location: *const ::core::ffi::c_char, + ); +} + +unsafe extern "C" { + /// Displays a dialog that lets the user select a folder on their filesystem. + /// + /// This is an asynchronous function; it will return immediately, and the + /// result will be passed to the callback. + /// + /// The callback will be invoked with a null-terminated list of files the user + /// chose. The list will be empty if the user canceled the dialog, and it will + /// be NULL if an error occurred. + /// + /// Note that the callback may be called from a different thread than the one + /// the function was invoked on. + /// + /// Depending on the platform, the user may be allowed to input paths that + /// don't yet exist. + /// + /// On Linux, dialogs may require XDG Portals, which requires DBus, which + /// requires an event-handling loop. Apps that do not use SDL to handle events + /// should add a call to [`SDL_PumpEvents`] in their main loop. + /// + /// ## Parameters + /// - `callback`: a function pointer to be invoked when the user selects a + /// file and accepts, or cancels the dialog, or an error + /// occurs. + /// - `userdata`: an optional pointer to pass extra data to the callback when + /// it will be invoked. + /// - `window`: the window that the dialog should be modal for, may be NULL. + /// Not all platforms support this option. + /// - `default_location`: the default folder or file to start the dialog at, + /// may be NULL. Not all platforms support this option. + /// - `allow_many`: if non-zero, the user will be allowed to select multiple + /// entries. Not all platforms support this option. + /// + /// ## Thread safety + /// This function should be called only from the main thread. The + /// callback may be invoked from the same thread or from a + /// different one, depending on the OS's constraints. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DialogFileCallback`] + /// - [`SDL_ShowOpenFileDialog`] + /// - [`SDL_ShowSaveFileDialog`] + /// - [`SDL_ShowFileDialogWithProperties`] + pub fn SDL_ShowOpenFolderDialog( + callback: SDL_DialogFileCallback, + userdata: *mut ::core::ffi::c_void, + window: *mut SDL_Window, + default_location: *const ::core::ffi::c_char, + allow_many: ::core::primitive::bool, + ); +} + +/// Various types of file dialogs. +/// +/// This is used by [`SDL_ShowFileDialogWithProperties()`] to decide what kind of +/// dialog to present to the user. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ShowFileDialogWithProperties`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`OPENFILE`](SDL_FileDialogType::OPENFILE) | [`SDL_FILEDIALOG_OPENFILE`] | | +/// | [`SAVEFILE`](SDL_FileDialogType::SAVEFILE) | [`SDL_FILEDIALOG_SAVEFILE`] | | +/// | [`OPENFOLDER`](SDL_FileDialogType::OPENFOLDER) | [`SDL_FILEDIALOG_OPENFOLDER`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_FileDialogType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_FileDialogType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_FileDialogType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_FileDialogType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_FileDialogType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::OPENFILE => "SDL_FILEDIALOG_OPENFILE", + Self::SAVEFILE => "SDL_FILEDIALOG_SAVEFILE", + Self::OPENFOLDER => "SDL_FILEDIALOG_OPENFOLDER", + + _ => return write!(f, "SDL_FileDialogType({})", self.0), + }) + } +} + +impl SDL_FileDialogType { + pub const OPENFILE: Self = Self((0 as ::core::ffi::c_int)); + pub const SAVEFILE: Self = Self((1 as ::core::ffi::c_int)); + pub const OPENFOLDER: Self = Self((2 as ::core::ffi::c_int)); +} + +pub const SDL_FILEDIALOG_OPENFILE: SDL_FileDialogType = SDL_FileDialogType::OPENFILE; +pub const SDL_FILEDIALOG_SAVEFILE: SDL_FileDialogType = SDL_FileDialogType::SAVEFILE; +pub const SDL_FILEDIALOG_OPENFOLDER: SDL_FileDialogType = SDL_FileDialogType::OPENFOLDER; + +impl SDL_FileDialogType { + /// Initialize a `SDL_FileDialogType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_FileDialogType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_FileDialogType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::dialog::METADATA_SDL_FileDialogType; +} + +unsafe extern "C" { + /// Create and launch a file dialog with the specified properties. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_FILE_DIALOG_FILTERS_POINTER`]\: a pointer to a list of + /// [`SDL_DialogFileFilter`] structs, which will be used as filters for + /// file-based selections. Ignored if the dialog is an "Open Folder" dialog. + /// If non-NULL, the array of filters must remain valid at least until the + /// callback is invoked. + /// - [`SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER`]\: the number of filters in the + /// array of filters, if it exists. + /// - [`SDL_PROP_FILE_DIALOG_WINDOW_POINTER`]\: the window that the dialog should + /// be modal for. + /// - [`SDL_PROP_FILE_DIALOG_LOCATION_STRING`]\: the default folder or file to + /// start the dialog at. + /// - [`SDL_PROP_FILE_DIALOG_MANY_BOOLEAN`]\: true to allow the user to select + /// more than one entry. + /// - [`SDL_PROP_FILE_DIALOG_TITLE_STRING`]\: the title for the dialog. + /// - [`SDL_PROP_FILE_DIALOG_ACCEPT_STRING`]\: the label that the accept button + /// should have. + /// - [`SDL_PROP_FILE_DIALOG_CANCEL_STRING`]\: the label that the cancel button + /// should have. + /// + /// Note that each platform may or may not support any of the properties. + /// + /// ## Parameters + /// - `type`: the type of file dialog. + /// - `callback`: a function pointer to be invoked when the user selects a + /// file and accepts, or cancels the dialog, or an error + /// occurs. + /// - `userdata`: an optional pointer to pass extra data to the callback when + /// it will be invoked. + /// - `props`: the properties to use. + /// + /// ## Thread safety + /// This function should be called only from the main thread. The + /// callback may be invoked from the same thread or from a + /// different one, depending on the OS's constraints. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_FileDialogType`] + /// - [`SDL_DialogFileCallback`] + /// - [`SDL_DialogFileFilter`] + /// - [`SDL_ShowOpenFileDialog`] + /// - [`SDL_ShowSaveFileDialog`] + /// - [`SDL_ShowOpenFolderDialog`] + pub fn SDL_ShowFileDialogWithProperties( + r#type: SDL_FileDialogType, + callback: SDL_DialogFileCallback, + userdata: *mut ::core::ffi::c_void, + props: SDL_PropertiesID, + ); +} + +pub const SDL_PROP_FILE_DIALOG_FILTERS_POINTER: *const ::core::ffi::c_char = + c"SDL.filedialog.filters".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER: *const ::core::ffi::c_char = + c"SDL.filedialog.nfilters".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.filedialog.window".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_LOCATION_STRING: *const ::core::ffi::c_char = + c"SDL.filedialog.location".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_MANY_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.filedialog.many".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_TITLE_STRING: *const ::core::ffi::c_char = + c"SDL.filedialog.title".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_ACCEPT_STRING: *const ::core::ffi::c_char = + c"SDL.filedialog.accept".as_ptr(); + +pub const SDL_PROP_FILE_DIALOG_CANCEL_STRING: *const ::core::ffi::c_char = + c"SDL.filedialog.cancel".as_ptr(); + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/error.rs b/vendor/sdl3-sys/src/generated/error.rs new file mode 100644 index 00000000..11e4f355 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/error.rs @@ -0,0 +1,206 @@ +//! Simple error message routines for SDL. +//! +//! Most apps will interface with these APIs in exactly one function: when +//! almost any SDL function call reports failure, you can get a human-readable +//! string of the problem from [`SDL_GetError()`]. +//! +//! These strings are maintained per-thread, and apps are welcome to set their +//! own errors, which is popular when building libraries on top of SDL for +//! other apps to consume. These strings are set by calling [`SDL_SetError()`]. +//! +//! A common usage pattern is to have a function that returns true for success +//! and false for failure, and do this when something fails: +//! +//! ```c +//! if (something_went_wrong) { +//! return SDL_SetError("The thing broke in this specific way: %d", errcode); +//! } +//! ``` +//! +//! It's also common to just return `false` in this case if the failing thing +//! is known to call [`SDL_SetError()`], so errors simply propagate through. + +use super::stdinc::*; + +unsafe extern "C" { + /// Set the SDL error message for the current thread. + /// + /// Calling this function will replace any previous error message that was set. + /// + /// This function always returns false, since SDL frequently uses false to + /// signify a failing result, leading to this idiom: + /// + /// ```c + /// if (error_code) { + /// return SDL_SetError("This operation has failed: %d", error_code); + /// } + /// ``` + /// + /// ## Parameters + /// - `fmt`: a printf()-style message format string. + /// - `...`: additional parameters matching % tokens in the `fmt` string, if + /// any. + /// + /// ## Return value + /// Returns false. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClearError`] + /// - [`SDL_GetError`] + /// - [`SDL_SetErrorV`] + pub fn SDL_SetError(fmt: *const ::core::ffi::c_char, ...) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the SDL error message for the current thread. + /// + /// Calling this function will replace any previous error message that was set. + /// + /// ## Parameters + /// - `fmt`: a printf()-style message format string. + /// - `ap`: a variable argument list. + /// + /// ## Return value + /// Returns false. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClearError`] + /// - [`SDL_GetError`] + /// - [`SDL_SetError`] + pub fn SDL_SetErrorV( + fmt: *const ::core::ffi::c_char, + ap: crate::ffi::VaList, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an error indicating that memory allocation failed. + /// + /// This function does not do any memory allocation. + /// + /// ## Return value + /// Returns false. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_OutOfMemory() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Retrieve a message about the last error that occurred on the current + /// thread. + /// + /// It is possible for multiple errors to occur before calling [`SDL_GetError()`]. + /// Only the last error is returned. + /// + /// The message is only applicable when an SDL function has signaled an error. + /// You must check the return values of SDL function calls to determine when to + /// appropriately call [`SDL_GetError()`]. You should *not* use the results of + /// [`SDL_GetError()`] to decide if an error has occurred! Sometimes SDL will set + /// an error string even when reporting success. + /// + /// SDL will *not* clear the error string for successful API calls. You *must* + /// check return values for failure cases before you can assume the error + /// string applies. + /// + /// Error strings are set per-thread, so an error set in a different thread + /// will not interfere with the current thread's operation. + /// + /// The returned value is a thread-local string which will remain valid until + /// the current thread's error string is changed. The caller should make a copy + /// if the value is needed after the next SDL API call. + /// + /// ## Return value + /// Returns a message with information about the specific error that occurred, + /// or an empty string if there hasn't been an error message set since + /// the last call to [`SDL_ClearError()`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClearError`] + /// - [`SDL_SetError`] + pub safe fn SDL_GetError() -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Clear any previous error message for this thread. + /// + /// ## Return value + /// Returns true. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetError`] + /// - [`SDL_SetError`] + pub safe fn SDL_ClearError() -> ::core::primitive::bool; +} + +/// A macro to standardize error reporting on unsupported operations. +/// +/// This simply calls [`SDL_SetError()`] with a standardized error string, for +/// convenience, consistency, and clarity. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub unsafe fn SDL_Unsupported() -> ::core::primitive::bool { + unsafe { SDL_SetError(c"That operation is not supported".as_ptr()) } +} + +/// A macro to standardize error reporting on unsupported operations. +/// +/// This simply calls [`SDL_SetError()`] with a standardized error string, for +/// convenience, consistency, and clarity. +/// +/// A common usage pattern inside SDL is this: +/// +/// ```c +/// bool MyFunction(const char *str) { +/// if (!str) { +/// return SDL_InvalidParamError("str"); // returns false. +/// } +/// DoSomething(str); +/// return true; +/// } +/// ``` +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub unsafe fn SDL_InvalidParamError(param: *const ::core::ffi::c_char) -> ::core::primitive::bool { + unsafe { SDL_SetError(c"Parameter '%s' is invalid".as_ptr(), (param)) } +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/events.rs b/vendor/sdl3-sys/src/generated/events.rs new file mode 100644 index 00000000..32695451 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/events.rs @@ -0,0 +1,3085 @@ +//! Event queue management. +//! +//! It's extremely common--often required--that an app deal with SDL's event +//! queue. Almost all useful information about interactions with the real world +//! flow through here: the user interacting with the computer and app, hardware +//! coming and going, the system changing in some way, etc. +//! +//! An app generally takes a moment, perhaps at the start of a new frame, to +//! examine any events that have occurred since the last time and process or +//! ignore them. This is generally done by calling [`SDL_PollEvent()`] in a loop +//! until it returns false (or, if using the main callbacks, events are +//! provided one at a time in calls to [`SDL_AppEvent()`] before the next call to +//! [`SDL_AppIterate()`]; in this scenario, the app does not call [`SDL_PollEvent()`] +//! at all). +//! +//! There is other forms of control, too: [`SDL_PeepEvents()`] has more +//! functionality at the cost of more complexity, and [`SDL_WaitEvent()`] can block +//! the process until something interesting happens, which might be beneficial +//! for certain types of programs on low-power hardware. One may also call +//! [`SDL_AddEventWatch()`] to set a callback when new events arrive. +//! +//! The app is free to generate their own events, too: [`SDL_PushEvent`] allows the +//! app to put events onto the queue for later retrieval; [`SDL_RegisterEvents`] +//! can guarantee that these events have a type that isn't in use by other +//! parts of the system. + +use super::stdinc::*; + +use super::audio::*; + +use super::camera::*; + +use super::error::*; + +use super::gamepad::*; + +use super::joystick::*; + +use super::keyboard::*; + +use super::keycode::*; + +use super::mouse::*; + +use super::pen::*; + +use super::power::*; + +use super::sensor::*; + +use super::scancode::*; + +use super::touch::*; + +use super::video::*; + +/// The types of events that can be delivered. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`FIRST`](SDL_EventType::FIRST) | [`SDL_EVENT_FIRST`] | Unused (do not remove) | +/// | [`QUIT`](SDL_EventType::QUIT) | [`SDL_EVENT_QUIT`] | User-requested quit | +/// | [`TERMINATING`](SDL_EventType::TERMINATING) | [`SDL_EVENT_TERMINATING`] | The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationWillTerminate() Called on Android in onDestroy() | +/// | [`LOW_MEMORY`](SDL_EventType::LOW_MEMORY) | [`SDL_EVENT_LOW_MEMORY`] | The application is low on memory, free memory if possible. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationDidReceiveMemoryWarning() Called on Android in onTrimMemory() | +/// | [`WILL_ENTER_BACKGROUND`](SDL_EventType::WILL_ENTER_BACKGROUND) | [`SDL_EVENT_WILL_ENTER_BACKGROUND`] | The application is about to enter the background. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationWillResignActive() Called on Android in onPause() | +/// | [`DID_ENTER_BACKGROUND`](SDL_EventType::DID_ENTER_BACKGROUND) | [`SDL_EVENT_DID_ENTER_BACKGROUND`] | The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationDidEnterBackground() Called on Android in onPause() | +/// | [`WILL_ENTER_FOREGROUND`](SDL_EventType::WILL_ENTER_FOREGROUND) | [`SDL_EVENT_WILL_ENTER_FOREGROUND`] | The application is about to enter the foreground. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationWillEnterForeground() Called on Android in onResume() | +/// | [`DID_ENTER_FOREGROUND`](SDL_EventType::DID_ENTER_FOREGROUND) | [`SDL_EVENT_DID_ENTER_FOREGROUND`] | The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationDidBecomeActive() Called on Android in onResume() | +/// | [`LOCALE_CHANGED`](SDL_EventType::LOCALE_CHANGED) | [`SDL_EVENT_LOCALE_CHANGED`] | The user's locale preferences have changed. | +/// | [`SYSTEM_THEME_CHANGED`](SDL_EventType::SYSTEM_THEME_CHANGED) | [`SDL_EVENT_SYSTEM_THEME_CHANGED`] | The system theme changed | +/// | [`DISPLAY_ORIENTATION`](SDL_EventType::DISPLAY_ORIENTATION) | [`SDL_EVENT_DISPLAY_ORIENTATION`] | Display orientation has changed to data1 | +/// | [`DISPLAY_ADDED`](SDL_EventType::DISPLAY_ADDED) | [`SDL_EVENT_DISPLAY_ADDED`] | Display has been added to the system | +/// | [`DISPLAY_REMOVED`](SDL_EventType::DISPLAY_REMOVED) | [`SDL_EVENT_DISPLAY_REMOVED`] | Display has been removed from the system | +/// | [`DISPLAY_MOVED`](SDL_EventType::DISPLAY_MOVED) | [`SDL_EVENT_DISPLAY_MOVED`] | Display has changed position | +/// | [`DISPLAY_DESKTOP_MODE_CHANGED`](SDL_EventType::DISPLAY_DESKTOP_MODE_CHANGED) | [`SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED`] | Display has changed desktop mode | +/// | [`DISPLAY_CURRENT_MODE_CHANGED`](SDL_EventType::DISPLAY_CURRENT_MODE_CHANGED) | [`SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED`] | Display has changed current mode | +/// | [`DISPLAY_CONTENT_SCALE_CHANGED`](SDL_EventType::DISPLAY_CONTENT_SCALE_CHANGED) | [`SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED`] | Display has changed content scale | +/// | [`DISPLAY_USABLE_BOUNDS_CHANGED`](SDL_EventType::DISPLAY_USABLE_BOUNDS_CHANGED) | [`SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED`] | Display has changed usable bounds | +/// | [`DISPLAY_FIRST`](SDL_EventType::DISPLAY_FIRST) | [`SDL_EVENT_DISPLAY_FIRST`] | | +/// | [`DISPLAY_LAST`](SDL_EventType::DISPLAY_LAST) | [`SDL_EVENT_DISPLAY_LAST`] | | +/// | [`WINDOW_SHOWN`](SDL_EventType::WINDOW_SHOWN) | [`SDL_EVENT_WINDOW_SHOWN`] | Window has been shown | +/// | [`WINDOW_HIDDEN`](SDL_EventType::WINDOW_HIDDEN) | [`SDL_EVENT_WINDOW_HIDDEN`] | Window has been hidden | +/// | [`WINDOW_EXPOSED`](SDL_EventType::WINDOW_EXPOSED) | [`SDL_EVENT_WINDOW_EXPOSED`] | Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event. data1 is 1 for live-resize expose events, 0 otherwise. | +/// | [`WINDOW_MOVED`](SDL_EventType::WINDOW_MOVED) | [`SDL_EVENT_WINDOW_MOVED`] | Window has been moved to data1, data2 | +/// | [`WINDOW_RESIZED`](SDL_EventType::WINDOW_RESIZED) | [`SDL_EVENT_WINDOW_RESIZED`] | Window has been resized to data1xdata2 | +/// | [`WINDOW_PIXEL_SIZE_CHANGED`](SDL_EventType::WINDOW_PIXEL_SIZE_CHANGED) | [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] | The pixel size of the window has changed to data1xdata2 | +/// | [`WINDOW_METAL_VIEW_RESIZED`](SDL_EventType::WINDOW_METAL_VIEW_RESIZED) | [`SDL_EVENT_WINDOW_METAL_VIEW_RESIZED`] | The pixel size of a Metal view associated with the window has changed | +/// | [`WINDOW_MINIMIZED`](SDL_EventType::WINDOW_MINIMIZED) | [`SDL_EVENT_WINDOW_MINIMIZED`] | Window has been minimized | +/// | [`WINDOW_MAXIMIZED`](SDL_EventType::WINDOW_MAXIMIZED) | [`SDL_EVENT_WINDOW_MAXIMIZED`] | Window has been maximized | +/// | [`WINDOW_RESTORED`](SDL_EventType::WINDOW_RESTORED) | [`SDL_EVENT_WINDOW_RESTORED`] | Window has been restored to normal size and position | +/// | [`WINDOW_MOUSE_ENTER`](SDL_EventType::WINDOW_MOUSE_ENTER) | [`SDL_EVENT_WINDOW_MOUSE_ENTER`] | Window has gained mouse focus | +/// | [`WINDOW_MOUSE_LEAVE`](SDL_EventType::WINDOW_MOUSE_LEAVE) | [`SDL_EVENT_WINDOW_MOUSE_LEAVE`] | Window has lost mouse focus | +/// | [`WINDOW_FOCUS_GAINED`](SDL_EventType::WINDOW_FOCUS_GAINED) | [`SDL_EVENT_WINDOW_FOCUS_GAINED`] | Window has gained keyboard focus | +/// | [`WINDOW_FOCUS_LOST`](SDL_EventType::WINDOW_FOCUS_LOST) | [`SDL_EVENT_WINDOW_FOCUS_LOST`] | Window has lost keyboard focus | +/// | [`WINDOW_CLOSE_REQUESTED`](SDL_EventType::WINDOW_CLOSE_REQUESTED) | [`SDL_EVENT_WINDOW_CLOSE_REQUESTED`] | The window manager requests that the window be closed | +/// | [`WINDOW_HIT_TEST`](SDL_EventType::WINDOW_HIT_TEST) | [`SDL_EVENT_WINDOW_HIT_TEST`] | Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`] | +/// | [`WINDOW_ICCPROF_CHANGED`](SDL_EventType::WINDOW_ICCPROF_CHANGED) | [`SDL_EVENT_WINDOW_ICCPROF_CHANGED`] | The ICC profile of the window's display has changed | +/// | [`WINDOW_DISPLAY_CHANGED`](SDL_EventType::WINDOW_DISPLAY_CHANGED) | [`SDL_EVENT_WINDOW_DISPLAY_CHANGED`] | Window has been moved to display data1 | +/// | [`WINDOW_DISPLAY_SCALE_CHANGED`](SDL_EventType::WINDOW_DISPLAY_SCALE_CHANGED) | [`SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED`] | Window display scale has been changed | +/// | [`WINDOW_SAFE_AREA_CHANGED`](SDL_EventType::WINDOW_SAFE_AREA_CHANGED) | [`SDL_EVENT_WINDOW_SAFE_AREA_CHANGED`] | The window safe area has been changed | +/// | [`WINDOW_OCCLUDED`](SDL_EventType::WINDOW_OCCLUDED) | [`SDL_EVENT_WINDOW_OCCLUDED`] | The window has been occluded | +/// | [`WINDOW_ENTER_FULLSCREEN`](SDL_EventType::WINDOW_ENTER_FULLSCREEN) | [`SDL_EVENT_WINDOW_ENTER_FULLSCREEN`] | The window has entered fullscreen mode | +/// | [`WINDOW_LEAVE_FULLSCREEN`](SDL_EventType::WINDOW_LEAVE_FULLSCREEN) | [`SDL_EVENT_WINDOW_LEAVE_FULLSCREEN`] | The window has left fullscreen mode | +/// | [`WINDOW_DESTROYED`](SDL_EventType::WINDOW_DESTROYED) | [`SDL_EVENT_WINDOW_DESTROYED`] | The window with the associated ID is being or has been destroyed. If this message is being handled in an event watcher, the window handle is still valid and can still be used to retrieve any properties associated with the window. Otherwise, the handle has already been destroyed and all resources associated with it are invalid | +/// | [`WINDOW_HDR_STATE_CHANGED`](SDL_EventType::WINDOW_HDR_STATE_CHANGED) | [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] | Window HDR properties have changed | +/// | [`WINDOW_FIRST`](SDL_EventType::WINDOW_FIRST) | [`SDL_EVENT_WINDOW_FIRST`] | | +/// | [`WINDOW_LAST`](SDL_EventType::WINDOW_LAST) | [`SDL_EVENT_WINDOW_LAST`] | | +/// | [`KEY_DOWN`](SDL_EventType::KEY_DOWN) | [`SDL_EVENT_KEY_DOWN`] | Key pressed | +/// | [`KEY_UP`](SDL_EventType::KEY_UP) | [`SDL_EVENT_KEY_UP`] | Key released | +/// | [`TEXT_EDITING`](SDL_EventType::TEXT_EDITING) | [`SDL_EVENT_TEXT_EDITING`] | Keyboard text editing (composition) | +/// | [`TEXT_INPUT`](SDL_EventType::TEXT_INPUT) | [`SDL_EVENT_TEXT_INPUT`] | Keyboard text input | +/// | [`KEYMAP_CHANGED`](SDL_EventType::KEYMAP_CHANGED) | [`SDL_EVENT_KEYMAP_CHANGED`] | Keymap changed due to a system event such as an input language or keyboard layout change. | +/// | [`KEYBOARD_ADDED`](SDL_EventType::KEYBOARD_ADDED) | [`SDL_EVENT_KEYBOARD_ADDED`] | A new keyboard has been inserted into the system | +/// | [`KEYBOARD_REMOVED`](SDL_EventType::KEYBOARD_REMOVED) | [`SDL_EVENT_KEYBOARD_REMOVED`] | A keyboard has been removed | +/// | [`TEXT_EDITING_CANDIDATES`](SDL_EventType::TEXT_EDITING_CANDIDATES) | [`SDL_EVENT_TEXT_EDITING_CANDIDATES`] | Keyboard text editing candidates | +/// | [`SCREEN_KEYBOARD_SHOWN`](SDL_EventType::SCREEN_KEYBOARD_SHOWN) | [`SDL_EVENT_SCREEN_KEYBOARD_SHOWN`] | The on-screen keyboard has been shown | +/// | [`SCREEN_KEYBOARD_HIDDEN`](SDL_EventType::SCREEN_KEYBOARD_HIDDEN) | [`SDL_EVENT_SCREEN_KEYBOARD_HIDDEN`] | The on-screen keyboard has been hidden | +/// | [`MOUSE_MOTION`](SDL_EventType::MOUSE_MOTION) | [`SDL_EVENT_MOUSE_MOTION`] | Mouse moved | +/// | [`MOUSE_BUTTON_DOWN`](SDL_EventType::MOUSE_BUTTON_DOWN) | [`SDL_EVENT_MOUSE_BUTTON_DOWN`] | Mouse button pressed | +/// | [`MOUSE_BUTTON_UP`](SDL_EventType::MOUSE_BUTTON_UP) | [`SDL_EVENT_MOUSE_BUTTON_UP`] | Mouse button released | +/// | [`MOUSE_WHEEL`](SDL_EventType::MOUSE_WHEEL) | [`SDL_EVENT_MOUSE_WHEEL`] | Mouse wheel motion | +/// | [`MOUSE_ADDED`](SDL_EventType::MOUSE_ADDED) | [`SDL_EVENT_MOUSE_ADDED`] | A new mouse has been inserted into the system | +/// | [`MOUSE_REMOVED`](SDL_EventType::MOUSE_REMOVED) | [`SDL_EVENT_MOUSE_REMOVED`] | A mouse has been removed | +/// | [`JOYSTICK_AXIS_MOTION`](SDL_EventType::JOYSTICK_AXIS_MOTION) | [`SDL_EVENT_JOYSTICK_AXIS_MOTION`] | Joystick axis motion | +/// | [`JOYSTICK_BALL_MOTION`](SDL_EventType::JOYSTICK_BALL_MOTION) | [`SDL_EVENT_JOYSTICK_BALL_MOTION`] | Joystick trackball motion | +/// | [`JOYSTICK_HAT_MOTION`](SDL_EventType::JOYSTICK_HAT_MOTION) | [`SDL_EVENT_JOYSTICK_HAT_MOTION`] | Joystick hat position change | +/// | [`JOYSTICK_BUTTON_DOWN`](SDL_EventType::JOYSTICK_BUTTON_DOWN) | [`SDL_EVENT_JOYSTICK_BUTTON_DOWN`] | Joystick button pressed | +/// | [`JOYSTICK_BUTTON_UP`](SDL_EventType::JOYSTICK_BUTTON_UP) | [`SDL_EVENT_JOYSTICK_BUTTON_UP`] | Joystick button released | +/// | [`JOYSTICK_ADDED`](SDL_EventType::JOYSTICK_ADDED) | [`SDL_EVENT_JOYSTICK_ADDED`] | A new joystick has been inserted into the system | +/// | [`JOYSTICK_REMOVED`](SDL_EventType::JOYSTICK_REMOVED) | [`SDL_EVENT_JOYSTICK_REMOVED`] | An opened joystick has been removed | +/// | [`JOYSTICK_BATTERY_UPDATED`](SDL_EventType::JOYSTICK_BATTERY_UPDATED) | [`SDL_EVENT_JOYSTICK_BATTERY_UPDATED`] | Joystick battery level change | +/// | [`JOYSTICK_UPDATE_COMPLETE`](SDL_EventType::JOYSTICK_UPDATE_COMPLETE) | [`SDL_EVENT_JOYSTICK_UPDATE_COMPLETE`] | Joystick update is complete | +/// | [`GAMEPAD_AXIS_MOTION`](SDL_EventType::GAMEPAD_AXIS_MOTION) | [`SDL_EVENT_GAMEPAD_AXIS_MOTION`] | Gamepad axis motion | +/// | [`GAMEPAD_BUTTON_DOWN`](SDL_EventType::GAMEPAD_BUTTON_DOWN) | [`SDL_EVENT_GAMEPAD_BUTTON_DOWN`] | Gamepad button pressed | +/// | [`GAMEPAD_BUTTON_UP`](SDL_EventType::GAMEPAD_BUTTON_UP) | [`SDL_EVENT_GAMEPAD_BUTTON_UP`] | Gamepad button released | +/// | [`GAMEPAD_ADDED`](SDL_EventType::GAMEPAD_ADDED) | [`SDL_EVENT_GAMEPAD_ADDED`] | A new gamepad has been inserted into the system | +/// | [`GAMEPAD_REMOVED`](SDL_EventType::GAMEPAD_REMOVED) | [`SDL_EVENT_GAMEPAD_REMOVED`] | A gamepad has been removed | +/// | [`GAMEPAD_REMAPPED`](SDL_EventType::GAMEPAD_REMAPPED) | [`SDL_EVENT_GAMEPAD_REMAPPED`] | The gamepad mapping was updated | +/// | [`GAMEPAD_TOUCHPAD_DOWN`](SDL_EventType::GAMEPAD_TOUCHPAD_DOWN) | [`SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN`] | Gamepad touchpad was touched | +/// | [`GAMEPAD_TOUCHPAD_MOTION`](SDL_EventType::GAMEPAD_TOUCHPAD_MOTION) | [`SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION`] | Gamepad touchpad finger was moved | +/// | [`GAMEPAD_TOUCHPAD_UP`](SDL_EventType::GAMEPAD_TOUCHPAD_UP) | [`SDL_EVENT_GAMEPAD_TOUCHPAD_UP`] | Gamepad touchpad finger was lifted | +/// | [`GAMEPAD_SENSOR_UPDATE`](SDL_EventType::GAMEPAD_SENSOR_UPDATE) | [`SDL_EVENT_GAMEPAD_SENSOR_UPDATE`] | Gamepad sensor was updated | +/// | [`GAMEPAD_UPDATE_COMPLETE`](SDL_EventType::GAMEPAD_UPDATE_COMPLETE) | [`SDL_EVENT_GAMEPAD_UPDATE_COMPLETE`] | Gamepad update is complete | +/// | [`GAMEPAD_STEAM_HANDLE_UPDATED`](SDL_EventType::GAMEPAD_STEAM_HANDLE_UPDATED) | [`SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED`] | Gamepad Steam handle has changed | +/// | [`FINGER_DOWN`](SDL_EventType::FINGER_DOWN) | [`SDL_EVENT_FINGER_DOWN`] | | +/// | [`FINGER_UP`](SDL_EventType::FINGER_UP) | [`SDL_EVENT_FINGER_UP`] | | +/// | [`FINGER_MOTION`](SDL_EventType::FINGER_MOTION) | [`SDL_EVENT_FINGER_MOTION`] | | +/// | [`FINGER_CANCELED`](SDL_EventType::FINGER_CANCELED) | [`SDL_EVENT_FINGER_CANCELED`] | | +/// | [`PINCH_BEGIN`](SDL_EventType::PINCH_BEGIN) | [`SDL_EVENT_PINCH_BEGIN`] | Pinch gesture started | +/// | [`PINCH_UPDATE`](SDL_EventType::PINCH_UPDATE) | [`SDL_EVENT_PINCH_UPDATE`] | Pinch gesture updated | +/// | [`PINCH_END`](SDL_EventType::PINCH_END) | [`SDL_EVENT_PINCH_END`] | Pinch gesture ended | +/// | [`CLIPBOARD_UPDATE`](SDL_EventType::CLIPBOARD_UPDATE) | [`SDL_EVENT_CLIPBOARD_UPDATE`] | The clipboard changed | +/// | [`DROP_FILE`](SDL_EventType::DROP_FILE) | [`SDL_EVENT_DROP_FILE`] | The system requests a file open | +/// | [`DROP_TEXT`](SDL_EventType::DROP_TEXT) | [`SDL_EVENT_DROP_TEXT`] | text/plain drag-and-drop event | +/// | [`DROP_BEGIN`](SDL_EventType::DROP_BEGIN) | [`SDL_EVENT_DROP_BEGIN`] | A new set of drops is beginning (NULL filename) | +/// | [`DROP_COMPLETE`](SDL_EventType::DROP_COMPLETE) | [`SDL_EVENT_DROP_COMPLETE`] | Current set of drops is now complete (NULL filename) | +/// | [`DROP_POSITION`](SDL_EventType::DROP_POSITION) | [`SDL_EVENT_DROP_POSITION`] | Position while moving over the window | +/// | [`AUDIO_DEVICE_ADDED`](SDL_EventType::AUDIO_DEVICE_ADDED) | [`SDL_EVENT_AUDIO_DEVICE_ADDED`] | A new audio device is available | +/// | [`AUDIO_DEVICE_REMOVED`](SDL_EventType::AUDIO_DEVICE_REMOVED) | [`SDL_EVENT_AUDIO_DEVICE_REMOVED`] | An audio device has been removed. | +/// | [`AUDIO_DEVICE_FORMAT_CHANGED`](SDL_EventType::AUDIO_DEVICE_FORMAT_CHANGED) | [`SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED`] | An audio device's format has been changed by the system. | +/// | [`SENSOR_UPDATE`](SDL_EventType::SENSOR_UPDATE) | [`SDL_EVENT_SENSOR_UPDATE`] | A sensor was updated | +/// | [`PEN_PROXIMITY_IN`](SDL_EventType::PEN_PROXIMITY_IN) | [`SDL_EVENT_PEN_PROXIMITY_IN`] | Pressure-sensitive pen has become available | +/// | [`PEN_PROXIMITY_OUT`](SDL_EventType::PEN_PROXIMITY_OUT) | [`SDL_EVENT_PEN_PROXIMITY_OUT`] | Pressure-sensitive pen has become unavailable | +/// | [`PEN_DOWN`](SDL_EventType::PEN_DOWN) | [`SDL_EVENT_PEN_DOWN`] | Pressure-sensitive pen touched drawing surface | +/// | [`PEN_UP`](SDL_EventType::PEN_UP) | [`SDL_EVENT_PEN_UP`] | Pressure-sensitive pen stopped touching drawing surface | +/// | [`PEN_BUTTON_DOWN`](SDL_EventType::PEN_BUTTON_DOWN) | [`SDL_EVENT_PEN_BUTTON_DOWN`] | Pressure-sensitive pen button pressed | +/// | [`PEN_BUTTON_UP`](SDL_EventType::PEN_BUTTON_UP) | [`SDL_EVENT_PEN_BUTTON_UP`] | Pressure-sensitive pen button released | +/// | [`PEN_MOTION`](SDL_EventType::PEN_MOTION) | [`SDL_EVENT_PEN_MOTION`] | Pressure-sensitive pen is moving on the tablet | +/// | [`PEN_AXIS`](SDL_EventType::PEN_AXIS) | [`SDL_EVENT_PEN_AXIS`] | Pressure-sensitive pen angle/pressure/etc changed | +/// | [`CAMERA_DEVICE_ADDED`](SDL_EventType::CAMERA_DEVICE_ADDED) | [`SDL_EVENT_CAMERA_DEVICE_ADDED`] | A new camera device is available | +/// | [`CAMERA_DEVICE_REMOVED`](SDL_EventType::CAMERA_DEVICE_REMOVED) | [`SDL_EVENT_CAMERA_DEVICE_REMOVED`] | A camera device has been removed. | +/// | [`CAMERA_DEVICE_APPROVED`](SDL_EventType::CAMERA_DEVICE_APPROVED) | [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] | A camera device has been approved for use by the user. | +/// | [`CAMERA_DEVICE_DENIED`](SDL_EventType::CAMERA_DEVICE_DENIED) | [`SDL_EVENT_CAMERA_DEVICE_DENIED`] | A camera device has been denied for use by the user. | +/// | [`RENDER_TARGETS_RESET`](SDL_EventType::RENDER_TARGETS_RESET) | [`SDL_EVENT_RENDER_TARGETS_RESET`] | The render targets have been reset and their contents need to be updated | +/// | [`RENDER_DEVICE_RESET`](SDL_EventType::RENDER_DEVICE_RESET) | [`SDL_EVENT_RENDER_DEVICE_RESET`] | The device has been reset and all textures need to be recreated | +/// | [`RENDER_DEVICE_LOST`](SDL_EventType::RENDER_DEVICE_LOST) | [`SDL_EVENT_RENDER_DEVICE_LOST`] | The device has been lost and can't be recovered. | +/// | [`PRIVATE0`](SDL_EventType::PRIVATE0) | [`SDL_EVENT_PRIVATE0`] | | +/// | [`PRIVATE1`](SDL_EventType::PRIVATE1) | [`SDL_EVENT_PRIVATE1`] | | +/// | [`PRIVATE2`](SDL_EventType::PRIVATE2) | [`SDL_EVENT_PRIVATE2`] | | +/// | [`PRIVATE3`](SDL_EventType::PRIVATE3) | [`SDL_EVENT_PRIVATE3`] | | +/// | [`POLL_SENTINEL`](SDL_EventType::POLL_SENTINEL) | [`SDL_EVENT_POLL_SENTINEL`] | Signals the end of an event poll cycle | +/// | [`USER`](SDL_EventType::USER) | [`SDL_EVENT_USER`] | Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use, and should be allocated with [`SDL_RegisterEvents()`] | +/// | [`LAST`](SDL_EventType::LAST) | [`SDL_EVENT_LAST`] | * This last event is only for bounding internal arrays | +/// | [`ENUM_PADDING`](SDL_EventType::ENUM_PADDING) | [`SDL_EVENT_ENUM_PADDING`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_EventType(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_EventType { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_EventType) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_EventType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_EventType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::FIRST => "SDL_EVENT_FIRST", + Self::QUIT => "SDL_EVENT_QUIT", + Self::TERMINATING => "SDL_EVENT_TERMINATING", + Self::LOW_MEMORY => "SDL_EVENT_LOW_MEMORY", + Self::WILL_ENTER_BACKGROUND => "SDL_EVENT_WILL_ENTER_BACKGROUND", + Self::DID_ENTER_BACKGROUND => "SDL_EVENT_DID_ENTER_BACKGROUND", + Self::WILL_ENTER_FOREGROUND => "SDL_EVENT_WILL_ENTER_FOREGROUND", + Self::DID_ENTER_FOREGROUND => "SDL_EVENT_DID_ENTER_FOREGROUND", + Self::LOCALE_CHANGED => "SDL_EVENT_LOCALE_CHANGED", + Self::SYSTEM_THEME_CHANGED => "SDL_EVENT_SYSTEM_THEME_CHANGED", + Self::DISPLAY_ORIENTATION => "SDL_EVENT_DISPLAY_ORIENTATION", + Self::DISPLAY_ADDED => "SDL_EVENT_DISPLAY_ADDED", + Self::DISPLAY_REMOVED => "SDL_EVENT_DISPLAY_REMOVED", + Self::DISPLAY_MOVED => "SDL_EVENT_DISPLAY_MOVED", + Self::DISPLAY_DESKTOP_MODE_CHANGED => "SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED", + Self::DISPLAY_CURRENT_MODE_CHANGED => "SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED", + Self::DISPLAY_CONTENT_SCALE_CHANGED => "SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED", + Self::DISPLAY_USABLE_BOUNDS_CHANGED => "SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED", + Self::DISPLAY_FIRST => "SDL_EVENT_DISPLAY_FIRST", + Self::DISPLAY_LAST => "SDL_EVENT_DISPLAY_LAST", + Self::WINDOW_SHOWN => "SDL_EVENT_WINDOW_SHOWN", + Self::WINDOW_HIDDEN => "SDL_EVENT_WINDOW_HIDDEN", + Self::WINDOW_EXPOSED => "SDL_EVENT_WINDOW_EXPOSED", + Self::WINDOW_MOVED => "SDL_EVENT_WINDOW_MOVED", + Self::WINDOW_RESIZED => "SDL_EVENT_WINDOW_RESIZED", + Self::WINDOW_PIXEL_SIZE_CHANGED => "SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED", + Self::WINDOW_METAL_VIEW_RESIZED => "SDL_EVENT_WINDOW_METAL_VIEW_RESIZED", + Self::WINDOW_MINIMIZED => "SDL_EVENT_WINDOW_MINIMIZED", + Self::WINDOW_MAXIMIZED => "SDL_EVENT_WINDOW_MAXIMIZED", + Self::WINDOW_RESTORED => "SDL_EVENT_WINDOW_RESTORED", + Self::WINDOW_MOUSE_ENTER => "SDL_EVENT_WINDOW_MOUSE_ENTER", + Self::WINDOW_MOUSE_LEAVE => "SDL_EVENT_WINDOW_MOUSE_LEAVE", + Self::WINDOW_FOCUS_GAINED => "SDL_EVENT_WINDOW_FOCUS_GAINED", + Self::WINDOW_FOCUS_LOST => "SDL_EVENT_WINDOW_FOCUS_LOST", + Self::WINDOW_CLOSE_REQUESTED => "SDL_EVENT_WINDOW_CLOSE_REQUESTED", + Self::WINDOW_HIT_TEST => "SDL_EVENT_WINDOW_HIT_TEST", + Self::WINDOW_ICCPROF_CHANGED => "SDL_EVENT_WINDOW_ICCPROF_CHANGED", + Self::WINDOW_DISPLAY_CHANGED => "SDL_EVENT_WINDOW_DISPLAY_CHANGED", + Self::WINDOW_DISPLAY_SCALE_CHANGED => "SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED", + Self::WINDOW_SAFE_AREA_CHANGED => "SDL_EVENT_WINDOW_SAFE_AREA_CHANGED", + Self::WINDOW_OCCLUDED => "SDL_EVENT_WINDOW_OCCLUDED", + Self::WINDOW_ENTER_FULLSCREEN => "SDL_EVENT_WINDOW_ENTER_FULLSCREEN", + Self::WINDOW_LEAVE_FULLSCREEN => "SDL_EVENT_WINDOW_LEAVE_FULLSCREEN", + Self::WINDOW_DESTROYED => "SDL_EVENT_WINDOW_DESTROYED", + Self::WINDOW_HDR_STATE_CHANGED => "SDL_EVENT_WINDOW_HDR_STATE_CHANGED", + Self::WINDOW_FIRST => "SDL_EVENT_WINDOW_FIRST", + Self::WINDOW_LAST => "SDL_EVENT_WINDOW_LAST", + Self::KEY_DOWN => "SDL_EVENT_KEY_DOWN", + Self::KEY_UP => "SDL_EVENT_KEY_UP", + Self::TEXT_EDITING => "SDL_EVENT_TEXT_EDITING", + Self::TEXT_INPUT => "SDL_EVENT_TEXT_INPUT", + Self::KEYMAP_CHANGED => "SDL_EVENT_KEYMAP_CHANGED", + Self::KEYBOARD_ADDED => "SDL_EVENT_KEYBOARD_ADDED", + Self::KEYBOARD_REMOVED => "SDL_EVENT_KEYBOARD_REMOVED", + Self::TEXT_EDITING_CANDIDATES => "SDL_EVENT_TEXT_EDITING_CANDIDATES", + Self::SCREEN_KEYBOARD_SHOWN => "SDL_EVENT_SCREEN_KEYBOARD_SHOWN", + Self::SCREEN_KEYBOARD_HIDDEN => "SDL_EVENT_SCREEN_KEYBOARD_HIDDEN", + Self::MOUSE_MOTION => "SDL_EVENT_MOUSE_MOTION", + Self::MOUSE_BUTTON_DOWN => "SDL_EVENT_MOUSE_BUTTON_DOWN", + Self::MOUSE_BUTTON_UP => "SDL_EVENT_MOUSE_BUTTON_UP", + Self::MOUSE_WHEEL => "SDL_EVENT_MOUSE_WHEEL", + Self::MOUSE_ADDED => "SDL_EVENT_MOUSE_ADDED", + Self::MOUSE_REMOVED => "SDL_EVENT_MOUSE_REMOVED", + Self::JOYSTICK_AXIS_MOTION => "SDL_EVENT_JOYSTICK_AXIS_MOTION", + Self::JOYSTICK_BALL_MOTION => "SDL_EVENT_JOYSTICK_BALL_MOTION", + Self::JOYSTICK_HAT_MOTION => "SDL_EVENT_JOYSTICK_HAT_MOTION", + Self::JOYSTICK_BUTTON_DOWN => "SDL_EVENT_JOYSTICK_BUTTON_DOWN", + Self::JOYSTICK_BUTTON_UP => "SDL_EVENT_JOYSTICK_BUTTON_UP", + Self::JOYSTICK_ADDED => "SDL_EVENT_JOYSTICK_ADDED", + Self::JOYSTICK_REMOVED => "SDL_EVENT_JOYSTICK_REMOVED", + Self::JOYSTICK_BATTERY_UPDATED => "SDL_EVENT_JOYSTICK_BATTERY_UPDATED", + Self::JOYSTICK_UPDATE_COMPLETE => "SDL_EVENT_JOYSTICK_UPDATE_COMPLETE", + Self::GAMEPAD_AXIS_MOTION => "SDL_EVENT_GAMEPAD_AXIS_MOTION", + Self::GAMEPAD_BUTTON_DOWN => "SDL_EVENT_GAMEPAD_BUTTON_DOWN", + Self::GAMEPAD_BUTTON_UP => "SDL_EVENT_GAMEPAD_BUTTON_UP", + Self::GAMEPAD_ADDED => "SDL_EVENT_GAMEPAD_ADDED", + Self::GAMEPAD_REMOVED => "SDL_EVENT_GAMEPAD_REMOVED", + Self::GAMEPAD_REMAPPED => "SDL_EVENT_GAMEPAD_REMAPPED", + Self::GAMEPAD_TOUCHPAD_DOWN => "SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN", + Self::GAMEPAD_TOUCHPAD_MOTION => "SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION", + Self::GAMEPAD_TOUCHPAD_UP => "SDL_EVENT_GAMEPAD_TOUCHPAD_UP", + Self::GAMEPAD_SENSOR_UPDATE => "SDL_EVENT_GAMEPAD_SENSOR_UPDATE", + Self::GAMEPAD_UPDATE_COMPLETE => "SDL_EVENT_GAMEPAD_UPDATE_COMPLETE", + Self::GAMEPAD_STEAM_HANDLE_UPDATED => "SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED", + Self::FINGER_DOWN => "SDL_EVENT_FINGER_DOWN", + Self::FINGER_UP => "SDL_EVENT_FINGER_UP", + Self::FINGER_MOTION => "SDL_EVENT_FINGER_MOTION", + Self::FINGER_CANCELED => "SDL_EVENT_FINGER_CANCELED", + Self::PINCH_BEGIN => "SDL_EVENT_PINCH_BEGIN", + Self::PINCH_UPDATE => "SDL_EVENT_PINCH_UPDATE", + Self::PINCH_END => "SDL_EVENT_PINCH_END", + Self::CLIPBOARD_UPDATE => "SDL_EVENT_CLIPBOARD_UPDATE", + Self::DROP_FILE => "SDL_EVENT_DROP_FILE", + Self::DROP_TEXT => "SDL_EVENT_DROP_TEXT", + Self::DROP_BEGIN => "SDL_EVENT_DROP_BEGIN", + Self::DROP_COMPLETE => "SDL_EVENT_DROP_COMPLETE", + Self::DROP_POSITION => "SDL_EVENT_DROP_POSITION", + Self::AUDIO_DEVICE_ADDED => "SDL_EVENT_AUDIO_DEVICE_ADDED", + Self::AUDIO_DEVICE_REMOVED => "SDL_EVENT_AUDIO_DEVICE_REMOVED", + Self::AUDIO_DEVICE_FORMAT_CHANGED => "SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED", + Self::SENSOR_UPDATE => "SDL_EVENT_SENSOR_UPDATE", + Self::PEN_PROXIMITY_IN => "SDL_EVENT_PEN_PROXIMITY_IN", + Self::PEN_PROXIMITY_OUT => "SDL_EVENT_PEN_PROXIMITY_OUT", + Self::PEN_DOWN => "SDL_EVENT_PEN_DOWN", + Self::PEN_UP => "SDL_EVENT_PEN_UP", + Self::PEN_BUTTON_DOWN => "SDL_EVENT_PEN_BUTTON_DOWN", + Self::PEN_BUTTON_UP => "SDL_EVENT_PEN_BUTTON_UP", + Self::PEN_MOTION => "SDL_EVENT_PEN_MOTION", + Self::PEN_AXIS => "SDL_EVENT_PEN_AXIS", + Self::CAMERA_DEVICE_ADDED => "SDL_EVENT_CAMERA_DEVICE_ADDED", + Self::CAMERA_DEVICE_REMOVED => "SDL_EVENT_CAMERA_DEVICE_REMOVED", + Self::CAMERA_DEVICE_APPROVED => "SDL_EVENT_CAMERA_DEVICE_APPROVED", + Self::CAMERA_DEVICE_DENIED => "SDL_EVENT_CAMERA_DEVICE_DENIED", + Self::RENDER_TARGETS_RESET => "SDL_EVENT_RENDER_TARGETS_RESET", + Self::RENDER_DEVICE_RESET => "SDL_EVENT_RENDER_DEVICE_RESET", + Self::RENDER_DEVICE_LOST => "SDL_EVENT_RENDER_DEVICE_LOST", + Self::PRIVATE0 => "SDL_EVENT_PRIVATE0", + Self::PRIVATE1 => "SDL_EVENT_PRIVATE1", + Self::PRIVATE2 => "SDL_EVENT_PRIVATE2", + Self::PRIVATE3 => "SDL_EVENT_PRIVATE3", + Self::POLL_SENTINEL => "SDL_EVENT_POLL_SENTINEL", + Self::USER => "SDL_EVENT_USER", + Self::LAST => "SDL_EVENT_LAST", + Self::ENUM_PADDING => "SDL_EVENT_ENUM_PADDING", + + _ => return write!(f, "SDL_EventType({})", self.0), + }) + } +} + +impl SDL_EventType { + /// Unused (do not remove) + pub const FIRST: Self = Self((0 as Uint32)); + /// User-requested quit + pub const QUIT: Self = Self((0x100 as Uint32)); + /// The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. + /// Called on iOS in applicationWillTerminate() + /// Called on Android in onDestroy() + pub const TERMINATING: Self = Self((257 as Uint32)); + /// The application is low on memory, free memory if possible. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. + /// Called on iOS in applicationDidReceiveMemoryWarning() + /// Called on Android in onTrimMemory() + pub const LOW_MEMORY: Self = Self((258 as Uint32)); + /// The application is about to enter the background. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. + /// Called on iOS in applicationWillResignActive() + /// Called on Android in onPause() + pub const WILL_ENTER_BACKGROUND: Self = Self((259 as Uint32)); + /// The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. + /// Called on iOS in applicationDidEnterBackground() + /// Called on Android in onPause() + pub const DID_ENTER_BACKGROUND: Self = Self((260 as Uint32)); + /// The application is about to enter the foreground. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. + /// Called on iOS in applicationWillEnterForeground() + /// Called on Android in onResume() + pub const WILL_ENTER_FOREGROUND: Self = Self((261 as Uint32)); + /// The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. + /// Called on iOS in applicationDidBecomeActive() + /// Called on Android in onResume() + pub const DID_ENTER_FOREGROUND: Self = Self((262 as Uint32)); + /// The user's locale preferences have changed. + pub const LOCALE_CHANGED: Self = Self((263 as Uint32)); + /// The system theme changed + pub const SYSTEM_THEME_CHANGED: Self = Self((264 as Uint32)); + /// Display orientation has changed to data1 + pub const DISPLAY_ORIENTATION: Self = Self((0x151 as Uint32)); + /// Display has been added to the system + pub const DISPLAY_ADDED: Self = Self((338 as Uint32)); + /// Display has been removed from the system + pub const DISPLAY_REMOVED: Self = Self((339 as Uint32)); + /// Display has changed position + pub const DISPLAY_MOVED: Self = Self((340 as Uint32)); + /// Display has changed desktop mode + pub const DISPLAY_DESKTOP_MODE_CHANGED: Self = Self((341 as Uint32)); + /// Display has changed current mode + pub const DISPLAY_CURRENT_MODE_CHANGED: Self = Self((342 as Uint32)); + /// Display has changed content scale + pub const DISPLAY_CONTENT_SCALE_CHANGED: Self = Self((343 as Uint32)); + /// Display has changed usable bounds + pub const DISPLAY_USABLE_BOUNDS_CHANGED: Self = Self((344 as Uint32)); + pub const DISPLAY_FIRST: Self = SDL_EVENT_DISPLAY_ORIENTATION; + pub const DISPLAY_LAST: Self = SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED; + /// Window has been shown + pub const WINDOW_SHOWN: Self = Self((0x202 as Uint32)); + /// Window has been hidden + pub const WINDOW_HIDDEN: Self = Self((515 as Uint32)); + /// Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event. + /// data1 is 1 for live-resize expose events, 0 otherwise. + pub const WINDOW_EXPOSED: Self = Self((516 as Uint32)); + /// Window has been moved to data1, data2 + pub const WINDOW_MOVED: Self = Self((517 as Uint32)); + /// Window has been resized to data1xdata2 + pub const WINDOW_RESIZED: Self = Self((518 as Uint32)); + /// The pixel size of the window has changed to data1xdata2 + pub const WINDOW_PIXEL_SIZE_CHANGED: Self = Self((519 as Uint32)); + /// The pixel size of a Metal view associated with the window has changed + pub const WINDOW_METAL_VIEW_RESIZED: Self = Self((520 as Uint32)); + /// Window has been minimized + pub const WINDOW_MINIMIZED: Self = Self((521 as Uint32)); + /// Window has been maximized + pub const WINDOW_MAXIMIZED: Self = Self((522 as Uint32)); + /// Window has been restored to normal size and position + pub const WINDOW_RESTORED: Self = Self((523 as Uint32)); + /// Window has gained mouse focus + pub const WINDOW_MOUSE_ENTER: Self = Self((524 as Uint32)); + /// Window has lost mouse focus + pub const WINDOW_MOUSE_LEAVE: Self = Self((525 as Uint32)); + /// Window has gained keyboard focus + pub const WINDOW_FOCUS_GAINED: Self = Self((526 as Uint32)); + /// Window has lost keyboard focus + pub const WINDOW_FOCUS_LOST: Self = Self((527 as Uint32)); + /// The window manager requests that the window be closed + pub const WINDOW_CLOSE_REQUESTED: Self = Self((528 as Uint32)); + /// Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`] + pub const WINDOW_HIT_TEST: Self = Self((529 as Uint32)); + /// The ICC profile of the window's display has changed + pub const WINDOW_ICCPROF_CHANGED: Self = Self((530 as Uint32)); + /// Window has been moved to display data1 + pub const WINDOW_DISPLAY_CHANGED: Self = Self((531 as Uint32)); + /// Window display scale has been changed + pub const WINDOW_DISPLAY_SCALE_CHANGED: Self = Self((532 as Uint32)); + /// The window safe area has been changed + pub const WINDOW_SAFE_AREA_CHANGED: Self = Self((533 as Uint32)); + /// The window has been occluded + pub const WINDOW_OCCLUDED: Self = Self((534 as Uint32)); + /// The window has entered fullscreen mode + pub const WINDOW_ENTER_FULLSCREEN: Self = Self((535 as Uint32)); + /// The window has left fullscreen mode + pub const WINDOW_LEAVE_FULLSCREEN: Self = Self((536 as Uint32)); + /// The window with the associated ID is being or has been destroyed. If this message is being handled + /// in an event watcher, the window handle is still valid and can still be used to retrieve any properties + /// associated with the window. Otherwise, the handle has already been destroyed and all resources + /// associated with it are invalid + pub const WINDOW_DESTROYED: Self = Self((537 as Uint32)); + /// Window HDR properties have changed + pub const WINDOW_HDR_STATE_CHANGED: Self = Self((538 as Uint32)); + pub const WINDOW_FIRST: Self = SDL_EVENT_WINDOW_SHOWN; + pub const WINDOW_LAST: Self = SDL_EVENT_WINDOW_HDR_STATE_CHANGED; + /// Key pressed + pub const KEY_DOWN: Self = Self((0x300 as Uint32)); + /// Key released + pub const KEY_UP: Self = Self((769 as Uint32)); + /// Keyboard text editing (composition) + pub const TEXT_EDITING: Self = Self((770 as Uint32)); + /// Keyboard text input + pub const TEXT_INPUT: Self = Self((771 as Uint32)); + /// Keymap changed due to a system event such as an + /// input language or keyboard layout change. + pub const KEYMAP_CHANGED: Self = Self((772 as Uint32)); + /// A new keyboard has been inserted into the system + pub const KEYBOARD_ADDED: Self = Self((773 as Uint32)); + /// A keyboard has been removed + pub const KEYBOARD_REMOVED: Self = Self((774 as Uint32)); + /// Keyboard text editing candidates + pub const TEXT_EDITING_CANDIDATES: Self = Self((775 as Uint32)); + /// The on-screen keyboard has been shown + pub const SCREEN_KEYBOARD_SHOWN: Self = Self((776 as Uint32)); + /// The on-screen keyboard has been hidden + pub const SCREEN_KEYBOARD_HIDDEN: Self = Self((777 as Uint32)); + /// Mouse moved + pub const MOUSE_MOTION: Self = Self((0x400 as Uint32)); + /// Mouse button pressed + pub const MOUSE_BUTTON_DOWN: Self = Self((1025 as Uint32)); + /// Mouse button released + pub const MOUSE_BUTTON_UP: Self = Self((1026 as Uint32)); + /// Mouse wheel motion + pub const MOUSE_WHEEL: Self = Self((1027 as Uint32)); + /// A new mouse has been inserted into the system + pub const MOUSE_ADDED: Self = Self((1028 as Uint32)); + /// A mouse has been removed + pub const MOUSE_REMOVED: Self = Self((1029 as Uint32)); + /// Joystick axis motion + pub const JOYSTICK_AXIS_MOTION: Self = Self((0x600 as Uint32)); + /// Joystick trackball motion + pub const JOYSTICK_BALL_MOTION: Self = Self((1537 as Uint32)); + /// Joystick hat position change + pub const JOYSTICK_HAT_MOTION: Self = Self((1538 as Uint32)); + /// Joystick button pressed + pub const JOYSTICK_BUTTON_DOWN: Self = Self((1539 as Uint32)); + /// Joystick button released + pub const JOYSTICK_BUTTON_UP: Self = Self((1540 as Uint32)); + /// A new joystick has been inserted into the system + pub const JOYSTICK_ADDED: Self = Self((1541 as Uint32)); + /// An opened joystick has been removed + pub const JOYSTICK_REMOVED: Self = Self((1542 as Uint32)); + /// Joystick battery level change + pub const JOYSTICK_BATTERY_UPDATED: Self = Self((1543 as Uint32)); + /// Joystick update is complete + pub const JOYSTICK_UPDATE_COMPLETE: Self = Self((1544 as Uint32)); + /// Gamepad axis motion + pub const GAMEPAD_AXIS_MOTION: Self = Self((0x650 as Uint32)); + /// Gamepad button pressed + pub const GAMEPAD_BUTTON_DOWN: Self = Self((1617 as Uint32)); + /// Gamepad button released + pub const GAMEPAD_BUTTON_UP: Self = Self((1618 as Uint32)); + /// A new gamepad has been inserted into the system + pub const GAMEPAD_ADDED: Self = Self((1619 as Uint32)); + /// A gamepad has been removed + pub const GAMEPAD_REMOVED: Self = Self((1620 as Uint32)); + /// The gamepad mapping was updated + pub const GAMEPAD_REMAPPED: Self = Self((1621 as Uint32)); + /// Gamepad touchpad was touched + pub const GAMEPAD_TOUCHPAD_DOWN: Self = Self((1622 as Uint32)); + /// Gamepad touchpad finger was moved + pub const GAMEPAD_TOUCHPAD_MOTION: Self = Self((1623 as Uint32)); + /// Gamepad touchpad finger was lifted + pub const GAMEPAD_TOUCHPAD_UP: Self = Self((1624 as Uint32)); + /// Gamepad sensor was updated + pub const GAMEPAD_SENSOR_UPDATE: Self = Self((1625 as Uint32)); + /// Gamepad update is complete + pub const GAMEPAD_UPDATE_COMPLETE: Self = Self((1626 as Uint32)); + /// Gamepad Steam handle has changed + pub const GAMEPAD_STEAM_HANDLE_UPDATED: Self = Self((1627 as Uint32)); + pub const FINGER_DOWN: Self = Self((0x700 as Uint32)); + pub const FINGER_UP: Self = Self((1793 as Uint32)); + pub const FINGER_MOTION: Self = Self((1794 as Uint32)); + pub const FINGER_CANCELED: Self = Self((1795 as Uint32)); + /// Pinch gesture started + pub const PINCH_BEGIN: Self = Self((0x710 as Uint32)); + /// Pinch gesture updated + pub const PINCH_UPDATE: Self = Self((1809 as Uint32)); + /// Pinch gesture ended + pub const PINCH_END: Self = Self((1810 as Uint32)); + /// The clipboard changed + pub const CLIPBOARD_UPDATE: Self = Self((0x900 as Uint32)); + /// The system requests a file open + pub const DROP_FILE: Self = Self((0x1000 as Uint32)); + /// text/plain drag-and-drop event + pub const DROP_TEXT: Self = Self((4097 as Uint32)); + /// A new set of drops is beginning (NULL filename) + pub const DROP_BEGIN: Self = Self((4098 as Uint32)); + /// Current set of drops is now complete (NULL filename) + pub const DROP_COMPLETE: Self = Self((4099 as Uint32)); + /// Position while moving over the window + pub const DROP_POSITION: Self = Self((4100 as Uint32)); + /// A new audio device is available + pub const AUDIO_DEVICE_ADDED: Self = Self((0x1100 as Uint32)); + /// An audio device has been removed. + pub const AUDIO_DEVICE_REMOVED: Self = Self((4353 as Uint32)); + /// An audio device's format has been changed by the system. + pub const AUDIO_DEVICE_FORMAT_CHANGED: Self = Self((4354 as Uint32)); + /// A sensor was updated + pub const SENSOR_UPDATE: Self = Self((0x1200 as Uint32)); + /// Pressure-sensitive pen has become available + pub const PEN_PROXIMITY_IN: Self = Self((0x1300 as Uint32)); + /// Pressure-sensitive pen has become unavailable + pub const PEN_PROXIMITY_OUT: Self = Self((4865 as Uint32)); + /// Pressure-sensitive pen touched drawing surface + pub const PEN_DOWN: Self = Self((4866 as Uint32)); + /// Pressure-sensitive pen stopped touching drawing surface + pub const PEN_UP: Self = Self((4867 as Uint32)); + /// Pressure-sensitive pen button pressed + pub const PEN_BUTTON_DOWN: Self = Self((4868 as Uint32)); + /// Pressure-sensitive pen button released + pub const PEN_BUTTON_UP: Self = Self((4869 as Uint32)); + /// Pressure-sensitive pen is moving on the tablet + pub const PEN_MOTION: Self = Self((4870 as Uint32)); + /// Pressure-sensitive pen angle/pressure/etc changed + pub const PEN_AXIS: Self = Self((4871 as Uint32)); + /// A new camera device is available + pub const CAMERA_DEVICE_ADDED: Self = Self((0x1400 as Uint32)); + /// A camera device has been removed. + pub const CAMERA_DEVICE_REMOVED: Self = Self((5121 as Uint32)); + /// A camera device has been approved for use by the user. + pub const CAMERA_DEVICE_APPROVED: Self = Self((5122 as Uint32)); + /// A camera device has been denied for use by the user. + pub const CAMERA_DEVICE_DENIED: Self = Self((5123 as Uint32)); + /// The render targets have been reset and their contents need to be updated + pub const RENDER_TARGETS_RESET: Self = Self((0x2000 as Uint32)); + /// The device has been reset and all textures need to be recreated + pub const RENDER_DEVICE_RESET: Self = Self((8193 as Uint32)); + /// The device has been lost and can't be recovered. + pub const RENDER_DEVICE_LOST: Self = Self((8194 as Uint32)); + pub const PRIVATE0: Self = Self((0x4000 as Uint32)); + pub const PRIVATE1: Self = Self((16385 as Uint32)); + pub const PRIVATE2: Self = Self((16386 as Uint32)); + pub const PRIVATE3: Self = Self((16387 as Uint32)); + /// Signals the end of an event poll cycle + pub const POLL_SENTINEL: Self = Self((0x7f00 as Uint32)); + /// Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use, + /// and should be allocated with [`SDL_RegisterEvents()`] + pub const USER: Self = Self((0x8000 as Uint32)); + /// * This last event is only for bounding internal arrays + pub const LAST: Self = Self((0xffff as Uint32)); + pub const ENUM_PADDING: Self = Self((0x7fffffff as Uint32)); +} + +/// Unused (do not remove) +pub const SDL_EVENT_FIRST: SDL_EventType = SDL_EventType::FIRST; +/// User-requested quit +pub const SDL_EVENT_QUIT: SDL_EventType = SDL_EventType::QUIT; +/// The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. +/// Called on iOS in applicationWillTerminate() +/// Called on Android in onDestroy() +pub const SDL_EVENT_TERMINATING: SDL_EventType = SDL_EventType::TERMINATING; +/// The application is low on memory, free memory if possible. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. +/// Called on iOS in applicationDidReceiveMemoryWarning() +/// Called on Android in onTrimMemory() +pub const SDL_EVENT_LOW_MEMORY: SDL_EventType = SDL_EventType::LOW_MEMORY; +/// The application is about to enter the background. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. +/// Called on iOS in applicationWillResignActive() +/// Called on Android in onPause() +pub const SDL_EVENT_WILL_ENTER_BACKGROUND: SDL_EventType = SDL_EventType::WILL_ENTER_BACKGROUND; +/// The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. +/// Called on iOS in applicationDidEnterBackground() +/// Called on Android in onPause() +pub const SDL_EVENT_DID_ENTER_BACKGROUND: SDL_EventType = SDL_EventType::DID_ENTER_BACKGROUND; +/// The application is about to enter the foreground. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. +/// Called on iOS in applicationWillEnterForeground() +/// Called on Android in onResume() +pub const SDL_EVENT_WILL_ENTER_FOREGROUND: SDL_EventType = SDL_EventType::WILL_ENTER_FOREGROUND; +/// The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. +/// Called on iOS in applicationDidBecomeActive() +/// Called on Android in onResume() +pub const SDL_EVENT_DID_ENTER_FOREGROUND: SDL_EventType = SDL_EventType::DID_ENTER_FOREGROUND; +/// The user's locale preferences have changed. +pub const SDL_EVENT_LOCALE_CHANGED: SDL_EventType = SDL_EventType::LOCALE_CHANGED; +/// The system theme changed +pub const SDL_EVENT_SYSTEM_THEME_CHANGED: SDL_EventType = SDL_EventType::SYSTEM_THEME_CHANGED; +/// Display orientation has changed to data1 +pub const SDL_EVENT_DISPLAY_ORIENTATION: SDL_EventType = SDL_EventType::DISPLAY_ORIENTATION; +/// Display has been added to the system +pub const SDL_EVENT_DISPLAY_ADDED: SDL_EventType = SDL_EventType::DISPLAY_ADDED; +/// Display has been removed from the system +pub const SDL_EVENT_DISPLAY_REMOVED: SDL_EventType = SDL_EventType::DISPLAY_REMOVED; +/// Display has changed position +pub const SDL_EVENT_DISPLAY_MOVED: SDL_EventType = SDL_EventType::DISPLAY_MOVED; +/// Display has changed desktop mode +pub const SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED: SDL_EventType = + SDL_EventType::DISPLAY_DESKTOP_MODE_CHANGED; +/// Display has changed current mode +pub const SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED: SDL_EventType = + SDL_EventType::DISPLAY_CURRENT_MODE_CHANGED; +/// Display has changed content scale +pub const SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED: SDL_EventType = + SDL_EventType::DISPLAY_CONTENT_SCALE_CHANGED; +/// Display has changed usable bounds +pub const SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED: SDL_EventType = + SDL_EventType::DISPLAY_USABLE_BOUNDS_CHANGED; +pub const SDL_EVENT_DISPLAY_FIRST: SDL_EventType = SDL_EventType::DISPLAY_FIRST; +pub const SDL_EVENT_DISPLAY_LAST: SDL_EventType = SDL_EventType::DISPLAY_LAST; +/// Window has been shown +pub const SDL_EVENT_WINDOW_SHOWN: SDL_EventType = SDL_EventType::WINDOW_SHOWN; +/// Window has been hidden +pub const SDL_EVENT_WINDOW_HIDDEN: SDL_EventType = SDL_EventType::WINDOW_HIDDEN; +/// Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event. +/// data1 is 1 for live-resize expose events, 0 otherwise. +pub const SDL_EVENT_WINDOW_EXPOSED: SDL_EventType = SDL_EventType::WINDOW_EXPOSED; +/// Window has been moved to data1, data2 +pub const SDL_EVENT_WINDOW_MOVED: SDL_EventType = SDL_EventType::WINDOW_MOVED; +/// Window has been resized to data1xdata2 +pub const SDL_EVENT_WINDOW_RESIZED: SDL_EventType = SDL_EventType::WINDOW_RESIZED; +/// The pixel size of the window has changed to data1xdata2 +pub const SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED: SDL_EventType = + SDL_EventType::WINDOW_PIXEL_SIZE_CHANGED; +/// The pixel size of a Metal view associated with the window has changed +pub const SDL_EVENT_WINDOW_METAL_VIEW_RESIZED: SDL_EventType = + SDL_EventType::WINDOW_METAL_VIEW_RESIZED; +/// Window has been minimized +pub const SDL_EVENT_WINDOW_MINIMIZED: SDL_EventType = SDL_EventType::WINDOW_MINIMIZED; +/// Window has been maximized +pub const SDL_EVENT_WINDOW_MAXIMIZED: SDL_EventType = SDL_EventType::WINDOW_MAXIMIZED; +/// Window has been restored to normal size and position +pub const SDL_EVENT_WINDOW_RESTORED: SDL_EventType = SDL_EventType::WINDOW_RESTORED; +/// Window has gained mouse focus +pub const SDL_EVENT_WINDOW_MOUSE_ENTER: SDL_EventType = SDL_EventType::WINDOW_MOUSE_ENTER; +/// Window has lost mouse focus +pub const SDL_EVENT_WINDOW_MOUSE_LEAVE: SDL_EventType = SDL_EventType::WINDOW_MOUSE_LEAVE; +/// Window has gained keyboard focus +pub const SDL_EVENT_WINDOW_FOCUS_GAINED: SDL_EventType = SDL_EventType::WINDOW_FOCUS_GAINED; +/// Window has lost keyboard focus +pub const SDL_EVENT_WINDOW_FOCUS_LOST: SDL_EventType = SDL_EventType::WINDOW_FOCUS_LOST; +/// The window manager requests that the window be closed +pub const SDL_EVENT_WINDOW_CLOSE_REQUESTED: SDL_EventType = SDL_EventType::WINDOW_CLOSE_REQUESTED; +/// Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`] +pub const SDL_EVENT_WINDOW_HIT_TEST: SDL_EventType = SDL_EventType::WINDOW_HIT_TEST; +/// The ICC profile of the window's display has changed +pub const SDL_EVENT_WINDOW_ICCPROF_CHANGED: SDL_EventType = SDL_EventType::WINDOW_ICCPROF_CHANGED; +/// Window has been moved to display data1 +pub const SDL_EVENT_WINDOW_DISPLAY_CHANGED: SDL_EventType = SDL_EventType::WINDOW_DISPLAY_CHANGED; +/// Window display scale has been changed +pub const SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED: SDL_EventType = + SDL_EventType::WINDOW_DISPLAY_SCALE_CHANGED; +/// The window safe area has been changed +pub const SDL_EVENT_WINDOW_SAFE_AREA_CHANGED: SDL_EventType = + SDL_EventType::WINDOW_SAFE_AREA_CHANGED; +/// The window has been occluded +pub const SDL_EVENT_WINDOW_OCCLUDED: SDL_EventType = SDL_EventType::WINDOW_OCCLUDED; +/// The window has entered fullscreen mode +pub const SDL_EVENT_WINDOW_ENTER_FULLSCREEN: SDL_EventType = SDL_EventType::WINDOW_ENTER_FULLSCREEN; +/// The window has left fullscreen mode +pub const SDL_EVENT_WINDOW_LEAVE_FULLSCREEN: SDL_EventType = SDL_EventType::WINDOW_LEAVE_FULLSCREEN; +/// The window with the associated ID is being or has been destroyed. If this message is being handled +/// in an event watcher, the window handle is still valid and can still be used to retrieve any properties +/// associated with the window. Otherwise, the handle has already been destroyed and all resources +/// associated with it are invalid +pub const SDL_EVENT_WINDOW_DESTROYED: SDL_EventType = SDL_EventType::WINDOW_DESTROYED; +/// Window HDR properties have changed +pub const SDL_EVENT_WINDOW_HDR_STATE_CHANGED: SDL_EventType = + SDL_EventType::WINDOW_HDR_STATE_CHANGED; +pub const SDL_EVENT_WINDOW_FIRST: SDL_EventType = SDL_EventType::WINDOW_FIRST; +pub const SDL_EVENT_WINDOW_LAST: SDL_EventType = SDL_EventType::WINDOW_LAST; +/// Key pressed +pub const SDL_EVENT_KEY_DOWN: SDL_EventType = SDL_EventType::KEY_DOWN; +/// Key released +pub const SDL_EVENT_KEY_UP: SDL_EventType = SDL_EventType::KEY_UP; +/// Keyboard text editing (composition) +pub const SDL_EVENT_TEXT_EDITING: SDL_EventType = SDL_EventType::TEXT_EDITING; +/// Keyboard text input +pub const SDL_EVENT_TEXT_INPUT: SDL_EventType = SDL_EventType::TEXT_INPUT; +/// Keymap changed due to a system event such as an +/// input language or keyboard layout change. +pub const SDL_EVENT_KEYMAP_CHANGED: SDL_EventType = SDL_EventType::KEYMAP_CHANGED; +/// A new keyboard has been inserted into the system +pub const SDL_EVENT_KEYBOARD_ADDED: SDL_EventType = SDL_EventType::KEYBOARD_ADDED; +/// A keyboard has been removed +pub const SDL_EVENT_KEYBOARD_REMOVED: SDL_EventType = SDL_EventType::KEYBOARD_REMOVED; +/// Keyboard text editing candidates +pub const SDL_EVENT_TEXT_EDITING_CANDIDATES: SDL_EventType = SDL_EventType::TEXT_EDITING_CANDIDATES; +/// The on-screen keyboard has been shown +pub const SDL_EVENT_SCREEN_KEYBOARD_SHOWN: SDL_EventType = SDL_EventType::SCREEN_KEYBOARD_SHOWN; +/// The on-screen keyboard has been hidden +pub const SDL_EVENT_SCREEN_KEYBOARD_HIDDEN: SDL_EventType = SDL_EventType::SCREEN_KEYBOARD_HIDDEN; +/// Mouse moved +pub const SDL_EVENT_MOUSE_MOTION: SDL_EventType = SDL_EventType::MOUSE_MOTION; +/// Mouse button pressed +pub const SDL_EVENT_MOUSE_BUTTON_DOWN: SDL_EventType = SDL_EventType::MOUSE_BUTTON_DOWN; +/// Mouse button released +pub const SDL_EVENT_MOUSE_BUTTON_UP: SDL_EventType = SDL_EventType::MOUSE_BUTTON_UP; +/// Mouse wheel motion +pub const SDL_EVENT_MOUSE_WHEEL: SDL_EventType = SDL_EventType::MOUSE_WHEEL; +/// A new mouse has been inserted into the system +pub const SDL_EVENT_MOUSE_ADDED: SDL_EventType = SDL_EventType::MOUSE_ADDED; +/// A mouse has been removed +pub const SDL_EVENT_MOUSE_REMOVED: SDL_EventType = SDL_EventType::MOUSE_REMOVED; +/// Joystick axis motion +pub const SDL_EVENT_JOYSTICK_AXIS_MOTION: SDL_EventType = SDL_EventType::JOYSTICK_AXIS_MOTION; +/// Joystick trackball motion +pub const SDL_EVENT_JOYSTICK_BALL_MOTION: SDL_EventType = SDL_EventType::JOYSTICK_BALL_MOTION; +/// Joystick hat position change +pub const SDL_EVENT_JOYSTICK_HAT_MOTION: SDL_EventType = SDL_EventType::JOYSTICK_HAT_MOTION; +/// Joystick button pressed +pub const SDL_EVENT_JOYSTICK_BUTTON_DOWN: SDL_EventType = SDL_EventType::JOYSTICK_BUTTON_DOWN; +/// Joystick button released +pub const SDL_EVENT_JOYSTICK_BUTTON_UP: SDL_EventType = SDL_EventType::JOYSTICK_BUTTON_UP; +/// A new joystick has been inserted into the system +pub const SDL_EVENT_JOYSTICK_ADDED: SDL_EventType = SDL_EventType::JOYSTICK_ADDED; +/// An opened joystick has been removed +pub const SDL_EVENT_JOYSTICK_REMOVED: SDL_EventType = SDL_EventType::JOYSTICK_REMOVED; +/// Joystick battery level change +pub const SDL_EVENT_JOYSTICK_BATTERY_UPDATED: SDL_EventType = + SDL_EventType::JOYSTICK_BATTERY_UPDATED; +/// Joystick update is complete +pub const SDL_EVENT_JOYSTICK_UPDATE_COMPLETE: SDL_EventType = + SDL_EventType::JOYSTICK_UPDATE_COMPLETE; +/// Gamepad axis motion +pub const SDL_EVENT_GAMEPAD_AXIS_MOTION: SDL_EventType = SDL_EventType::GAMEPAD_AXIS_MOTION; +/// Gamepad button pressed +pub const SDL_EVENT_GAMEPAD_BUTTON_DOWN: SDL_EventType = SDL_EventType::GAMEPAD_BUTTON_DOWN; +/// Gamepad button released +pub const SDL_EVENT_GAMEPAD_BUTTON_UP: SDL_EventType = SDL_EventType::GAMEPAD_BUTTON_UP; +/// A new gamepad has been inserted into the system +pub const SDL_EVENT_GAMEPAD_ADDED: SDL_EventType = SDL_EventType::GAMEPAD_ADDED; +/// A gamepad has been removed +pub const SDL_EVENT_GAMEPAD_REMOVED: SDL_EventType = SDL_EventType::GAMEPAD_REMOVED; +/// The gamepad mapping was updated +pub const SDL_EVENT_GAMEPAD_REMAPPED: SDL_EventType = SDL_EventType::GAMEPAD_REMAPPED; +/// Gamepad touchpad was touched +pub const SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN: SDL_EventType = SDL_EventType::GAMEPAD_TOUCHPAD_DOWN; +/// Gamepad touchpad finger was moved +pub const SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: SDL_EventType = SDL_EventType::GAMEPAD_TOUCHPAD_MOTION; +/// Gamepad touchpad finger was lifted +pub const SDL_EVENT_GAMEPAD_TOUCHPAD_UP: SDL_EventType = SDL_EventType::GAMEPAD_TOUCHPAD_UP; +/// Gamepad sensor was updated +pub const SDL_EVENT_GAMEPAD_SENSOR_UPDATE: SDL_EventType = SDL_EventType::GAMEPAD_SENSOR_UPDATE; +/// Gamepad update is complete +pub const SDL_EVENT_GAMEPAD_UPDATE_COMPLETE: SDL_EventType = SDL_EventType::GAMEPAD_UPDATE_COMPLETE; +/// Gamepad Steam handle has changed +pub const SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED: SDL_EventType = + SDL_EventType::GAMEPAD_STEAM_HANDLE_UPDATED; +pub const SDL_EVENT_FINGER_DOWN: SDL_EventType = SDL_EventType::FINGER_DOWN; +pub const SDL_EVENT_FINGER_UP: SDL_EventType = SDL_EventType::FINGER_UP; +pub const SDL_EVENT_FINGER_MOTION: SDL_EventType = SDL_EventType::FINGER_MOTION; +pub const SDL_EVENT_FINGER_CANCELED: SDL_EventType = SDL_EventType::FINGER_CANCELED; +/// Pinch gesture started +pub const SDL_EVENT_PINCH_BEGIN: SDL_EventType = SDL_EventType::PINCH_BEGIN; +/// Pinch gesture updated +pub const SDL_EVENT_PINCH_UPDATE: SDL_EventType = SDL_EventType::PINCH_UPDATE; +/// Pinch gesture ended +pub const SDL_EVENT_PINCH_END: SDL_EventType = SDL_EventType::PINCH_END; +/// The clipboard changed +pub const SDL_EVENT_CLIPBOARD_UPDATE: SDL_EventType = SDL_EventType::CLIPBOARD_UPDATE; +/// The system requests a file open +pub const SDL_EVENT_DROP_FILE: SDL_EventType = SDL_EventType::DROP_FILE; +/// text/plain drag-and-drop event +pub const SDL_EVENT_DROP_TEXT: SDL_EventType = SDL_EventType::DROP_TEXT; +/// A new set of drops is beginning (NULL filename) +pub const SDL_EVENT_DROP_BEGIN: SDL_EventType = SDL_EventType::DROP_BEGIN; +/// Current set of drops is now complete (NULL filename) +pub const SDL_EVENT_DROP_COMPLETE: SDL_EventType = SDL_EventType::DROP_COMPLETE; +/// Position while moving over the window +pub const SDL_EVENT_DROP_POSITION: SDL_EventType = SDL_EventType::DROP_POSITION; +/// A new audio device is available +pub const SDL_EVENT_AUDIO_DEVICE_ADDED: SDL_EventType = SDL_EventType::AUDIO_DEVICE_ADDED; +/// An audio device has been removed. +pub const SDL_EVENT_AUDIO_DEVICE_REMOVED: SDL_EventType = SDL_EventType::AUDIO_DEVICE_REMOVED; +/// An audio device's format has been changed by the system. +pub const SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED: SDL_EventType = + SDL_EventType::AUDIO_DEVICE_FORMAT_CHANGED; +/// A sensor was updated +pub const SDL_EVENT_SENSOR_UPDATE: SDL_EventType = SDL_EventType::SENSOR_UPDATE; +/// Pressure-sensitive pen has become available +pub const SDL_EVENT_PEN_PROXIMITY_IN: SDL_EventType = SDL_EventType::PEN_PROXIMITY_IN; +/// Pressure-sensitive pen has become unavailable +pub const SDL_EVENT_PEN_PROXIMITY_OUT: SDL_EventType = SDL_EventType::PEN_PROXIMITY_OUT; +/// Pressure-sensitive pen touched drawing surface +pub const SDL_EVENT_PEN_DOWN: SDL_EventType = SDL_EventType::PEN_DOWN; +/// Pressure-sensitive pen stopped touching drawing surface +pub const SDL_EVENT_PEN_UP: SDL_EventType = SDL_EventType::PEN_UP; +/// Pressure-sensitive pen button pressed +pub const SDL_EVENT_PEN_BUTTON_DOWN: SDL_EventType = SDL_EventType::PEN_BUTTON_DOWN; +/// Pressure-sensitive pen button released +pub const SDL_EVENT_PEN_BUTTON_UP: SDL_EventType = SDL_EventType::PEN_BUTTON_UP; +/// Pressure-sensitive pen is moving on the tablet +pub const SDL_EVENT_PEN_MOTION: SDL_EventType = SDL_EventType::PEN_MOTION; +/// Pressure-sensitive pen angle/pressure/etc changed +pub const SDL_EVENT_PEN_AXIS: SDL_EventType = SDL_EventType::PEN_AXIS; +/// A new camera device is available +pub const SDL_EVENT_CAMERA_DEVICE_ADDED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_ADDED; +/// A camera device has been removed. +pub const SDL_EVENT_CAMERA_DEVICE_REMOVED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_REMOVED; +/// A camera device has been approved for use by the user. +pub const SDL_EVENT_CAMERA_DEVICE_APPROVED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_APPROVED; +/// A camera device has been denied for use by the user. +pub const SDL_EVENT_CAMERA_DEVICE_DENIED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_DENIED; +/// The render targets have been reset and their contents need to be updated +pub const SDL_EVENT_RENDER_TARGETS_RESET: SDL_EventType = SDL_EventType::RENDER_TARGETS_RESET; +/// The device has been reset and all textures need to be recreated +pub const SDL_EVENT_RENDER_DEVICE_RESET: SDL_EventType = SDL_EventType::RENDER_DEVICE_RESET; +/// The device has been lost and can't be recovered. +pub const SDL_EVENT_RENDER_DEVICE_LOST: SDL_EventType = SDL_EventType::RENDER_DEVICE_LOST; +pub const SDL_EVENT_PRIVATE0: SDL_EventType = SDL_EventType::PRIVATE0; +pub const SDL_EVENT_PRIVATE1: SDL_EventType = SDL_EventType::PRIVATE1; +pub const SDL_EVENT_PRIVATE2: SDL_EventType = SDL_EventType::PRIVATE2; +pub const SDL_EVENT_PRIVATE3: SDL_EventType = SDL_EventType::PRIVATE3; +/// Signals the end of an event poll cycle +pub const SDL_EVENT_POLL_SENTINEL: SDL_EventType = SDL_EventType::POLL_SENTINEL; +/// Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use, +/// and should be allocated with [`SDL_RegisterEvents()`] +pub const SDL_EVENT_USER: SDL_EventType = SDL_EventType::USER; +/// * This last event is only for bounding internal arrays +pub const SDL_EVENT_LAST: SDL_EventType = SDL_EventType::LAST; +pub const SDL_EVENT_ENUM_PADDING: SDL_EventType = SDL_EventType::ENUM_PADDING; + +impl SDL_EventType { + /// Initialize a `SDL_EventType` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_EventType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_EventType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::events::METADATA_SDL_EventType; +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Fields shared by every event +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_CommonEvent { + /// Event type, shared with all events, Uint32 to cover user events which are not in the [`SDL_EventType`] enumeration + pub r#type: Uint32, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Display state change event data (event.display.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_DisplayEvent { + /// SDL_EVENT_DISPLAY_* + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The associated display + pub displayID: SDL_DisplayID, + /// event dependent data + pub data1: Sint32, + /// event dependent data + pub data2: Sint32, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Window state change event data (event.window.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_WindowEvent { + /// SDL_EVENT_WINDOW_* + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The associated window + pub windowID: SDL_WindowID, + /// event dependent data + pub data1: Sint32, + /// event dependent data + pub data2: Sint32, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Keyboard device event structure (event.kdevice.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_KeyboardDeviceEvent { + /// [`SDL_EVENT_KEYBOARD_ADDED`] or [`SDL_EVENT_KEYBOARD_REMOVED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The keyboard instance id + pub which: SDL_KeyboardID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Keyboard button event structure (event.key.*) +/// +/// The `key` is the base [`SDL_Keycode`] generated by pressing the `scancode` +/// using the current keyboard layout, applying any options specified in +/// [`SDL_HINT_KEYCODE_OPTIONS`]. You can get the [`SDL_Keycode`] corresponding to the +/// event scancode and modifiers directly from the keyboard layout, bypassing +/// [`SDL_HINT_KEYCODE_OPTIONS`], by calling [`SDL_GetKeyFromScancode()`]. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetKeyFromScancode`] +/// - [`SDL_HINT_KEYCODE_OPTIONS`] +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_KeyboardEvent { + /// [`SDL_EVENT_KEY_DOWN`] or [`SDL_EVENT_KEY_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with keyboard focus, if any + pub windowID: SDL_WindowID, + /// The keyboard instance id, or 0 if unknown or virtual + pub which: SDL_KeyboardID, + /// SDL physical key code + pub scancode: SDL_Scancode, + /// SDL virtual key code + pub key: SDL_Keycode, + /// current key modifiers + pub r#mod: SDL_Keymod, + /// The platform dependent scancode for this event + pub raw: Uint16, + /// true if the key is pressed + pub down: ::core::primitive::bool, + /// true if this is a key repeat + pub repeat: ::core::primitive::bool, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Keyboard text editing event structure (event.edit.*) +/// +/// The start cursor is the position, in UTF-8 characters, where new typing +/// will be inserted into the editing text. The length is the number of UTF-8 +/// characters that will be replaced by new typing. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TextEditingEvent { + /// [`SDL_EVENT_TEXT_EDITING`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with keyboard focus, if any + pub windowID: SDL_WindowID, + /// The editing text + pub text: *const ::core::ffi::c_char, + /// The start cursor of selected editing text, or -1 if not set + pub start: Sint32, + /// The length of selected editing text, or -1 if not set + pub length: Sint32, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_TextEditingEvent { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Keyboard IME candidates event structure (event.edit_candidates.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TextEditingCandidatesEvent { + /// [`SDL_EVENT_TEXT_EDITING_CANDIDATES`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with keyboard focus, if any + pub windowID: SDL_WindowID, + /// The list of candidates, or NULL if there are no candidates available + pub candidates: *const *const ::core::ffi::c_char, + /// The number of strings in `candidates` + pub num_candidates: Sint32, + /// The index of the selected candidate, or -1 if no candidate is selected + pub selected_candidate: Sint32, + /// true if the list is horizontal, false if it's vertical + pub horizontal: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_TextEditingCandidatesEvent { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Keyboard text input event structure (event.text.*) +/// +/// This event will never be delivered unless text input is enabled by calling +/// [`SDL_StartTextInput()`]. Text input is disabled by default! +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_StartTextInput`] +/// - [`SDL_StopTextInput`] +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TextInputEvent { + /// [`SDL_EVENT_TEXT_INPUT`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with keyboard focus, if any + pub windowID: SDL_WindowID, + /// The input text, UTF-8 encoded + pub text: *const ::core::ffi::c_char, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_TextInputEvent { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Mouse device event structure (event.mdevice.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MouseDeviceEvent { + /// [`SDL_EVENT_MOUSE_ADDED`] or [`SDL_EVENT_MOUSE_REMOVED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The mouse instance id + pub which: SDL_MouseID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Mouse motion event structure (event.motion.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MouseMotionEvent { + /// [`SDL_EVENT_MOUSE_MOTION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with mouse focus, if any + pub windowID: SDL_WindowID, + /// The mouse instance id in relative mode, [`SDL_TOUCH_MOUSEID`] for touch events, [`SDL_PEN_MOUSEID`] for pen events, or 0 + pub which: SDL_MouseID, + /// The current button state + pub state: SDL_MouseButtonFlags, + /// X coordinate, relative to window + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub y: ::core::ffi::c_float, + /// The relative motion in the X direction + pub xrel: ::core::ffi::c_float, + /// The relative motion in the Y direction + pub yrel: ::core::ffi::c_float, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Mouse button event structure (event.button.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MouseButtonEvent { + /// [`SDL_EVENT_MOUSE_BUTTON_DOWN`] or [`SDL_EVENT_MOUSE_BUTTON_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with mouse focus, if any + pub windowID: SDL_WindowID, + /// The mouse instance id in relative mode, [`SDL_TOUCH_MOUSEID`] for touch events, or 0 + pub which: SDL_MouseID, + /// The mouse button index + pub button: Uint8, + /// true if the button is pressed + pub down: ::core::primitive::bool, + /// 1 for single-click, 2 for double-click, etc. + pub clicks: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding: Uint8, + /// X coordinate, relative to window + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub y: ::core::ffi::c_float, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Mouse wheel event structure (event.wheel.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MouseWheelEvent { + /// [`SDL_EVENT_MOUSE_WHEEL`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with mouse focus, if any + pub windowID: SDL_WindowID, + /// The mouse instance id in relative mode or 0 + pub which: SDL_MouseID, + /// The amount scrolled horizontally, positive to the right and negative to the left + pub x: ::core::ffi::c_float, + /// The amount scrolled vertically, positive away from the user and negative toward the user + pub y: ::core::ffi::c_float, + /// Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back + pub direction: SDL_MouseWheelDirection, + /// X coordinate, relative to window + pub mouse_x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub mouse_y: ::core::ffi::c_float, + /// The amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12) + pub integer_x: Sint32, + /// The amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12) + pub integer_y: Sint32, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Joystick axis motion event structure (event.jaxis.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoyAxisEvent { + /// [`SDL_EVENT_JOYSTICK_AXIS_MOTION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The joystick axis index + pub axis: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, + /// The axis value (range: -32768 to 32767) + pub value: Sint16, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding4: Uint16, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Joystick trackball motion event structure (event.jball.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoyBallEvent { + /// [`SDL_EVENT_JOYSTICK_BALL_MOTION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The joystick trackball index + pub ball: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, + /// The relative motion in the X direction + pub xrel: Sint16, + /// The relative motion in the Y direction + pub yrel: Sint16, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Joystick hat position change event structure (event.jhat.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoyHatEvent { + /// [`SDL_EVENT_JOYSTICK_HAT_MOTION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The joystick hat index + pub hat: Uint8, + /// The hat position value. + /// ## See also + /// - [`SDL_HAT_LEFTUP`] [`SDL_HAT_UP`] [`SDL_HAT_RIGHTUP`] + /// - [`SDL_HAT_LEFT`] [`SDL_HAT_CENTERED`] [`SDL_HAT_RIGHT`] + /// - [`SDL_HAT_LEFTDOWN`] [`SDL_HAT_DOWN`] [`SDL_HAT_RIGHTDOWN`] + /// + /// Note that zero means the POV is centered. + pub value: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Joystick button event structure (event.jbutton.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoyButtonEvent { + /// [`SDL_EVENT_JOYSTICK_BUTTON_DOWN`] or [`SDL_EVENT_JOYSTICK_BUTTON_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The joystick button index + pub button: Uint8, + /// true if the button is pressed + pub down: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Joystick device event structure (event.jdevice.*) +/// +/// SDL will send JOYSTICK_ADDED events for devices that are already plugged in +/// during [`SDL_Init`]. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GamepadDeviceEvent`] +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoyDeviceEvent { + /// [`SDL_EVENT_JOYSTICK_ADDED`] or [`SDL_EVENT_JOYSTICK_REMOVED`] or [`SDL_EVENT_JOYSTICK_UPDATE_COMPLETE`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Joystick battery level change event structure (event.jbattery.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoyBatteryEvent { + /// [`SDL_EVENT_JOYSTICK_BATTERY_UPDATED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The joystick battery state + pub state: SDL_PowerState, + /// The joystick battery percent charge remaining + pub percent: ::core::ffi::c_int, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Gamepad axis motion event structure (event.gaxis.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadAxisEvent { + /// [`SDL_EVENT_GAMEPAD_AXIS_MOTION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The gamepad axis ([`SDL_GamepadAxis`]) + pub axis: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, + /// The axis value (range: -32768 to 32767) + pub value: Sint16, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding4: Uint16, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Gamepad button event structure (event.gbutton.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadButtonEvent { + /// [`SDL_EVENT_GAMEPAD_BUTTON_DOWN`] or [`SDL_EVENT_GAMEPAD_BUTTON_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The gamepad button ([`SDL_GamepadButton`]) + pub button: Uint8, + /// true if the button is pressed + pub down: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Gamepad device event structure (event.gdevice.*) +/// +/// Joysticks that are supported gamepads receive both an [`SDL_JoyDeviceEvent`] +/// and an [`SDL_GamepadDeviceEvent`]. +/// +/// SDL will send GAMEPAD_ADDED events for joysticks that are already plugged +/// in during [`SDL_Init()`] and are recognized as gamepads. It will also send +/// events for joysticks that get gamepad mappings at runtime. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_JoyDeviceEvent`] +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadDeviceEvent { + /// [`SDL_EVENT_GAMEPAD_ADDED`], [`SDL_EVENT_GAMEPAD_REMOVED`], or [`SDL_EVENT_GAMEPAD_REMAPPED`], [`SDL_EVENT_GAMEPAD_UPDATE_COMPLETE`] or [`SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Gamepad touchpad event structure (event.gtouchpad.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadTouchpadEvent { + /// [`SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN`] or [`SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION`] or [`SDL_EVENT_GAMEPAD_TOUCHPAD_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The index of the touchpad + pub touchpad: Sint32, + /// The index of the finger on the touchpad + pub finger: Sint32, + /// Normalized in the range 0...1 with 0 being on the left + pub x: ::core::ffi::c_float, + /// Normalized in the range 0...1 with 0 being at the top + pub y: ::core::ffi::c_float, + /// Normalized in the range 0...1 + pub pressure: ::core::ffi::c_float, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Gamepad sensor event structure (event.gsensor.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadSensorEvent { + /// [`SDL_EVENT_GAMEPAD_SENSOR_UPDATE`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The joystick instance id + pub which: SDL_JoystickID, + /// The type of the sensor, one of the values of [`SDL_SensorType`] + pub sensor: Sint32, + /// Up to 3 values from the sensor, as defined in SDL_sensor.h + pub data: [::core::ffi::c_float; 3], + /// The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock + pub sensor_timestamp: Uint64, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Audio device event structure (event.adevice.*) +/// +/// Note that SDL will send a [`SDL_EVENT_AUDIO_DEVICE_ADDED`] event for every +/// device it discovers during initialization. After that, this event will only +/// arrive when a device is hotplugged during the program's run. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_AudioDeviceEvent { + /// [`SDL_EVENT_AUDIO_DEVICE_ADDED`], or [`SDL_EVENT_AUDIO_DEVICE_REMOVED`], or [`SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// [`SDL_AudioDeviceID`] for the device being added or removed or changing + pub which: SDL_AudioDeviceID, + /// false if a playback device, true if a recording device. + pub recording: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Camera device event structure (event.cdevice.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_CameraDeviceEvent { + /// [`SDL_EVENT_CAMERA_DEVICE_ADDED`], [`SDL_EVENT_CAMERA_DEVICE_REMOVED`], [`SDL_EVENT_CAMERA_DEVICE_APPROVED`], [`SDL_EVENT_CAMERA_DEVICE_DENIED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// [`SDL_CameraID`] for the device being added or removed or changing + pub which: SDL_CameraID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Renderer event structure (event.render.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_RenderEvent { + /// [`SDL_EVENT_RENDER_TARGETS_RESET`], [`SDL_EVENT_RENDER_DEVICE_RESET`], [`SDL_EVENT_RENDER_DEVICE_LOST`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window containing the renderer in question. + pub windowID: SDL_WindowID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Touch finger event structure (event.tfinger.*) +/// +/// Coordinates in this event are normalized. `x` and `y` are normalized to a +/// range between 0.0f and 1.0f, relative to the window, so (0,0) is the top +/// left and (1,1) is the bottom right. Delta coordinates `dx` and `dy` are +/// normalized in the ranges of -1.0f (traversed all the way from the bottom or +/// right to all the way up or left) to 1.0f (traversed all the way from the +/// top or left to all the way down or right). +/// +/// Note that while the coordinates are _normalized_, they are not _clamped_, +/// which means in some circumstances you can get a value outside of this +/// range. For example, a renderer using logical presentation might give a +/// negative value when the touch is in the letterboxing. Some platforms might +/// report a touch outside of the window, which will also be outside of the +/// range. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TouchFingerEvent { + /// [`SDL_EVENT_FINGER_DOWN`], [`SDL_EVENT_FINGER_UP`], [`SDL_EVENT_FINGER_MOTION`], or [`SDL_EVENT_FINGER_CANCELED`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The touch device id + pub touchID: SDL_TouchID, + pub fingerID: SDL_FingerID, + /// Normalized in the range 0...1 + pub x: ::core::ffi::c_float, + /// Normalized in the range 0...1 + pub y: ::core::ffi::c_float, + /// Normalized in the range -1...1 + pub dx: ::core::ffi::c_float, + /// Normalized in the range -1...1 + pub dy: ::core::ffi::c_float, + /// Normalized in the range 0...1 + pub pressure: ::core::ffi::c_float, + /// The window underneath the finger, if any + pub windowID: SDL_WindowID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// * Pinch event structure (event.pinch.*) +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PinchFingerEvent { + /// ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The scale change since the last [`SDL_EVENT_PINCH_UPDATE`]. Scale < 1 is "zoom out". Scale > 1 is "zoom in". + pub scale: ::core::ffi::c_float, + /// The window underneath the finger, if any + pub windowID: SDL_WindowID, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Pressure-sensitive pen proximity event structure (event.pproximity.*) +/// +/// When a pen becomes visible to the system (it is close enough to a tablet, +/// etc), SDL will send an [`SDL_EVENT_PEN_PROXIMITY_IN`] event with the new pen's +/// ID. This ID is valid until the pen leaves proximity again (has been removed +/// from the tablet's area, the tablet has been unplugged, etc). If the same +/// pen reenters proximity again, it will be given a new ID. +/// +/// Note that "proximity" means "close enough for the tablet to know the tool +/// is there." The pen touching and lifting off from the tablet while not +/// leaving the area are handled by [`SDL_EVENT_PEN_DOWN`] and [`SDL_EVENT_PEN_UP`]. +/// +/// Not all platforms have a window associated with the pen during proximity +/// events. Some wait until motion/button/etc events to offer this info. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PenProximityEvent { + /// [`SDL_EVENT_PEN_PROXIMITY_IN`] or [`SDL_EVENT_PEN_PROXIMITY_OUT`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with pen focus, if any + pub windowID: SDL_WindowID, + /// The pen instance id + pub which: SDL_PenID, + /// Complete pen input state at time of event (added in 3.4.16). + pub pen_state: SDL_PenInputFlags, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Pressure-sensitive pen motion event structure (event.pmotion.*) +/// +/// Depending on the hardware, you may get motion events when the pen is not +/// touching a tablet, for tracking a pen even when it isn't drawing. You +/// should listen for [`SDL_EVENT_PEN_DOWN`] and [`SDL_EVENT_PEN_UP`] events, or check +/// `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when +/// dealing with pen motion. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PenMotionEvent { + /// [`SDL_EVENT_PEN_MOTION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with pen focus, if any + pub windowID: SDL_WindowID, + /// The pen instance id + pub which: SDL_PenID, + /// Complete pen input state at time of event + pub pen_state: SDL_PenInputFlags, + /// X coordinate, relative to window + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub y: ::core::ffi::c_float, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Pressure-sensitive pen touched event structure (event.ptouch.*) +/// +/// These events come when a pen touches a surface (a tablet, etc), or lifts +/// off from one. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PenTouchEvent { + /// [`SDL_EVENT_PEN_DOWN`] or [`SDL_EVENT_PEN_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with pen focus, if any + pub windowID: SDL_WindowID, + /// The pen instance id + pub which: SDL_PenID, + /// Complete pen input state at time of event + pub pen_state: SDL_PenInputFlags, + /// X coordinate, relative to window + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub y: ::core::ffi::c_float, + /// true if eraser end is used (not all pens support this). + pub eraser: ::core::primitive::bool, + /// true if the pen is touching or false if the pen is lifted off + pub down: ::core::primitive::bool, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Pressure-sensitive pen button event structure (event.pbutton.*) +/// +/// This is for buttons on the pen itself that the user might click. The pen +/// itself pressing down to draw triggers a [`SDL_EVENT_PEN_DOWN`] event instead. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PenButtonEvent { + /// [`SDL_EVENT_PEN_BUTTON_DOWN`] or [`SDL_EVENT_PEN_BUTTON_UP`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with mouse focus, if any + pub windowID: SDL_WindowID, + /// The pen instance id + pub which: SDL_PenID, + /// Complete pen input state at time of event + pub pen_state: SDL_PenInputFlags, + /// X coordinate, relative to window + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub y: ::core::ffi::c_float, + /// The pen button index (first button is 1). + pub button: Uint8, + /// true if the button is pressed + pub down: ::core::primitive::bool, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Pressure-sensitive pen pressure / angle event structure (event.paxis.*) +/// +/// You might get some of these events even if the pen isn't touching the +/// tablet. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PenAxisEvent { + /// [`SDL_EVENT_PEN_AXIS`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window with pen focus, if any + pub windowID: SDL_WindowID, + /// The pen instance id + pub which: SDL_PenID, + /// Complete pen input state at time of event + pub pen_state: SDL_PenInputFlags, + /// X coordinate, relative to window + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window + pub y: ::core::ffi::c_float, + /// Axis that has changed + pub axis: SDL_PenAxis, + /// New value of axis + pub value: ::core::ffi::c_float, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// An event used to drop text or request a file open by the system +/// (event.drop.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_DropEvent { + /// [`SDL_EVENT_DROP_BEGIN`] or [`SDL_EVENT_DROP_FILE`] or [`SDL_EVENT_DROP_TEXT`] or [`SDL_EVENT_DROP_COMPLETE`] or [`SDL_EVENT_DROP_POSITION`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The window that was dropped on, if any + pub windowID: SDL_WindowID, + /// X coordinate, relative to window (not on begin) + pub x: ::core::ffi::c_float, + /// Y coordinate, relative to window (not on begin) + pub y: ::core::ffi::c_float, + /// The source app that sent this drop event, or NULL if that isn't available + pub source: *const ::core::ffi::c_char, + /// The text for [`SDL_EVENT_DROP_TEXT`] and the file name for [`SDL_EVENT_DROP_FILE`], NULL for other events + pub data: *const ::core::ffi::c_char, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_DropEvent { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// An event triggered when the clipboard contents have changed +/// (event.clipboard.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_ClipboardEvent { + /// [`SDL_EVENT_CLIPBOARD_UPDATE`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// are we owning the clipboard (internal update) + pub owner: ::core::primitive::bool, + /// number of mime types + pub num_mime_types: Sint32, + /// current mime types + pub mime_types: *mut *const ::core::ffi::c_char, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_ClipboardEvent { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// Sensor event structure (event.sensor.*) +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_SensorEvent { + /// [`SDL_EVENT_SENSOR_UPDATE`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The instance ID of the sensor + pub which: SDL_SensorID, + /// Up to 6 values from the sensor - additional values can be queried using [`SDL_GetSensorData()`] + pub data: [::core::ffi::c_float; 6], + /// The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock + pub sensor_timestamp: Uint64, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// The "quit requested" event +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_QuitEvent { + /// [`SDL_EVENT_QUIT`] + pub r#type: SDL_EventType, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// A user-defined event type (event.user.*) +/// +/// This event is unique; it is never created by SDL, but only by the +/// application. The event can be pushed onto the event queue using +/// [`SDL_PushEvent()`]. The contents of the structure members are completely up to +/// the programmer; the only requirement is that '''type''' is a value obtained +/// from [`SDL_RegisterEvents()`]. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_UserEvent { + /// [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`], Uint32 because these are not in the [`SDL_EventType`] enumeration + pub r#type: Uint32, + pub reserved: Uint32, + /// In nanoseconds, populated using [`SDL_GetTicksNS()`] + pub timestamp: Uint64, + /// The associated window if any + pub windowID: SDL_WindowID, + /// User defined event code + pub code: Sint32, + /// User defined data pointer + pub data1: *mut ::core::ffi::c_void, + /// User defined data pointer + pub data2: *mut ::core::ffi::c_void, + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_UserEvent { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +impl SDL_Event { + /// Get the type of this event + #[inline(always)] + pub const fn event_type(&self) -> SDL_EventType { + SDL_EventType(unsafe { self.r#type }) + } +} + +#[allow(clippy::manual_non_exhaustive)] // https://github.com/rust-lang/rust/issues/132699 +/// The structure for all events in SDL. +/// +/// The [`SDL_Event`] structure is the core of all event handling in SDL. [`SDL_Event`] +/// is a union of all event structures used in SDL. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent. +#[repr(C)] +#[derive(Clone, Copy)] +pub union SDL_Event { + /// Event type, shared with all events, Uint32 to cover user events which are not in the [`SDL_EventType`] enumeration + pub r#type: Uint32, + /// Common event data + pub common: SDL_CommonEvent, + /// Display event data + pub display: SDL_DisplayEvent, + /// Window event data + pub window: SDL_WindowEvent, + /// Keyboard device change event data + pub kdevice: SDL_KeyboardDeviceEvent, + /// Keyboard event data + pub key: SDL_KeyboardEvent, + /// Text editing event data + pub edit: SDL_TextEditingEvent, + /// Text editing candidates event data + pub edit_candidates: SDL_TextEditingCandidatesEvent, + /// Text input event data + pub text: SDL_TextInputEvent, + /// Mouse device change event data + pub mdevice: SDL_MouseDeviceEvent, + /// Mouse motion event data + pub motion: SDL_MouseMotionEvent, + /// Mouse button event data + pub button: SDL_MouseButtonEvent, + /// Mouse wheel event data + pub wheel: SDL_MouseWheelEvent, + /// Joystick device change event data + pub jdevice: SDL_JoyDeviceEvent, + /// Joystick axis event data + pub jaxis: SDL_JoyAxisEvent, + /// Joystick ball event data + pub jball: SDL_JoyBallEvent, + /// Joystick hat event data + pub jhat: SDL_JoyHatEvent, + /// Joystick button event data + pub jbutton: SDL_JoyButtonEvent, + /// Joystick battery event data + pub jbattery: SDL_JoyBatteryEvent, + /// Gamepad device event data + pub gdevice: SDL_GamepadDeviceEvent, + /// Gamepad axis event data + pub gaxis: SDL_GamepadAxisEvent, + /// Gamepad button event data + pub gbutton: SDL_GamepadButtonEvent, + /// Gamepad touchpad event data + pub gtouchpad: SDL_GamepadTouchpadEvent, + /// Gamepad sensor event data + pub gsensor: SDL_GamepadSensorEvent, + /// Audio device event data + pub adevice: SDL_AudioDeviceEvent, + /// Camera device event data + pub cdevice: SDL_CameraDeviceEvent, + /// Sensor event data + pub sensor: SDL_SensorEvent, + /// Quit request event data + pub quit: SDL_QuitEvent, + /// Custom event data + pub user: SDL_UserEvent, + /// Touch finger event data + pub tfinger: SDL_TouchFingerEvent, + /// Pinch event data + pub pinch: SDL_PinchFingerEvent, + /// Pen proximity event data + pub pproximity: SDL_PenProximityEvent, + /// Pen tip touching event data + pub ptouch: SDL_PenTouchEvent, + /// Pen motion event data + pub pmotion: SDL_PenMotionEvent, + /// Pen button event data + pub pbutton: SDL_PenButtonEvent, + /// Pen axis event data + pub paxis: SDL_PenAxisEvent, + /// Render event data + pub render: SDL_RenderEvent, + /// Drag and drop event data + pub drop: SDL_DropEvent, + /// Clipboard event data + pub clipboard: SDL_ClipboardEvent, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding: [Uint8; 128], + #[doc(hidden)] + #[deprecated(note = "this struct is non-exhaustive; init with `..Default::default()`")] + pub __non_exhaustive: (), +} + +impl ::core::default::Default for SDL_Event { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +const _: () = ::core::assert!( + (::core::mem::size_of::() == crate::size_of_field!(SDL_Event, padding)) +); + +unsafe extern "C" { + /// Pump the event loop, gathering events from the input devices. + /// + /// This function updates the event queue and internal input device state. + /// + /// [`SDL_PumpEvents()`] gathers all the pending input information from devices and + /// places it in the event queue. Without calls to [`SDL_PumpEvents()`] no events + /// would ever be placed on the queue. Often the need for calls to + /// [`SDL_PumpEvents()`] is hidden from the user since [`SDL_PollEvent()`] and + /// [`SDL_WaitEvent()`] implicitly call [`SDL_PumpEvents()`]. However, if you are not + /// polling or waiting for events (e.g. you are filtering them), then you must + /// call [`SDL_PumpEvents()`] to force an event queue update. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PollEvent`] + /// - [`SDL_WaitEvent`] + pub fn SDL_PumpEvents(); +} + +/// The type of action to request from [`SDL_PeepEvents()`]. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`ADDEVENT`](SDL_EventAction::ADDEVENT) | [`SDL_ADDEVENT`] | Add events to the back of the queue. | +/// | [`PEEKEVENT`](SDL_EventAction::PEEKEVENT) | [`SDL_PEEKEVENT`] | Check but don't remove events from the queue front. | +/// | [`GETEVENT`](SDL_EventAction::GETEVENT) | [`SDL_GETEVENT`] | Retrieve/remove events from the front of the queue. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_EventAction(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_EventAction { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_EventAction) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_EventAction) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_EventAction { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::ADDEVENT => "SDL_ADDEVENT", + Self::PEEKEVENT => "SDL_PEEKEVENT", + Self::GETEVENT => "SDL_GETEVENT", + + _ => return write!(f, "SDL_EventAction({})", self.0), + }) + } +} + +impl SDL_EventAction { + /// Add events to the back of the queue. + pub const ADDEVENT: Self = Self((0 as ::core::ffi::c_int)); + /// Check but don't remove events from the queue front. + pub const PEEKEVENT: Self = Self((1 as ::core::ffi::c_int)); + /// Retrieve/remove events from the front of the queue. + pub const GETEVENT: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Add events to the back of the queue. +pub const SDL_ADDEVENT: SDL_EventAction = SDL_EventAction::ADDEVENT; +/// Check but don't remove events from the queue front. +pub const SDL_PEEKEVENT: SDL_EventAction = SDL_EventAction::PEEKEVENT; +/// Retrieve/remove events from the front of the queue. +pub const SDL_GETEVENT: SDL_EventAction = SDL_EventAction::GETEVENT; + +impl SDL_EventAction { + /// Initialize a `SDL_EventAction` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_EventAction { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_EventAction { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::events::METADATA_SDL_EventAction; +} + +unsafe extern "C" { + /// Check the event queue for messages and optionally return them. + /// + /// `action` may be any of the following: + /// + /// - [`SDL_ADDEVENT`]\: up to `numevents` events will be added to the back of the + /// event queue. + /// - [`SDL_PEEKEVENT`]\: `numevents` events at the front of the event queue, + /// within the specified minimum and maximum type, will be returned to the + /// caller and will _not_ be removed from the queue. If you pass NULL for + /// `events`, then `numevents` is ignored and the total number of matching + /// events will be returned. + /// - [`SDL_GETEVENT`]\: up to `numevents` events at the front of the event queue, + /// within the specified minimum and maximum type, will be returned to the + /// caller and will be removed from the queue. + /// + /// You may have to call [`SDL_PumpEvents()`] before calling this function. + /// Otherwise, the events may not be ready to be filtered when you call + /// [`SDL_PeepEvents()`]. + /// + /// ## Parameters + /// - `events`: destination buffer for the retrieved events, may be NULL to + /// leave the events in the queue and return the number of events + /// that would have been stored. + /// - `numevents`: if action is [`SDL_ADDEVENT`], the number of events to add + /// back to the event queue; if action is [`SDL_PEEKEVENT`] or + /// [`SDL_GETEVENT`], the maximum number of events to retrieve. + /// - `action`: action to take; see [Remarks](#remarks) for details. + /// - `minType`: minimum value of the event type to be considered; + /// [`SDL_EVENT_FIRST`] is a safe choice. + /// - `maxType`: maximum value of the event type to be considered; + /// [`SDL_EVENT_LAST`] is a safe choice. + /// + /// ## Return value + /// Returns the number of events actually stored or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PollEvent`] + /// - [`SDL_PumpEvents`] + /// - [`SDL_PushEvent`] + pub fn SDL_PeepEvents( + events: *mut SDL_Event, + numevents: ::core::ffi::c_int, + action: SDL_EventAction, + minType: Uint32, + maxType: Uint32, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Check for the existence of a certain event type in the event queue. + /// + /// If you need to check for a range of event types, use [`SDL_HasEvents()`] + /// instead. + /// + /// ## Parameters + /// - `type`: the type of event to be queried; see [`SDL_EventType`] for details. + /// + /// ## Return value + /// Returns true if events matching `type` are present, or false if events + /// matching `type` are not present. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasEvents`] + pub fn SDL_HasEvent(r#type: Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Check for the existence of certain event types in the event queue. + /// + /// If you need to check for a single event type, use [`SDL_HasEvent()`] instead. + /// + /// ## Parameters + /// - `minType`: the low end of event type to be queried, inclusive; see + /// [`SDL_EventType`] for details. + /// - `maxType`: the high end of event type to be queried, inclusive; see + /// [`SDL_EventType`] for details. + /// + /// ## Return value + /// Returns true if events with type >= `minType` and <= `maxType` are + /// present, or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasEvents`] + pub fn SDL_HasEvents(minType: Uint32, maxType: Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear events of a specific type from the event queue. + /// + /// This will unconditionally remove any events from the queue that match + /// `type`. If you need to remove a range of event types, use [`SDL_FlushEvents()`] + /// instead. + /// + /// It's also normal to just ignore events you don't care about in your event + /// loop without calling this function. + /// + /// This function only affects currently queued events. If you want to make + /// sure that all pending OS events are flushed, you can call [`SDL_PumpEvents()`] + /// on the main thread immediately before the flush call. + /// + /// If you have user events with custom data that needs to be freed, you should + /// use [`SDL_PeepEvents()`] to remove and clean up those events before calling + /// this function. + /// + /// ## Parameters + /// - `type`: the type of event to be cleared; see [`SDL_EventType`] for details. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_FlushEvents`] + pub fn SDL_FlushEvent(r#type: Uint32); +} + +unsafe extern "C" { + /// Clear events of a range of types from the event queue. + /// + /// This will unconditionally remove any events from the queue that are in the + /// range of `minType` to `maxType`, inclusive. If you need to remove a single + /// event type, use [`SDL_FlushEvent()`] instead. + /// + /// It's also normal to just ignore events you don't care about in your event + /// loop without calling this function. + /// + /// This function only affects currently queued events. If you want to make + /// sure that all pending OS events are flushed, you can call [`SDL_PumpEvents()`] + /// on the main thread immediately before the flush call. + /// + /// ## Parameters + /// - `minType`: the low end of event type to be cleared, inclusive; see + /// [`SDL_EventType`] for details. + /// - `maxType`: the high end of event type to be cleared, inclusive; see + /// [`SDL_EventType`] for details. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_FlushEvent`] + pub fn SDL_FlushEvents(minType: Uint32, maxType: Uint32); +} + +unsafe extern "C" { + /// Poll for currently pending events. + /// + /// If `event` is not NULL, the next event is removed from the queue and stored + /// in the [`SDL_Event`] structure pointed to by `event`. + /// + /// If `event` is NULL, it simply returns true if there is an event in the + /// queue, but will not remove it from the queue. + /// + /// As this function may implicitly call [`SDL_PumpEvents()`], you can only call + /// this function in the thread that initialized the video subsystem. + /// + /// [`SDL_PollEvent()`] is the favored way of receiving system events since it can + /// be done from the main loop and does not suspend the main loop while waiting + /// on an event to be posted. + /// + /// The common practice is to fully process the event queue once every frame, + /// usually as a first step before updating the game's state: + /// + /// ```c + /// while (game_is_still_running) { + /// SDL_Event event; + /// while (SDL_PollEvent(&event)) { // poll until all events are handled! + /// // decide what to do with this event. + /// } + /// + /// // update game state, draw the current frame + /// } + /// ``` + /// + /// Note that Windows (and possibly other platforms) has a quirk about how it + /// handles events while dragging/resizing a window, which can cause this + /// function to block for significant amounts of time. Technical explanations + /// and solutions are discussed on the wiki: + /// + /// + /// + /// ## Parameters + /// - `event`: the [`SDL_Event`] structure to be filled with the next event from + /// the queue, or NULL. + /// + /// ## Return value + /// Returns true if this got an event or false if there are none available. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PushEvent`] + /// - [`SDL_WaitEvent`] + /// - [`SDL_WaitEventTimeout`] + pub fn SDL_PollEvent(event: *mut SDL_Event) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Wait indefinitely for the next available event. + /// + /// If `event` is not NULL, the next event is removed from the queue and stored + /// in the [`SDL_Event`] structure pointed to by `event`. + /// + /// As this function may implicitly call [`SDL_PumpEvents()`], you can only call + /// this function in the thread that initialized the video subsystem. + /// + /// ## Parameters + /// - `event`: the [`SDL_Event`] structure to be filled in with the next event + /// from the queue, or NULL. + /// + /// ## Return value + /// Returns true on success or false if there was an error while waiting for + /// events; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PollEvent`] + /// - [`SDL_PushEvent`] + /// - [`SDL_WaitEventTimeout`] + pub fn SDL_WaitEvent(event: *mut SDL_Event) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Wait until the specified timeout (in milliseconds) for the next available + /// event. + /// + /// If `event` is not NULL, the next event is removed from the queue and stored + /// in the [`SDL_Event`] structure pointed to by `event`. + /// + /// As this function may implicitly call [`SDL_PumpEvents()`], you can only call + /// this function in the thread that initialized the video subsystem. + /// + /// The timeout is not guaranteed, the actual wait time could be longer due to + /// system scheduling. + /// + /// ## Parameters + /// - `event`: the [`SDL_Event`] structure to be filled in with the next event + /// from the queue, or NULL. + /// - `timeoutMS`: the maximum number of milliseconds to wait for the next + /// available event. + /// + /// ## Return value + /// Returns true if this got an event or false if the timeout elapsed without + /// any events available. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PollEvent`] + /// - [`SDL_PushEvent`] + /// - [`SDL_WaitEvent`] + pub fn SDL_WaitEventTimeout( + event: *mut SDL_Event, + timeoutMS: Sint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Add an event to the event queue. + /// + /// The event queue can actually be used as a two way communication channel. + /// Not only can events be read from the queue, but the user can also push + /// their own events onto it. `event` is a pointer to the event structure you + /// wish to push onto the queue. The event is copied into the queue, and the + /// caller may dispose of the memory pointed to after [`SDL_PushEvent()`] returns. + /// + /// Note: Pushing device input events onto the queue doesn't modify the state + /// of the device within SDL. + /// + /// Note: Events pushed onto the queue with [`SDL_PushEvent()`] get passed through + /// the event filter but events added with [`SDL_PeepEvents()`] do not. + /// + /// For pushing application-specific events, please use [`SDL_RegisterEvents()`] to + /// get an event type that does not conflict with other code that also wants + /// its own custom event types. + /// + /// ## Parameters + /// - `event`: the [`SDL_Event`] to be added to the queue. + /// + /// ## Return value + /// Returns true on success, false if the event was filtered or on failure; + /// call [`SDL_GetError()`] for more information. A common reason for + /// error is the event queue being full. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PeepEvents`] + /// - [`SDL_PollEvent`] + /// - [`SDL_RegisterEvents`] + pub fn SDL_PushEvent(event: *mut SDL_Event) -> ::core::primitive::bool; +} + +/// A function pointer used for callbacks that watch the event queue. +/// +/// ## Parameters +/// - `userdata`: what was passed as `userdata` to [`SDL_SetEventFilter()`] or +/// [`SDL_AddEventWatch`], etc. +/// - `event`: the event that triggered the callback. +/// +/// ## Return value +/// Returns true to permit event to be added to the queue, and false to +/// disallow it. When used with [`SDL_AddEventWatch`], the return value is +/// ignored. +/// +/// ## Thread safety +/// SDL may call this callback at any time from any thread; the +/// application is responsible for locking resources the callback +/// touches that need to be protected. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetEventFilter`] +/// - [`SDL_AddEventWatch`] +pub type SDL_EventFilter = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + event: *mut SDL_Event, + ) -> ::core::primitive::bool, +>; + +unsafe extern "C" { + /// Set up a filter to process all events before they are added to the internal + /// event queue. + /// + /// If you just want to see events without modifying them or preventing them + /// from being queued, you should use [`SDL_AddEventWatch()`] instead. + /// + /// If the filter function returns true when called, then the event will be + /// added to the internal queue. If it returns false, then the event will be + /// dropped from the queue, but the internal state will still be updated. This + /// allows selective filtering of dynamically arriving events. + /// + /// **WARNING**: Be very careful of what you do in the event filter function, + /// as it may run in a different thread! The exception is handling of + /// [`SDL_EVENT_WINDOW_EXPOSED`], which is guaranteed to be sent from the OS on the + /// main thread and you are expected to redraw your window in response to this + /// event. + /// + /// On platforms that support it, if the quit event is generated by an + /// interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the + /// application at the next event poll. + /// + /// Note: Disabled events never make it to the event filter function; see + /// [`SDL_SetEventEnabled()`]. + /// + /// Note: Events pushed onto the queue with [`SDL_PushEvent()`] get passed through + /// the event filter, but events pushed onto the queue with [`SDL_PeepEvents()`] do + /// not. + /// + /// ## Parameters + /// - `filter`: a function to call when an event happens. + /// - `userdata`: a pointer that is passed to `filter`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddEventWatch`] + /// - [`SDL_SetEventEnabled`] + /// - [`SDL_GetEventFilter`] + /// - [`SDL_PeepEvents`] + /// - [`SDL_PushEvent`] + pub fn SDL_SetEventFilter(filter: SDL_EventFilter, userdata: *mut ::core::ffi::c_void); +} + +unsafe extern "C" { + /// Query the current event filter. + /// + /// This function can be used to "chain" filters, by saving the existing filter + /// before replacing it with a function that will call that saved filter. + /// + /// ## Parameters + /// - `filter`: the current callback function will be stored here. + /// - `userdata`: the pointer that is passed to the current event filter will + /// be stored here. + /// + /// ## Return value + /// Returns true on success or false if there is no event filter set. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetEventFilter`] + pub fn SDL_GetEventFilter( + filter: *mut SDL_EventFilter, + userdata: *mut *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Add a callback to be triggered when an event is added to the event queue. + /// + /// `filter` will be called when an event happens, and its return value is + /// ignored. + /// + /// **WARNING**: Be very careful of what you do in the event filter function, + /// as it may run in a different thread! + /// + /// If the quit event is generated by a signal (e.g. SIGINT), it will bypass + /// the internal queue and be delivered to the watch callback immediately, and + /// arrive at the next event poll. + /// + /// Note: the callback is called for events posted by the user through + /// [`SDL_PushEvent()`], but not for disabled events, nor for events by a filter + /// callback set with [`SDL_SetEventFilter()`], nor for events posted by the user + /// through [`SDL_PeepEvents()`]. + /// + /// ## Parameters + /// - `filter`: an [`SDL_EventFilter`] function to call when an event happens. + /// - `userdata`: a pointer that is passed to `filter`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RemoveEventWatch`] + /// - [`SDL_SetEventFilter`] + pub fn SDL_AddEventWatch( + filter: SDL_EventFilter, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Remove an event watch callback added with [`SDL_AddEventWatch()`]. + /// + /// This function takes the same input as [`SDL_AddEventWatch()`] to identify and + /// delete the corresponding callback. + /// + /// ## Parameters + /// - `filter`: the function originally passed to [`SDL_AddEventWatch()`]. + /// - `userdata`: the pointer originally passed to [`SDL_AddEventWatch()`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddEventWatch`] + pub fn SDL_RemoveEventWatch(filter: SDL_EventFilter, userdata: *mut ::core::ffi::c_void); +} + +unsafe extern "C" { + /// Run a specific filter function on the current event queue, removing any + /// events for which the filter returns false. + /// + /// See [`SDL_SetEventFilter()`] for more information. Unlike [`SDL_SetEventFilter()`], + /// this function does not change the filter permanently, it only uses the + /// supplied filter until this function returns. + /// + /// ## Parameters + /// - `filter`: the [`SDL_EventFilter`] function to call when an event happens. + /// - `userdata`: a pointer that is passed to `filter`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEventFilter`] + /// - [`SDL_SetEventFilter`] + pub fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *mut ::core::ffi::c_void); +} + +unsafe extern "C" { + /// Set the state of processing events by type. + /// + /// ## Parameters + /// - `type`: the type of event; see [`SDL_EventType`] for details. + /// - `enabled`: whether to process the event or not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_EventEnabled`] + pub fn SDL_SetEventEnabled(r#type: Uint32, enabled: ::core::primitive::bool); +} + +unsafe extern "C" { + /// Query the state of processing events by type. + /// + /// ## Parameters + /// - `type`: the type of event; see [`SDL_EventType`] for details. + /// + /// ## Return value + /// Returns true if the event is being processed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetEventEnabled`] + pub fn SDL_EventEnabled(r#type: Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Allocate a set of user-defined events, and return the beginning event + /// number for that set of events. + /// + /// ## Parameters + /// - `numevents`: the number of events to be allocated. + /// + /// ## Return value + /// Returns the beginning event number, or 0 if numevents is invalid or if + /// there are not enough user-defined events left. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PushEvent`] + pub fn SDL_RegisterEvents(numevents: ::core::ffi::c_int) -> Uint32; +} + +unsafe extern "C" { + /// Get window associated with an event. + /// + /// ## Parameters + /// - `event`: an event containing a `windowID`. + /// + /// ## Return value + /// Returns the associated window on success or NULL if there is none. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PollEvent`] + /// - [`SDL_WaitEvent`] + /// - [`SDL_WaitEventTimeout`] + pub fn SDL_GetWindowFromEvent(event: *const SDL_Event) -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Generate an English description of an event. + /// + /// This will fill `buf` with a null-terminated string that might look + /// something like this: + /// + /// ```text + /// SDL_EVENT_MOUSE_MOTION (timestamp=1140256324 windowid=2 which=0 state=0 x=492.99 y=139.09 xrel=52 yrel=6) + /// ``` + /// + /// The exact format of the string is not guaranteed; it is intended for + /// logging purposes, to be read by a human, and not parsed by a computer. + /// + /// The returned value follows the same rules as [`SDL_snprintf()`]\: `buf` will + /// always be NULL-terminated (unless `buflen` is zero), and will be truncated + /// if `buflen` is too small. The return code is the number of bytes needed for + /// the complete string, not counting the NULL-terminator, whether the string + /// was truncated or not. Unlike [`SDL_snprintf()`], though, this function never + /// returns -1. + /// + /// ## Parameters + /// - `event`: an event to describe. May be NULL. + /// - `buf`: the buffer to fill with the description string. May be NULL. + /// - `buflen`: the maximum bytes that can be written to `buf`. + /// + /// ## Return value + /// Returns number of bytes needed for the full string, not counting the + /// null-terminator byte. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetEventDescription( + event: *const SDL_Event, + buf: *mut ::core::ffi::c_char, + buflen: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/filesystem.rs b/vendor/sdl3-sys/src/generated/filesystem.rs new file mode 100644 index 00000000..f76e129e --- /dev/null +++ b/vendor/sdl3-sys/src/generated/filesystem.rs @@ -0,0 +1,1006 @@ +//! SDL offers an API for examining and manipulating the system's filesystem. +//! This covers most things one would need to do with directories, except for +//! actual file I/O (which is covered by [CategoryIOStream](CategoryIOStream) +//! and [CategoryAsyncIO](CategoryAsyncIO) instead). +//! +//! There are functions to answer necessary path questions: +//! +//! - Where is my app's data? [`SDL_GetBasePath()`]. +//! - Where can I safely write files? [`SDL_GetPrefPath()`]. +//! - Where are paths like Downloads, Desktop, Music? [`SDL_GetUserFolder()`]. +//! - What is this thing at this location? [`SDL_GetPathInfo()`]. +//! - What items live in this folder? [`SDL_EnumerateDirectory()`]. +//! - What items live in this folder by wildcard? [`SDL_GlobDirectory()`]. +//! - What is my current working directory? [`SDL_GetCurrentDirectory()`]. +//! +//! SDL also offers functions to manipulate the directory tree: renaming, +//! removing, copying files. + +use super::stdinc::*; + +use super::error::*; + +unsafe extern "C" { + /// Get the directory where the application was run from. + /// + /// SDL caches the result of this call internally, but the first call to this + /// function is not necessarily fast, so plan accordingly. + /// + /// **macOS and iOS Specific Functionality**: If the application is in a ".app" + /// bundle, this function returns the Resource directory (e.g. + /// MyApp.app/Contents/Resources/). This behaviour can be overridden by adding + /// a property to the Info.plist file. Adding a string key with the name + /// SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the + /// behaviour. + /// + /// Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an + /// application in /Applications/SDLApp/MyApp.app): + /// + /// - `resource`: bundle resource directory (the default). For example: + /// `/Applications/SDLApp/MyApp.app/Contents/Resources` + /// - `bundle`: the Bundle directory. For example: + /// `/Applications/SDLApp/MyApp.app/` + /// - `parent`: the containing directory of the bundle. For example: + /// `/Applications/SDLApp/` + /// + /// **Android Specific Functionality**: This function returns "./", which + /// allows filesystem operations to use internal storage and the asset system. + /// + /// **Nintendo 3DS Specific Functionality**: This function returns "romfs" + /// directory of the application as it is uncommon to store resources outside + /// the executable. As such it is not a writable directory. + /// + /// The returned path is guaranteed to end with a path separator ('\\' on + /// Windows, '/' on most other platforms). + /// + /// ## Return value + /// Returns an absolute path in UTF-8 encoding to the application data + /// directory. NULL will be returned on error or when the platform + /// doesn't implement this functionality, call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPrefPath`] + pub fn SDL_GetBasePath() -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the user-and-app-specific path where files can be written. + /// + /// Get the "pref dir". This is meant to be where users can write personal + /// files (preferences and save games, etc) that are specific to your + /// application. This directory is unique per user, per application. + /// + /// This function will decide the appropriate location in the native + /// filesystem, create the directory if necessary, and return a string of the + /// absolute path to the directory in UTF-8 encoding. + /// + /// On Windows, the string might look like: + /// + /// `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` + /// + /// On Linux, the string might look like: + /// + /// `/home/bob/.local/share/My Program Name/` + /// + /// On macOS, the string might look like: + /// + /// `/Users/bob/Library/Application Support/My Program Name/` + /// + /// You should assume the path returned by this function is the only safe place + /// to write files (and that [`SDL_GetBasePath()`], while it might be writable, or + /// even the parent of the returned path, isn't where you should be writing + /// things). + /// + /// Both the org and app strings may become part of a directory name, so please + /// follow these rules: + /// + /// - Try to use the same org string (_including case-sensitivity_) for all + /// your applications that use this function. + /// - Always use a unique app string for each one, and make sure it never + /// changes for an app once you've decided on it. + /// - Unicode characters are legal, as long as they are UTF-8 encoded, but... + /// - ...only use letters, numbers, and spaces. Avoid punctuation like "Game + /// Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. + /// + /// Due to historical mistakes, `org` is allowed to be NULL or "". In such + /// cases, SDL will omit the org subdirectory, including on platforms where it + /// shouldn't, and including on platforms where this would make your app fail + /// certification for an app store. New apps should definitely specify a real + /// string for `org`. + /// + /// The returned path is guaranteed to end with a path separator ('\\' on + /// Windows, '/' on most other platforms). + /// + /// ## Parameters + /// - `org`: the name of your organization. + /// - `app`: the name of your application. + /// + /// ## Return value + /// Returns a UTF-8 string of the user directory in platform-dependent + /// notation. NULL if there's a problem (creating directory failed, + /// etc.). This should be freed with [`SDL_free()`] when it is no longer + /// needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetBasePath`] + pub fn SDL_GetPrefPath( + org: *const ::core::ffi::c_char, + app: *const ::core::ffi::c_char, + ) -> *mut ::core::ffi::c_char; +} + +/// The type of the OS-provided default folder for a specific purpose. +/// +/// Note that the Trash folder isn't included here, because trashing files +/// usually involves extra OS-specific functionality to remember the file's +/// original location. +/// +/// The folders supported per platform are: +/// +/// | | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten | +/// | ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- | +/// | HOME | X | X | | X | X | X | +/// | DESKTOP | X | X | | X | X | | +/// | DOCUMENTS | X | X | | X | | | +/// | DOWNLOADS | Vista+ | X | | X | | | +/// | MUSIC | X | X | | X | | | +/// | PICTURES | X | X | | X | | | +/// | PUBLICSHARE | | X | | X | | | +/// | SAVEDGAMES | Vista+ | | | | | | +/// | SCREENSHOTS | Vista+ | | | | | | +/// | TEMPLATES | X | X | | X | | | +/// | VIDEOS | X | X* | | X | | | +/// +/// Note that on macOS/iOS, the Videos folder is called "Movies". +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetUserFolder`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`HOME`](SDL_Folder::HOME) | [`SDL_FOLDER_HOME`] | The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. | +/// | [`DESKTOP`](SDL_Folder::DESKTOP) | [`SDL_FOLDER_DESKTOP`] | The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. | +/// | [`DOCUMENTS`](SDL_Folder::DOCUMENTS) | [`SDL_FOLDER_DOCUMENTS`] | User document files, possibly application-specific. This is a good place to save a user's projects. | +/// | [`DOWNLOADS`](SDL_Folder::DOWNLOADS) | [`SDL_FOLDER_DOWNLOADS`] | Standard folder for user files downloaded from the internet. | +/// | [`MUSIC`](SDL_Folder::MUSIC) | [`SDL_FOLDER_MUSIC`] | Music files that can be played using a standard music player (mp3, ogg...). | +/// | [`PICTURES`](SDL_Folder::PICTURES) | [`SDL_FOLDER_PICTURES`] | Image files that can be displayed using a standard viewer (png, jpg...). | +/// | [`PUBLICSHARE`](SDL_Folder::PUBLICSHARE) | [`SDL_FOLDER_PUBLICSHARE`] | Files that are meant to be shared with other users on the same computer. | +/// | [`SAVEDGAMES`](SDL_Folder::SAVEDGAMES) | [`SDL_FOLDER_SAVEDGAMES`] | Save files for games. | +/// | [`SCREENSHOTS`](SDL_Folder::SCREENSHOTS) | [`SDL_FOLDER_SCREENSHOTS`] | Application screenshots. | +/// | [`TEMPLATES`](SDL_Folder::TEMPLATES) | [`SDL_FOLDER_TEMPLATES`] | Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. | +/// | [`VIDEOS`](SDL_Folder::VIDEOS) | [`SDL_FOLDER_VIDEOS`] | Video files that can be played using a standard video player (mp4, webm...). | +/// | [`COUNT`](SDL_Folder::COUNT) | [`SDL_FOLDER_COUNT`] | Total number of types in this enum, not a folder type by itself. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_Folder(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_Folder { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_Folder) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_Folder) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Folder { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::HOME => "SDL_FOLDER_HOME", + Self::DESKTOP => "SDL_FOLDER_DESKTOP", + Self::DOCUMENTS => "SDL_FOLDER_DOCUMENTS", + Self::DOWNLOADS => "SDL_FOLDER_DOWNLOADS", + Self::MUSIC => "SDL_FOLDER_MUSIC", + Self::PICTURES => "SDL_FOLDER_PICTURES", + Self::PUBLICSHARE => "SDL_FOLDER_PUBLICSHARE", + Self::SAVEDGAMES => "SDL_FOLDER_SAVEDGAMES", + Self::SCREENSHOTS => "SDL_FOLDER_SCREENSHOTS", + Self::TEMPLATES => "SDL_FOLDER_TEMPLATES", + Self::VIDEOS => "SDL_FOLDER_VIDEOS", + Self::COUNT => "SDL_FOLDER_COUNT", + + _ => return write!(f, "SDL_Folder({})", self.0), + }) + } +} + +impl SDL_Folder { + /// The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. + pub const HOME: Self = Self((0 as ::core::ffi::c_int)); + /// The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. + pub const DESKTOP: Self = Self((1 as ::core::ffi::c_int)); + /// User document files, possibly application-specific. This is a good place to save a user's projects. + pub const DOCUMENTS: Self = Self((2 as ::core::ffi::c_int)); + /// Standard folder for user files downloaded from the internet. + pub const DOWNLOADS: Self = Self((3 as ::core::ffi::c_int)); + /// Music files that can be played using a standard music player (mp3, ogg...). + pub const MUSIC: Self = Self((4 as ::core::ffi::c_int)); + /// Image files that can be displayed using a standard viewer (png, jpg...). + pub const PICTURES: Self = Self((5 as ::core::ffi::c_int)); + /// Files that are meant to be shared with other users on the same computer. + pub const PUBLICSHARE: Self = Self((6 as ::core::ffi::c_int)); + /// Save files for games. + pub const SAVEDGAMES: Self = Self((7 as ::core::ffi::c_int)); + /// Application screenshots. + pub const SCREENSHOTS: Self = Self((8 as ::core::ffi::c_int)); + /// Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. + pub const TEMPLATES: Self = Self((9 as ::core::ffi::c_int)); + /// Video files that can be played using a standard video player (mp4, webm...). + pub const VIDEOS: Self = Self((10 as ::core::ffi::c_int)); + /// Total number of types in this enum, not a folder type by itself. + pub const COUNT: Self = Self((11 as ::core::ffi::c_int)); +} + +/// The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. +pub const SDL_FOLDER_HOME: SDL_Folder = SDL_Folder::HOME; +/// The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. +pub const SDL_FOLDER_DESKTOP: SDL_Folder = SDL_Folder::DESKTOP; +/// User document files, possibly application-specific. This is a good place to save a user's projects. +pub const SDL_FOLDER_DOCUMENTS: SDL_Folder = SDL_Folder::DOCUMENTS; +/// Standard folder for user files downloaded from the internet. +pub const SDL_FOLDER_DOWNLOADS: SDL_Folder = SDL_Folder::DOWNLOADS; +/// Music files that can be played using a standard music player (mp3, ogg...). +pub const SDL_FOLDER_MUSIC: SDL_Folder = SDL_Folder::MUSIC; +/// Image files that can be displayed using a standard viewer (png, jpg...). +pub const SDL_FOLDER_PICTURES: SDL_Folder = SDL_Folder::PICTURES; +/// Files that are meant to be shared with other users on the same computer. +pub const SDL_FOLDER_PUBLICSHARE: SDL_Folder = SDL_Folder::PUBLICSHARE; +/// Save files for games. +pub const SDL_FOLDER_SAVEDGAMES: SDL_Folder = SDL_Folder::SAVEDGAMES; +/// Application screenshots. +pub const SDL_FOLDER_SCREENSHOTS: SDL_Folder = SDL_Folder::SCREENSHOTS; +/// Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. +pub const SDL_FOLDER_TEMPLATES: SDL_Folder = SDL_Folder::TEMPLATES; +/// Video files that can be played using a standard video player (mp4, webm...). +pub const SDL_FOLDER_VIDEOS: SDL_Folder = SDL_Folder::VIDEOS; +/// Total number of types in this enum, not a folder type by itself. +pub const SDL_FOLDER_COUNT: SDL_Folder = SDL_Folder::COUNT; + +impl SDL_Folder { + /// Initialize a `SDL_Folder` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_Folder { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Folder { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::filesystem::METADATA_SDL_Folder; +} + +unsafe extern "C" { + /// Finds the most suitable user folder for a specific purpose. + /// + /// Many OSes provide certain standard folders for certain purposes, such as + /// storing pictures, music or videos for a certain user. This function gives + /// the path for many of those special locations. + /// + /// This function is specifically for _user_ folders, which are meant for the + /// user to access and manage. For application-specific folders, meant to hold + /// data for the application to manage, see [`SDL_GetBasePath()`] and + /// [`SDL_GetPrefPath()`]. + /// + /// The returned path is guaranteed to end with a path separator ('\\' on + /// Windows, '/' on most other platforms). + /// + /// If NULL is returned, the error may be obtained with [`SDL_GetError()`]. + /// + /// ## Parameters + /// - `folder`: the type of folder to find. + /// + /// ## Return value + /// Returns either a null-terminated C string containing the full path to the + /// folder, or NULL if an error happened. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetUserFolder(folder: SDL_Folder) -> *const ::core::ffi::c_char; +} + +/// Types of filesystem entries. +/// +/// Note that there may be other sorts of items on a filesystem: devices, named +/// pipes, etc. They are currently reported as [`SDL_PATHTYPE_OTHER`]. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_PathInfo`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_PathType::NONE) | [`SDL_PATHTYPE_NONE`] | path does not exist | +/// | [`FILE`](SDL_PathType::FILE) | [`SDL_PATHTYPE_FILE`] | a normal file | +/// | [`DIRECTORY`](SDL_PathType::DIRECTORY) | [`SDL_PATHTYPE_DIRECTORY`] | a directory | +/// | [`OTHER`](SDL_PathType::OTHER) | [`SDL_PATHTYPE_OTHER`] | something completely different like a device node (not a symlink, those are always followed) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PathType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PathType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PathType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PathType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PathType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_PATHTYPE_NONE", + Self::FILE => "SDL_PATHTYPE_FILE", + Self::DIRECTORY => "SDL_PATHTYPE_DIRECTORY", + Self::OTHER => "SDL_PATHTYPE_OTHER", + + _ => return write!(f, "SDL_PathType({})", self.0), + }) + } +} + +impl SDL_PathType { + /// path does not exist + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + /// a normal file + pub const FILE: Self = Self((1 as ::core::ffi::c_int)); + /// a directory + pub const DIRECTORY: Self = Self((2 as ::core::ffi::c_int)); + /// something completely different like a device node (not a symlink, those are always followed) + pub const OTHER: Self = Self((3 as ::core::ffi::c_int)); +} + +/// path does not exist +pub const SDL_PATHTYPE_NONE: SDL_PathType = SDL_PathType::NONE; +/// a normal file +pub const SDL_PATHTYPE_FILE: SDL_PathType = SDL_PathType::FILE; +/// a directory +pub const SDL_PATHTYPE_DIRECTORY: SDL_PathType = SDL_PathType::DIRECTORY; +/// something completely different like a device node (not a symlink, those are always followed) +pub const SDL_PATHTYPE_OTHER: SDL_PathType = SDL_PathType::OTHER; + +impl SDL_PathType { + /// Initialize a `SDL_PathType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PathType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PathType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::filesystem::METADATA_SDL_PathType; +} + +/// Information about a path on the filesystem. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetPathInfo`] +/// - [`SDL_GetStoragePathInfo`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PathInfo { + /// the path type + pub r#type: SDL_PathType, + /// the file size in bytes + pub size: Uint64, + /// the time when the path was created + pub create_time: SDL_Time, + /// the last time the path was modified + pub modify_time: SDL_Time, + /// the last time the path was read + pub access_time: SDL_Time, +} + +/// Flags for path matching. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GlobDirectory`] +/// - [`SDL_GlobStorageDirectory`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`CASEINSENSITIVE`](SDL_GlobFlags::CASEINSENSITIVE) | [`SDL_GLOB_CASEINSENSITIVE`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GlobFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_GlobFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GlobFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_GlobFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GlobFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GlobFlags(")?; + let all_bits = all_bits | Self::CASEINSENSITIVE.0; + if (Self::CASEINSENSITIVE != 0 || self.0 == 0) + && *self & Self::CASEINSENSITIVE == Self::CASEINSENSITIVE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CASEINSENSITIVE")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GlobFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GlobFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GlobFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GlobFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GlobFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GlobFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GlobFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GlobFlags { + pub const CASEINSENSITIVE: Self = Self((1_u32 as Uint32)); +} + +pub const SDL_GLOB_CASEINSENSITIVE: SDL_GlobFlags = SDL_GlobFlags::CASEINSENSITIVE; + +impl SDL_GlobFlags { + /// Initialize a `SDL_GlobFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_GlobFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GlobFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::filesystem::METADATA_SDL_GlobFlags; +} + +unsafe extern "C" { + /// Create a directory, and any missing parent directories. + /// + /// This reports success if `path` already exists as a directory. + /// + /// If parent directories are missing, it will also create them. Note that if + /// this fails, it will not remove any parent directories it already made. + /// + /// ## Parameters + /// - `path`: the path of the directory to create. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CreateDirectory(path: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +/// Possible results from an enumeration callback. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_EnumerateDirectoryCallback`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`CONTINUE`](SDL_EnumerationResult::CONTINUE) | [`SDL_ENUM_CONTINUE`] | Value that requests that enumeration continue. | +/// | [`SUCCESS`](SDL_EnumerationResult::SUCCESS) | [`SDL_ENUM_SUCCESS`] | Value that requests that enumeration stop, successfully. | +/// | [`FAILURE`](SDL_EnumerationResult::FAILURE) | [`SDL_ENUM_FAILURE`] | Value that requests that enumeration stop, as a failure. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_EnumerationResult(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_EnumerationResult { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_EnumerationResult) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_EnumerationResult) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_EnumerationResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::CONTINUE => "SDL_ENUM_CONTINUE", + Self::SUCCESS => "SDL_ENUM_SUCCESS", + Self::FAILURE => "SDL_ENUM_FAILURE", + + _ => return write!(f, "SDL_EnumerationResult({})", self.0), + }) + } +} + +impl SDL_EnumerationResult { + /// Value that requests that enumeration continue. + pub const CONTINUE: Self = Self((0 as ::core::ffi::c_int)); + /// Value that requests that enumeration stop, successfully. + pub const SUCCESS: Self = Self((1 as ::core::ffi::c_int)); + /// Value that requests that enumeration stop, as a failure. + pub const FAILURE: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Value that requests that enumeration continue. +pub const SDL_ENUM_CONTINUE: SDL_EnumerationResult = SDL_EnumerationResult::CONTINUE; +/// Value that requests that enumeration stop, successfully. +pub const SDL_ENUM_SUCCESS: SDL_EnumerationResult = SDL_EnumerationResult::SUCCESS; +/// Value that requests that enumeration stop, as a failure. +pub const SDL_ENUM_FAILURE: SDL_EnumerationResult = SDL_EnumerationResult::FAILURE; + +impl SDL_EnumerationResult { + /// Initialize a `SDL_EnumerationResult` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_EnumerationResult { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_EnumerationResult { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::filesystem::METADATA_SDL_EnumerationResult; +} + +/// Callback for directory enumeration. +/// +/// Enumeration of directory entries will continue until either all entries +/// have been provided to the callback, or the callback has requested a stop +/// through its return value. +/// +/// Returning [`SDL_ENUM_CONTINUE`] will let enumeration proceed, calling the +/// callback with further entries. [`SDL_ENUM_SUCCESS`] and [`SDL_ENUM_FAILURE`] will +/// terminate the enumeration early, and dictate the return value of the +/// enumeration function itself. +/// +/// `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/' +/// on most other platforms). +/// +/// ## Parameters +/// - `userdata`: an app-controlled pointer that is passed to the callback. +/// - `dirname`: the directory that is being enumerated. +/// - `fname`: the next entry in the enumeration. +/// +/// ## Return value +/// Returns how the enumeration should proceed. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_EnumerateDirectory`] +pub type SDL_EnumerateDirectoryCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + dirname: *const ::core::ffi::c_char, + fname: *const ::core::ffi::c_char, + ) -> SDL_EnumerationResult, +>; + +unsafe extern "C" { + /// Enumerate a directory through a callback function. + /// + /// This function provides every directory entry through an app-provided + /// callback, called once for each directory entry, until all results have been + /// provided or the callback returns either [`SDL_ENUM_SUCCESS`] or + /// [`SDL_ENUM_FAILURE`]. + /// + /// This will return false if there was a system problem in general, or if a + /// callback returns [`SDL_ENUM_FAILURE`]. A successful return means a callback + /// returned [`SDL_ENUM_SUCCESS`] to halt enumeration, or all directory entries + /// were enumerated. + /// + /// ## Parameters + /// - `path`: the path of the directory to enumerate. + /// - `callback`: a function that is called for each entry in the directory. + /// - `userdata`: a pointer that is passed to `callback`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EnumerateDirectory( + path: *const ::core::ffi::c_char, + callback: SDL_EnumerateDirectoryCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Remove a file or an empty directory. + /// + /// Directories that are not empty will fail; this function will not recursely + /// delete directory trees. + /// + /// ## Parameters + /// - `path`: the path to remove from the filesystem. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RemovePath(path: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Rename a file or directory. + /// + /// If the file at `newpath` already exists, it will be replaced. + /// + /// Note that this will not copy files across filesystems/drives/volumes, as + /// that is a much more complicated (and possibly time-consuming) operation. + /// + /// Which is to say, if this function fails, [`SDL_CopyFile()`] to a temporary file + /// in the same directory as `newpath`, then [`SDL_RenamePath()`] from the + /// temporary file to `newpath` and [`SDL_RemovePath()`] on `oldpath` might work + /// for files. Renaming a non-empty directory across filesystems is + /// dramatically more complex, however. + /// + /// ## Parameters + /// - `oldpath`: the old path. + /// - `newpath`: the new path. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RenamePath( + oldpath: *const ::core::ffi::c_char, + newpath: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy a file. + /// + /// If the file at `newpath` already exists, it will be overwritten with the + /// contents of the file at `oldpath`. + /// + /// This function will block until the copy is complete, which might be a + /// significant time for large files on slow disks. On some platforms, the copy + /// can be handed off to the OS itself, but on others SDL might just open both + /// paths, and read from one and write to the other. + /// + /// Note that this is not an atomic operation! If something tries to read from + /// `newpath` while the copy is in progress, it will see an incomplete copy of + /// the data, and if the calling thread terminates (or the power goes out) + /// during the copy, `newpath`'s previous contents will be gone, replaced with + /// an incomplete copy of the data. To avoid this risk, it is recommended that + /// the app copy to a temporary file in the same directory as `newpath`, and if + /// the copy is successful, use [`SDL_RenamePath()`] to replace `newpath` with the + /// temporary file. This will ensure that reads of `newpath` will either see a + /// complete copy of the data, or it will see the pre-copy state of `newpath`. + /// + /// This function attempts to synchronize the newly-copied data to disk before + /// returning, if the platform allows it, so that the renaming trick will not + /// have a problem in a system crash or power failure, where the file could be + /// renamed but the contents never made it from the system file cache to the + /// physical disk. + /// + /// If the copy fails for any reason, the state of `newpath` is undefined. It + /// might be half a copy, it might be the untouched data of what was already + /// there, or it might be a zero-byte file, etc. + /// + /// ## Parameters + /// - `oldpath`: the old path. + /// - `newpath`: the new path. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but this + /// operation is not atomic, so the app might need to protect + /// access to specific paths from other threads if appropriate. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CopyFile( + oldpath: *const ::core::ffi::c_char, + newpath: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get information about a filesystem path. + /// + /// Symlinks, on filesystems that support them, are always followed, so you + /// will always get information on what the symlink eventually points to, and + /// not the symlink itself. + /// + /// ## Parameters + /// - `path`: the path to query. + /// - `info`: a pointer filled in with information about the path, or NULL to + /// check for the existence of a file. + /// + /// ## Return value + /// Returns true on success or false if the file doesn't exist, or another + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetPathInfo( + path: *const ::core::ffi::c_char, + info: *mut SDL_PathInfo, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Enumerate a directory tree, filtered by pattern, and return a list. + /// + /// Files are filtered out if they don't match the string in `pattern`, which + /// may contain wildcard characters `*` (match everything) and `?` (match one + /// character). If pattern is NULL, no filtering is done and all results are + /// returned. Subdirectories are permitted, and are specified with a path + /// separator of `/`. Wildcard characters `*` and `?` never match a path + /// separator. + /// + /// `flags` may be set to [`SDL_GLOB_CASEINSENSITIVE`] to make the pattern matching + /// case-insensitive. + /// + /// The returned array is always NULL-terminated, for your iterating + /// convenience, but if `count` is non-NULL, on return it will contain the + /// number of items in the array, not counting the NULL terminator. + /// + /// ## Parameters + /// - `path`: the path of the directory to enumerate. + /// - `pattern`: the pattern that files in the directory must match. Can be + /// NULL. + /// - `flags`: `SDL_GLOB_*` bitflags that affect this search. + /// - `count`: on return, will be set to the number of items in the returned + /// array. Can be NULL. + /// + /// ## Return value + /// Returns an array of strings on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. This is a single allocation + /// that should be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GlobDirectory( + path: *const ::core::ffi::c_char, + pattern: *const ::core::ffi::c_char, + flags: SDL_GlobFlags, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get what the system believes is the "current working directory." + /// + /// For systems without a concept of a current working directory, this will + /// still attempt to provide something reasonable. + /// + /// SDL does not provide a means to _change_ the current working directory; for + /// platforms without this concept, this would cause surprises with file access + /// outside of SDL. + /// + /// The returned path is guaranteed to end with a path separator ('\\' on + /// Windows, '/' on most other platforms). + /// + /// ## Return value + /// Returns a UTF-8 string of the current working directory in + /// platform-dependent notation. NULL if there's a problem. This + /// should be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetCurrentDirectory() -> *mut ::core::ffi::c_char; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/gamepad.rs b/vendor/sdl3-sys/src/generated/gamepad.rs new file mode 100644 index 00000000..86a4b0bc --- /dev/null +++ b/vendor/sdl3-sys/src/generated/gamepad.rs @@ -0,0 +1,2716 @@ +//! SDL provides a low-level joystick API, which just treats joysticks as an +//! arbitrary pile of buttons, axes, and hat switches. If you're planning to +//! write your own control configuration screen, this can give you a lot of +//! flexibility, but that's a lot of work, and most things that we consider +//! "joysticks" now are actually console-style gamepads. So SDL provides the +//! gamepad API on top of the lower-level joystick functionality. +//! +//! The difference between a joystick and a gamepad is that a gamepad tells you +//! _where_ a button or axis is on the device. You don't speak to gamepads in +//! terms of arbitrary numbers like "button 3" or "axis 2" but in standard +//! locations: the d-pad, the shoulder buttons, triggers, A/B/X/Y (or +//! X/O/Square/Triangle, if you will). +//! +//! One turns a joystick into a gamepad by providing a magic configuration +//! string, which tells SDL the details of a specific device: when you see this +//! specific hardware, if button 2 gets pressed, this is actually D-Pad Up, +//! etc. +//! +//! SDL has many popular controllers configured out of the box, and users can +//! add their own controller details through an environment variable if it's +//! otherwise unknown to SDL. +//! +//! In order to use these functions, [`SDL_Init()`] must have been called with the +//! [`SDL_INIT_GAMEPAD`] flag. This causes SDL to scan the system for gamepads, and +//! load appropriate drivers. +//! +//! If you're using SDL gamepad support in a Steam game, you must call +//! SteamAPI_InitEx() before calling [`SDL_Init()`]. +//! +//! If you would like to receive gamepad updates while the application is in +//! the background, you should set the following hint before calling +//! [`SDL_Init()`]\: [`SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS`] +//! +//! Gamepads support various optional features such as rumble, color LEDs, +//! touchpad, gyro, etc. The support for these features varies depending on the +//! controller and OS support available. You can check for LED and rumble +//! capabilities at runtime by calling [`SDL_GetGamepadProperties()`] and checking +//! the various capability properties. You can check for touchpad by calling +//! [`SDL_GetNumGamepadTouchpads()`] and check for gyro and accelerometer by +//! calling [`SDL_GamepadHasSensor()`]. +//! +//! By default SDL will try to use the most capable driver available, but you +//! can tune which OS drivers to use with the various joystick hints in +//! SDL_hints.h. +//! +//! Your application should always support gamepad hotplugging. On some +//! platforms like Xbox, Steam Deck, etc., this is a requirement for +//! certification. On other platforms, like macOS and Windows when using +//! Windows.Gaming.Input, controllers may not be available at startup and will +//! come in at some point after you've started processing events. + +use super::stdinc::*; + +use super::error::*; + +use super::guid::*; + +use super::iostream::*; + +use super::joystick::*; + +use super::power::*; + +use super::properties::*; + +use super::sensor::*; + +/// Standard gamepad types. +/// +/// This type does not necessarily map to first-party controllers from +/// Microsoft/Sony/Nintendo; in many cases, third-party controllers can report +/// as these, either because they were designed for a specific console, or they +/// simply most closely match that console's controllers (does it have A/B/X/Y +/// buttons or X/O/Square/Triangle? Does it have a touchpad? etc). +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_GamepadType::UNKNOWN) | [`SDL_GAMEPAD_TYPE_UNKNOWN`] | | +/// | [`STANDARD`](SDL_GamepadType::STANDARD) | [`SDL_GAMEPAD_TYPE_STANDARD`] | | +/// | [`XBOX360`](SDL_GamepadType::XBOX360) | [`SDL_GAMEPAD_TYPE_XBOX360`] | | +/// | [`XBOXONE`](SDL_GamepadType::XBOXONE) | [`SDL_GAMEPAD_TYPE_XBOXONE`] | | +/// | [`PS3`](SDL_GamepadType::PS3) | [`SDL_GAMEPAD_TYPE_PS3`] | | +/// | [`PS4`](SDL_GamepadType::PS4) | [`SDL_GAMEPAD_TYPE_PS4`] | | +/// | [`PS5`](SDL_GamepadType::PS5) | [`SDL_GAMEPAD_TYPE_PS5`] | | +/// | [`NINTENDO_SWITCH_PRO`](SDL_GamepadType::NINTENDO_SWITCH_PRO) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO`] | | +/// | [`NINTENDO_SWITCH_JOYCON_LEFT`](SDL_GamepadType::NINTENDO_SWITCH_JOYCON_LEFT) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT`] | | +/// | [`NINTENDO_SWITCH_JOYCON_RIGHT`](SDL_GamepadType::NINTENDO_SWITCH_JOYCON_RIGHT) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT`] | | +/// | [`NINTENDO_SWITCH_JOYCON_PAIR`](SDL_GamepadType::NINTENDO_SWITCH_JOYCON_PAIR) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR`] | | +/// | [`GAMECUBE`](SDL_GamepadType::GAMECUBE) | [`SDL_GAMEPAD_TYPE_GAMECUBE`] | | +/// | [`COUNT`](SDL_GamepadType::COUNT) | [`SDL_GAMEPAD_TYPE_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GamepadType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GamepadType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GamepadType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GamepadType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_GAMEPAD_TYPE_UNKNOWN", + Self::STANDARD => "SDL_GAMEPAD_TYPE_STANDARD", + Self::XBOX360 => "SDL_GAMEPAD_TYPE_XBOX360", + Self::XBOXONE => "SDL_GAMEPAD_TYPE_XBOXONE", + Self::PS3 => "SDL_GAMEPAD_TYPE_PS3", + Self::PS4 => "SDL_GAMEPAD_TYPE_PS4", + Self::PS5 => "SDL_GAMEPAD_TYPE_PS5", + Self::NINTENDO_SWITCH_PRO => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO", + Self::NINTENDO_SWITCH_JOYCON_LEFT => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT", + Self::NINTENDO_SWITCH_JOYCON_RIGHT => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT", + Self::NINTENDO_SWITCH_JOYCON_PAIR => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR", + Self::GAMECUBE => "SDL_GAMEPAD_TYPE_GAMECUBE", + Self::COUNT => "SDL_GAMEPAD_TYPE_COUNT", + + _ => return write!(f, "SDL_GamepadType({})", self.0), + }) + } +} + +impl SDL_GamepadType { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const STANDARD: Self = Self((1 as ::core::ffi::c_int)); + pub const XBOX360: Self = Self((2 as ::core::ffi::c_int)); + pub const XBOXONE: Self = Self((3 as ::core::ffi::c_int)); + pub const PS3: Self = Self((4 as ::core::ffi::c_int)); + pub const PS4: Self = Self((5 as ::core::ffi::c_int)); + pub const PS5: Self = Self((6 as ::core::ffi::c_int)); + pub const NINTENDO_SWITCH_PRO: Self = Self((7 as ::core::ffi::c_int)); + pub const NINTENDO_SWITCH_JOYCON_LEFT: Self = Self((8 as ::core::ffi::c_int)); + pub const NINTENDO_SWITCH_JOYCON_RIGHT: Self = Self((9 as ::core::ffi::c_int)); + pub const NINTENDO_SWITCH_JOYCON_PAIR: Self = Self((10 as ::core::ffi::c_int)); + pub const GAMECUBE: Self = Self((11 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((12 as ::core::ffi::c_int)); +} + +pub const SDL_GAMEPAD_TYPE_UNKNOWN: SDL_GamepadType = SDL_GamepadType::UNKNOWN; +pub const SDL_GAMEPAD_TYPE_STANDARD: SDL_GamepadType = SDL_GamepadType::STANDARD; +pub const SDL_GAMEPAD_TYPE_XBOX360: SDL_GamepadType = SDL_GamepadType::XBOX360; +pub const SDL_GAMEPAD_TYPE_XBOXONE: SDL_GamepadType = SDL_GamepadType::XBOXONE; +pub const SDL_GAMEPAD_TYPE_PS3: SDL_GamepadType = SDL_GamepadType::PS3; +pub const SDL_GAMEPAD_TYPE_PS4: SDL_GamepadType = SDL_GamepadType::PS4; +pub const SDL_GAMEPAD_TYPE_PS5: SDL_GamepadType = SDL_GamepadType::PS5; +pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO: SDL_GamepadType = + SDL_GamepadType::NINTENDO_SWITCH_PRO; +pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT: SDL_GamepadType = + SDL_GamepadType::NINTENDO_SWITCH_JOYCON_LEFT; +pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT: SDL_GamepadType = + SDL_GamepadType::NINTENDO_SWITCH_JOYCON_RIGHT; +pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: SDL_GamepadType = + SDL_GamepadType::NINTENDO_SWITCH_JOYCON_PAIR; +pub const SDL_GAMEPAD_TYPE_GAMECUBE: SDL_GamepadType = SDL_GamepadType::GAMECUBE; +pub const SDL_GAMEPAD_TYPE_COUNT: SDL_GamepadType = SDL_GamepadType::COUNT; + +impl SDL_GamepadType { + /// Initialize a `SDL_GamepadType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GamepadType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gamepad::METADATA_SDL_GamepadType; +} + +/// The list of buttons available on a gamepad +/// +/// For controllers that use a diamond pattern for the face buttons, the +/// south/east/west/north buttons below correspond to the locations in the +/// diamond pattern. For Xbox controllers, this would be A/B/X/Y, for Nintendo +/// Switch controllers, this would be B/A/Y/X, for GameCube controllers this +/// would be A/X/B/Y, for PlayStation controllers this would be +/// Cross/Circle/Square/Triangle. +/// +/// For controllers that don't use a diamond pattern for the face buttons, the +/// south/east/west/north buttons indicate the buttons labeled A, B, C, D, or +/// 1, 2, 3, 4, or for controllers that aren't labeled, they are the primary, +/// secondary, etc. buttons. +/// +/// The activate action is often the south button and the cancel action is +/// often the east button, but in some regions this is reversed, so your game +/// should allow remapping actions based on user preferences. +/// +/// You can query the labels for the face buttons using +/// [`SDL_GetGamepadButtonLabel()`] +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GamepadButton::INVALID) | [`SDL_GAMEPAD_BUTTON_INVALID`] | | +/// | [`SOUTH`](SDL_GamepadButton::SOUTH) | [`SDL_GAMEPAD_BUTTON_SOUTH`] | Bottom face button (e.g. Xbox A button) | +/// | [`EAST`](SDL_GamepadButton::EAST) | [`SDL_GAMEPAD_BUTTON_EAST`] | Right face button (e.g. Xbox B button) | +/// | [`WEST`](SDL_GamepadButton::WEST) | [`SDL_GAMEPAD_BUTTON_WEST`] | Left face button (e.g. Xbox X button) | +/// | [`NORTH`](SDL_GamepadButton::NORTH) | [`SDL_GAMEPAD_BUTTON_NORTH`] | Top face button (e.g. Xbox Y button) | +/// | [`BACK`](SDL_GamepadButton::BACK) | [`SDL_GAMEPAD_BUTTON_BACK`] | | +/// | [`GUIDE`](SDL_GamepadButton::GUIDE) | [`SDL_GAMEPAD_BUTTON_GUIDE`] | | +/// | [`START`](SDL_GamepadButton::START) | [`SDL_GAMEPAD_BUTTON_START`] | | +/// | [`LEFT_STICK`](SDL_GamepadButton::LEFT_STICK) | [`SDL_GAMEPAD_BUTTON_LEFT_STICK`] | | +/// | [`RIGHT_STICK`](SDL_GamepadButton::RIGHT_STICK) | [`SDL_GAMEPAD_BUTTON_RIGHT_STICK`] | | +/// | [`LEFT_SHOULDER`](SDL_GamepadButton::LEFT_SHOULDER) | [`SDL_GAMEPAD_BUTTON_LEFT_SHOULDER`] | | +/// | [`RIGHT_SHOULDER`](SDL_GamepadButton::RIGHT_SHOULDER) | [`SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER`] | | +/// | [`DPAD_UP`](SDL_GamepadButton::DPAD_UP) | [`SDL_GAMEPAD_BUTTON_DPAD_UP`] | | +/// | [`DPAD_DOWN`](SDL_GamepadButton::DPAD_DOWN) | [`SDL_GAMEPAD_BUTTON_DPAD_DOWN`] | | +/// | [`DPAD_LEFT`](SDL_GamepadButton::DPAD_LEFT) | [`SDL_GAMEPAD_BUTTON_DPAD_LEFT`] | | +/// | [`DPAD_RIGHT`](SDL_GamepadButton::DPAD_RIGHT) | [`SDL_GAMEPAD_BUTTON_DPAD_RIGHT`] | | +/// | [`MISC1`](SDL_GamepadButton::MISC1) | [`SDL_GAMEPAD_BUTTON_MISC1`] | Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Steam Controller QAM button, Amazon Luna microphone button, Google Stadia capture button) | +/// | [`RIGHT_PADDLE1`](SDL_GamepadButton::RIGHT_PADDLE1) | [`SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1`] | Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button, Steam Controller R4 button) | +/// | [`LEFT_PADDLE1`](SDL_GamepadButton::LEFT_PADDLE1) | [`SDL_GAMEPAD_BUTTON_LEFT_PADDLE1`] | Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button, Steam Controller L4 button) | +/// | [`RIGHT_PADDLE2`](SDL_GamepadButton::RIGHT_PADDLE2) | [`SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2`] | Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button, Steam Controller R5 button) | +/// | [`LEFT_PADDLE2`](SDL_GamepadButton::LEFT_PADDLE2) | [`SDL_GAMEPAD_BUTTON_LEFT_PADDLE2`] | Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button, Steam Controller L5 button) | +/// | [`TOUCHPAD`](SDL_GamepadButton::TOUCHPAD) | [`SDL_GAMEPAD_BUTTON_TOUCHPAD`] | PS4/PS5 touchpad button | +/// | [`MISC2`](SDL_GamepadButton::MISC2) | [`SDL_GAMEPAD_BUTTON_MISC2`] | Additional button | +/// | [`MISC3`](SDL_GamepadButton::MISC3) | [`SDL_GAMEPAD_BUTTON_MISC3`] | Additional button (e.g. Nintendo GameCube left trigger click) | +/// | [`MISC4`](SDL_GamepadButton::MISC4) | [`SDL_GAMEPAD_BUTTON_MISC4`] | Additional button (e.g. Nintendo GameCube right trigger click) | +/// | [`MISC5`](SDL_GamepadButton::MISC5) | [`SDL_GAMEPAD_BUTTON_MISC5`] | Additional button | +/// | [`MISC6`](SDL_GamepadButton::MISC6) | [`SDL_GAMEPAD_BUTTON_MISC6`] | Additional button | +/// | [`COUNT`](SDL_GamepadButton::COUNT) | [`SDL_GAMEPAD_BUTTON_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GamepadButton(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadButton { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GamepadButton) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GamepadButton) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GamepadButton { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GAMEPAD_BUTTON_INVALID", + Self::SOUTH => "SDL_GAMEPAD_BUTTON_SOUTH", + Self::EAST => "SDL_GAMEPAD_BUTTON_EAST", + Self::WEST => "SDL_GAMEPAD_BUTTON_WEST", + Self::NORTH => "SDL_GAMEPAD_BUTTON_NORTH", + Self::BACK => "SDL_GAMEPAD_BUTTON_BACK", + Self::GUIDE => "SDL_GAMEPAD_BUTTON_GUIDE", + Self::START => "SDL_GAMEPAD_BUTTON_START", + Self::LEFT_STICK => "SDL_GAMEPAD_BUTTON_LEFT_STICK", + Self::RIGHT_STICK => "SDL_GAMEPAD_BUTTON_RIGHT_STICK", + Self::LEFT_SHOULDER => "SDL_GAMEPAD_BUTTON_LEFT_SHOULDER", + Self::RIGHT_SHOULDER => "SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER", + Self::DPAD_UP => "SDL_GAMEPAD_BUTTON_DPAD_UP", + Self::DPAD_DOWN => "SDL_GAMEPAD_BUTTON_DPAD_DOWN", + Self::DPAD_LEFT => "SDL_GAMEPAD_BUTTON_DPAD_LEFT", + Self::DPAD_RIGHT => "SDL_GAMEPAD_BUTTON_DPAD_RIGHT", + Self::MISC1 => "SDL_GAMEPAD_BUTTON_MISC1", + Self::RIGHT_PADDLE1 => "SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1", + Self::LEFT_PADDLE1 => "SDL_GAMEPAD_BUTTON_LEFT_PADDLE1", + Self::RIGHT_PADDLE2 => "SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2", + Self::LEFT_PADDLE2 => "SDL_GAMEPAD_BUTTON_LEFT_PADDLE2", + Self::TOUCHPAD => "SDL_GAMEPAD_BUTTON_TOUCHPAD", + Self::MISC2 => "SDL_GAMEPAD_BUTTON_MISC2", + Self::MISC3 => "SDL_GAMEPAD_BUTTON_MISC3", + Self::MISC4 => "SDL_GAMEPAD_BUTTON_MISC4", + Self::MISC5 => "SDL_GAMEPAD_BUTTON_MISC5", + Self::MISC6 => "SDL_GAMEPAD_BUTTON_MISC6", + Self::COUNT => "SDL_GAMEPAD_BUTTON_COUNT", + + _ => return write!(f, "SDL_GamepadButton({})", self.0), + }) + } +} + +impl SDL_GamepadButton { + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// Bottom face button (e.g. Xbox A button) + pub const SOUTH: Self = Self((0_i32 as ::core::ffi::c_int)); + /// Right face button (e.g. Xbox B button) + pub const EAST: Self = Self((1_i32 as ::core::ffi::c_int)); + /// Left face button (e.g. Xbox X button) + pub const WEST: Self = Self((2_i32 as ::core::ffi::c_int)); + /// Top face button (e.g. Xbox Y button) + pub const NORTH: Self = Self((3_i32 as ::core::ffi::c_int)); + pub const BACK: Self = Self((4_i32 as ::core::ffi::c_int)); + pub const GUIDE: Self = Self((5_i32 as ::core::ffi::c_int)); + pub const START: Self = Self((6_i32 as ::core::ffi::c_int)); + pub const LEFT_STICK: Self = Self((7_i32 as ::core::ffi::c_int)); + pub const RIGHT_STICK: Self = Self((8_i32 as ::core::ffi::c_int)); + pub const LEFT_SHOULDER: Self = Self((9_i32 as ::core::ffi::c_int)); + pub const RIGHT_SHOULDER: Self = Self((10_i32 as ::core::ffi::c_int)); + pub const DPAD_UP: Self = Self((11_i32 as ::core::ffi::c_int)); + pub const DPAD_DOWN: Self = Self((12_i32 as ::core::ffi::c_int)); + pub const DPAD_LEFT: Self = Self((13_i32 as ::core::ffi::c_int)); + pub const DPAD_RIGHT: Self = Self((14_i32 as ::core::ffi::c_int)); + /// Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Steam Controller QAM button, Amazon Luna microphone button, Google Stadia capture button) + pub const MISC1: Self = Self((15_i32 as ::core::ffi::c_int)); + /// Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button, Steam Controller R4 button) + pub const RIGHT_PADDLE1: Self = Self((16_i32 as ::core::ffi::c_int)); + /// Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button, Steam Controller L4 button) + pub const LEFT_PADDLE1: Self = Self((17_i32 as ::core::ffi::c_int)); + /// Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button, Steam Controller R5 button) + pub const RIGHT_PADDLE2: Self = Self((18_i32 as ::core::ffi::c_int)); + /// Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button, Steam Controller L5 button) + pub const LEFT_PADDLE2: Self = Self((19_i32 as ::core::ffi::c_int)); + /// PS4/PS5 touchpad button + pub const TOUCHPAD: Self = Self((20_i32 as ::core::ffi::c_int)); + /// Additional button + pub const MISC2: Self = Self((21_i32 as ::core::ffi::c_int)); + /// Additional button (e.g. Nintendo GameCube left trigger click) + pub const MISC3: Self = Self((22_i32 as ::core::ffi::c_int)); + /// Additional button (e.g. Nintendo GameCube right trigger click) + pub const MISC4: Self = Self((23_i32 as ::core::ffi::c_int)); + /// Additional button + pub const MISC5: Self = Self((24_i32 as ::core::ffi::c_int)); + /// Additional button + pub const MISC6: Self = Self((25_i32 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((26_i32 as ::core::ffi::c_int)); +} + +pub const SDL_GAMEPAD_BUTTON_INVALID: SDL_GamepadButton = SDL_GamepadButton::INVALID; +/// Bottom face button (e.g. Xbox A button) +pub const SDL_GAMEPAD_BUTTON_SOUTH: SDL_GamepadButton = SDL_GamepadButton::SOUTH; +/// Right face button (e.g. Xbox B button) +pub const SDL_GAMEPAD_BUTTON_EAST: SDL_GamepadButton = SDL_GamepadButton::EAST; +/// Left face button (e.g. Xbox X button) +pub const SDL_GAMEPAD_BUTTON_WEST: SDL_GamepadButton = SDL_GamepadButton::WEST; +/// Top face button (e.g. Xbox Y button) +pub const SDL_GAMEPAD_BUTTON_NORTH: SDL_GamepadButton = SDL_GamepadButton::NORTH; +pub const SDL_GAMEPAD_BUTTON_BACK: SDL_GamepadButton = SDL_GamepadButton::BACK; +pub const SDL_GAMEPAD_BUTTON_GUIDE: SDL_GamepadButton = SDL_GamepadButton::GUIDE; +pub const SDL_GAMEPAD_BUTTON_START: SDL_GamepadButton = SDL_GamepadButton::START; +pub const SDL_GAMEPAD_BUTTON_LEFT_STICK: SDL_GamepadButton = SDL_GamepadButton::LEFT_STICK; +pub const SDL_GAMEPAD_BUTTON_RIGHT_STICK: SDL_GamepadButton = SDL_GamepadButton::RIGHT_STICK; +pub const SDL_GAMEPAD_BUTTON_LEFT_SHOULDER: SDL_GamepadButton = SDL_GamepadButton::LEFT_SHOULDER; +pub const SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER: SDL_GamepadButton = SDL_GamepadButton::RIGHT_SHOULDER; +pub const SDL_GAMEPAD_BUTTON_DPAD_UP: SDL_GamepadButton = SDL_GamepadButton::DPAD_UP; +pub const SDL_GAMEPAD_BUTTON_DPAD_DOWN: SDL_GamepadButton = SDL_GamepadButton::DPAD_DOWN; +pub const SDL_GAMEPAD_BUTTON_DPAD_LEFT: SDL_GamepadButton = SDL_GamepadButton::DPAD_LEFT; +pub const SDL_GAMEPAD_BUTTON_DPAD_RIGHT: SDL_GamepadButton = SDL_GamepadButton::DPAD_RIGHT; +/// Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Steam Controller QAM button, Amazon Luna microphone button, Google Stadia capture button) +pub const SDL_GAMEPAD_BUTTON_MISC1: SDL_GamepadButton = SDL_GamepadButton::MISC1; +/// Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button, Steam Controller R4 button) +pub const SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1: SDL_GamepadButton = SDL_GamepadButton::RIGHT_PADDLE1; +/// Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button, Steam Controller L4 button) +pub const SDL_GAMEPAD_BUTTON_LEFT_PADDLE1: SDL_GamepadButton = SDL_GamepadButton::LEFT_PADDLE1; +/// Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button, Steam Controller R5 button) +pub const SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2: SDL_GamepadButton = SDL_GamepadButton::RIGHT_PADDLE2; +/// Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button, Steam Controller L5 button) +pub const SDL_GAMEPAD_BUTTON_LEFT_PADDLE2: SDL_GamepadButton = SDL_GamepadButton::LEFT_PADDLE2; +/// PS4/PS5 touchpad button +pub const SDL_GAMEPAD_BUTTON_TOUCHPAD: SDL_GamepadButton = SDL_GamepadButton::TOUCHPAD; +/// Additional button +pub const SDL_GAMEPAD_BUTTON_MISC2: SDL_GamepadButton = SDL_GamepadButton::MISC2; +/// Additional button (e.g. Nintendo GameCube left trigger click) +pub const SDL_GAMEPAD_BUTTON_MISC3: SDL_GamepadButton = SDL_GamepadButton::MISC3; +/// Additional button (e.g. Nintendo GameCube right trigger click) +pub const SDL_GAMEPAD_BUTTON_MISC4: SDL_GamepadButton = SDL_GamepadButton::MISC4; +/// Additional button +pub const SDL_GAMEPAD_BUTTON_MISC5: SDL_GamepadButton = SDL_GamepadButton::MISC5; +/// Additional button +pub const SDL_GAMEPAD_BUTTON_MISC6: SDL_GamepadButton = SDL_GamepadButton::MISC6; +pub const SDL_GAMEPAD_BUTTON_COUNT: SDL_GamepadButton = SDL_GamepadButton::COUNT; + +impl SDL_GamepadButton { + /// Initialize a `SDL_GamepadButton` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GamepadButton { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadButton { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gamepad::METADATA_SDL_GamepadButton; +} + +/// The set of gamepad button labels +/// +/// This isn't a complete set, just the face buttons to make it easy to show +/// button prompts. +/// +/// For a complete set, you should look at the button and gamepad type and have +/// a set of symbols that work well with your art style. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_GamepadButtonLabel::UNKNOWN) | [`SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN`] | | +/// | [`A`](SDL_GamepadButtonLabel::A) | [`SDL_GAMEPAD_BUTTON_LABEL_A`] | | +/// | [`B`](SDL_GamepadButtonLabel::B) | [`SDL_GAMEPAD_BUTTON_LABEL_B`] | | +/// | [`X`](SDL_GamepadButtonLabel::X) | [`SDL_GAMEPAD_BUTTON_LABEL_X`] | | +/// | [`Y`](SDL_GamepadButtonLabel::Y) | [`SDL_GAMEPAD_BUTTON_LABEL_Y`] | | +/// | [`CROSS`](SDL_GamepadButtonLabel::CROSS) | [`SDL_GAMEPAD_BUTTON_LABEL_CROSS`] | | +/// | [`CIRCLE`](SDL_GamepadButtonLabel::CIRCLE) | [`SDL_GAMEPAD_BUTTON_LABEL_CIRCLE`] | | +/// | [`SQUARE`](SDL_GamepadButtonLabel::SQUARE) | [`SDL_GAMEPAD_BUTTON_LABEL_SQUARE`] | | +/// | [`TRIANGLE`](SDL_GamepadButtonLabel::TRIANGLE) | [`SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GamepadButtonLabel(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadButtonLabel { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GamepadButtonLabel) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GamepadButtonLabel) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GamepadButtonLabel { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN", + Self::A => "SDL_GAMEPAD_BUTTON_LABEL_A", + Self::B => "SDL_GAMEPAD_BUTTON_LABEL_B", + Self::X => "SDL_GAMEPAD_BUTTON_LABEL_X", + Self::Y => "SDL_GAMEPAD_BUTTON_LABEL_Y", + Self::CROSS => "SDL_GAMEPAD_BUTTON_LABEL_CROSS", + Self::CIRCLE => "SDL_GAMEPAD_BUTTON_LABEL_CIRCLE", + Self::SQUARE => "SDL_GAMEPAD_BUTTON_LABEL_SQUARE", + Self::TRIANGLE => "SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE", + + _ => return write!(f, "SDL_GamepadButtonLabel({})", self.0), + }) + } +} + +impl SDL_GamepadButtonLabel { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const A: Self = Self((1 as ::core::ffi::c_int)); + pub const B: Self = Self((2 as ::core::ffi::c_int)); + pub const X: Self = Self((3 as ::core::ffi::c_int)); + pub const Y: Self = Self((4 as ::core::ffi::c_int)); + pub const CROSS: Self = Self((5 as ::core::ffi::c_int)); + pub const CIRCLE: Self = Self((6 as ::core::ffi::c_int)); + pub const SQUARE: Self = Self((7 as ::core::ffi::c_int)); + pub const TRIANGLE: Self = Self((8 as ::core::ffi::c_int)); +} + +pub const SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN: SDL_GamepadButtonLabel = + SDL_GamepadButtonLabel::UNKNOWN; +pub const SDL_GAMEPAD_BUTTON_LABEL_A: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::A; +pub const SDL_GAMEPAD_BUTTON_LABEL_B: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::B; +pub const SDL_GAMEPAD_BUTTON_LABEL_X: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::X; +pub const SDL_GAMEPAD_BUTTON_LABEL_Y: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::Y; +pub const SDL_GAMEPAD_BUTTON_LABEL_CROSS: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::CROSS; +pub const SDL_GAMEPAD_BUTTON_LABEL_CIRCLE: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::CIRCLE; +pub const SDL_GAMEPAD_BUTTON_LABEL_SQUARE: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::SQUARE; +pub const SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE: SDL_GamepadButtonLabel = + SDL_GamepadButtonLabel::TRIANGLE; + +impl SDL_GamepadButtonLabel { + /// Initialize a `SDL_GamepadButtonLabel` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GamepadButtonLabel { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadButtonLabel { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gamepad::METADATA_SDL_GamepadButtonLabel; +} + +/// The list of axes available on a gamepad +/// +/// Thumbstick axis values range from [`SDL_JOYSTICK_AXIS_MIN`] to +/// [`SDL_JOYSTICK_AXIS_MAX`], and are centered within ~8000 of zero, though +/// advanced UI will allow users to set or autodetect the dead zone, which +/// varies between gamepads. +/// +/// Trigger axis values range from 0 (released) to [`SDL_JOYSTICK_AXIS_MAX`] (fully +/// pressed) when reported by [`SDL_GetGamepadAxis()`]. Note that this is not the +/// same range that will be reported by the lower-level [`SDL_GetJoystickAxis()`]. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GamepadAxis::INVALID) | [`SDL_GAMEPAD_AXIS_INVALID`] | | +/// | [`LEFTX`](SDL_GamepadAxis::LEFTX) | [`SDL_GAMEPAD_AXIS_LEFTX`] | | +/// | [`LEFTY`](SDL_GamepadAxis::LEFTY) | [`SDL_GAMEPAD_AXIS_LEFTY`] | | +/// | [`RIGHTX`](SDL_GamepadAxis::RIGHTX) | [`SDL_GAMEPAD_AXIS_RIGHTX`] | | +/// | [`RIGHTY`](SDL_GamepadAxis::RIGHTY) | [`SDL_GAMEPAD_AXIS_RIGHTY`] | | +/// | [`LEFT_TRIGGER`](SDL_GamepadAxis::LEFT_TRIGGER) | [`SDL_GAMEPAD_AXIS_LEFT_TRIGGER`] | | +/// | [`RIGHT_TRIGGER`](SDL_GamepadAxis::RIGHT_TRIGGER) | [`SDL_GAMEPAD_AXIS_RIGHT_TRIGGER`] | | +/// | [`COUNT`](SDL_GamepadAxis::COUNT) | [`SDL_GAMEPAD_AXIS_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GamepadAxis(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadAxis { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GamepadAxis) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GamepadAxis) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GamepadAxis { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GAMEPAD_AXIS_INVALID", + Self::LEFTX => "SDL_GAMEPAD_AXIS_LEFTX", + Self::LEFTY => "SDL_GAMEPAD_AXIS_LEFTY", + Self::RIGHTX => "SDL_GAMEPAD_AXIS_RIGHTX", + Self::RIGHTY => "SDL_GAMEPAD_AXIS_RIGHTY", + Self::LEFT_TRIGGER => "SDL_GAMEPAD_AXIS_LEFT_TRIGGER", + Self::RIGHT_TRIGGER => "SDL_GAMEPAD_AXIS_RIGHT_TRIGGER", + Self::COUNT => "SDL_GAMEPAD_AXIS_COUNT", + + _ => return write!(f, "SDL_GamepadAxis({})", self.0), + }) + } +} + +impl SDL_GamepadAxis { + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + pub const LEFTX: Self = Self((0_i32 as ::core::ffi::c_int)); + pub const LEFTY: Self = Self((1_i32 as ::core::ffi::c_int)); + pub const RIGHTX: Self = Self((2_i32 as ::core::ffi::c_int)); + pub const RIGHTY: Self = Self((3_i32 as ::core::ffi::c_int)); + pub const LEFT_TRIGGER: Self = Self((4_i32 as ::core::ffi::c_int)); + pub const RIGHT_TRIGGER: Self = Self((5_i32 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((6_i32 as ::core::ffi::c_int)); +} + +pub const SDL_GAMEPAD_AXIS_INVALID: SDL_GamepadAxis = SDL_GamepadAxis::INVALID; +pub const SDL_GAMEPAD_AXIS_LEFTX: SDL_GamepadAxis = SDL_GamepadAxis::LEFTX; +pub const SDL_GAMEPAD_AXIS_LEFTY: SDL_GamepadAxis = SDL_GamepadAxis::LEFTY; +pub const SDL_GAMEPAD_AXIS_RIGHTX: SDL_GamepadAxis = SDL_GamepadAxis::RIGHTX; +pub const SDL_GAMEPAD_AXIS_RIGHTY: SDL_GamepadAxis = SDL_GamepadAxis::RIGHTY; +pub const SDL_GAMEPAD_AXIS_LEFT_TRIGGER: SDL_GamepadAxis = SDL_GamepadAxis::LEFT_TRIGGER; +pub const SDL_GAMEPAD_AXIS_RIGHT_TRIGGER: SDL_GamepadAxis = SDL_GamepadAxis::RIGHT_TRIGGER; +pub const SDL_GAMEPAD_AXIS_COUNT: SDL_GamepadAxis = SDL_GamepadAxis::COUNT; + +impl SDL_GamepadAxis { + /// Initialize a `SDL_GamepadAxis` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GamepadAxis { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadAxis { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gamepad::METADATA_SDL_GamepadAxis; +} + +/// Types of gamepad control bindings. +/// +/// A gamepad is a collection of bindings that map arbitrary joystick buttons, +/// axes and hat switches to specific positions on a generic console-style +/// gamepad. This enum is used as part of [`SDL_GamepadBinding`] to specify those +/// mappings. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_GamepadBindingType::NONE) | [`SDL_GAMEPAD_BINDTYPE_NONE`] | | +/// | [`BUTTON`](SDL_GamepadBindingType::BUTTON) | [`SDL_GAMEPAD_BINDTYPE_BUTTON`] | | +/// | [`AXIS`](SDL_GamepadBindingType::AXIS) | [`SDL_GAMEPAD_BINDTYPE_AXIS`] | | +/// | [`HAT`](SDL_GamepadBindingType::HAT) | [`SDL_GAMEPAD_BINDTYPE_HAT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GamepadBindingType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadBindingType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GamepadBindingType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GamepadBindingType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GamepadBindingType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_GAMEPAD_BINDTYPE_NONE", + Self::BUTTON => "SDL_GAMEPAD_BINDTYPE_BUTTON", + Self::AXIS => "SDL_GAMEPAD_BINDTYPE_AXIS", + Self::HAT => "SDL_GAMEPAD_BINDTYPE_HAT", + + _ => return write!(f, "SDL_GamepadBindingType({})", self.0), + }) + } +} + +impl SDL_GamepadBindingType { + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + pub const BUTTON: Self = Self((1 as ::core::ffi::c_int)); + pub const AXIS: Self = Self((2 as ::core::ffi::c_int)); + pub const HAT: Self = Self((3 as ::core::ffi::c_int)); +} + +pub const SDL_GAMEPAD_BINDTYPE_NONE: SDL_GamepadBindingType = SDL_GamepadBindingType::NONE; +pub const SDL_GAMEPAD_BINDTYPE_BUTTON: SDL_GamepadBindingType = SDL_GamepadBindingType::BUTTON; +pub const SDL_GAMEPAD_BINDTYPE_AXIS: SDL_GamepadBindingType = SDL_GamepadBindingType::AXIS; +pub const SDL_GAMEPAD_BINDTYPE_HAT: SDL_GamepadBindingType = SDL_GamepadBindingType::HAT; + +impl SDL_GamepadBindingType { + /// Initialize a `SDL_GamepadBindingType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GamepadBindingType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadBindingType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gamepad::METADATA_SDL_GamepadBindingType; +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GamepadBinding { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut s = f.debug_struct("SDL_GamepadBinding"); + s.field("input_type", &self.input_type); + match self.input_type { + SDL_GamepadBindingType::BUTTON => { + s.field("input.button", unsafe { &self.input.button }); + } + SDL_GamepadBindingType::AXIS => { + s.field("input.axis", unsafe { &self.input.axis }); + } + SDL_GamepadBindingType::HAT => { + s.field("input.hat", unsafe { &self.input.hat }); + } + _ => (), + } + s.field("output_type", &self.output_type); + match self.output_type { + SDL_GamepadBindingType::BUTTON => { + s.field("output.button", unsafe { &self.output.button }); + } + SDL_GamepadBindingType::AXIS => { + s.field("output.axis", unsafe { &self.output.axis }); + } + _ => (), + } + s.finish() + } +} +/// A mapping between one joystick input to a gamepad control. +/// +/// A gamepad has a collection of several bindings, to say, for example, when +/// joystick button number 5 is pressed, that should be treated like the +/// gamepad's "start" button. +/// +/// SDL has these bindings built-in for many popular controllers, and can add +/// more with a simple text string. Those strings are parsed into a collection +/// of these structs to make it easier to operate on the data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetGamepadBindings`] +#[repr(C)] +#[derive(Clone, Copy)] +pub struct SDL_GamepadBinding { + pub input_type: SDL_GamepadBindingType, + pub input: SDL_GamepadBinding__AnonUnion1, + pub output_type: SDL_GamepadBindingType, + pub output: SDL_GamepadBinding__AnonUnion2, +} + +impl ::core::default::Default for SDL_GamepadBinding { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub union SDL_GamepadBinding__AnonUnion1 { + pub button: ::core::ffi::c_int, + pub axis: SDL_GamepadBinding__AnonUnion1__AnonStruct1, + pub hat: SDL_GamepadBinding__AnonUnion1__AnonStruct2, +} + +impl ::core::default::Default for SDL_GamepadBinding__AnonUnion1 { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadBinding__AnonUnion1__AnonStruct1 { + pub axis: ::core::ffi::c_int, + pub axis_min: ::core::ffi::c_int, + pub axis_max: ::core::ffi::c_int, +} + +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadBinding__AnonUnion1__AnonStruct2 { + pub hat: ::core::ffi::c_int, + pub hat_mask: ::core::ffi::c_int, +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub union SDL_GamepadBinding__AnonUnion2 { + pub button: SDL_GamepadButton, + pub axis: SDL_GamepadBinding__AnonUnion2__AnonStruct1, +} + +impl ::core::default::Default for SDL_GamepadBinding__AnonUnion2 { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GamepadBinding__AnonUnion2__AnonStruct1 { + pub axis: SDL_GamepadAxis, + pub axis_min: ::core::ffi::c_int, + pub axis_max: ::core::ffi::c_int, +} + +unsafe extern "C" { + /// Add support for gamepads that SDL is unaware of or change the binding of an + /// existing gamepad. + /// + /// The mapping string has the format "GUID,name,mapping", where GUID is the + /// string value from [`SDL_GUIDToString()`], name is the human readable string for + /// the device and mappings are gamepad mappings to joystick ones. Under + /// Windows there is a reserved GUID of "xinput" that covers all XInput + /// devices. The mapping format for joystick is: + /// + /// - `bX`: a joystick button, index X + /// - `hX.Y`: hat X with value Y + /// - `aX`: axis X of the joystick + /// + /// Buttons can be used as a gamepad axes and vice versa. + /// + /// If a device with this GUID is already plugged in, SDL will generate an + /// [`SDL_EVENT_GAMEPAD_ADDED`] event. + /// + /// This string shows an example of a valid mapping for a gamepad: + /// + /// ```c + /// "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7" + /// ``` + /// + /// ## Parameters + /// - `mapping`: the mapping string. + /// + /// ## Return value + /// Returns 1 if a new mapping is added, 0 if an existing mapping is updated, + /// -1 on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddGamepadMappingsFromFile`] + /// - [`SDL_AddGamepadMappingsFromIO`] + /// - [`SDL_GetGamepadMapping`] + /// - [`SDL_GetGamepadMappingForGUID`] + /// - [`SDL_HINT_GAMECONTROLLERCONFIG`] + /// - [`SDL_HINT_GAMECONTROLLERCONFIG_FILE`] + /// - [`SDL_EVENT_GAMEPAD_ADDED`] + pub fn SDL_AddGamepadMapping(mapping: *const ::core::ffi::c_char) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Load a set of gamepad mappings from an [`SDL_IOStream`]. + /// + /// You can call this function several times, if needed, to load different + /// database files. + /// + /// If a new mapping is loaded for an already known gamepad GUID, the later + /// version will overwrite the one currently loaded. + /// + /// Any new mappings for already plugged in controllers will generate + /// [`SDL_EVENT_GAMEPAD_ADDED`] events. + /// + /// Mappings not belonging to the current platform or with no platform field + /// specified will be ignored (i.e. mappings for Linux will be ignored in + /// Windows, etc). + /// + /// This function will load the text database entirely in memory before + /// processing it, so take this into consideration if you are in a memory + /// constrained environment. + /// + /// ## Parameters + /// - `src`: the data stream for the mappings to be added. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns the number of mappings added or -1 on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddGamepadMapping`] + /// - [`SDL_AddGamepadMappingsFromFile`] + /// - [`SDL_GetGamepadMapping`] + /// - [`SDL_GetGamepadMappingForGUID`] + /// - [`SDL_HINT_GAMECONTROLLERCONFIG`] + /// - [`SDL_HINT_GAMECONTROLLERCONFIG_FILE`] + /// - [`SDL_EVENT_GAMEPAD_ADDED`] + pub fn SDL_AddGamepadMappingsFromIO( + src: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Load a set of gamepad mappings from a file. + /// + /// You can call this function several times, if needed, to load different + /// database files. + /// + /// If a new mapping is loaded for an already known gamepad GUID, the later + /// version will overwrite the one currently loaded. + /// + /// Any new mappings for already plugged in controllers will generate + /// [`SDL_EVENT_GAMEPAD_ADDED`] events. + /// + /// Mappings not belonging to the current platform or with no platform field + /// specified will be ignored (i.e. mappings for Linux will be ignored in + /// Windows, etc). + /// + /// ## Parameters + /// - `file`: the mappings file to load. + /// + /// ## Return value + /// Returns the number of mappings added or -1 on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddGamepadMapping`] + /// - [`SDL_AddGamepadMappingsFromIO`] + /// - [`SDL_GetGamepadMapping`] + /// - [`SDL_GetGamepadMappingForGUID`] + /// - [`SDL_HINT_GAMECONTROLLERCONFIG`] + /// - [`SDL_HINT_GAMECONTROLLERCONFIG_FILE`] + /// - [`SDL_EVENT_GAMEPAD_ADDED`] + pub fn SDL_AddGamepadMappingsFromFile(file: *const ::core::ffi::c_char) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Reinitialize the SDL mapping database to its initial state. + /// + /// This will generate gamepad events as needed if device mappings change. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReloadGamepadMappings() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current gamepad mappings. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of mappings returned, can + /// be NULL. + /// + /// ## Return value + /// Returns an array of the mapping strings, NULL-terminated, or NULL on + /// failure; call [`SDL_GetError()`] for more information. This is a + /// single allocation that should be freed with [`SDL_free()`] when it is + /// no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadMappings(count: *mut ::core::ffi::c_int) -> *mut *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the gamepad mapping string for a given GUID. + /// + /// ## Parameters + /// - `guid`: a structure containing the GUID for which a mapping is desired. + /// + /// ## Return value + /// Returns a mapping string or NULL on failure; call [`SDL_GetError()`] for more + /// information. This should be freed with [`SDL_free()`] when it is no + /// longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickGUIDForID`] + /// - [`SDL_GetJoystickGUID`] + pub fn SDL_GetGamepadMappingForGUID(guid: SDL_GUID) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the current mapping of a gamepad. + /// + /// Details about mappings are discussed with [`SDL_AddGamepadMapping()`]. + /// + /// ## Parameters + /// - `gamepad`: the gamepad you want to get the current mapping for. + /// + /// ## Return value + /// Returns a string that has the gamepad's mapping or NULL if no mapping is + /// available; call [`SDL_GetError()`] for more information. This should + /// be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddGamepadMapping`] + /// - [`SDL_GetGamepadMappingForID`] + /// - [`SDL_GetGamepadMappingForGUID`] + /// - [`SDL_SetGamepadMapping`] + pub fn SDL_GetGamepadMapping(gamepad: *mut SDL_Gamepad) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Set the current mapping of a joystick or gamepad. + /// + /// Details about mappings are discussed with [`SDL_AddGamepadMapping()`]. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// - `mapping`: the mapping to use for this device, or NULL to clear the + /// mapping. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddGamepadMapping`] + /// - [`SDL_GetGamepadMapping`] + pub fn SDL_SetGamepadMapping( + instance_id: SDL_JoystickID, + mapping: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether a gamepad is currently connected. + /// + /// ## Return value + /// Returns true if a gamepad is connected, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepads`] + pub fn SDL_HasGamepad() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a list of currently connected gamepads. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of gamepads returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of joystick instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasGamepad`] + /// - [`SDL_OpenGamepad`] + pub fn SDL_GetGamepads(count: *mut ::core::ffi::c_int) -> *mut SDL_JoystickID; +} + +unsafe extern "C" { + /// Check if the given joystick is supported by the gamepad interface. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns true if the given joystick is supported by the gamepad interface, + /// false if it isn't or it's an invalid index. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoysticks`] + /// - [`SDL_OpenGamepad`] + pub fn SDL_IsGamepad(instance_id: SDL_JoystickID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the implementation dependent name of a gamepad. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the name of the selected gamepad. If no name can be found, this + /// function returns NULL; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadName`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadNameForID(instance_id: SDL_JoystickID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the implementation dependent path of a gamepad. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the path of the selected gamepad. If no path can be found, this + /// function returns NULL; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadPath`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadPathForID(instance_id: SDL_JoystickID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the player index of a gamepad. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the player index of a gamepad, or -1 if it's not available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadPlayerIndex`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadPlayerIndexForID(instance_id: SDL_JoystickID) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the implementation-dependent GUID of a gamepad. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the GUID of the selected gamepad. If called on an invalid index, + /// this function returns a zero GUID. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GUIDToString`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadGUIDForID(instance_id: SDL_JoystickID) -> SDL_GUID; +} + +unsafe extern "C" { + /// Get the USB vendor ID of a gamepad, if available. + /// + /// This can be called before any gamepads are opened. If the vendor ID isn't + /// available this function returns 0. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the USB vendor ID of the selected gamepad. If called on an invalid + /// index, this function returns zero. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadVendor`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadVendorForID(instance_id: SDL_JoystickID) -> Uint16; +} + +unsafe extern "C" { + /// Get the USB product ID of a gamepad, if available. + /// + /// This can be called before any gamepads are opened. If the product ID isn't + /// available this function returns 0. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the USB product ID of the selected gamepad. If called on an + /// invalid index, this function returns zero. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadProduct`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadProductForID(instance_id: SDL_JoystickID) -> Uint16; +} + +unsafe extern "C" { + /// Get the product version of a gamepad, if available. + /// + /// This can be called before any gamepads are opened. If the product version + /// isn't available this function returns 0. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the product version of the selected gamepad. If called on an + /// invalid index, this function returns zero. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadProductVersion`] + /// - [`SDL_GetGamepads`] + pub fn SDL_GetGamepadProductVersionForID(instance_id: SDL_JoystickID) -> Uint16; +} + +unsafe extern "C" { + /// Get the type of a gamepad. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the gamepad type. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadType`] + /// - [`SDL_GetGamepads`] + /// - [`SDL_GetRealGamepadTypeForID`] + pub fn SDL_GetGamepadTypeForID(instance_id: SDL_JoystickID) -> SDL_GamepadType; +} + +unsafe extern "C" { + /// Get the type of a gamepad, ignoring any mapping override. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the gamepad type. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadTypeForID`] + /// - [`SDL_GetGamepads`] + /// - [`SDL_GetRealGamepadType`] + pub fn SDL_GetRealGamepadTypeForID(instance_id: SDL_JoystickID) -> SDL_GamepadType; +} + +unsafe extern "C" { + /// Get the mapping of a gamepad. + /// + /// This can be called before any gamepads are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the mapping string. Returns NULL if no mapping is available. This + /// should be freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepads`] + /// - [`SDL_GetGamepadMapping`] + pub fn SDL_GetGamepadMappingForID(instance_id: SDL_JoystickID) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Open a gamepad for use. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns a gamepad identifier or NULL if an error occurred; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseGamepad`] + /// - [`SDL_IsGamepad`] + pub fn SDL_OpenGamepad(instance_id: SDL_JoystickID) -> *mut SDL_Gamepad; +} + +unsafe extern "C" { + /// Get the [`SDL_Gamepad`] associated with a joystick instance ID, if it has been + /// opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID of the gamepad. + /// + /// ## Return value + /// Returns an [`SDL_Gamepad`] on success or NULL on failure or if it hasn't been + /// opened yet; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadFromID(instance_id: SDL_JoystickID) -> *mut SDL_Gamepad; +} + +unsafe extern "C" { + /// Get the [`SDL_Gamepad`] associated with a player index. + /// + /// ## Parameters + /// - `player_index`: the player index, which different from the instance ID. + /// + /// ## Return value + /// Returns the [`SDL_Gamepad`] associated with a player index. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadPlayerIndex`] + /// - [`SDL_SetGamepadPlayerIndex`] + pub fn SDL_GetGamepadFromPlayerIndex(player_index: ::core::ffi::c_int) -> *mut SDL_Gamepad; +} + +unsafe extern "C" { + /// Get the properties associated with an opened gamepad. + /// + /// These properties are shared with the underlying joystick object. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN`]\: true if this gamepad has an LED + /// that has adjustable brightness + /// - [`SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN`]\: true if this gamepad has an LED + /// that has adjustable color + /// - [`SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN`]\: true if this gamepad has a + /// player LED + /// - [`SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN`]\: true if this gamepad has + /// left/right rumble + /// - [`SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN`]\: true if this gamepad has + /// simple trigger rumble + /// + /// ## Parameters + /// - `gamepad`: a gamepad identifier previously returned by + /// [`SDL_OpenGamepad()`]. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadProperties(gamepad: *mut SDL_Gamepad) -> SDL_PropertiesID; +} + +pub const SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN: *const ::core::ffi::c_char = + SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN; + +pub const SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN: *const ::core::ffi::c_char = + SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN; + +pub const SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN: *const ::core::ffi::c_char = + SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN; + +pub const SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN: *const ::core::ffi::c_char = + SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN; + +pub const SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN: *const ::core::ffi::c_char = + SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN; + +unsafe extern "C" { + /// Get the instance ID of an opened gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad identifier previously returned by + /// [`SDL_OpenGamepad()`]. + /// + /// ## Return value + /// Returns the instance ID of the specified gamepad on success or 0 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadID(gamepad: *mut SDL_Gamepad) -> SDL_JoystickID; +} + +unsafe extern "C" { + /// Get the implementation-dependent name for an opened gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad identifier previously returned by + /// [`SDL_OpenGamepad()`]. + /// + /// ## Return value + /// Returns the implementation dependent name for the gamepad, or NULL if + /// there is no name or the identifier passed is invalid. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadNameForID`] + pub fn SDL_GetGamepadName(gamepad: *mut SDL_Gamepad) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the implementation-dependent path for an opened gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad identifier previously returned by + /// [`SDL_OpenGamepad()`]. + /// + /// ## Return value + /// Returns the implementation dependent path for the gamepad, or NULL if + /// there is no path or the identifier passed is invalid. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadPathForID`] + pub fn SDL_GetGamepadPath(gamepad: *mut SDL_Gamepad) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the type of an opened gamepad. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the gamepad type, or [`SDL_GAMEPAD_TYPE_UNKNOWN`] if it's not + /// available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadTypeForID`] + pub fn SDL_GetGamepadType(gamepad: *mut SDL_Gamepad) -> SDL_GamepadType; +} + +unsafe extern "C" { + /// Get the type of an opened gamepad, ignoring any mapping override. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the gamepad type, or [`SDL_GAMEPAD_TYPE_UNKNOWN`] if it's not + /// available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRealGamepadTypeForID`] + pub fn SDL_GetRealGamepadType(gamepad: *mut SDL_Gamepad) -> SDL_GamepadType; +} + +unsafe extern "C" { + /// Get the player index of an opened gamepad. + /// + /// For XInput gamepads this returns the XInput user index. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the player index for gamepad, or -1 if it's not available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetGamepadPlayerIndex`] + pub fn SDL_GetGamepadPlayerIndex(gamepad: *mut SDL_Gamepad) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Set the player index of an opened gamepad. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to adjust. + /// - `player_index`: player index to assign to this gamepad, or -1 to clear + /// the player index and turn off player LEDs. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadPlayerIndex`] + pub fn SDL_SetGamepadPlayerIndex( + gamepad: *mut SDL_Gamepad, + player_index: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the USB vendor ID of an opened gamepad, if available. + /// + /// If the vendor ID isn't available this function returns 0. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the USB vendor ID, or zero if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadVendorForID`] + pub fn SDL_GetGamepadVendor(gamepad: *mut SDL_Gamepad) -> Uint16; +} + +unsafe extern "C" { + /// Get the USB product ID of an opened gamepad, if available. + /// + /// If the product ID isn't available this function returns 0. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the USB product ID, or zero if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadProductForID`] + pub fn SDL_GetGamepadProduct(gamepad: *mut SDL_Gamepad) -> Uint16; +} + +unsafe extern "C" { + /// Get the product version of an opened gamepad, if available. + /// + /// If the product version isn't available this function returns 0. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the USB product version, or zero if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadProductVersionForID`] + pub fn SDL_GetGamepadProductVersion(gamepad: *mut SDL_Gamepad) -> Uint16; +} + +unsafe extern "C" { + /// Get the firmware version of an opened gamepad, if available. + /// + /// If the firmware version isn't available this function returns 0. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the gamepad firmware version, or zero if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadFirmwareVersion(gamepad: *mut SDL_Gamepad) -> Uint16; +} + +unsafe extern "C" { + /// Get the serial number of an opened gamepad, if available. + /// + /// Returns the serial number of the gamepad, or NULL if it is not available. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the serial number, or NULL if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadSerial(gamepad: *mut SDL_Gamepad) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the Steam Input handle of an opened gamepad, if available. + /// + /// Returns an InputHandle_t for the gamepad that can be used with Steam Input + /// API: + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the gamepad handle, or 0 if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadSteamHandle(gamepad: *mut SDL_Gamepad) -> Uint64; +} + +unsafe extern "C" { + /// Get the connection state of a gamepad. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// + /// ## Return value + /// Returns the connection state on success or + /// [`SDL_JOYSTICK_CONNECTION_INVALID`] on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadConnectionState(gamepad: *mut SDL_Gamepad) -> SDL_JoystickConnectionState; +} + +unsafe extern "C" { + /// Get the battery state of a gamepad. + /// + /// You should never take a battery status as absolute truth. Batteries + /// (especially failing batteries) are delicate hardware, and the values + /// reported here are best estimates based on what that hardware reports. It's + /// not uncommon for older batteries to lose stored power much faster than it + /// reports, or completely drain when reporting it has 20 percent left, etc. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object to query. + /// - `percent`: a pointer filled in with the percentage of battery life + /// left, between 0 and 100, or NULL to ignore. This will be + /// filled in with -1 we can't determine a value or there is no + /// battery. + /// + /// ## Return value + /// Returns the current battery state. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadPowerInfo( + gamepad: *mut SDL_Gamepad, + percent: *mut ::core::ffi::c_int, + ) -> SDL_PowerState; +} + +unsafe extern "C" { + /// Check if a gamepad has been opened and is currently connected. + /// + /// ## Parameters + /// - `gamepad`: a gamepad identifier previously returned by + /// [`SDL_OpenGamepad()`]. + /// + /// ## Return value + /// Returns true if the gamepad has been opened and is currently connected, or + /// false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GamepadConnected(gamepad: *mut SDL_Gamepad) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the underlying joystick from a gamepad. + /// + /// This function will give you a [`SDL_Joystick`] object, which allows you to use + /// the [`SDL_Joystick`] functions with a [`SDL_Gamepad`] object. This would be useful + /// for getting a joystick's position at any given time, even if it hasn't + /// moved (moving it would produce an event, which would have the axis' value). + /// + /// The pointer returned is owned by the [`SDL_Gamepad`]. You should not call + /// [`SDL_CloseJoystick()`] on it, for example, since doing so will likely cause + /// SDL to crash. + /// + /// ## Parameters + /// - `gamepad`: the gamepad object that you want to get a joystick from. + /// + /// ## Return value + /// Returns an [`SDL_Joystick`] object, or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadJoystick(gamepad: *mut SDL_Gamepad) -> *mut SDL_Joystick; +} + +unsafe extern "C" { + /// Set the state of gamepad event processing. + /// + /// If gamepad events are disabled, you must call [`SDL_UpdateGamepads()`] yourself + /// and check the state of the gamepad when you want gamepad information. + /// + /// ## Parameters + /// - `enabled`: whether to process gamepad events or not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GamepadEventsEnabled`] + /// - [`SDL_UpdateGamepads`] + pub fn SDL_SetGamepadEventsEnabled(enabled: ::core::primitive::bool); +} + +unsafe extern "C" { + /// Query the state of gamepad event processing. + /// + /// If gamepad events are disabled, you must call [`SDL_UpdateGamepads()`] yourself + /// and check the state of the gamepad when you want gamepad information. + /// + /// ## Return value + /// Returns true if gamepad events are being processed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetGamepadEventsEnabled`] + pub fn SDL_GamepadEventsEnabled() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the SDL joystick layer bindings for a gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `count`: a pointer filled in with the number of bindings returned. + /// + /// ## Return value + /// Returns a NULL terminated array of pointers to bindings or NULL on + /// failure; call [`SDL_GetError()`] for more information. This is a + /// single allocation that should be freed with [`SDL_free()`] when it is + /// no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadBindings( + gamepad: *mut SDL_Gamepad, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut SDL_GamepadBinding; +} + +unsafe extern "C" { + /// Manually pump gamepad updates if not using the loop. + /// + /// This function is called automatically by the event loop if events are + /// enabled. Under such circumstances, it will not be necessary to call this + /// function. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UpdateGamepads(); +} + +unsafe extern "C" { + /// Convert a string into [`SDL_GamepadType`] enum. + /// + /// This function is called internally to translate [`SDL_Gamepad`] mapping strings + /// for the underlying joystick device into the consistent [`SDL_Gamepad`] mapping. + /// You do not normally need to call this function unless you are parsing + /// [`SDL_Gamepad`] mappings in your own code. + /// + /// ## Parameters + /// - `str`: string representing a [`SDL_GamepadType`] type. + /// + /// ## Return value + /// Returns the [`SDL_GamepadType`] enum corresponding to the input string, or + /// [`SDL_GAMEPAD_TYPE_UNKNOWN`] if no match was found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadStringForType`] + pub fn SDL_GetGamepadTypeFromString(str: *const ::core::ffi::c_char) -> SDL_GamepadType; +} + +unsafe extern "C" { + /// Convert from an [`SDL_GamepadType`] enum to a string. + /// + /// ## Parameters + /// - `type`: an enum value for a given [`SDL_GamepadType`]. + /// + /// ## Return value + /// Returns a string for the given type, or NULL if an invalid type is + /// specified. The string returned is of the format used by + /// [`SDL_Gamepad`] mapping strings. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadTypeFromString`] + pub fn SDL_GetGamepadStringForType(r#type: SDL_GamepadType) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert a string into [`SDL_GamepadAxis`] enum. + /// + /// This function is called internally to translate [`SDL_Gamepad`] mapping strings + /// for the underlying joystick device into the consistent [`SDL_Gamepad`] mapping. + /// You do not normally need to call this function unless you are parsing + /// [`SDL_Gamepad`] mappings in your own code. + /// + /// Note specially that "righttrigger" and "lefttrigger" map to + /// [`SDL_GAMEPAD_AXIS_RIGHT_TRIGGER`] and [`SDL_GAMEPAD_AXIS_LEFT_TRIGGER`], + /// respectively. + /// + /// ## Parameters + /// - `str`: string representing a [`SDL_Gamepad`] axis. + /// + /// ## Return value + /// Returns the [`SDL_GamepadAxis`] enum corresponding to the input string, or + /// [`SDL_GAMEPAD_AXIS_INVALID`] if no match was found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadStringForAxis`] + pub fn SDL_GetGamepadAxisFromString(str: *const ::core::ffi::c_char) -> SDL_GamepadAxis; +} + +unsafe extern "C" { + /// Convert from an [`SDL_GamepadAxis`] enum to a string. + /// + /// ## Parameters + /// - `axis`: an enum value for a given [`SDL_GamepadAxis`]. + /// + /// ## Return value + /// Returns a string for the given axis, or NULL if an invalid axis is + /// specified. The string returned is of the format used by + /// [`SDL_Gamepad`] mapping strings. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadAxisFromString`] + pub fn SDL_GetGamepadStringForAxis(axis: SDL_GamepadAxis) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Query whether a gamepad has a given axis. + /// + /// This merely reports whether the gamepad's mapping defined this axis, as + /// that is all the information SDL has about the physical device. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `axis`: an axis enum value (an [`SDL_GamepadAxis`] value). + /// + /// ## Return value + /// Returns true if the gamepad has this axis, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GamepadHasButton`] + /// - [`SDL_GetGamepadAxis`] + pub fn SDL_GamepadHasAxis( + gamepad: *mut SDL_Gamepad, + axis: SDL_GamepadAxis, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current state of an axis control on a gamepad. + /// + /// The axis indices start at index 0. + /// + /// For thumbsticks, the state is a value ranging from -32768 (up/left) to + /// 32767 (down/right). + /// + /// Triggers range from 0 when released to 32767 when fully pressed, and never + /// return a negative value. Note that this differs from the value reported by + /// the lower-level [`SDL_GetJoystickAxis()`], which normally uses the full range. + /// + /// Note that for invalid gamepads or axes, this will return 0. Zero is also a + /// valid value in normal operation; usually it means a centered axis. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `axis`: an axis index (one of the [`SDL_GamepadAxis`] values). + /// + /// ## Return value + /// Returns axis state. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GamepadHasAxis`] + /// - [`SDL_GetGamepadButton`] + pub fn SDL_GetGamepadAxis(gamepad: *mut SDL_Gamepad, axis: SDL_GamepadAxis) -> Sint16; +} + +unsafe extern "C" { + /// Convert a string into an [`SDL_GamepadButton`] enum. + /// + /// This function is called internally to translate [`SDL_Gamepad`] mapping strings + /// for the underlying joystick device into the consistent [`SDL_Gamepad`] mapping. + /// You do not normally need to call this function unless you are parsing + /// [`SDL_Gamepad`] mappings in your own code. + /// + /// ## Parameters + /// - `str`: string representing a [`SDL_Gamepad`] button. + /// + /// ## Return value + /// Returns the [`SDL_GamepadButton`] enum corresponding to the input string, or + /// [`SDL_GAMEPAD_BUTTON_INVALID`] if no match was found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadStringForButton`] + pub fn SDL_GetGamepadButtonFromString(str: *const ::core::ffi::c_char) -> SDL_GamepadButton; +} + +unsafe extern "C" { + /// Convert from an [`SDL_GamepadButton`] enum to a string. + /// + /// ## Parameters + /// - `button`: an enum value for a given [`SDL_GamepadButton`]. + /// + /// ## Return value + /// Returns a string for the given button, or NULL if an invalid button is + /// specified. The string returned is of the format used by + /// [`SDL_Gamepad`] mapping strings. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadButtonFromString`] + pub fn SDL_GetGamepadStringForButton(button: SDL_GamepadButton) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Query whether a gamepad has a given button. + /// + /// This merely reports whether the gamepad's mapping defined this button, as + /// that is all the information SDL has about the physical device. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `button`: a button enum value (an [`SDL_GamepadButton`] value). + /// + /// ## Return value + /// Returns true if the gamepad has this button, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GamepadHasAxis`] + pub fn SDL_GamepadHasButton( + gamepad: *mut SDL_Gamepad, + button: SDL_GamepadButton, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current state of a button on a gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `button`: a button index (one of the [`SDL_GamepadButton`] values). + /// + /// ## Return value + /// Returns true if the button is pressed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GamepadHasButton`] + /// - [`SDL_GetGamepadAxis`] + pub fn SDL_GetGamepadButton( + gamepad: *mut SDL_Gamepad, + button: SDL_GamepadButton, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the label of a button on a gamepad. + /// + /// ## Parameters + /// - `type`: the type of gamepad to check. + /// - `button`: a button index (one of the [`SDL_GamepadButton`] values). + /// + /// ## Return value + /// Returns the [`SDL_GamepadButtonLabel`] enum corresponding to the button label. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadButtonLabel`] + pub fn SDL_GetGamepadButtonLabelForType( + r#type: SDL_GamepadType, + button: SDL_GamepadButton, + ) -> SDL_GamepadButtonLabel; +} + +unsafe extern "C" { + /// Get the label of a button on a gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `button`: a button index (one of the [`SDL_GamepadButton`] values). + /// + /// ## Return value + /// Returns the [`SDL_GamepadButtonLabel`] enum corresponding to the button label. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadButtonLabelForType`] + pub fn SDL_GetGamepadButtonLabel( + gamepad: *mut SDL_Gamepad, + button: SDL_GamepadButton, + ) -> SDL_GamepadButtonLabel; +} + +unsafe extern "C" { + /// Get the number of touchpads on a gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// + /// ## Return value + /// Returns number of touchpads. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumGamepadTouchpadFingers`] + pub fn SDL_GetNumGamepadTouchpads(gamepad: *mut SDL_Gamepad) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of supported simultaneous fingers on a touchpad on a game + /// gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `touchpad`: a touchpad. + /// + /// ## Return value + /// Returns number of supported simultaneous fingers. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadTouchpadFinger`] + /// - [`SDL_GetNumGamepadTouchpads`] + pub fn SDL_GetNumGamepadTouchpadFingers( + gamepad: *mut SDL_Gamepad, + touchpad: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the current state of a finger on a touchpad on a gamepad. + /// + /// ## Parameters + /// - `gamepad`: a gamepad. + /// - `touchpad`: a touchpad. + /// - `finger`: a finger. + /// - `down`: a pointer filled with true if the finger is down, false + /// otherwise, may be NULL. + /// - `x`: a pointer filled with the x position, normalized 0 to 1, with the + /// origin in the upper left, may be NULL. + /// - `y`: a pointer filled with the y position, normalized 0 to 1, with the + /// origin in the upper left, may be NULL. + /// - `pressure`: a pointer filled with pressure value, may be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumGamepadTouchpadFingers`] + pub fn SDL_GetGamepadTouchpadFinger( + gamepad: *mut SDL_Gamepad, + touchpad: ::core::ffi::c_int, + finger: ::core::ffi::c_int, + down: *mut ::core::primitive::bool, + x: *mut ::core::ffi::c_float, + y: *mut ::core::ffi::c_float, + pressure: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether a gamepad has a particular sensor. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to query. + /// - `type`: the type of sensor to query. + /// + /// ## Return value + /// Returns true if the sensor exists, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadSensorData`] + /// - [`SDL_GetGamepadSensorDataRate`] + /// - [`SDL_SetGamepadSensorEnabled`] + pub fn SDL_GamepadHasSensor( + gamepad: *mut SDL_Gamepad, + r#type: SDL_SensorType, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set whether data reporting for a gamepad sensor is enabled. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to update. + /// - `type`: the type of sensor to enable/disable. + /// - `enabled`: whether data reporting should be enabled. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GamepadHasSensor`] + /// - [`SDL_GamepadSensorEnabled`] + pub fn SDL_SetGamepadSensorEnabled( + gamepad: *mut SDL_Gamepad, + r#type: SDL_SensorType, + enabled: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Query whether sensor data reporting is enabled for a gamepad. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to query. + /// - `type`: the type of sensor to query. + /// + /// ## Return value + /// Returns true if the sensor is enabled, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetGamepadSensorEnabled`] + pub fn SDL_GamepadSensorEnabled( + gamepad: *mut SDL_Gamepad, + r#type: SDL_SensorType, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the data rate (number of events per second) of a gamepad sensor. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to query. + /// - `type`: the type of sensor to query. + /// + /// ## Return value + /// Returns the data rate, or 0.0f if the data rate is not available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadSensorDataRate( + gamepad: *mut SDL_Gamepad, + r#type: SDL_SensorType, + ) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Get the current state of a gamepad sensor. + /// + /// The number of values and interpretation of the data is sensor dependent. + /// See the remarks in [`SDL_SensorType`] for details for each type of sensor. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to query. + /// - `type`: the type of sensor to query. + /// - `data`: a pointer filled with the current sensor state. + /// - `num_values`: the number of values to write to data. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGamepadSensorData( + gamepad: *mut SDL_Gamepad, + r#type: SDL_SensorType, + data: *mut ::core::ffi::c_float, + num_values: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Start a rumble effect on a gamepad. + /// + /// Each call to this function cancels any previous rumble effect, and calling + /// it with 0 intensity stops any rumbling. + /// + /// This function requires you to process SDL events or call + /// [`SDL_UpdateJoysticks()`] to update rumble state. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to vibrate. + /// - `low_frequency_rumble`: the intensity of the low frequency (left) + /// rumble motor, from 0 to 0xFFFF. + /// - `high_frequency_rumble`: the intensity of the high frequency (right) + /// rumble motor, from 0 to 0xFFFF. + /// - `duration_ms`: the duration of the rumble effect, in milliseconds. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RumbleGamepad( + gamepad: *mut SDL_Gamepad, + low_frequency_rumble: Uint16, + high_frequency_rumble: Uint16, + duration_ms: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Start a rumble effect in the gamepad's triggers. + /// + /// Each call to this function cancels any previous trigger rumble effect, and + /// calling it with 0 intensity stops any rumbling. + /// + /// Note that this is rumbling of the _triggers_ and not the gamepad as a + /// whole. This is currently only supported on Xbox One gamepads. If you want + /// the (more common) whole-gamepad rumble, use [`SDL_RumbleGamepad()`] instead. + /// + /// This function requires you to process SDL events or call + /// [`SDL_UpdateJoysticks()`] to update rumble state. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to vibrate. + /// - `left_rumble`: the intensity of the left trigger rumble motor, from 0 + /// to 0xFFFF. + /// - `right_rumble`: the intensity of the right trigger rumble motor, from 0 + /// to 0xFFFF. + /// - `duration_ms`: the duration of the rumble effect, in milliseconds. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RumbleGamepad`] + pub fn SDL_RumbleGamepadTriggers( + gamepad: *mut SDL_Gamepad, + left_rumble: Uint16, + right_rumble: Uint16, + duration_ms: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update a gamepad's LED color. + /// + /// An example of a joystick LED is the light on the back of a PlayStation 4's + /// DualShock 4 controller. + /// + /// For gamepads with a single color LED, the maximum of the RGB values will be + /// used as the LED brightness. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to update. + /// - `red`: the intensity of the red LED. + /// - `green`: the intensity of the green LED. + /// - `blue`: the intensity of the blue LED. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetGamepadLED( + gamepad: *mut SDL_Gamepad, + red: Uint8, + green: Uint8, + blue: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Send a gamepad specific effect packet. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to affect. + /// - `data`: the data to send to the gamepad. + /// - `size`: the size of the data to send to the gamepad. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SendGamepadEffect( + gamepad: *mut SDL_Gamepad, + data: *const ::core::ffi::c_void, + size: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Close a gamepad previously opened with [`SDL_OpenGamepad()`]. + /// + /// ## Parameters + /// - `gamepad`: a gamepad identifier previously returned by + /// [`SDL_OpenGamepad()`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenGamepad`] + pub fn SDL_CloseGamepad(gamepad: *mut SDL_Gamepad); +} + +unsafe extern "C" { + /// Return the sfSymbolsName for a given button on a gamepad on Apple + /// platforms. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to query. + /// - `button`: a button on the gamepad. + /// + /// ## Return value + /// Returns the sfSymbolsName or NULL if the name can't be found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadAppleSFSymbolsNameForAxis`] + pub fn SDL_GetGamepadAppleSFSymbolsNameForButton( + gamepad: *mut SDL_Gamepad, + button: SDL_GamepadButton, + ) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Return the sfSymbolsName for a given axis on a gamepad on Apple platforms. + /// + /// ## Parameters + /// - `gamepad`: the gamepad to query. + /// - `axis`: an axis on the gamepad. + /// + /// ## Return value + /// Returns the sfSymbolsName or NULL if the name can't be found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGamepadAppleSFSymbolsNameForButton`] + pub fn SDL_GetGamepadAppleSFSymbolsNameForAxis( + gamepad: *mut SDL_Gamepad, + axis: SDL_GamepadAxis, + ) -> *const ::core::ffi::c_char; +} + +/// The structure used to identify an SDL gamepad +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Gamepad { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/gpu.rs b/vendor/sdl3-sys/src/generated/gpu.rs new file mode 100644 index 00000000..26757147 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/gpu.rs @@ -0,0 +1,8768 @@ +//! The GPU API offers a cross-platform way for apps to talk to modern graphics +//! hardware. It offers both 3D graphics and compute support, in the style of +//! Metal, Vulkan, and Direct3D 12. +//! +//! A basic workflow might be something like this: +//! +//! The app creates a GPU device with [`SDL_CreateGPUDevice()`], and assigns it to +//! a window with [`SDL_ClaimWindowForGPUDevice()`]--although strictly speaking you +//! can render offscreen entirely, perhaps for image processing, and not use a +//! window at all. +//! +//! Next, the app prepares static data (things that are created once and used +//! over and over). For example: +//! +//! - Shaders (programs that run on the GPU): use [`SDL_CreateGPUShader()`]. +//! - Vertex buffers (arrays of geometry data) and other rendering data: use +//! [`SDL_CreateGPUBuffer()`] and [`SDL_UploadToGPUBuffer()`]. +//! - Textures (images): use [`SDL_CreateGPUTexture()`] and +//! [`SDL_UploadToGPUTexture()`]. +//! - Samplers (how textures should be read from): use [`SDL_CreateGPUSampler()`]. +//! - Render pipelines (precalculated rendering state): use +//! [`SDL_CreateGPUGraphicsPipeline()`] +//! +//! To render, the app creates one or more command buffers, with +//! [`SDL_AcquireGPUCommandBuffer()`]. Command buffers collect rendering +//! instructions that will be submitted to the GPU in batch. Complex scenes can +//! use multiple command buffers, maybe configured across multiple threads in +//! parallel, as long as they are submitted in the correct order, but many apps +//! will just need one command buffer per frame. +//! +//! Rendering can happen to a texture (what other APIs call a "render target") +//! or it can happen to the swapchain texture (which is just a special texture +//! that represents a window's contents). The app can use +//! [`SDL_WaitAndAcquireGPUSwapchainTexture()`] to render to the window. +//! +//! Rendering actually happens in a Render Pass, which is encoded into a +//! command buffer. One can encode multiple render passes (or alternate between +//! render and compute passes) in a single command buffer, but many apps might +//! simply need a single render pass in a single command buffer. Render Passes +//! can render to up to four color textures and one depth texture +//! simultaneously. If the set of textures being rendered to needs to change, +//! the Render Pass must be ended and a new one must be begun. +//! +//! The app calls [`SDL_BeginGPURenderPass()`]. Then it sets states it needs for +//! each draw: +//! +//! - [`SDL_BindGPUGraphicsPipeline()`] +//! - [`SDL_SetGPUViewport()`] +//! - [`SDL_BindGPUVertexBuffers()`] +//! - [`SDL_BindGPUVertexSamplers()`] +//! - etc +//! +//! Then, make the actual draw commands with these states: +//! +//! - [`SDL_DrawGPUPrimitives()`] +//! - [`SDL_DrawGPUPrimitivesIndirect()`] +//! - [`SDL_DrawGPUIndexedPrimitivesIndirect()`] +//! - etc +//! +//! After all the drawing commands for a pass are complete, the app should call +//! [`SDL_EndGPURenderPass()`]. Once a render pass ends all render-related state is +//! reset. +//! +//! The app can begin new Render Passes and make new draws in the same command +//! buffer until the entire scene is rendered. +//! +//! Once all of the render commands for the scene are complete, the app calls +//! [`SDL_SubmitGPUCommandBuffer()`] to send it to the GPU for processing. +//! +//! If the app needs to read back data from texture or buffers, the API has an +//! efficient way of doing this, provided that the app is willing to tolerate +//! some latency. When the app uses [`SDL_DownloadFromGPUTexture()`] or +//! [`SDL_DownloadFromGPUBuffer()`], submitting the command buffer with +//! [`SDL_SubmitGPUCommandBufferAndAcquireFence()`] will return a fence handle that +//! the app can poll or wait on in a thread. Once the fence indicates that the +//! command buffer is done processing, it is safe to read the downloaded data. +//! Make sure to call [`SDL_ReleaseGPUFence()`] when done with the fence. +//! +//! The API also has "compute" support. The app calls [`SDL_BeginGPUComputePass()`] +//! with compute-writeable textures and/or buffers, which can be written to in +//! a compute shader. Then it sets states it needs for the compute dispatches: +//! +//! - [`SDL_BindGPUComputePipeline()`] +//! - [`SDL_BindGPUComputeStorageBuffers()`] +//! - [`SDL_BindGPUComputeStorageTextures()`] +//! +//! Then, dispatch compute work: +//! +//! - [`SDL_DispatchGPUCompute()`] +//! +//! For advanced users, this opens up powerful GPU-driven workflows. +//! +//! Graphics and compute pipelines require the use of shaders, which as +//! mentioned above are small programs executed on the GPU. Each backend +//! (Vulkan, Metal, D3D12) requires a different shader format. When the app +//! creates the GPU device, the app lets the device know which shader formats +//! the app can provide. It will then select the appropriate backend depending +//! on the available shader formats and the backends available on the platform. +//! When creating shaders, the app must provide the correct shader format for +//! the selected backend. If you would like to learn more about why the API +//! works this way, there is a detailed +//! [blog post](https://moonside.games/posts/layers-all-the-way-down/) +//! explaining this situation. +//! +//! It is optimal for apps to pre-compile the shader formats they might use, +//! but for ease of use SDL provides a separate project, +//! [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross) +//! , for performing runtime shader cross-compilation. It also has a CLI +//! interface for offline precompilation as well. +//! +//! This is an extremely quick overview that leaves out several important +//! details. Already, though, one can see that GPU programming can be quite +//! complex! If you just need simple 2D graphics, the +//! [Render API](https://wiki.libsdl.org/SDL3/CategoryRender) +//! is much easier to use but still hardware-accelerated. That said, even for +//! 2D applications the performance benefits and expressiveness of the GPU API +//! are significant. +//! +//! The GPU API targets a feature set with a wide range of hardware support and +//! ease of portability. It is designed so that the app won't have to branch +//! itself by querying feature support. If you need cutting-edge features with +//! limited hardware support, this API is probably not for you. +//! +//! Examples demonstrating proper usage of this API can be found +//! [here](https://github.com/TheSpydog/SDL_gpu_examples) +//! . +//! +//! ## Performance considerations +//! +//! Here are some basic tips for maximizing your rendering performance. +//! +//! - Beginning a new render pass is relatively expensive. Use as few render +//! passes as you can. +//! - Minimize the amount of state changes. For example, binding a pipeline is +//! relatively cheap, but doing it hundreds of times when you don't need to +//! will slow the performance significantly. +//! - Perform your data uploads as early as possible in the frame. +//! - Don't churn resources. Creating and releasing resources is expensive. +//! It's better to create what you need up front and cache it. +//! - Don't use uniform buffers for large amounts of data (more than a matrix +//! or so). Use a storage buffer instead. +//! - Use cycling correctly. There is a detailed explanation of cycling further +//! below. +//! - Use culling techniques to minimize pixel writes. The less writing the GPU +//! has to do the better. Culling can be a very advanced topic but even +//! simple culling techniques can boost performance significantly. +//! +//! In general try to remember the golden rule of performance: doing things is +//! more expensive than not doing things. Don't Touch The Driver! +//! +//! ## FAQ +//! +//! **Question: When are you adding more advanced features, like ray tracing or +//! mesh shaders?** +//! +//! Answer: We don't have immediate plans to add more bleeding-edge features, +//! but we certainly might in the future, when these features prove worthwhile, +//! and reasonable to implement across several platforms and underlying APIs. +//! So while these things are not in the "never" category, they are definitely +//! not "near future" items either. +//! +//! **Question: Why is my shader not working?** +//! +//! Answer: A common oversight when using shaders is not properly laying out +//! the shader resources/registers correctly. The GPU API is very strict with +//! how it wants resources to be laid out and it's difficult for the API to +//! automatically validate shaders to see if they have a compatible layout. See +//! the documentation for [`SDL_CreateGPUShader()`] and +//! [`SDL_CreateGPUComputePipeline()`] for information on the expected layout. +//! +//! Another common issue is not setting the correct number of samplers, +//! textures, and buffers in [`SDL_GPUShaderCreateInfo`]. If possible use shader +//! reflection to extract the required information from the shader +//! automatically instead of manually filling in the struct's values. +//! +//! **Question: My application isn't performing very well. Is this the GPU +//! API's fault?** +//! +//! Answer: No. Long answer: The GPU API is a relatively thin layer over the +//! underlying graphics API. While it's possible that we have done something +//! inefficiently, it's very unlikely especially if you are relatively +//! inexperienced with GPU rendering. Please see the performance tips above and +//! make sure you are following them. Additionally, tools like +//! [RenderDoc](https://renderdoc.org/) +//! can be very helpful for diagnosing incorrect behavior and performance +//! issues. +//! +//! ## System Requirements +//! +//! ### Vulkan +//! +//! SDL driver name: "vulkan" (for use in [`SDL_CreateGPUDevice()`] and +//! [`SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`]) +//! +//! Supported on Windows, Linux, Nintendo Switch, and certain Android devices. +//! Requires Vulkan 1.0 with the following extensions and device features: +//! +//! - `VK_KHR_swapchain` +//! - `VK_KHR_maintenance1` +//! - `independentBlend` +//! - `imageCubeArray` +//! - `depthClamp` +//! - `shaderClipDistance` +//! - `drawIndirectFirstInstance` +//! - `sampleRateShading` +//! +//! You can remove some of these requirements to increase compatibility with +//! Android devices by using these properties when creating the GPU device with +//! [`SDL_CreateGPUDeviceWithProperties()`]\: +//! +//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN`] +//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN`] +//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN`] +//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN`] +//! +//! ### D3D12 +//! +//! SDL driver name: "direct3d12" +//! +//! Supported on Windows 10 or newer, Xbox One (GDK), and Xbox Series X|S +//! (GDK). Requires a GPU that supports DirectX 12 Feature Level 11_0 and +//! Resource Binding Tier 2 or above. +//! +//! You can remove the Tier 2 resource binding requirement to support Intel +//! Haswell and Broadwell GPUs by using this property when creating the GPU +//! device with [`SDL_CreateGPUDeviceWithProperties()`]\: +//! +//! - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN`] +//! +//! ### Metal +//! +//! SDL driver name: "metal" +//! +//! Supported on macOS 10.14+ and iOS/tvOS 13.0+. Hardware requirements vary by +//! operating system: +//! +//! - macOS requires an Apple Silicon or +//! [Intel Mac2 family](https://developer.apple.com/documentation/metal/mtlfeatureset/mtlfeatureset_macos_gpufamily2_v1?language=objc) +//! GPU +//! - iOS/tvOS requires an A9 GPU or newer +//! - iOS Simulator and tvOS Simulator are unsupported +//! +//! ## Coordinate System +//! +//! The GPU API uses a left-handed coordinate system, following the convention +//! of D3D12 and Metal. Specifically: +//! +//! - **Normalized Device Coordinates:** The lower-left corner has an x,y +//! coordinate of `(-1.0, -1.0)`. The upper-right corner is `(1.0, 1.0)`. Z +//! values range from `[0.0, 1.0]` where 0 is the near plane. +//! - **Viewport Coordinates:** The top-left corner has an x,y coordinate of +//! `(0, 0)` and extends to the bottom-right corner at `(viewportWidth, +//! viewportHeight)`. +Y is down. +//! - **Texture Coordinates:** The top-left corner has an x,y coordinate of +//! `(0, 0)` and extends to the bottom-right corner at `(1.0, 1.0)`. +Y is +//! down. +//! +//! If the backend driver differs from this convention (e.g. Vulkan, which has +//! an NDC that assumes +Y is down), SDL will automatically convert the +//! coordinate system behind the scenes, so you don't need to perform any +//! coordinate flipping logic in your shaders. +//! +//! ## Uniform Data +//! +//! Uniforms are for passing data to shaders. The uniform data will be constant +//! across all executions of the shader. +//! +//! There are 4 available uniform slots per shader stage (where the stages are +//! vertex, fragment, and compute). Uniform data pushed to a slot on a stage +//! keeps its value throughout the command buffer until you call the relevant +//! Push function on that slot again. +//! +//! For example, you could write your vertex shaders to read a camera matrix +//! from uniform binding slot 0, push the camera matrix at the start of the +//! command buffer, and that data will be used for every subsequent draw call. +//! +//! It is valid to push uniform data during a render or compute pass. +//! +//! Uniforms are best for pushing small amounts of data. If you are pushing +//! more than a matrix or two per call you should consider using a storage +//! buffer instead. +//! +//! ## A Note On Cycling +//! +//! When using a command buffer, operations do not occur immediately - they +//! occur some time after the command buffer is submitted. +//! +//! When a resource is used in a pending or active command buffer, it is +//! considered to be "bound". When a resource is no longer used in any pending +//! or active command buffers, it is considered to be "unbound". +//! +//! If data resources are bound, it is unspecified when that data will be +//! unbound unless you acquire a fence when submitting the command buffer and +//! wait on it. However, this doesn't mean you need to track resource usage +//! manually. +//! +//! All of the functions and structs that involve writing to a resource have a +//! "cycle" bool. [`SDL_GPUTransferBuffer`], [`SDL_GPUBuffer`], and [`SDL_GPUTexture`] all +//! effectively function as ring buffers on internal resources. When cycle is +//! true, if the resource is bound, the cycle rotates to the next unbound +//! internal resource, or if none are available, a new one is created. This +//! means you don't have to worry about complex state tracking and +//! synchronization as long as cycling is correctly employed. +//! +//! For example: you can call [`SDL_MapGPUTransferBuffer()`], write texture data, +//! [`SDL_UnmapGPUTransferBuffer()`], and then [`SDL_UploadToGPUTexture()`]. The next +//! time you write texture data to the transfer buffer, if you set the cycle +//! param to true, you don't have to worry about overwriting any data that is +//! not yet uploaded. +//! +//! Another example: If you are using a texture in a render pass every frame, +//! this can cause a data dependency between frames. If you set cycle to true +//! in the [`SDL_GPUColorTargetInfo`] struct, you can prevent this data dependency. +//! +//! Cycling will never undefine already bound data. When cycling, all data in +//! the resource is considered to be undefined for subsequent commands until +//! that data is written again. You must take care not to read undefined data. +//! +//! Note that when cycling a texture, the entire texture will be cycled, even +//! if only part of the texture is used in the call, so you must consider the +//! entire texture to contain undefined data after cycling. +//! +//! You must also take care not to overwrite a section of data that has been +//! referenced in a command without cycling first. It is OK to overwrite +//! unreferenced data in a bound resource without cycling, but overwriting a +//! section of data that has already been referenced will produce unexpected +//! results. +//! +//! ## Debugging +//! +//! At some point of your GPU journey, you will probably encounter issues that +//! are not traceable with regular debugger - for example, your code compiles +//! but you get an empty screen, or your shader fails in runtime. +//! +//! For debugging such cases, there are tools that allow visually inspecting +//! the whole GPU frame, every drawcall, every bound resource, memory buffers, +//! etc. They are the following, per platform: +//! +//! * For Windows/Linux, use +//! [RenderDoc](https://renderdoc.org/) +//! * For MacOS (Metal), use Xcode built-in debugger (Open XCode, go to Debug > +//! Debug Executable..., select your application, set "GPU Frame Capture" to +//! "Metal" in scheme "Options" window, run your app, and click the small +//! Metal icon on the bottom to capture a frame) +//! +//! Aside from that, you may want to enable additional debug layers to receive +//! more detailed error messages, based on your GPU backend: +//! +//! * For D3D12, the debug layer is an optional feature that can be installed +//! via "Windows Settings -> System -> Optional features" and adding the +//! "Graphics Tools" optional feature. +//! * For Vulkan, you will need to install Vulkan SDK on Windows, and on Linux, +//! you usually have some sort of `vulkan-validation-layers` system package +//! that should be installed. +//! * For Metal, it should be enough just to run the application from XCode to +//! receive detailed errors or warnings in the output. +//! +//! Don't hesitate to use tools as RenderDoc when encountering runtime issues +//! or unexpected output on screen, quick GPU frame inspection can usually help +//! you fix the majority of such problems. + +use super::stdinc::*; + +use super::pixels::*; + +use super::properties::*; + +use super::rect::*; + +use super::surface::*; + +use super::video::*; + +/// Specifies the primitive topology of a graphics pipeline. +/// +/// If you are using POINTLIST you must include a point size output in the +/// vertex shader. +/// +/// - For HLSL compiling to SPIRV you must decorate a float output with +/// \[\[vk::builtin("PointSize")\]\]. +/// - For GLSL you must set the gl_PointSize builtin. +/// - For MSL you must include a float output with the \[\[point_size\]\] +/// decorator. +/// +/// Note that sized point topology is totally unsupported on D3D12. Any size +/// other than 1 will be ignored. In general, you should avoid using point +/// topology for both compatibility and performance reasons. You WILL regret +/// using it. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`TRIANGLELIST`](SDL_GPUPrimitiveType::TRIANGLELIST) | [`SDL_GPU_PRIMITIVETYPE_TRIANGLELIST`] | A series of separate triangles. | +/// | [`TRIANGLESTRIP`](SDL_GPUPrimitiveType::TRIANGLESTRIP) | [`SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP`] | A series of connected triangles. | +/// | [`LINELIST`](SDL_GPUPrimitiveType::LINELIST) | [`SDL_GPU_PRIMITIVETYPE_LINELIST`] | A series of separate lines. | +/// | [`LINESTRIP`](SDL_GPUPrimitiveType::LINESTRIP) | [`SDL_GPU_PRIMITIVETYPE_LINESTRIP`] | A series of connected lines. | +/// | [`POINTLIST`](SDL_GPUPrimitiveType::POINTLIST) | [`SDL_GPU_PRIMITIVETYPE_POINTLIST`] | A series of separate points. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUPrimitiveType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUPrimitiveType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUPrimitiveType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUPrimitiveType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUPrimitiveType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::TRIANGLELIST => "SDL_GPU_PRIMITIVETYPE_TRIANGLELIST", + Self::TRIANGLESTRIP => "SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP", + Self::LINELIST => "SDL_GPU_PRIMITIVETYPE_LINELIST", + Self::LINESTRIP => "SDL_GPU_PRIMITIVETYPE_LINESTRIP", + Self::POINTLIST => "SDL_GPU_PRIMITIVETYPE_POINTLIST", + + _ => return write!(f, "SDL_GPUPrimitiveType({})", self.0), + }) + } +} + +impl SDL_GPUPrimitiveType { + /// A series of separate triangles. + pub const TRIANGLELIST: Self = Self((0 as ::core::ffi::c_int)); + /// A series of connected triangles. + pub const TRIANGLESTRIP: Self = Self((1 as ::core::ffi::c_int)); + /// A series of separate lines. + pub const LINELIST: Self = Self((2 as ::core::ffi::c_int)); + /// A series of connected lines. + pub const LINESTRIP: Self = Self((3 as ::core::ffi::c_int)); + /// A series of separate points. + pub const POINTLIST: Self = Self((4 as ::core::ffi::c_int)); +} + +/// A series of separate triangles. +pub const SDL_GPU_PRIMITIVETYPE_TRIANGLELIST: SDL_GPUPrimitiveType = + SDL_GPUPrimitiveType::TRIANGLELIST; +/// A series of connected triangles. +pub const SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP: SDL_GPUPrimitiveType = + SDL_GPUPrimitiveType::TRIANGLESTRIP; +/// A series of separate lines. +pub const SDL_GPU_PRIMITIVETYPE_LINELIST: SDL_GPUPrimitiveType = SDL_GPUPrimitiveType::LINELIST; +/// A series of connected lines. +pub const SDL_GPU_PRIMITIVETYPE_LINESTRIP: SDL_GPUPrimitiveType = SDL_GPUPrimitiveType::LINESTRIP; +/// A series of separate points. +pub const SDL_GPU_PRIMITIVETYPE_POINTLIST: SDL_GPUPrimitiveType = SDL_GPUPrimitiveType::POINTLIST; + +impl SDL_GPUPrimitiveType { + /// Initialize a `SDL_GPUPrimitiveType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUPrimitiveType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUPrimitiveType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUPrimitiveType; +} + +/// Specifies how the contents of a texture attached to a render pass are +/// treated at the beginning of the render pass. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPURenderPass`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`LOAD`](SDL_GPULoadOp::LOAD) | [`SDL_GPU_LOADOP_LOAD`] | The previous contents of the texture will be preserved. | +/// | [`CLEAR`](SDL_GPULoadOp::CLEAR) | [`SDL_GPU_LOADOP_CLEAR`] | The contents of the texture will be cleared to a color. | +/// | [`DONT_CARE`](SDL_GPULoadOp::DONT_CARE) | [`SDL_GPU_LOADOP_DONT_CARE`] | The previous contents of the texture need not be preserved. The contents will be undefined. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPULoadOp(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPULoadOp { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPULoadOp) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPULoadOp) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPULoadOp { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::LOAD => "SDL_GPU_LOADOP_LOAD", + Self::CLEAR => "SDL_GPU_LOADOP_CLEAR", + Self::DONT_CARE => "SDL_GPU_LOADOP_DONT_CARE", + + _ => return write!(f, "SDL_GPULoadOp({})", self.0), + }) + } +} + +impl SDL_GPULoadOp { + /// The previous contents of the texture will be preserved. + pub const LOAD: Self = Self((0 as ::core::ffi::c_int)); + /// The contents of the texture will be cleared to a color. + pub const CLEAR: Self = Self((1 as ::core::ffi::c_int)); + /// The previous contents of the texture need not be preserved. The contents will be undefined. + pub const DONT_CARE: Self = Self((2 as ::core::ffi::c_int)); +} + +/// The previous contents of the texture will be preserved. +pub const SDL_GPU_LOADOP_LOAD: SDL_GPULoadOp = SDL_GPULoadOp::LOAD; +/// The contents of the texture will be cleared to a color. +pub const SDL_GPU_LOADOP_CLEAR: SDL_GPULoadOp = SDL_GPULoadOp::CLEAR; +/// The previous contents of the texture need not be preserved. The contents will be undefined. +pub const SDL_GPU_LOADOP_DONT_CARE: SDL_GPULoadOp = SDL_GPULoadOp::DONT_CARE; + +impl SDL_GPULoadOp { + /// Initialize a `SDL_GPULoadOp` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPULoadOp { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPULoadOp { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPULoadOp; +} + +/// Specifies how the contents of a texture attached to a render pass are +/// treated at the end of the render pass. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPURenderPass`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`STORE`](SDL_GPUStoreOp::STORE) | [`SDL_GPU_STOREOP_STORE`] | The contents generated during the render pass will be written to memory. | +/// | [`DONT_CARE`](SDL_GPUStoreOp::DONT_CARE) | [`SDL_GPU_STOREOP_DONT_CARE`] | The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. | +/// | [`RESOLVE`](SDL_GPUStoreOp::RESOLVE) | [`SDL_GPU_STOREOP_RESOLVE`] | The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. | +/// | [`RESOLVE_AND_STORE`](SDL_GPUStoreOp::RESOLVE_AND_STORE) | [`SDL_GPU_STOREOP_RESOLVE_AND_STORE`] | The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUStoreOp(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUStoreOp { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUStoreOp) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUStoreOp) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUStoreOp { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::STORE => "SDL_GPU_STOREOP_STORE", + Self::DONT_CARE => "SDL_GPU_STOREOP_DONT_CARE", + Self::RESOLVE => "SDL_GPU_STOREOP_RESOLVE", + Self::RESOLVE_AND_STORE => "SDL_GPU_STOREOP_RESOLVE_AND_STORE", + + _ => return write!(f, "SDL_GPUStoreOp({})", self.0), + }) + } +} + +impl SDL_GPUStoreOp { + /// The contents generated during the render pass will be written to memory. + pub const STORE: Self = Self((0 as ::core::ffi::c_int)); + /// The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. + pub const DONT_CARE: Self = Self((1 as ::core::ffi::c_int)); + /// The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. + pub const RESOLVE: Self = Self((2 as ::core::ffi::c_int)); + /// The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. + pub const RESOLVE_AND_STORE: Self = Self((3 as ::core::ffi::c_int)); +} + +/// The contents generated during the render pass will be written to memory. +pub const SDL_GPU_STOREOP_STORE: SDL_GPUStoreOp = SDL_GPUStoreOp::STORE; +/// The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. +pub const SDL_GPU_STOREOP_DONT_CARE: SDL_GPUStoreOp = SDL_GPUStoreOp::DONT_CARE; +/// The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. +pub const SDL_GPU_STOREOP_RESOLVE: SDL_GPUStoreOp = SDL_GPUStoreOp::RESOLVE; +/// The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. +pub const SDL_GPU_STOREOP_RESOLVE_AND_STORE: SDL_GPUStoreOp = SDL_GPUStoreOp::RESOLVE_AND_STORE; + +impl SDL_GPUStoreOp { + /// Initialize a `SDL_GPUStoreOp` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUStoreOp { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUStoreOp { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUStoreOp; +} + +/// Specifies the size of elements in an index buffer. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`_16BIT`](SDL_GPUIndexElementSize::_16BIT) | [`SDL_GPU_INDEXELEMENTSIZE_16BIT`] | The index elements are 16-bit. | +/// | [`_32BIT`](SDL_GPUIndexElementSize::_32BIT) | [`SDL_GPU_INDEXELEMENTSIZE_32BIT`] | The index elements are 32-bit. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUIndexElementSize(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUIndexElementSize { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUIndexElementSize) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUIndexElementSize) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUIndexElementSize { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::_16BIT => "SDL_GPU_INDEXELEMENTSIZE_16BIT", + Self::_32BIT => "SDL_GPU_INDEXELEMENTSIZE_32BIT", + + _ => return write!(f, "SDL_GPUIndexElementSize({})", self.0), + }) + } +} + +impl SDL_GPUIndexElementSize { + /// The index elements are 16-bit. + pub const _16BIT: Self = Self((0 as ::core::ffi::c_int)); + /// The index elements are 32-bit. + pub const _32BIT: Self = Self((1 as ::core::ffi::c_int)); +} + +/// The index elements are 16-bit. +pub const SDL_GPU_INDEXELEMENTSIZE_16BIT: SDL_GPUIndexElementSize = SDL_GPUIndexElementSize::_16BIT; +/// The index elements are 32-bit. +pub const SDL_GPU_INDEXELEMENTSIZE_32BIT: SDL_GPUIndexElementSize = SDL_GPUIndexElementSize::_32BIT; + +impl SDL_GPUIndexElementSize { + /// Initialize a `SDL_GPUIndexElementSize` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUIndexElementSize { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUIndexElementSize { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUIndexElementSize; +} + +/// Specifies the pixel format of a texture. +/// +/// Texture format support varies depending on driver, hardware, and usage +/// flags. In general, you should use [`SDL_GPUTextureSupportsFormat`] to query if +/// a format is supported before using it. However, there are a few guaranteed +/// formats. +/// +/// FIXME: Check universal support for 32-bit component formats FIXME: Check +/// universal support for SIMULTANEOUS_READ_WRITE +/// +/// For SAMPLER usage, the following formats are universally supported: +/// +/// - R8G8B8A8_UNORM +/// - B8G8R8A8_UNORM +/// - R8_UNORM +/// - R8_SNORM +/// - R8G8_UNORM +/// - R8G8_SNORM +/// - R8G8B8A8_SNORM +/// - R16_FLOAT +/// - R16G16_FLOAT +/// - R16G16B16A16_FLOAT +/// - R32_FLOAT +/// - R32G32_FLOAT +/// - R32G32B32A32_FLOAT +/// - R11G11B10_UFLOAT +/// - R8G8B8A8_UNORM_SRGB +/// - B8G8R8A8_UNORM_SRGB +/// - D16_UNORM +/// +/// For COLOR_TARGET usage, the following formats are universally supported: +/// +/// - R8G8B8A8_UNORM +/// - B8G8R8A8_UNORM +/// - R8_UNORM +/// - R16_FLOAT +/// - R16G16_FLOAT +/// - R16G16B16A16_FLOAT +/// - R32_FLOAT +/// - R32G32_FLOAT +/// - R32G32B32A32_FLOAT +/// - R8_UINT +/// - R8G8_UINT +/// - R8G8B8A8_UINT +/// - R16_UINT +/// - R16G16_UINT +/// - R16G16B16A16_UINT +/// - R8_INT +/// - R8G8_INT +/// - R8G8B8A8_INT +/// - R16_INT +/// - R16G16_INT +/// - R16G16B16A16_INT +/// - R8G8B8A8_UNORM_SRGB +/// - B8G8R8A8_UNORM_SRGB +/// +/// For STORAGE usages, the following formats are universally supported: +/// +/// - R8G8B8A8_UNORM +/// - R8G8B8A8_SNORM +/// - R16G16B16A16_FLOAT +/// - R32_FLOAT +/// - R32G32_FLOAT +/// - R32G32B32A32_FLOAT +/// - R8G8B8A8_UINT +/// - R16G16B16A16_UINT +/// - R8G8B8A8_INT +/// - R16G16B16A16_INT +/// +/// For DEPTH_STENCIL_TARGET usage, the following formats are universally +/// supported: +/// +/// - D16_UNORM +/// - Either (but not necessarily both!) D24_UNORM or D32_FLOAT +/// - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT +/// +/// Unless D16_UNORM is sufficient for your purposes, always check which of +/// D24/D32 is supported before creating a depth-stencil texture! +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTexture`] +/// - [`SDL_GPUTextureSupportsFormat`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUTextureFormat::INVALID) | [`SDL_GPU_TEXTUREFORMAT_INVALID`] | | +/// | [`A8_UNORM`](SDL_GPUTextureFormat::A8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_A8_UNORM`] | | +/// | [`R8_UNORM`](SDL_GPUTextureFormat::R8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R8_UNORM`] | | +/// | [`R8G8_UNORM`](SDL_GPUTextureFormat::R8G8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8_UNORM`] | | +/// | [`R8G8B8A8_UNORM`](SDL_GPUTextureFormat::R8G8B8A8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM`] | | +/// | [`R16_UNORM`](SDL_GPUTextureFormat::R16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R16_UNORM`] | | +/// | [`R16G16_UNORM`](SDL_GPUTextureFormat::R16G16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16_UNORM`] | | +/// | [`R16G16B16A16_UNORM`](SDL_GPUTextureFormat::R16G16B16A16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM`] | | +/// | [`R10G10B10A2_UNORM`](SDL_GPUTextureFormat::R10G10B10A2_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM`] | | +/// | [`B5G6R5_UNORM`](SDL_GPUTextureFormat::B5G6R5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM`] | | +/// | [`B5G5R5A1_UNORM`](SDL_GPUTextureFormat::B5G5R5A1_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM`] | | +/// | [`B4G4R4A4_UNORM`](SDL_GPUTextureFormat::B4G4R4A4_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM`] | | +/// | [`B8G8R8A8_UNORM`](SDL_GPUTextureFormat::B8G8R8A8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM`] | | +/// | [`BC1_RGBA_UNORM`](SDL_GPUTextureFormat::BC1_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM`] | | +/// | [`BC2_RGBA_UNORM`](SDL_GPUTextureFormat::BC2_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM`] | | +/// | [`BC3_RGBA_UNORM`](SDL_GPUTextureFormat::BC3_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM`] | | +/// | [`BC4_R_UNORM`](SDL_GPUTextureFormat::BC4_R_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM`] | | +/// | [`BC5_RG_UNORM`](SDL_GPUTextureFormat::BC5_RG_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM`] | | +/// | [`BC7_RGBA_UNORM`](SDL_GPUTextureFormat::BC7_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM`] | | +/// | [`BC6H_RGB_FLOAT`](SDL_GPUTextureFormat::BC6H_RGB_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT`] | | +/// | [`BC6H_RGB_UFLOAT`](SDL_GPUTextureFormat::BC6H_RGB_UFLOAT) | [`SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT`] | | +/// | [`R8_SNORM`](SDL_GPUTextureFormat::R8_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R8_SNORM`] | | +/// | [`R8G8_SNORM`](SDL_GPUTextureFormat::R8G8_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8_SNORM`] | | +/// | [`R8G8B8A8_SNORM`](SDL_GPUTextureFormat::R8G8B8A8_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM`] | | +/// | [`R16_SNORM`](SDL_GPUTextureFormat::R16_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R16_SNORM`] | | +/// | [`R16G16_SNORM`](SDL_GPUTextureFormat::R16G16_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16_SNORM`] | | +/// | [`R16G16B16A16_SNORM`](SDL_GPUTextureFormat::R16G16B16A16_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM`] | | +/// | [`R16_FLOAT`](SDL_GPUTextureFormat::R16_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R16_FLOAT`] | | +/// | [`R16G16_FLOAT`](SDL_GPUTextureFormat::R16G16_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT`] | | +/// | [`R16G16B16A16_FLOAT`](SDL_GPUTextureFormat::R16G16B16A16_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT`] | | +/// | [`R32_FLOAT`](SDL_GPUTextureFormat::R32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R32_FLOAT`] | | +/// | [`R32G32_FLOAT`](SDL_GPUTextureFormat::R32G32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT`] | | +/// | [`R32G32B32A32_FLOAT`](SDL_GPUTextureFormat::R32G32B32A32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT`] | | +/// | [`R11G11B10_UFLOAT`](SDL_GPUTextureFormat::R11G11B10_UFLOAT) | [`SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT`] | | +/// | [`R8_UINT`](SDL_GPUTextureFormat::R8_UINT) | [`SDL_GPU_TEXTUREFORMAT_R8_UINT`] | | +/// | [`R8G8_UINT`](SDL_GPUTextureFormat::R8G8_UINT) | [`SDL_GPU_TEXTUREFORMAT_R8G8_UINT`] | | +/// | [`R8G8B8A8_UINT`](SDL_GPUTextureFormat::R8G8B8A8_UINT) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT`] | | +/// | [`R16_UINT`](SDL_GPUTextureFormat::R16_UINT) | [`SDL_GPU_TEXTUREFORMAT_R16_UINT`] | | +/// | [`R16G16_UINT`](SDL_GPUTextureFormat::R16G16_UINT) | [`SDL_GPU_TEXTUREFORMAT_R16G16_UINT`] | | +/// | [`R16G16B16A16_UINT`](SDL_GPUTextureFormat::R16G16B16A16_UINT) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT`] | | +/// | [`R32_UINT`](SDL_GPUTextureFormat::R32_UINT) | [`SDL_GPU_TEXTUREFORMAT_R32_UINT`] | | +/// | [`R32G32_UINT`](SDL_GPUTextureFormat::R32G32_UINT) | [`SDL_GPU_TEXTUREFORMAT_R32G32_UINT`] | | +/// | [`R32G32B32A32_UINT`](SDL_GPUTextureFormat::R32G32B32A32_UINT) | [`SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT`] | | +/// | [`R8_INT`](SDL_GPUTextureFormat::R8_INT) | [`SDL_GPU_TEXTUREFORMAT_R8_INT`] | | +/// | [`R8G8_INT`](SDL_GPUTextureFormat::R8G8_INT) | [`SDL_GPU_TEXTUREFORMAT_R8G8_INT`] | | +/// | [`R8G8B8A8_INT`](SDL_GPUTextureFormat::R8G8B8A8_INT) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT`] | | +/// | [`R16_INT`](SDL_GPUTextureFormat::R16_INT) | [`SDL_GPU_TEXTUREFORMAT_R16_INT`] | | +/// | [`R16G16_INT`](SDL_GPUTextureFormat::R16G16_INT) | [`SDL_GPU_TEXTUREFORMAT_R16G16_INT`] | | +/// | [`R16G16B16A16_INT`](SDL_GPUTextureFormat::R16G16B16A16_INT) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT`] | | +/// | [`R32_INT`](SDL_GPUTextureFormat::R32_INT) | [`SDL_GPU_TEXTUREFORMAT_R32_INT`] | | +/// | [`R32G32_INT`](SDL_GPUTextureFormat::R32G32_INT) | [`SDL_GPU_TEXTUREFORMAT_R32G32_INT`] | | +/// | [`R32G32B32A32_INT`](SDL_GPUTextureFormat::R32G32B32A32_INT) | [`SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT`] | | +/// | [`R8G8B8A8_UNORM_SRGB`](SDL_GPUTextureFormat::R8G8B8A8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB`] | | +/// | [`B8G8R8A8_UNORM_SRGB`](SDL_GPUTextureFormat::B8G8R8A8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB`] | | +/// | [`BC1_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC1_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB`] | | +/// | [`BC2_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC2_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB`] | | +/// | [`BC3_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC3_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB`] | | +/// | [`BC7_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC7_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB`] | | +/// | [`D16_UNORM`](SDL_GPUTextureFormat::D16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_D16_UNORM`] | | +/// | [`D24_UNORM`](SDL_GPUTextureFormat::D24_UNORM) | [`SDL_GPU_TEXTUREFORMAT_D24_UNORM`] | | +/// | [`D32_FLOAT`](SDL_GPUTextureFormat::D32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_D32_FLOAT`] | | +/// | [`D24_UNORM_S8_UINT`](SDL_GPUTextureFormat::D24_UNORM_S8_UINT) | [`SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT`] | | +/// | [`D32_FLOAT_S8_UINT`](SDL_GPUTextureFormat::D32_FLOAT_S8_UINT) | [`SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT`] | | +/// | [`ASTC_4x4_UNORM`](SDL_GPUTextureFormat::ASTC_4x4_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM`] | | +/// | [`ASTC_5x4_UNORM`](SDL_GPUTextureFormat::ASTC_5x4_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM`] | | +/// | [`ASTC_5x5_UNORM`](SDL_GPUTextureFormat::ASTC_5x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM`] | | +/// | [`ASTC_6x5_UNORM`](SDL_GPUTextureFormat::ASTC_6x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM`] | | +/// | [`ASTC_6x6_UNORM`](SDL_GPUTextureFormat::ASTC_6x6_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM`] | | +/// | [`ASTC_8x5_UNORM`](SDL_GPUTextureFormat::ASTC_8x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM`] | | +/// | [`ASTC_8x6_UNORM`](SDL_GPUTextureFormat::ASTC_8x6_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM`] | | +/// | [`ASTC_8x8_UNORM`](SDL_GPUTextureFormat::ASTC_8x8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM`] | | +/// | [`ASTC_10x5_UNORM`](SDL_GPUTextureFormat::ASTC_10x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM`] | | +/// | [`ASTC_10x6_UNORM`](SDL_GPUTextureFormat::ASTC_10x6_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM`] | | +/// | [`ASTC_10x8_UNORM`](SDL_GPUTextureFormat::ASTC_10x8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM`] | | +/// | [`ASTC_10x10_UNORM`](SDL_GPUTextureFormat::ASTC_10x10_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM`] | | +/// | [`ASTC_12x10_UNORM`](SDL_GPUTextureFormat::ASTC_12x10_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM`] | | +/// | [`ASTC_12x12_UNORM`](SDL_GPUTextureFormat::ASTC_12x12_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM`] | | +/// | [`ASTC_4x4_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_4x4_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB`] | | +/// | [`ASTC_5x4_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_5x4_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB`] | | +/// | [`ASTC_5x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_5x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB`] | | +/// | [`ASTC_6x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_6x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB`] | | +/// | [`ASTC_6x6_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_6x6_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB`] | | +/// | [`ASTC_8x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_8x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB`] | | +/// | [`ASTC_8x6_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_8x6_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB`] | | +/// | [`ASTC_8x8_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_8x8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB`] | | +/// | [`ASTC_10x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB`] | | +/// | [`ASTC_10x6_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x6_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB`] | | +/// | [`ASTC_10x8_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB`] | | +/// | [`ASTC_10x10_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x10_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB`] | | +/// | [`ASTC_12x10_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_12x10_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB`] | | +/// | [`ASTC_12x12_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_12x12_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB`] | | +/// | [`ASTC_4x4_FLOAT`](SDL_GPUTextureFormat::ASTC_4x4_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT`] | | +/// | [`ASTC_5x4_FLOAT`](SDL_GPUTextureFormat::ASTC_5x4_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT`] | | +/// | [`ASTC_5x5_FLOAT`](SDL_GPUTextureFormat::ASTC_5x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT`] | | +/// | [`ASTC_6x5_FLOAT`](SDL_GPUTextureFormat::ASTC_6x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT`] | | +/// | [`ASTC_6x6_FLOAT`](SDL_GPUTextureFormat::ASTC_6x6_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT`] | | +/// | [`ASTC_8x5_FLOAT`](SDL_GPUTextureFormat::ASTC_8x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT`] | | +/// | [`ASTC_8x6_FLOAT`](SDL_GPUTextureFormat::ASTC_8x6_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT`] | | +/// | [`ASTC_8x8_FLOAT`](SDL_GPUTextureFormat::ASTC_8x8_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT`] | | +/// | [`ASTC_10x5_FLOAT`](SDL_GPUTextureFormat::ASTC_10x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT`] | | +/// | [`ASTC_10x6_FLOAT`](SDL_GPUTextureFormat::ASTC_10x6_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT`] | | +/// | [`ASTC_10x8_FLOAT`](SDL_GPUTextureFormat::ASTC_10x8_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT`] | | +/// | [`ASTC_10x10_FLOAT`](SDL_GPUTextureFormat::ASTC_10x10_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT`] | | +/// | [`ASTC_12x10_FLOAT`](SDL_GPUTextureFormat::ASTC_12x10_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT`] | | +/// | [`ASTC_12x12_FLOAT`](SDL_GPUTextureFormat::ASTC_12x12_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUTextureFormat(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUTextureFormat { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUTextureFormat) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUTextureFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUTextureFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GPU_TEXTUREFORMAT_INVALID", + Self::A8_UNORM => "SDL_GPU_TEXTUREFORMAT_A8_UNORM", + Self::R8_UNORM => "SDL_GPU_TEXTUREFORMAT_R8_UNORM", + Self::R8G8_UNORM => "SDL_GPU_TEXTUREFORMAT_R8G8_UNORM", + Self::R8G8B8A8_UNORM => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM", + Self::R16_UNORM => "SDL_GPU_TEXTUREFORMAT_R16_UNORM", + Self::R16G16_UNORM => "SDL_GPU_TEXTUREFORMAT_R16G16_UNORM", + Self::R16G16B16A16_UNORM => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM", + Self::R10G10B10A2_UNORM => "SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM", + Self::B5G6R5_UNORM => "SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM", + Self::B5G5R5A1_UNORM => "SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM", + Self::B4G4R4A4_UNORM => "SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM", + Self::B8G8R8A8_UNORM => "SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM", + Self::BC1_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM", + Self::BC2_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM", + Self::BC3_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM", + Self::BC4_R_UNORM => "SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM", + Self::BC5_RG_UNORM => "SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM", + Self::BC7_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM", + Self::BC6H_RGB_FLOAT => "SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT", + Self::BC6H_RGB_UFLOAT => "SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT", + Self::R8_SNORM => "SDL_GPU_TEXTUREFORMAT_R8_SNORM", + Self::R8G8_SNORM => "SDL_GPU_TEXTUREFORMAT_R8G8_SNORM", + Self::R8G8B8A8_SNORM => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM", + Self::R16_SNORM => "SDL_GPU_TEXTUREFORMAT_R16_SNORM", + Self::R16G16_SNORM => "SDL_GPU_TEXTUREFORMAT_R16G16_SNORM", + Self::R16G16B16A16_SNORM => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM", + Self::R16_FLOAT => "SDL_GPU_TEXTUREFORMAT_R16_FLOAT", + Self::R16G16_FLOAT => "SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT", + Self::R16G16B16A16_FLOAT => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT", + Self::R32_FLOAT => "SDL_GPU_TEXTUREFORMAT_R32_FLOAT", + Self::R32G32_FLOAT => "SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT", + Self::R32G32B32A32_FLOAT => "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT", + Self::R11G11B10_UFLOAT => "SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT", + Self::R8_UINT => "SDL_GPU_TEXTUREFORMAT_R8_UINT", + Self::R8G8_UINT => "SDL_GPU_TEXTUREFORMAT_R8G8_UINT", + Self::R8G8B8A8_UINT => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT", + Self::R16_UINT => "SDL_GPU_TEXTUREFORMAT_R16_UINT", + Self::R16G16_UINT => "SDL_GPU_TEXTUREFORMAT_R16G16_UINT", + Self::R16G16B16A16_UINT => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT", + Self::R32_UINT => "SDL_GPU_TEXTUREFORMAT_R32_UINT", + Self::R32G32_UINT => "SDL_GPU_TEXTUREFORMAT_R32G32_UINT", + Self::R32G32B32A32_UINT => "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT", + Self::R8_INT => "SDL_GPU_TEXTUREFORMAT_R8_INT", + Self::R8G8_INT => "SDL_GPU_TEXTUREFORMAT_R8G8_INT", + Self::R8G8B8A8_INT => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT", + Self::R16_INT => "SDL_GPU_TEXTUREFORMAT_R16_INT", + Self::R16G16_INT => "SDL_GPU_TEXTUREFORMAT_R16G16_INT", + Self::R16G16B16A16_INT => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT", + Self::R32_INT => "SDL_GPU_TEXTUREFORMAT_R32_INT", + Self::R32G32_INT => "SDL_GPU_TEXTUREFORMAT_R32G32_INT", + Self::R32G32B32A32_INT => "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT", + Self::R8G8B8A8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB", + Self::B8G8R8A8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB", + Self::BC1_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB", + Self::BC2_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB", + Self::BC3_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB", + Self::BC7_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB", + Self::D16_UNORM => "SDL_GPU_TEXTUREFORMAT_D16_UNORM", + Self::D24_UNORM => "SDL_GPU_TEXTUREFORMAT_D24_UNORM", + Self::D32_FLOAT => "SDL_GPU_TEXTUREFORMAT_D32_FLOAT", + Self::D24_UNORM_S8_UINT => "SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT", + Self::D32_FLOAT_S8_UINT => "SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT", + Self::ASTC_4x4_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM", + Self::ASTC_5x4_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM", + Self::ASTC_5x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM", + Self::ASTC_6x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM", + Self::ASTC_6x6_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM", + Self::ASTC_8x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM", + Self::ASTC_8x6_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM", + Self::ASTC_8x8_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM", + Self::ASTC_10x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM", + Self::ASTC_10x6_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM", + Self::ASTC_10x8_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM", + Self::ASTC_10x10_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM", + Self::ASTC_12x10_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM", + Self::ASTC_12x12_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM", + Self::ASTC_4x4_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB", + Self::ASTC_5x4_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB", + Self::ASTC_5x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB", + Self::ASTC_6x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB", + Self::ASTC_6x6_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB", + Self::ASTC_8x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB", + Self::ASTC_8x6_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB", + Self::ASTC_8x8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB", + Self::ASTC_10x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB", + Self::ASTC_10x6_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB", + Self::ASTC_10x8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB", + Self::ASTC_10x10_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB", + Self::ASTC_12x10_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB", + Self::ASTC_12x12_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB", + Self::ASTC_4x4_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT", + Self::ASTC_5x4_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT", + Self::ASTC_5x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT", + Self::ASTC_6x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT", + Self::ASTC_6x6_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT", + Self::ASTC_8x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT", + Self::ASTC_8x6_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT", + Self::ASTC_8x8_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT", + Self::ASTC_10x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT", + Self::ASTC_10x6_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT", + Self::ASTC_10x8_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT", + Self::ASTC_10x10_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT", + Self::ASTC_12x10_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT", + Self::ASTC_12x12_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT", + + _ => return write!(f, "SDL_GPUTextureFormat({})", self.0), + }) + } +} + +impl SDL_GPUTextureFormat { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + pub const A8_UNORM: Self = Self((1 as ::core::ffi::c_int)); + pub const R8_UNORM: Self = Self((2 as ::core::ffi::c_int)); + pub const R8G8_UNORM: Self = Self((3 as ::core::ffi::c_int)); + pub const R8G8B8A8_UNORM: Self = Self((4 as ::core::ffi::c_int)); + pub const R16_UNORM: Self = Self((5 as ::core::ffi::c_int)); + pub const R16G16_UNORM: Self = Self((6 as ::core::ffi::c_int)); + pub const R16G16B16A16_UNORM: Self = Self((7 as ::core::ffi::c_int)); + pub const R10G10B10A2_UNORM: Self = Self((8 as ::core::ffi::c_int)); + pub const B5G6R5_UNORM: Self = Self((9 as ::core::ffi::c_int)); + pub const B5G5R5A1_UNORM: Self = Self((10 as ::core::ffi::c_int)); + pub const B4G4R4A4_UNORM: Self = Self((11 as ::core::ffi::c_int)); + pub const B8G8R8A8_UNORM: Self = Self((12 as ::core::ffi::c_int)); + pub const BC1_RGBA_UNORM: Self = Self((13 as ::core::ffi::c_int)); + pub const BC2_RGBA_UNORM: Self = Self((14 as ::core::ffi::c_int)); + pub const BC3_RGBA_UNORM: Self = Self((15 as ::core::ffi::c_int)); + pub const BC4_R_UNORM: Self = Self((16 as ::core::ffi::c_int)); + pub const BC5_RG_UNORM: Self = Self((17 as ::core::ffi::c_int)); + pub const BC7_RGBA_UNORM: Self = Self((18 as ::core::ffi::c_int)); + pub const BC6H_RGB_FLOAT: Self = Self((19 as ::core::ffi::c_int)); + pub const BC6H_RGB_UFLOAT: Self = Self((20 as ::core::ffi::c_int)); + pub const R8_SNORM: Self = Self((21 as ::core::ffi::c_int)); + pub const R8G8_SNORM: Self = Self((22 as ::core::ffi::c_int)); + pub const R8G8B8A8_SNORM: Self = Self((23 as ::core::ffi::c_int)); + pub const R16_SNORM: Self = Self((24 as ::core::ffi::c_int)); + pub const R16G16_SNORM: Self = Self((25 as ::core::ffi::c_int)); + pub const R16G16B16A16_SNORM: Self = Self((26 as ::core::ffi::c_int)); + pub const R16_FLOAT: Self = Self((27 as ::core::ffi::c_int)); + pub const R16G16_FLOAT: Self = Self((28 as ::core::ffi::c_int)); + pub const R16G16B16A16_FLOAT: Self = Self((29 as ::core::ffi::c_int)); + pub const R32_FLOAT: Self = Self((30 as ::core::ffi::c_int)); + pub const R32G32_FLOAT: Self = Self((31 as ::core::ffi::c_int)); + pub const R32G32B32A32_FLOAT: Self = Self((32 as ::core::ffi::c_int)); + pub const R11G11B10_UFLOAT: Self = Self((33 as ::core::ffi::c_int)); + pub const R8_UINT: Self = Self((34 as ::core::ffi::c_int)); + pub const R8G8_UINT: Self = Self((35 as ::core::ffi::c_int)); + pub const R8G8B8A8_UINT: Self = Self((36 as ::core::ffi::c_int)); + pub const R16_UINT: Self = Self((37 as ::core::ffi::c_int)); + pub const R16G16_UINT: Self = Self((38 as ::core::ffi::c_int)); + pub const R16G16B16A16_UINT: Self = Self((39 as ::core::ffi::c_int)); + pub const R32_UINT: Self = Self((40 as ::core::ffi::c_int)); + pub const R32G32_UINT: Self = Self((41 as ::core::ffi::c_int)); + pub const R32G32B32A32_UINT: Self = Self((42 as ::core::ffi::c_int)); + pub const R8_INT: Self = Self((43 as ::core::ffi::c_int)); + pub const R8G8_INT: Self = Self((44 as ::core::ffi::c_int)); + pub const R8G8B8A8_INT: Self = Self((45 as ::core::ffi::c_int)); + pub const R16_INT: Self = Self((46 as ::core::ffi::c_int)); + pub const R16G16_INT: Self = Self((47 as ::core::ffi::c_int)); + pub const R16G16B16A16_INT: Self = Self((48 as ::core::ffi::c_int)); + pub const R32_INT: Self = Self((49 as ::core::ffi::c_int)); + pub const R32G32_INT: Self = Self((50 as ::core::ffi::c_int)); + pub const R32G32B32A32_INT: Self = Self((51 as ::core::ffi::c_int)); + pub const R8G8B8A8_UNORM_SRGB: Self = Self((52 as ::core::ffi::c_int)); + pub const B8G8R8A8_UNORM_SRGB: Self = Self((53 as ::core::ffi::c_int)); + pub const BC1_RGBA_UNORM_SRGB: Self = Self((54 as ::core::ffi::c_int)); + pub const BC2_RGBA_UNORM_SRGB: Self = Self((55 as ::core::ffi::c_int)); + pub const BC3_RGBA_UNORM_SRGB: Self = Self((56 as ::core::ffi::c_int)); + pub const BC7_RGBA_UNORM_SRGB: Self = Self((57 as ::core::ffi::c_int)); + pub const D16_UNORM: Self = Self((58 as ::core::ffi::c_int)); + pub const D24_UNORM: Self = Self((59 as ::core::ffi::c_int)); + pub const D32_FLOAT: Self = Self((60 as ::core::ffi::c_int)); + pub const D24_UNORM_S8_UINT: Self = Self((61 as ::core::ffi::c_int)); + pub const D32_FLOAT_S8_UINT: Self = Self((62 as ::core::ffi::c_int)); + pub const ASTC_4x4_UNORM: Self = Self((63 as ::core::ffi::c_int)); + pub const ASTC_5x4_UNORM: Self = Self((64 as ::core::ffi::c_int)); + pub const ASTC_5x5_UNORM: Self = Self((65 as ::core::ffi::c_int)); + pub const ASTC_6x5_UNORM: Self = Self((66 as ::core::ffi::c_int)); + pub const ASTC_6x6_UNORM: Self = Self((67 as ::core::ffi::c_int)); + pub const ASTC_8x5_UNORM: Self = Self((68 as ::core::ffi::c_int)); + pub const ASTC_8x6_UNORM: Self = Self((69 as ::core::ffi::c_int)); + pub const ASTC_8x8_UNORM: Self = Self((70 as ::core::ffi::c_int)); + pub const ASTC_10x5_UNORM: Self = Self((71 as ::core::ffi::c_int)); + pub const ASTC_10x6_UNORM: Self = Self((72 as ::core::ffi::c_int)); + pub const ASTC_10x8_UNORM: Self = Self((73 as ::core::ffi::c_int)); + pub const ASTC_10x10_UNORM: Self = Self((74 as ::core::ffi::c_int)); + pub const ASTC_12x10_UNORM: Self = Self((75 as ::core::ffi::c_int)); + pub const ASTC_12x12_UNORM: Self = Self((76 as ::core::ffi::c_int)); + pub const ASTC_4x4_UNORM_SRGB: Self = Self((77 as ::core::ffi::c_int)); + pub const ASTC_5x4_UNORM_SRGB: Self = Self((78 as ::core::ffi::c_int)); + pub const ASTC_5x5_UNORM_SRGB: Self = Self((79 as ::core::ffi::c_int)); + pub const ASTC_6x5_UNORM_SRGB: Self = Self((80 as ::core::ffi::c_int)); + pub const ASTC_6x6_UNORM_SRGB: Self = Self((81 as ::core::ffi::c_int)); + pub const ASTC_8x5_UNORM_SRGB: Self = Self((82 as ::core::ffi::c_int)); + pub const ASTC_8x6_UNORM_SRGB: Self = Self((83 as ::core::ffi::c_int)); + pub const ASTC_8x8_UNORM_SRGB: Self = Self((84 as ::core::ffi::c_int)); + pub const ASTC_10x5_UNORM_SRGB: Self = Self((85 as ::core::ffi::c_int)); + pub const ASTC_10x6_UNORM_SRGB: Self = Self((86 as ::core::ffi::c_int)); + pub const ASTC_10x8_UNORM_SRGB: Self = Self((87 as ::core::ffi::c_int)); + pub const ASTC_10x10_UNORM_SRGB: Self = Self((88 as ::core::ffi::c_int)); + pub const ASTC_12x10_UNORM_SRGB: Self = Self((89 as ::core::ffi::c_int)); + pub const ASTC_12x12_UNORM_SRGB: Self = Self((90 as ::core::ffi::c_int)); + pub const ASTC_4x4_FLOAT: Self = Self((91 as ::core::ffi::c_int)); + pub const ASTC_5x4_FLOAT: Self = Self((92 as ::core::ffi::c_int)); + pub const ASTC_5x5_FLOAT: Self = Self((93 as ::core::ffi::c_int)); + pub const ASTC_6x5_FLOAT: Self = Self((94 as ::core::ffi::c_int)); + pub const ASTC_6x6_FLOAT: Self = Self((95 as ::core::ffi::c_int)); + pub const ASTC_8x5_FLOAT: Self = Self((96 as ::core::ffi::c_int)); + pub const ASTC_8x6_FLOAT: Self = Self((97 as ::core::ffi::c_int)); + pub const ASTC_8x8_FLOAT: Self = Self((98 as ::core::ffi::c_int)); + pub const ASTC_10x5_FLOAT: Self = Self((99 as ::core::ffi::c_int)); + pub const ASTC_10x6_FLOAT: Self = Self((100 as ::core::ffi::c_int)); + pub const ASTC_10x8_FLOAT: Self = Self((101 as ::core::ffi::c_int)); + pub const ASTC_10x10_FLOAT: Self = Self((102 as ::core::ffi::c_int)); + pub const ASTC_12x10_FLOAT: Self = Self((103 as ::core::ffi::c_int)); + pub const ASTC_12x12_FLOAT: Self = Self((104 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_TEXTUREFORMAT_INVALID: SDL_GPUTextureFormat = SDL_GPUTextureFormat::INVALID; +pub const SDL_GPU_TEXTUREFORMAT_A8_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::A8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R8_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R8G8_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R8G8B8A8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16G16_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16B16A16_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R10G10B10A2_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::B5G6R5_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::B5G5R5A1_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::B4G4R4A4_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::B8G8R8A8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC1_RGBA_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC2_RGBA_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC3_RGBA_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC4_R_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC5_RG_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC7_RGBA_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC6H_RGB_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC6H_RGB_UFLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R8_SNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_SNORM; +pub const SDL_GPU_TEXTUREFORMAT_R8G8_SNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_SNORM; +pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R8G8B8A8_SNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16_SNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_SNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16G16_SNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16_SNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16B16A16_SNORM; +pub const SDL_GPU_TEXTUREFORMAT_R16_FLOAT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16B16A16_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R32_FLOAT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R32G32_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R32G32B32A32_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R11G11B10_UFLOAT; +pub const SDL_GPU_TEXTUREFORMAT_R8_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R8G8_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R8G8B8A8_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R16_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R16G16_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16B16A16_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R32_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R32G32_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R32G32_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R32G32B32A32_UINT; +pub const SDL_GPU_TEXTUREFORMAT_R8_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_INT; +pub const SDL_GPU_TEXTUREFORMAT_R8G8_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_INT; +pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R8G8B8A8_INT; +pub const SDL_GPU_TEXTUREFORMAT_R16_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_INT; +pub const SDL_GPU_TEXTUREFORMAT_R16G16_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16G16_INT; +pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R16G16B16A16_INT; +pub const SDL_GPU_TEXTUREFORMAT_R32_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32_INT; +pub const SDL_GPU_TEXTUREFORMAT_R32G32_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32G32_INT; +pub const SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R32G32B32A32_INT; +pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::R8G8B8A8_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::B8G8R8A8_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC1_RGBA_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC2_RGBA_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC3_RGBA_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::BC7_RGBA_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_D16_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::D16_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_D24_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::D24_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_D32_FLOAT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::D32_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::D24_UNORM_S8_UINT; +pub const SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::D32_FLOAT_S8_UINT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_4x4_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_5x4_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_5x5_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_6x5_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_6x6_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x5_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x6_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x5_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x6_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x8_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x10_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_12x10_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_12x12_UNORM; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_4x4_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_5x4_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_5x5_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_6x5_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_6x6_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x5_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x6_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x8_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x5_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x6_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x8_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x10_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_12x10_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_12x12_UNORM_SRGB; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_4x4_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_5x4_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_5x5_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_6x5_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_6x6_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x5_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x6_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_8x8_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x5_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x6_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x8_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_10x10_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_12x10_FLOAT; +pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT: SDL_GPUTextureFormat = + SDL_GPUTextureFormat::ASTC_12x12_FLOAT; + +impl SDL_GPUTextureFormat { + /// Initialize a `SDL_GPUTextureFormat` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUTextureFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTextureFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUTextureFormat; +} + +/// Specifies how a texture is intended to be used by the client. +/// +/// A texture must have at least one usage flag. +/// Note that combining SAMPLER with STORAGE_READ flags is invalid. +/// +/// With regards to compute storage usage, READ | WRITE means that you can have +/// shader A that only writes into the texture and shader B that only reads +/// from the texture and bind the same texture to either shader respectively. +/// SIMULTANEOUS means that you can do reads and writes within the same shader +/// or compute pass. It also implies that atomic ops can be used, since those +/// are read-modify-write operations. If you use SIMULTANEOUS, you are +/// responsible for avoiding data races, as there is no data synchronization +/// within a compute pass. Note that SIMULTANEOUS usage is only supported by a +/// limited number of texture formats. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTexture`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`SAMPLER`](SDL_GPUTextureUsageFlags::SAMPLER) | [`SDL_GPU_TEXTUREUSAGE_SAMPLER`] | Texture supports sampling. | +/// | [`COLOR_TARGET`](SDL_GPUTextureUsageFlags::COLOR_TARGET) | [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`] | Texture is a color render target. | +/// | [`DEPTH_STENCIL_TARGET`](SDL_GPUTextureUsageFlags::DEPTH_STENCIL_TARGET) | [`SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET`] | Texture is a depth stencil target. | +/// | [`GRAPHICS_STORAGE_READ`](SDL_GPUTextureUsageFlags::GRAPHICS_STORAGE_READ) | [`SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ`] | Texture supports storage reads in graphics stages. | +/// | [`COMPUTE_STORAGE_READ`](SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_READ) | [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ`] | Texture supports storage reads in the compute stage. | +/// | [`COMPUTE_STORAGE_WRITE`](SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_WRITE) | [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE`] | Texture supports storage writes in the compute stage. | +/// | [`COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`](SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE) | [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`] | Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GPUTextureUsageFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_GPUTextureUsageFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GPUTextureUsageFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_GPUTextureUsageFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUTextureUsageFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GPUTextureUsageFlags(")?; + let all_bits = all_bits | Self::SAMPLER.0; + if (Self::SAMPLER != 0 || self.0 == 0) && *self & Self::SAMPLER == Self::SAMPLER { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SAMPLER")?; + } + let all_bits = all_bits | Self::COLOR_TARGET.0; + if (Self::COLOR_TARGET != 0 || self.0 == 0) + && *self & Self::COLOR_TARGET == Self::COLOR_TARGET + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COLOR_TARGET")?; + } + let all_bits = all_bits | Self::DEPTH_STENCIL_TARGET.0; + if (Self::DEPTH_STENCIL_TARGET != 0 || self.0 == 0) + && *self & Self::DEPTH_STENCIL_TARGET == Self::DEPTH_STENCIL_TARGET + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DEPTH_STENCIL_TARGET")?; + } + let all_bits = all_bits | Self::GRAPHICS_STORAGE_READ.0; + if (Self::GRAPHICS_STORAGE_READ != 0 || self.0 == 0) + && *self & Self::GRAPHICS_STORAGE_READ == Self::GRAPHICS_STORAGE_READ + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "GRAPHICS_STORAGE_READ")?; + } + let all_bits = all_bits | Self::COMPUTE_STORAGE_READ.0; + if (Self::COMPUTE_STORAGE_READ != 0 || self.0 == 0) + && *self & Self::COMPUTE_STORAGE_READ == Self::COMPUTE_STORAGE_READ + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COMPUTE_STORAGE_READ")?; + } + let all_bits = all_bits | Self::COMPUTE_STORAGE_WRITE.0; + if (Self::COMPUTE_STORAGE_WRITE != 0 || self.0 == 0) + && *self & Self::COMPUTE_STORAGE_WRITE == Self::COMPUTE_STORAGE_WRITE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COMPUTE_STORAGE_WRITE")?; + } + let all_bits = all_bits | Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE.0; + if (Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE != 0 || self.0 == 0) + && *self & Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE + == Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GPUTextureUsageFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GPUTextureUsageFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GPUTextureUsageFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GPUTextureUsageFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GPUTextureUsageFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GPUTextureUsageFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GPUTextureUsageFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GPUTextureUsageFlags { + /// Texture supports sampling. + pub const SAMPLER: Self = Self((1_u32 as Uint32)); + /// Texture is a color render target. + pub const COLOR_TARGET: Self = Self((2_u32 as Uint32)); + /// Texture is a depth stencil target. + pub const DEPTH_STENCIL_TARGET: Self = Self((4_u32 as Uint32)); + /// Texture supports storage reads in graphics stages. + pub const GRAPHICS_STORAGE_READ: Self = Self((8_u32 as Uint32)); + /// Texture supports storage reads in the compute stage. + pub const COMPUTE_STORAGE_READ: Self = Self((16_u32 as Uint32)); + /// Texture supports storage writes in the compute stage. + pub const COMPUTE_STORAGE_WRITE: Self = Self((32_u32 as Uint32)); + /// Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. + pub const COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE: Self = Self((64_u32 as Uint32)); +} + +/// Texture supports sampling. +pub const SDL_GPU_TEXTUREUSAGE_SAMPLER: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::SAMPLER; +/// Texture is a color render target. +pub const SDL_GPU_TEXTUREUSAGE_COLOR_TARGET: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::COLOR_TARGET; +/// Texture is a depth stencil target. +pub const SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::DEPTH_STENCIL_TARGET; +/// Texture supports storage reads in graphics stages. +pub const SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::GRAPHICS_STORAGE_READ; +/// Texture supports storage reads in the compute stage. +pub const SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_READ; +/// Texture supports storage writes in the compute stage. +pub const SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_WRITE; +/// Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. +pub const SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE: SDL_GPUTextureUsageFlags = + SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE; + +impl SDL_GPUTextureUsageFlags { + /// Initialize a `SDL_GPUTextureUsageFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_GPUTextureUsageFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTextureUsageFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUTextureUsageFlags; +} + +/// Specifies the type of a texture. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTexture`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`_2D`](SDL_GPUTextureType::_2D) | [`SDL_GPU_TEXTURETYPE_2D`] | The texture is a 2-dimensional image. | +/// | [`_2D_ARRAY`](SDL_GPUTextureType::_2D_ARRAY) | [`SDL_GPU_TEXTURETYPE_2D_ARRAY`] | The texture is a 2-dimensional array image. | +/// | [`_3D`](SDL_GPUTextureType::_3D) | [`SDL_GPU_TEXTURETYPE_3D`] | The texture is a 3-dimensional image. | +/// | [`CUBE`](SDL_GPUTextureType::CUBE) | [`SDL_GPU_TEXTURETYPE_CUBE`] | The texture is a cube image. | +/// | [`CUBE_ARRAY`](SDL_GPUTextureType::CUBE_ARRAY) | [`SDL_GPU_TEXTURETYPE_CUBE_ARRAY`] | The texture is a cube array image. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUTextureType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUTextureType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUTextureType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUTextureType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUTextureType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::_2D => "SDL_GPU_TEXTURETYPE_2D", + Self::_2D_ARRAY => "SDL_GPU_TEXTURETYPE_2D_ARRAY", + Self::_3D => "SDL_GPU_TEXTURETYPE_3D", + Self::CUBE => "SDL_GPU_TEXTURETYPE_CUBE", + Self::CUBE_ARRAY => "SDL_GPU_TEXTURETYPE_CUBE_ARRAY", + + _ => return write!(f, "SDL_GPUTextureType({})", self.0), + }) + } +} + +impl SDL_GPUTextureType { + /// The texture is a 2-dimensional image. + pub const _2D: Self = Self((0 as ::core::ffi::c_int)); + /// The texture is a 2-dimensional array image. + pub const _2D_ARRAY: Self = Self((1 as ::core::ffi::c_int)); + /// The texture is a 3-dimensional image. + pub const _3D: Self = Self((2 as ::core::ffi::c_int)); + /// The texture is a cube image. + pub const CUBE: Self = Self((3 as ::core::ffi::c_int)); + /// The texture is a cube array image. + pub const CUBE_ARRAY: Self = Self((4 as ::core::ffi::c_int)); +} + +/// The texture is a 2-dimensional image. +pub const SDL_GPU_TEXTURETYPE_2D: SDL_GPUTextureType = SDL_GPUTextureType::_2D; +/// The texture is a 2-dimensional array image. +pub const SDL_GPU_TEXTURETYPE_2D_ARRAY: SDL_GPUTextureType = SDL_GPUTextureType::_2D_ARRAY; +/// The texture is a 3-dimensional image. +pub const SDL_GPU_TEXTURETYPE_3D: SDL_GPUTextureType = SDL_GPUTextureType::_3D; +/// The texture is a cube image. +pub const SDL_GPU_TEXTURETYPE_CUBE: SDL_GPUTextureType = SDL_GPUTextureType::CUBE; +/// The texture is a cube array image. +pub const SDL_GPU_TEXTURETYPE_CUBE_ARRAY: SDL_GPUTextureType = SDL_GPUTextureType::CUBE_ARRAY; + +impl SDL_GPUTextureType { + /// Initialize a `SDL_GPUTextureType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUTextureType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTextureType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUTextureType; +} + +/// Specifies the sample count of a texture. +/// +/// Used in multisampling. Note that this value only applies when the texture +/// is used as a render target. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTexture`] +/// - [`SDL_GPUTextureSupportsSampleCount`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`_1`](SDL_GPUSampleCount::_1) | [`SDL_GPU_SAMPLECOUNT_1`] | No multisampling. | +/// | [`_2`](SDL_GPUSampleCount::_2) | [`SDL_GPU_SAMPLECOUNT_2`] | MSAA 2x | +/// | [`_4`](SDL_GPUSampleCount::_4) | [`SDL_GPU_SAMPLECOUNT_4`] | MSAA 4x | +/// | [`_8`](SDL_GPUSampleCount::_8) | [`SDL_GPU_SAMPLECOUNT_8`] | MSAA 8x | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUSampleCount(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSampleCount { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUSampleCount) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUSampleCount) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUSampleCount { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::_1 => "SDL_GPU_SAMPLECOUNT_1", + Self::_2 => "SDL_GPU_SAMPLECOUNT_2", + Self::_4 => "SDL_GPU_SAMPLECOUNT_4", + Self::_8 => "SDL_GPU_SAMPLECOUNT_8", + + _ => return write!(f, "SDL_GPUSampleCount({})", self.0), + }) + } +} + +impl SDL_GPUSampleCount { + /// No multisampling. + pub const _1: Self = Self((0 as ::core::ffi::c_int)); + /// MSAA 2x + pub const _2: Self = Self((1 as ::core::ffi::c_int)); + /// MSAA 4x + pub const _4: Self = Self((2 as ::core::ffi::c_int)); + /// MSAA 8x + pub const _8: Self = Self((3 as ::core::ffi::c_int)); +} + +/// No multisampling. +pub const SDL_GPU_SAMPLECOUNT_1: SDL_GPUSampleCount = SDL_GPUSampleCount::_1; +/// MSAA 2x +pub const SDL_GPU_SAMPLECOUNT_2: SDL_GPUSampleCount = SDL_GPUSampleCount::_2; +/// MSAA 4x +pub const SDL_GPU_SAMPLECOUNT_4: SDL_GPUSampleCount = SDL_GPUSampleCount::_4; +/// MSAA 8x +pub const SDL_GPU_SAMPLECOUNT_8: SDL_GPUSampleCount = SDL_GPUSampleCount::_8; + +impl SDL_GPUSampleCount { + /// Initialize a `SDL_GPUSampleCount` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUSampleCount { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSampleCount { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUSampleCount; +} + +/// Specifies the face of a cube map. +/// +/// Can be passed in as the layer field in texture-related structs. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`POSITIVEX`](SDL_GPUCubeMapFace::POSITIVEX) | [`SDL_GPU_CUBEMAPFACE_POSITIVEX`] | | +/// | [`NEGATIVEX`](SDL_GPUCubeMapFace::NEGATIVEX) | [`SDL_GPU_CUBEMAPFACE_NEGATIVEX`] | | +/// | [`POSITIVEY`](SDL_GPUCubeMapFace::POSITIVEY) | [`SDL_GPU_CUBEMAPFACE_POSITIVEY`] | | +/// | [`NEGATIVEY`](SDL_GPUCubeMapFace::NEGATIVEY) | [`SDL_GPU_CUBEMAPFACE_NEGATIVEY`] | | +/// | [`POSITIVEZ`](SDL_GPUCubeMapFace::POSITIVEZ) | [`SDL_GPU_CUBEMAPFACE_POSITIVEZ`] | | +/// | [`NEGATIVEZ`](SDL_GPUCubeMapFace::NEGATIVEZ) | [`SDL_GPU_CUBEMAPFACE_NEGATIVEZ`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUCubeMapFace(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUCubeMapFace { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUCubeMapFace) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUCubeMapFace) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUCubeMapFace { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::POSITIVEX => "SDL_GPU_CUBEMAPFACE_POSITIVEX", + Self::NEGATIVEX => "SDL_GPU_CUBEMAPFACE_NEGATIVEX", + Self::POSITIVEY => "SDL_GPU_CUBEMAPFACE_POSITIVEY", + Self::NEGATIVEY => "SDL_GPU_CUBEMAPFACE_NEGATIVEY", + Self::POSITIVEZ => "SDL_GPU_CUBEMAPFACE_POSITIVEZ", + Self::NEGATIVEZ => "SDL_GPU_CUBEMAPFACE_NEGATIVEZ", + + _ => return write!(f, "SDL_GPUCubeMapFace({})", self.0), + }) + } +} + +impl SDL_GPUCubeMapFace { + pub const POSITIVEX: Self = Self((0 as ::core::ffi::c_int)); + pub const NEGATIVEX: Self = Self((1 as ::core::ffi::c_int)); + pub const POSITIVEY: Self = Self((2 as ::core::ffi::c_int)); + pub const NEGATIVEY: Self = Self((3 as ::core::ffi::c_int)); + pub const POSITIVEZ: Self = Self((4 as ::core::ffi::c_int)); + pub const NEGATIVEZ: Self = Self((5 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_CUBEMAPFACE_POSITIVEX: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::POSITIVEX; +pub const SDL_GPU_CUBEMAPFACE_NEGATIVEX: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::NEGATIVEX; +pub const SDL_GPU_CUBEMAPFACE_POSITIVEY: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::POSITIVEY; +pub const SDL_GPU_CUBEMAPFACE_NEGATIVEY: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::NEGATIVEY; +pub const SDL_GPU_CUBEMAPFACE_POSITIVEZ: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::POSITIVEZ; +pub const SDL_GPU_CUBEMAPFACE_NEGATIVEZ: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::NEGATIVEZ; + +impl SDL_GPUCubeMapFace { + /// Initialize a `SDL_GPUCubeMapFace` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUCubeMapFace { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUCubeMapFace { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUCubeMapFace; +} + +/// Specifies how a buffer is intended to be used by the client. +/// +/// A buffer must have at least one usage flag. +/// +/// If a buffer has multiple read usages, this may lead to a performance penalty +/// due to more conservative memory barriers, but it also may not necessarily affect the performance. +/// +/// Unlike textures, READ | WRITE can be used for simultaneous read-write +/// usage. The same data synchronization concerns as textures apply. +/// +/// If you use a STORAGE flag, the data in the buffer must respect std140 +/// layout conventions. In practical terms this means you must ensure that vec3 +/// and vec4 fields are 16-byte aligned. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUBuffer`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`VERTEX`](SDL_GPUBufferUsageFlags::VERTEX) | [`SDL_GPU_BUFFERUSAGE_VERTEX`] | Buffer is a vertex buffer. | +/// | [`INDEX`](SDL_GPUBufferUsageFlags::INDEX) | [`SDL_GPU_BUFFERUSAGE_INDEX`] | Buffer is an index buffer. | +/// | [`INDIRECT`](SDL_GPUBufferUsageFlags::INDIRECT) | [`SDL_GPU_BUFFERUSAGE_INDIRECT`] | Buffer is an indirect buffer. | +/// | [`GRAPHICS_STORAGE_READ`](SDL_GPUBufferUsageFlags::GRAPHICS_STORAGE_READ) | [`SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ`] | Buffer supports storage reads in graphics stages. | +/// | [`COMPUTE_STORAGE_READ`](SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_READ) | [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ`] | Buffer supports storage reads in the compute stage. | +/// | [`COMPUTE_STORAGE_WRITE`](SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_WRITE) | [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE`] | Buffer supports storage writes in the compute stage. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GPUBufferUsageFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_GPUBufferUsageFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GPUBufferUsageFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_GPUBufferUsageFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUBufferUsageFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GPUBufferUsageFlags(")?; + let all_bits = all_bits | Self::VERTEX.0; + if (Self::VERTEX != 0 || self.0 == 0) && *self & Self::VERTEX == Self::VERTEX { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "VERTEX")?; + } + let all_bits = all_bits | Self::INDEX.0; + if (Self::INDEX != 0 || self.0 == 0) && *self & Self::INDEX == Self::INDEX { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INDEX")?; + } + let all_bits = all_bits | Self::INDIRECT.0; + if (Self::INDIRECT != 0 || self.0 == 0) && *self & Self::INDIRECT == Self::INDIRECT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INDIRECT")?; + } + let all_bits = all_bits | Self::GRAPHICS_STORAGE_READ.0; + if (Self::GRAPHICS_STORAGE_READ != 0 || self.0 == 0) + && *self & Self::GRAPHICS_STORAGE_READ == Self::GRAPHICS_STORAGE_READ + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "GRAPHICS_STORAGE_READ")?; + } + let all_bits = all_bits | Self::COMPUTE_STORAGE_READ.0; + if (Self::COMPUTE_STORAGE_READ != 0 || self.0 == 0) + && *self & Self::COMPUTE_STORAGE_READ == Self::COMPUTE_STORAGE_READ + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COMPUTE_STORAGE_READ")?; + } + let all_bits = all_bits | Self::COMPUTE_STORAGE_WRITE.0; + if (Self::COMPUTE_STORAGE_WRITE != 0 || self.0 == 0) + && *self & Self::COMPUTE_STORAGE_WRITE == Self::COMPUTE_STORAGE_WRITE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COMPUTE_STORAGE_WRITE")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GPUBufferUsageFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GPUBufferUsageFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GPUBufferUsageFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GPUBufferUsageFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GPUBufferUsageFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GPUBufferUsageFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GPUBufferUsageFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GPUBufferUsageFlags { + /// Buffer is a vertex buffer. + pub const VERTEX: Self = Self((1_u32 as Uint32)); + /// Buffer is an index buffer. + pub const INDEX: Self = Self((2_u32 as Uint32)); + /// Buffer is an indirect buffer. + pub const INDIRECT: Self = Self((4_u32 as Uint32)); + /// Buffer supports storage reads in graphics stages. + pub const GRAPHICS_STORAGE_READ: Self = Self((8_u32 as Uint32)); + /// Buffer supports storage reads in the compute stage. + pub const COMPUTE_STORAGE_READ: Self = Self((16_u32 as Uint32)); + /// Buffer supports storage writes in the compute stage. + pub const COMPUTE_STORAGE_WRITE: Self = Self((32_u32 as Uint32)); +} + +/// Buffer is a vertex buffer. +pub const SDL_GPU_BUFFERUSAGE_VERTEX: SDL_GPUBufferUsageFlags = SDL_GPUBufferUsageFlags::VERTEX; +/// Buffer is an index buffer. +pub const SDL_GPU_BUFFERUSAGE_INDEX: SDL_GPUBufferUsageFlags = SDL_GPUBufferUsageFlags::INDEX; +/// Buffer is an indirect buffer. +pub const SDL_GPU_BUFFERUSAGE_INDIRECT: SDL_GPUBufferUsageFlags = SDL_GPUBufferUsageFlags::INDIRECT; +/// Buffer supports storage reads in graphics stages. +pub const SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ: SDL_GPUBufferUsageFlags = + SDL_GPUBufferUsageFlags::GRAPHICS_STORAGE_READ; +/// Buffer supports storage reads in the compute stage. +pub const SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ: SDL_GPUBufferUsageFlags = + SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_READ; +/// Buffer supports storage writes in the compute stage. +pub const SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE: SDL_GPUBufferUsageFlags = + SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_WRITE; + +impl SDL_GPUBufferUsageFlags { + /// Initialize a `SDL_GPUBufferUsageFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_GPUBufferUsageFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUBufferUsageFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUBufferUsageFlags; +} + +/// Specifies how a transfer buffer is intended to be used by the client. +/// +/// Note that mapping and copying FROM an upload transfer buffer or TO a +/// download transfer buffer is undefined behavior. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTransferBuffer`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UPLOAD`](SDL_GPUTransferBufferUsage::UPLOAD) | [`SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD`] | | +/// | [`DOWNLOAD`](SDL_GPUTransferBufferUsage::DOWNLOAD) | [`SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUTransferBufferUsage(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUTransferBufferUsage { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUTransferBufferUsage) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUTransferBufferUsage) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUTransferBufferUsage { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UPLOAD => "SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD", + Self::DOWNLOAD => "SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD", + + _ => return write!(f, "SDL_GPUTransferBufferUsage({})", self.0), + }) + } +} + +impl SDL_GPUTransferBufferUsage { + pub const UPLOAD: Self = Self((0 as ::core::ffi::c_int)); + pub const DOWNLOAD: Self = Self((1 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD: SDL_GPUTransferBufferUsage = + SDL_GPUTransferBufferUsage::UPLOAD; +pub const SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD: SDL_GPUTransferBufferUsage = + SDL_GPUTransferBufferUsage::DOWNLOAD; + +impl SDL_GPUTransferBufferUsage { + /// Initialize a `SDL_GPUTransferBufferUsage` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUTransferBufferUsage { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTransferBufferUsage { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUTransferBufferUsage; +} + +/// Specifies which stage a shader program corresponds to. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUShader`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`VERTEX`](SDL_GPUShaderStage::VERTEX) | [`SDL_GPU_SHADERSTAGE_VERTEX`] | | +/// | [`FRAGMENT`](SDL_GPUShaderStage::FRAGMENT) | [`SDL_GPU_SHADERSTAGE_FRAGMENT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUShaderStage(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUShaderStage { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUShaderStage) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUShaderStage) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUShaderStage { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::VERTEX => "SDL_GPU_SHADERSTAGE_VERTEX", + Self::FRAGMENT => "SDL_GPU_SHADERSTAGE_FRAGMENT", + + _ => return write!(f, "SDL_GPUShaderStage({})", self.0), + }) + } +} + +impl SDL_GPUShaderStage { + pub const VERTEX: Self = Self((0 as ::core::ffi::c_int)); + pub const FRAGMENT: Self = Self((1 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_SHADERSTAGE_VERTEX: SDL_GPUShaderStage = SDL_GPUShaderStage::VERTEX; +pub const SDL_GPU_SHADERSTAGE_FRAGMENT: SDL_GPUShaderStage = SDL_GPUShaderStage::FRAGMENT; + +impl SDL_GPUShaderStage { + /// Initialize a `SDL_GPUShaderStage` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUShaderStage { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUShaderStage { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUShaderStage; +} + +/// Specifies the format of shader code. +/// +/// Each format corresponds to a specific backend that accepts it. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUShader`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUShaderFormat::INVALID) | [`SDL_GPU_SHADERFORMAT_INVALID`] | | +/// | [`PRIVATE`](SDL_GPUShaderFormat::PRIVATE) | [`SDL_GPU_SHADERFORMAT_PRIVATE`] | Shaders for NDA'd platforms. | +/// | [`SPIRV`](SDL_GPUShaderFormat::SPIRV) | [`SDL_GPU_SHADERFORMAT_SPIRV`] | SPIR-V shaders for Vulkan. | +/// | [`DXBC`](SDL_GPUShaderFormat::DXBC) | [`SDL_GPU_SHADERFORMAT_DXBC`] | DXBC SM5_1 shaders for D3D12. | +/// | [`DXIL`](SDL_GPUShaderFormat::DXIL) | [`SDL_GPU_SHADERFORMAT_DXIL`] | DXIL SM6_0 shaders for D3D12. | +/// | [`MSL`](SDL_GPUShaderFormat::MSL) | [`SDL_GPU_SHADERFORMAT_MSL`] | MSL shaders for Metal. | +/// | [`METALLIB`](SDL_GPUShaderFormat::METALLIB) | [`SDL_GPU_SHADERFORMAT_METALLIB`] | Precompiled metallib shaders for Metal. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GPUShaderFormat(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_GPUShaderFormat { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GPUShaderFormat) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_GPUShaderFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUShaderFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GPUShaderFormat(")?; + let all_bits = all_bits | Self::INVALID.0; + if (Self::INVALID != 0 || self.0 == 0) && *self & Self::INVALID == Self::INVALID { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INVALID")?; + } + let all_bits = all_bits | Self::PRIVATE.0; + if (Self::PRIVATE != 0 || self.0 == 0) && *self & Self::PRIVATE == Self::PRIVATE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "PRIVATE")?; + } + let all_bits = all_bits | Self::SPIRV.0; + if (Self::SPIRV != 0 || self.0 == 0) && *self & Self::SPIRV == Self::SPIRV { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SPIRV")?; + } + let all_bits = all_bits | Self::DXBC.0; + if (Self::DXBC != 0 || self.0 == 0) && *self & Self::DXBC == Self::DXBC { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DXBC")?; + } + let all_bits = all_bits | Self::DXIL.0; + if (Self::DXIL != 0 || self.0 == 0) && *self & Self::DXIL == Self::DXIL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DXIL")?; + } + let all_bits = all_bits | Self::MSL.0; + if (Self::MSL != 0 || self.0 == 0) && *self & Self::MSL == Self::MSL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MSL")?; + } + let all_bits = all_bits | Self::METALLIB.0; + if (Self::METALLIB != 0 || self.0 == 0) && *self & Self::METALLIB == Self::METALLIB { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "METALLIB")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GPUShaderFormat { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GPUShaderFormat { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GPUShaderFormat { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GPUShaderFormat { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GPUShaderFormat { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GPUShaderFormat { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GPUShaderFormat { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GPUShaderFormat { + pub const INVALID: Self = Self((0 as Uint32)); + /// Shaders for NDA'd platforms. + pub const PRIVATE: Self = Self((1_u32 as Uint32)); + /// SPIR-V shaders for Vulkan. + pub const SPIRV: Self = Self((2_u32 as Uint32)); + /// DXBC SM5_1 shaders for D3D12. + pub const DXBC: Self = Self((4_u32 as Uint32)); + /// DXIL SM6_0 shaders for D3D12. + pub const DXIL: Self = Self((8_u32 as Uint32)); + /// MSL shaders for Metal. + pub const MSL: Self = Self((16_u32 as Uint32)); + /// Precompiled metallib shaders for Metal. + pub const METALLIB: Self = Self((32_u32 as Uint32)); +} + +pub const SDL_GPU_SHADERFORMAT_INVALID: SDL_GPUShaderFormat = SDL_GPUShaderFormat::INVALID; +/// Shaders for NDA'd platforms. +pub const SDL_GPU_SHADERFORMAT_PRIVATE: SDL_GPUShaderFormat = SDL_GPUShaderFormat::PRIVATE; +/// SPIR-V shaders for Vulkan. +pub const SDL_GPU_SHADERFORMAT_SPIRV: SDL_GPUShaderFormat = SDL_GPUShaderFormat::SPIRV; +/// DXBC SM5_1 shaders for D3D12. +pub const SDL_GPU_SHADERFORMAT_DXBC: SDL_GPUShaderFormat = SDL_GPUShaderFormat::DXBC; +/// DXIL SM6_0 shaders for D3D12. +pub const SDL_GPU_SHADERFORMAT_DXIL: SDL_GPUShaderFormat = SDL_GPUShaderFormat::DXIL; +/// MSL shaders for Metal. +pub const SDL_GPU_SHADERFORMAT_MSL: SDL_GPUShaderFormat = SDL_GPUShaderFormat::MSL; +/// Precompiled metallib shaders for Metal. +pub const SDL_GPU_SHADERFORMAT_METALLIB: SDL_GPUShaderFormat = SDL_GPUShaderFormat::METALLIB; + +impl SDL_GPUShaderFormat { + /// Initialize a `SDL_GPUShaderFormat` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_GPUShaderFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUShaderFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUShaderFormat; +} + +/// Specifies the format of a vertex attribute. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUVertexElementFormat::INVALID) | [`SDL_GPU_VERTEXELEMENTFORMAT_INVALID`] | | +/// | [`INT`](SDL_GPUVertexElementFormat::INT) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT`] | | +/// | [`INT2`](SDL_GPUVertexElementFormat::INT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT2`] | | +/// | [`INT3`](SDL_GPUVertexElementFormat::INT3) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT3`] | | +/// | [`INT4`](SDL_GPUVertexElementFormat::INT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT4`] | | +/// | [`UINT`](SDL_GPUVertexElementFormat::UINT) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT`] | | +/// | [`UINT2`](SDL_GPUVertexElementFormat::UINT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT2`] | | +/// | [`UINT3`](SDL_GPUVertexElementFormat::UINT3) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT3`] | | +/// | [`UINT4`](SDL_GPUVertexElementFormat::UINT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT4`] | | +/// | [`FLOAT`](SDL_GPUVertexElementFormat::FLOAT) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT`] | | +/// | [`FLOAT2`](SDL_GPUVertexElementFormat::FLOAT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2`] | | +/// | [`FLOAT3`](SDL_GPUVertexElementFormat::FLOAT3) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3`] | | +/// | [`FLOAT4`](SDL_GPUVertexElementFormat::FLOAT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4`] | | +/// | [`BYTE2`](SDL_GPUVertexElementFormat::BYTE2) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE2`] | | +/// | [`BYTE4`](SDL_GPUVertexElementFormat::BYTE4) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE4`] | | +/// | [`UBYTE2`](SDL_GPUVertexElementFormat::UBYTE2) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2`] | | +/// | [`UBYTE4`](SDL_GPUVertexElementFormat::UBYTE4) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4`] | | +/// | [`BYTE2_NORM`](SDL_GPUVertexElementFormat::BYTE2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM`] | | +/// | [`BYTE4_NORM`](SDL_GPUVertexElementFormat::BYTE4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM`] | | +/// | [`UBYTE2_NORM`](SDL_GPUVertexElementFormat::UBYTE2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM`] | | +/// | [`UBYTE4_NORM`](SDL_GPUVertexElementFormat::UBYTE4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM`] | | +/// | [`SHORT2`](SDL_GPUVertexElementFormat::SHORT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT2`] | | +/// | [`SHORT4`](SDL_GPUVertexElementFormat::SHORT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT4`] | | +/// | [`USHORT2`](SDL_GPUVertexElementFormat::USHORT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT2`] | | +/// | [`USHORT4`](SDL_GPUVertexElementFormat::USHORT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT4`] | | +/// | [`SHORT2_NORM`](SDL_GPUVertexElementFormat::SHORT2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM`] | | +/// | [`SHORT4_NORM`](SDL_GPUVertexElementFormat::SHORT4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM`] | | +/// | [`USHORT2_NORM`](SDL_GPUVertexElementFormat::USHORT2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM`] | | +/// | [`USHORT4_NORM`](SDL_GPUVertexElementFormat::USHORT4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM`] | | +/// | [`HALF2`](SDL_GPUVertexElementFormat::HALF2) | [`SDL_GPU_VERTEXELEMENTFORMAT_HALF2`] | | +/// | [`HALF4`](SDL_GPUVertexElementFormat::HALF4) | [`SDL_GPU_VERTEXELEMENTFORMAT_HALF4`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUVertexElementFormat(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUVertexElementFormat { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUVertexElementFormat) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUVertexElementFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUVertexElementFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GPU_VERTEXELEMENTFORMAT_INVALID", + Self::INT => "SDL_GPU_VERTEXELEMENTFORMAT_INT", + Self::INT2 => "SDL_GPU_VERTEXELEMENTFORMAT_INT2", + Self::INT3 => "SDL_GPU_VERTEXELEMENTFORMAT_INT3", + Self::INT4 => "SDL_GPU_VERTEXELEMENTFORMAT_INT4", + Self::UINT => "SDL_GPU_VERTEXELEMENTFORMAT_UINT", + Self::UINT2 => "SDL_GPU_VERTEXELEMENTFORMAT_UINT2", + Self::UINT3 => "SDL_GPU_VERTEXELEMENTFORMAT_UINT3", + Self::UINT4 => "SDL_GPU_VERTEXELEMENTFORMAT_UINT4", + Self::FLOAT => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT", + Self::FLOAT2 => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2", + Self::FLOAT3 => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3", + Self::FLOAT4 => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4", + Self::BYTE2 => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE2", + Self::BYTE4 => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE4", + Self::UBYTE2 => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2", + Self::UBYTE4 => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4", + Self::BYTE2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM", + Self::BYTE4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM", + Self::UBYTE2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM", + Self::UBYTE4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM", + Self::SHORT2 => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT2", + Self::SHORT4 => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT4", + Self::USHORT2 => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT2", + Self::USHORT4 => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT4", + Self::SHORT2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM", + Self::SHORT4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM", + Self::USHORT2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM", + Self::USHORT4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM", + Self::HALF2 => "SDL_GPU_VERTEXELEMENTFORMAT_HALF2", + Self::HALF4 => "SDL_GPU_VERTEXELEMENTFORMAT_HALF4", + + _ => return write!(f, "SDL_GPUVertexElementFormat({})", self.0), + }) + } +} + +impl SDL_GPUVertexElementFormat { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + pub const INT: Self = Self((1 as ::core::ffi::c_int)); + pub const INT2: Self = Self((2 as ::core::ffi::c_int)); + pub const INT3: Self = Self((3 as ::core::ffi::c_int)); + pub const INT4: Self = Self((4 as ::core::ffi::c_int)); + pub const UINT: Self = Self((5 as ::core::ffi::c_int)); + pub const UINT2: Self = Self((6 as ::core::ffi::c_int)); + pub const UINT3: Self = Self((7 as ::core::ffi::c_int)); + pub const UINT4: Self = Self((8 as ::core::ffi::c_int)); + pub const FLOAT: Self = Self((9 as ::core::ffi::c_int)); + pub const FLOAT2: Self = Self((10 as ::core::ffi::c_int)); + pub const FLOAT3: Self = Self((11 as ::core::ffi::c_int)); + pub const FLOAT4: Self = Self((12 as ::core::ffi::c_int)); + pub const BYTE2: Self = Self((13 as ::core::ffi::c_int)); + pub const BYTE4: Self = Self((14 as ::core::ffi::c_int)); + pub const UBYTE2: Self = Self((15 as ::core::ffi::c_int)); + pub const UBYTE4: Self = Self((16 as ::core::ffi::c_int)); + pub const BYTE2_NORM: Self = Self((17 as ::core::ffi::c_int)); + pub const BYTE4_NORM: Self = Self((18 as ::core::ffi::c_int)); + pub const UBYTE2_NORM: Self = Self((19 as ::core::ffi::c_int)); + pub const UBYTE4_NORM: Self = Self((20 as ::core::ffi::c_int)); + pub const SHORT2: Self = Self((21 as ::core::ffi::c_int)); + pub const SHORT4: Self = Self((22 as ::core::ffi::c_int)); + pub const USHORT2: Self = Self((23 as ::core::ffi::c_int)); + pub const USHORT4: Self = Self((24 as ::core::ffi::c_int)); + pub const SHORT2_NORM: Self = Self((25 as ::core::ffi::c_int)); + pub const SHORT4_NORM: Self = Self((26 as ::core::ffi::c_int)); + pub const USHORT2_NORM: Self = Self((27 as ::core::ffi::c_int)); + pub const USHORT4_NORM: Self = Self((28 as ::core::ffi::c_int)); + pub const HALF2: Self = Self((29 as ::core::ffi::c_int)); + pub const HALF4: Self = Self((30 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_VERTEXELEMENTFORMAT_INVALID: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::INVALID; +pub const SDL_GPU_VERTEXELEMENTFORMAT_INT: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::INT; +pub const SDL_GPU_VERTEXELEMENTFORMAT_INT2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::INT2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_INT3: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::INT3; +pub const SDL_GPU_VERTEXELEMENTFORMAT_INT4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::INT4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UINT; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UINT2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT3: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UINT3; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UINT4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::FLOAT; +pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::FLOAT2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::FLOAT3; +pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::FLOAT4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::BYTE2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::BYTE4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UBYTE2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UBYTE4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::BYTE2_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::BYTE4_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UBYTE2_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::UBYTE4_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::SHORT2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::SHORT4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::USHORT2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::USHORT4; +pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::SHORT2_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::SHORT4_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::USHORT2_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::USHORT4_NORM; +pub const SDL_GPU_VERTEXELEMENTFORMAT_HALF2: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::HALF2; +pub const SDL_GPU_VERTEXELEMENTFORMAT_HALF4: SDL_GPUVertexElementFormat = + SDL_GPUVertexElementFormat::HALF4; + +impl SDL_GPUVertexElementFormat { + /// Initialize a `SDL_GPUVertexElementFormat` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUVertexElementFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUVertexElementFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUVertexElementFormat; +} + +/// Specifies the rate at which vertex attributes are pulled from buffers. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`VERTEX`](SDL_GPUVertexInputRate::VERTEX) | [`SDL_GPU_VERTEXINPUTRATE_VERTEX`] | Attribute addressing is a function of the vertex index. | +/// | [`INSTANCE`](SDL_GPUVertexInputRate::INSTANCE) | [`SDL_GPU_VERTEXINPUTRATE_INSTANCE`] | Attribute addressing is a function of the instance index. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUVertexInputRate(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUVertexInputRate { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUVertexInputRate) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUVertexInputRate) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUVertexInputRate { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::VERTEX => "SDL_GPU_VERTEXINPUTRATE_VERTEX", + Self::INSTANCE => "SDL_GPU_VERTEXINPUTRATE_INSTANCE", + + _ => return write!(f, "SDL_GPUVertexInputRate({})", self.0), + }) + } +} + +impl SDL_GPUVertexInputRate { + /// Attribute addressing is a function of the vertex index. + pub const VERTEX: Self = Self((0 as ::core::ffi::c_int)); + /// Attribute addressing is a function of the instance index. + pub const INSTANCE: Self = Self((1 as ::core::ffi::c_int)); +} + +/// Attribute addressing is a function of the vertex index. +pub const SDL_GPU_VERTEXINPUTRATE_VERTEX: SDL_GPUVertexInputRate = SDL_GPUVertexInputRate::VERTEX; +/// Attribute addressing is a function of the instance index. +pub const SDL_GPU_VERTEXINPUTRATE_INSTANCE: SDL_GPUVertexInputRate = + SDL_GPUVertexInputRate::INSTANCE; + +impl SDL_GPUVertexInputRate { + /// Initialize a `SDL_GPUVertexInputRate` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUVertexInputRate { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUVertexInputRate { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUVertexInputRate; +} + +/// Specifies the fill mode of the graphics pipeline. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`FILL`](SDL_GPUFillMode::FILL) | [`SDL_GPU_FILLMODE_FILL`] | Polygons will be rendered via rasterization. | +/// | [`LINE`](SDL_GPUFillMode::LINE) | [`SDL_GPU_FILLMODE_LINE`] | Polygon edges will be drawn as line segments. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUFillMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUFillMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUFillMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUFillMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUFillMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::FILL => "SDL_GPU_FILLMODE_FILL", + Self::LINE => "SDL_GPU_FILLMODE_LINE", + + _ => return write!(f, "SDL_GPUFillMode({})", self.0), + }) + } +} + +impl SDL_GPUFillMode { + /// Polygons will be rendered via rasterization. + pub const FILL: Self = Self((0 as ::core::ffi::c_int)); + /// Polygon edges will be drawn as line segments. + pub const LINE: Self = Self((1 as ::core::ffi::c_int)); +} + +/// Polygons will be rendered via rasterization. +pub const SDL_GPU_FILLMODE_FILL: SDL_GPUFillMode = SDL_GPUFillMode::FILL; +/// Polygon edges will be drawn as line segments. +pub const SDL_GPU_FILLMODE_LINE: SDL_GPUFillMode = SDL_GPUFillMode::LINE; + +impl SDL_GPUFillMode { + /// Initialize a `SDL_GPUFillMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUFillMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUFillMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUFillMode; +} + +/// Specifies the facing direction in which triangle faces will be culled. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_GPUCullMode::NONE) | [`SDL_GPU_CULLMODE_NONE`] | No triangles are culled. | +/// | [`FRONT`](SDL_GPUCullMode::FRONT) | [`SDL_GPU_CULLMODE_FRONT`] | Front-facing triangles are culled. | +/// | [`BACK`](SDL_GPUCullMode::BACK) | [`SDL_GPU_CULLMODE_BACK`] | Back-facing triangles are culled. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUCullMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUCullMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUCullMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUCullMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUCullMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_GPU_CULLMODE_NONE", + Self::FRONT => "SDL_GPU_CULLMODE_FRONT", + Self::BACK => "SDL_GPU_CULLMODE_BACK", + + _ => return write!(f, "SDL_GPUCullMode({})", self.0), + }) + } +} + +impl SDL_GPUCullMode { + /// No triangles are culled. + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + /// Front-facing triangles are culled. + pub const FRONT: Self = Self((1 as ::core::ffi::c_int)); + /// Back-facing triangles are culled. + pub const BACK: Self = Self((2 as ::core::ffi::c_int)); +} + +/// No triangles are culled. +pub const SDL_GPU_CULLMODE_NONE: SDL_GPUCullMode = SDL_GPUCullMode::NONE; +/// Front-facing triangles are culled. +pub const SDL_GPU_CULLMODE_FRONT: SDL_GPUCullMode = SDL_GPUCullMode::FRONT; +/// Back-facing triangles are culled. +pub const SDL_GPU_CULLMODE_BACK: SDL_GPUCullMode = SDL_GPUCullMode::BACK; + +impl SDL_GPUCullMode { + /// Initialize a `SDL_GPUCullMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUCullMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUCullMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUCullMode; +} + +/// Specifies the vertex winding that will cause a triangle to be determined to +/// be front-facing. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`COUNTER_CLOCKWISE`](SDL_GPUFrontFace::COUNTER_CLOCKWISE) | [`SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE`] | A triangle with counter-clockwise vertex winding will be considered front-facing. | +/// | [`CLOCKWISE`](SDL_GPUFrontFace::CLOCKWISE) | [`SDL_GPU_FRONTFACE_CLOCKWISE`] | A triangle with clockwise vertex winding will be considered front-facing. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUFrontFace(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUFrontFace { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUFrontFace) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUFrontFace) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUFrontFace { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::COUNTER_CLOCKWISE => "SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE", + Self::CLOCKWISE => "SDL_GPU_FRONTFACE_CLOCKWISE", + + _ => return write!(f, "SDL_GPUFrontFace({})", self.0), + }) + } +} + +impl SDL_GPUFrontFace { + /// A triangle with counter-clockwise vertex winding will be considered front-facing. + pub const COUNTER_CLOCKWISE: Self = Self((0 as ::core::ffi::c_int)); + /// A triangle with clockwise vertex winding will be considered front-facing. + pub const CLOCKWISE: Self = Self((1 as ::core::ffi::c_int)); +} + +/// A triangle with counter-clockwise vertex winding will be considered front-facing. +pub const SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE: SDL_GPUFrontFace = + SDL_GPUFrontFace::COUNTER_CLOCKWISE; +/// A triangle with clockwise vertex winding will be considered front-facing. +pub const SDL_GPU_FRONTFACE_CLOCKWISE: SDL_GPUFrontFace = SDL_GPUFrontFace::CLOCKWISE; + +impl SDL_GPUFrontFace { + /// Initialize a `SDL_GPUFrontFace` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUFrontFace { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUFrontFace { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUFrontFace; +} + +/// Specifies a comparison operator for depth, stencil and sampler operations. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUCompareOp::INVALID) | [`SDL_GPU_COMPAREOP_INVALID`] | | +/// | [`NEVER`](SDL_GPUCompareOp::NEVER) | [`SDL_GPU_COMPAREOP_NEVER`] | The comparison always evaluates false. | +/// | [`LESS`](SDL_GPUCompareOp::LESS) | [`SDL_GPU_COMPAREOP_LESS`] | The comparison evaluates reference < test. | +/// | [`EQUAL`](SDL_GPUCompareOp::EQUAL) | [`SDL_GPU_COMPAREOP_EQUAL`] | The comparison evaluates reference == test. | +/// | [`LESS_OR_EQUAL`](SDL_GPUCompareOp::LESS_OR_EQUAL) | [`SDL_GPU_COMPAREOP_LESS_OR_EQUAL`] | The comparison evaluates reference <= test. | +/// | [`GREATER`](SDL_GPUCompareOp::GREATER) | [`SDL_GPU_COMPAREOP_GREATER`] | The comparison evaluates reference > test. | +/// | [`NOT_EQUAL`](SDL_GPUCompareOp::NOT_EQUAL) | [`SDL_GPU_COMPAREOP_NOT_EQUAL`] | The comparison evaluates reference != test. | +/// | [`GREATER_OR_EQUAL`](SDL_GPUCompareOp::GREATER_OR_EQUAL) | [`SDL_GPU_COMPAREOP_GREATER_OR_EQUAL`] | The comparison evaluates reference >= test. | +/// | [`ALWAYS`](SDL_GPUCompareOp::ALWAYS) | [`SDL_GPU_COMPAREOP_ALWAYS`] | The comparison always evaluates true. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUCompareOp(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUCompareOp { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUCompareOp) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUCompareOp) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUCompareOp { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GPU_COMPAREOP_INVALID", + Self::NEVER => "SDL_GPU_COMPAREOP_NEVER", + Self::LESS => "SDL_GPU_COMPAREOP_LESS", + Self::EQUAL => "SDL_GPU_COMPAREOP_EQUAL", + Self::LESS_OR_EQUAL => "SDL_GPU_COMPAREOP_LESS_OR_EQUAL", + Self::GREATER => "SDL_GPU_COMPAREOP_GREATER", + Self::NOT_EQUAL => "SDL_GPU_COMPAREOP_NOT_EQUAL", + Self::GREATER_OR_EQUAL => "SDL_GPU_COMPAREOP_GREATER_OR_EQUAL", + Self::ALWAYS => "SDL_GPU_COMPAREOP_ALWAYS", + + _ => return write!(f, "SDL_GPUCompareOp({})", self.0), + }) + } +} + +impl SDL_GPUCompareOp { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + /// The comparison always evaluates false. + pub const NEVER: Self = Self((1 as ::core::ffi::c_int)); + /// The comparison evaluates reference < test. + pub const LESS: Self = Self((2 as ::core::ffi::c_int)); + /// The comparison evaluates reference == test. + pub const EQUAL: Self = Self((3 as ::core::ffi::c_int)); + /// The comparison evaluates reference <= test. + pub const LESS_OR_EQUAL: Self = Self((4 as ::core::ffi::c_int)); + /// The comparison evaluates reference > test. + pub const GREATER: Self = Self((5 as ::core::ffi::c_int)); + /// The comparison evaluates reference != test. + pub const NOT_EQUAL: Self = Self((6 as ::core::ffi::c_int)); + /// The comparison evaluates reference >= test. + pub const GREATER_OR_EQUAL: Self = Self((7 as ::core::ffi::c_int)); + /// The comparison always evaluates true. + pub const ALWAYS: Self = Self((8 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_COMPAREOP_INVALID: SDL_GPUCompareOp = SDL_GPUCompareOp::INVALID; +/// The comparison always evaluates false. +pub const SDL_GPU_COMPAREOP_NEVER: SDL_GPUCompareOp = SDL_GPUCompareOp::NEVER; +/// The comparison evaluates reference < test. +pub const SDL_GPU_COMPAREOP_LESS: SDL_GPUCompareOp = SDL_GPUCompareOp::LESS; +/// The comparison evaluates reference == test. +pub const SDL_GPU_COMPAREOP_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::EQUAL; +/// The comparison evaluates reference <= test. +pub const SDL_GPU_COMPAREOP_LESS_OR_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::LESS_OR_EQUAL; +/// The comparison evaluates reference > test. +pub const SDL_GPU_COMPAREOP_GREATER: SDL_GPUCompareOp = SDL_GPUCompareOp::GREATER; +/// The comparison evaluates reference != test. +pub const SDL_GPU_COMPAREOP_NOT_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::NOT_EQUAL; +/// The comparison evaluates reference >= test. +pub const SDL_GPU_COMPAREOP_GREATER_OR_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::GREATER_OR_EQUAL; +/// The comparison always evaluates true. +pub const SDL_GPU_COMPAREOP_ALWAYS: SDL_GPUCompareOp = SDL_GPUCompareOp::ALWAYS; + +impl SDL_GPUCompareOp { + /// Initialize a `SDL_GPUCompareOp` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUCompareOp { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUCompareOp { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUCompareOp; +} + +/// Specifies what happens to a stored stencil value if stencil tests fail or +/// pass. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUStencilOp::INVALID) | [`SDL_GPU_STENCILOP_INVALID`] | | +/// | [`KEEP`](SDL_GPUStencilOp::KEEP) | [`SDL_GPU_STENCILOP_KEEP`] | Keeps the current value. | +/// | [`ZERO`](SDL_GPUStencilOp::ZERO) | [`SDL_GPU_STENCILOP_ZERO`] | Sets the value to 0. | +/// | [`REPLACE`](SDL_GPUStencilOp::REPLACE) | [`SDL_GPU_STENCILOP_REPLACE`] | Sets the value to reference. | +/// | [`INCREMENT_AND_CLAMP`](SDL_GPUStencilOp::INCREMENT_AND_CLAMP) | [`SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP`] | Increments the current value and clamps to the maximum value. | +/// | [`DECREMENT_AND_CLAMP`](SDL_GPUStencilOp::DECREMENT_AND_CLAMP) | [`SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP`] | Decrements the current value and clamps to 0. | +/// | [`INVERT`](SDL_GPUStencilOp::INVERT) | [`SDL_GPU_STENCILOP_INVERT`] | Bitwise-inverts the current value. | +/// | [`INCREMENT_AND_WRAP`](SDL_GPUStencilOp::INCREMENT_AND_WRAP) | [`SDL_GPU_STENCILOP_INCREMENT_AND_WRAP`] | Increments the current value and wraps back to 0. | +/// | [`DECREMENT_AND_WRAP`](SDL_GPUStencilOp::DECREMENT_AND_WRAP) | [`SDL_GPU_STENCILOP_DECREMENT_AND_WRAP`] | Decrements the current value and wraps to the maximum value. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUStencilOp(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUStencilOp { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUStencilOp) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUStencilOp) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUStencilOp { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GPU_STENCILOP_INVALID", + Self::KEEP => "SDL_GPU_STENCILOP_KEEP", + Self::ZERO => "SDL_GPU_STENCILOP_ZERO", + Self::REPLACE => "SDL_GPU_STENCILOP_REPLACE", + Self::INCREMENT_AND_CLAMP => "SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP", + Self::DECREMENT_AND_CLAMP => "SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP", + Self::INVERT => "SDL_GPU_STENCILOP_INVERT", + Self::INCREMENT_AND_WRAP => "SDL_GPU_STENCILOP_INCREMENT_AND_WRAP", + Self::DECREMENT_AND_WRAP => "SDL_GPU_STENCILOP_DECREMENT_AND_WRAP", + + _ => return write!(f, "SDL_GPUStencilOp({})", self.0), + }) + } +} + +impl SDL_GPUStencilOp { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + /// Keeps the current value. + pub const KEEP: Self = Self((1 as ::core::ffi::c_int)); + /// Sets the value to 0. + pub const ZERO: Self = Self((2 as ::core::ffi::c_int)); + /// Sets the value to reference. + pub const REPLACE: Self = Self((3 as ::core::ffi::c_int)); + /// Increments the current value and clamps to the maximum value. + pub const INCREMENT_AND_CLAMP: Self = Self((4 as ::core::ffi::c_int)); + /// Decrements the current value and clamps to 0. + pub const DECREMENT_AND_CLAMP: Self = Self((5 as ::core::ffi::c_int)); + /// Bitwise-inverts the current value. + pub const INVERT: Self = Self((6 as ::core::ffi::c_int)); + /// Increments the current value and wraps back to 0. + pub const INCREMENT_AND_WRAP: Self = Self((7 as ::core::ffi::c_int)); + /// Decrements the current value and wraps to the maximum value. + pub const DECREMENT_AND_WRAP: Self = Self((8 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_STENCILOP_INVALID: SDL_GPUStencilOp = SDL_GPUStencilOp::INVALID; +/// Keeps the current value. +pub const SDL_GPU_STENCILOP_KEEP: SDL_GPUStencilOp = SDL_GPUStencilOp::KEEP; +/// Sets the value to 0. +pub const SDL_GPU_STENCILOP_ZERO: SDL_GPUStencilOp = SDL_GPUStencilOp::ZERO; +/// Sets the value to reference. +pub const SDL_GPU_STENCILOP_REPLACE: SDL_GPUStencilOp = SDL_GPUStencilOp::REPLACE; +/// Increments the current value and clamps to the maximum value. +pub const SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP: SDL_GPUStencilOp = + SDL_GPUStencilOp::INCREMENT_AND_CLAMP; +/// Decrements the current value and clamps to 0. +pub const SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP: SDL_GPUStencilOp = + SDL_GPUStencilOp::DECREMENT_AND_CLAMP; +/// Bitwise-inverts the current value. +pub const SDL_GPU_STENCILOP_INVERT: SDL_GPUStencilOp = SDL_GPUStencilOp::INVERT; +/// Increments the current value and wraps back to 0. +pub const SDL_GPU_STENCILOP_INCREMENT_AND_WRAP: SDL_GPUStencilOp = + SDL_GPUStencilOp::INCREMENT_AND_WRAP; +/// Decrements the current value and wraps to the maximum value. +pub const SDL_GPU_STENCILOP_DECREMENT_AND_WRAP: SDL_GPUStencilOp = + SDL_GPUStencilOp::DECREMENT_AND_WRAP; + +impl SDL_GPUStencilOp { + /// Initialize a `SDL_GPUStencilOp` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUStencilOp { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUStencilOp { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUStencilOp; +} + +/// Specifies the operator to be used when pixels in a render target are +/// blended with existing pixels in the texture. +/// +/// The source color is the value written by the fragment shader. The +/// destination color is the value currently existing in the texture. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUBlendOp::INVALID) | [`SDL_GPU_BLENDOP_INVALID`] | | +/// | [`ADD`](SDL_GPUBlendOp::ADD) | [`SDL_GPU_BLENDOP_ADD`] | (source * source_factor) + (destination * destination_factor) | +/// | [`SUBTRACT`](SDL_GPUBlendOp::SUBTRACT) | [`SDL_GPU_BLENDOP_SUBTRACT`] | (source * source_factor) - (destination * destination_factor) | +/// | [`REVERSE_SUBTRACT`](SDL_GPUBlendOp::REVERSE_SUBTRACT) | [`SDL_GPU_BLENDOP_REVERSE_SUBTRACT`] | (destination * destination_factor) - (source * source_factor) | +/// | [`MIN`](SDL_GPUBlendOp::MIN) | [`SDL_GPU_BLENDOP_MIN`] | min(source, destination) | +/// | [`MAX`](SDL_GPUBlendOp::MAX) | [`SDL_GPU_BLENDOP_MAX`] | max(source, destination) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUBlendOp(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUBlendOp { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUBlendOp) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUBlendOp) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUBlendOp { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GPU_BLENDOP_INVALID", + Self::ADD => "SDL_GPU_BLENDOP_ADD", + Self::SUBTRACT => "SDL_GPU_BLENDOP_SUBTRACT", + Self::REVERSE_SUBTRACT => "SDL_GPU_BLENDOP_REVERSE_SUBTRACT", + Self::MIN => "SDL_GPU_BLENDOP_MIN", + Self::MAX => "SDL_GPU_BLENDOP_MAX", + + _ => return write!(f, "SDL_GPUBlendOp({})", self.0), + }) + } +} + +impl SDL_GPUBlendOp { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + /// (source * source_factor) + (destination * destination_factor) + pub const ADD: Self = Self((1 as ::core::ffi::c_int)); + /// (source * source_factor) - (destination * destination_factor) + pub const SUBTRACT: Self = Self((2 as ::core::ffi::c_int)); + /// (destination * destination_factor) - (source * source_factor) + pub const REVERSE_SUBTRACT: Self = Self((3 as ::core::ffi::c_int)); + /// min(source, destination) + pub const MIN: Self = Self((4 as ::core::ffi::c_int)); + /// max(source, destination) + pub const MAX: Self = Self((5 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_BLENDOP_INVALID: SDL_GPUBlendOp = SDL_GPUBlendOp::INVALID; +/// (source * source_factor) + (destination * destination_factor) +pub const SDL_GPU_BLENDOP_ADD: SDL_GPUBlendOp = SDL_GPUBlendOp::ADD; +/// (source * source_factor) - (destination * destination_factor) +pub const SDL_GPU_BLENDOP_SUBTRACT: SDL_GPUBlendOp = SDL_GPUBlendOp::SUBTRACT; +/// (destination * destination_factor) - (source * source_factor) +pub const SDL_GPU_BLENDOP_REVERSE_SUBTRACT: SDL_GPUBlendOp = SDL_GPUBlendOp::REVERSE_SUBTRACT; +/// min(source, destination) +pub const SDL_GPU_BLENDOP_MIN: SDL_GPUBlendOp = SDL_GPUBlendOp::MIN; +/// max(source, destination) +pub const SDL_GPU_BLENDOP_MAX: SDL_GPUBlendOp = SDL_GPUBlendOp::MAX; + +impl SDL_GPUBlendOp { + /// Initialize a `SDL_GPUBlendOp` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUBlendOp { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUBlendOp { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUBlendOp; +} + +/// Specifies a blending factor to be used when pixels in a render target are +/// blended with existing pixels in the texture. +/// +/// The source color is the value written by the fragment shader. The +/// destination color is the value currently existing in the texture. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_GPUBlendFactor::INVALID) | [`SDL_GPU_BLENDFACTOR_INVALID`] | | +/// | [`ZERO`](SDL_GPUBlendFactor::ZERO) | [`SDL_GPU_BLENDFACTOR_ZERO`] | 0 | +/// | [`ONE`](SDL_GPUBlendFactor::ONE) | [`SDL_GPU_BLENDFACTOR_ONE`] | 1 | +/// | [`SRC_COLOR`](SDL_GPUBlendFactor::SRC_COLOR) | [`SDL_GPU_BLENDFACTOR_SRC_COLOR`] | source color | +/// | [`ONE_MINUS_SRC_COLOR`](SDL_GPUBlendFactor::ONE_MINUS_SRC_COLOR) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR`] | 1 - source color | +/// | [`DST_COLOR`](SDL_GPUBlendFactor::DST_COLOR) | [`SDL_GPU_BLENDFACTOR_DST_COLOR`] | destination color | +/// | [`ONE_MINUS_DST_COLOR`](SDL_GPUBlendFactor::ONE_MINUS_DST_COLOR) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR`] | 1 - destination color | +/// | [`SRC_ALPHA`](SDL_GPUBlendFactor::SRC_ALPHA) | [`SDL_GPU_BLENDFACTOR_SRC_ALPHA`] | source alpha | +/// | [`ONE_MINUS_SRC_ALPHA`](SDL_GPUBlendFactor::ONE_MINUS_SRC_ALPHA) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA`] | 1 - source alpha | +/// | [`DST_ALPHA`](SDL_GPUBlendFactor::DST_ALPHA) | [`SDL_GPU_BLENDFACTOR_DST_ALPHA`] | destination alpha | +/// | [`ONE_MINUS_DST_ALPHA`](SDL_GPUBlendFactor::ONE_MINUS_DST_ALPHA) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA`] | 1 - destination alpha | +/// | [`CONSTANT_COLOR`](SDL_GPUBlendFactor::CONSTANT_COLOR) | [`SDL_GPU_BLENDFACTOR_CONSTANT_COLOR`] | blend constant | +/// | [`ONE_MINUS_CONSTANT_COLOR`](SDL_GPUBlendFactor::ONE_MINUS_CONSTANT_COLOR) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR`] | 1 - blend constant | +/// | [`SRC_ALPHA_SATURATE`](SDL_GPUBlendFactor::SRC_ALPHA_SATURATE) | [`SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE`] | min(source alpha, 1 - destination alpha) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUBlendFactor(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUBlendFactor { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUBlendFactor) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUBlendFactor) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUBlendFactor { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_GPU_BLENDFACTOR_INVALID", + Self::ZERO => "SDL_GPU_BLENDFACTOR_ZERO", + Self::ONE => "SDL_GPU_BLENDFACTOR_ONE", + Self::SRC_COLOR => "SDL_GPU_BLENDFACTOR_SRC_COLOR", + Self::ONE_MINUS_SRC_COLOR => "SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR", + Self::DST_COLOR => "SDL_GPU_BLENDFACTOR_DST_COLOR", + Self::ONE_MINUS_DST_COLOR => "SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR", + Self::SRC_ALPHA => "SDL_GPU_BLENDFACTOR_SRC_ALPHA", + Self::ONE_MINUS_SRC_ALPHA => "SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA", + Self::DST_ALPHA => "SDL_GPU_BLENDFACTOR_DST_ALPHA", + Self::ONE_MINUS_DST_ALPHA => "SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA", + Self::CONSTANT_COLOR => "SDL_GPU_BLENDFACTOR_CONSTANT_COLOR", + Self::ONE_MINUS_CONSTANT_COLOR => "SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR", + Self::SRC_ALPHA_SATURATE => "SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE", + + _ => return write!(f, "SDL_GPUBlendFactor({})", self.0), + }) + } +} + +impl SDL_GPUBlendFactor { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + /// 0 + pub const ZERO: Self = Self((1 as ::core::ffi::c_int)); + /// 1 + pub const ONE: Self = Self((2 as ::core::ffi::c_int)); + /// source color + pub const SRC_COLOR: Self = Self((3 as ::core::ffi::c_int)); + /// 1 - source color + pub const ONE_MINUS_SRC_COLOR: Self = Self((4 as ::core::ffi::c_int)); + /// destination color + pub const DST_COLOR: Self = Self((5 as ::core::ffi::c_int)); + /// 1 - destination color + pub const ONE_MINUS_DST_COLOR: Self = Self((6 as ::core::ffi::c_int)); + /// source alpha + pub const SRC_ALPHA: Self = Self((7 as ::core::ffi::c_int)); + /// 1 - source alpha + pub const ONE_MINUS_SRC_ALPHA: Self = Self((8 as ::core::ffi::c_int)); + /// destination alpha + pub const DST_ALPHA: Self = Self((9 as ::core::ffi::c_int)); + /// 1 - destination alpha + pub const ONE_MINUS_DST_ALPHA: Self = Self((10 as ::core::ffi::c_int)); + /// blend constant + pub const CONSTANT_COLOR: Self = Self((11 as ::core::ffi::c_int)); + /// 1 - blend constant + pub const ONE_MINUS_CONSTANT_COLOR: Self = Self((12 as ::core::ffi::c_int)); + /// min(source alpha, 1 - destination alpha) + pub const SRC_ALPHA_SATURATE: Self = Self((13 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_BLENDFACTOR_INVALID: SDL_GPUBlendFactor = SDL_GPUBlendFactor::INVALID; +/// 0 +pub const SDL_GPU_BLENDFACTOR_ZERO: SDL_GPUBlendFactor = SDL_GPUBlendFactor::ZERO; +/// 1 +pub const SDL_GPU_BLENDFACTOR_ONE: SDL_GPUBlendFactor = SDL_GPUBlendFactor::ONE; +/// source color +pub const SDL_GPU_BLENDFACTOR_SRC_COLOR: SDL_GPUBlendFactor = SDL_GPUBlendFactor::SRC_COLOR; +/// 1 - source color +pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::ONE_MINUS_SRC_COLOR; +/// destination color +pub const SDL_GPU_BLENDFACTOR_DST_COLOR: SDL_GPUBlendFactor = SDL_GPUBlendFactor::DST_COLOR; +/// 1 - destination color +pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::ONE_MINUS_DST_COLOR; +/// source alpha +pub const SDL_GPU_BLENDFACTOR_SRC_ALPHA: SDL_GPUBlendFactor = SDL_GPUBlendFactor::SRC_ALPHA; +/// 1 - source alpha +pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::ONE_MINUS_SRC_ALPHA; +/// destination alpha +pub const SDL_GPU_BLENDFACTOR_DST_ALPHA: SDL_GPUBlendFactor = SDL_GPUBlendFactor::DST_ALPHA; +/// 1 - destination alpha +pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::ONE_MINUS_DST_ALPHA; +/// blend constant +pub const SDL_GPU_BLENDFACTOR_CONSTANT_COLOR: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::CONSTANT_COLOR; +/// 1 - blend constant +pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::ONE_MINUS_CONSTANT_COLOR; +/// min(source alpha, 1 - destination alpha) +pub const SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE: SDL_GPUBlendFactor = + SDL_GPUBlendFactor::SRC_ALPHA_SATURATE; + +impl SDL_GPUBlendFactor { + /// Initialize a `SDL_GPUBlendFactor` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUBlendFactor { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUBlendFactor { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUBlendFactor; +} + +/// Specifies which color components are written in a graphics pipeline. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`R`](SDL_GPUColorComponentFlags::R) | [`SDL_GPU_COLORCOMPONENT_R`] | the red component | +/// | [`G`](SDL_GPUColorComponentFlags::G) | [`SDL_GPU_COLORCOMPONENT_G`] | the green component | +/// | [`B`](SDL_GPUColorComponentFlags::B) | [`SDL_GPU_COLORCOMPONENT_B`] | the blue component | +/// | [`A`](SDL_GPUColorComponentFlags::A) | [`SDL_GPU_COLORCOMPONENT_A`] | the alpha component | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GPUColorComponentFlags(pub Uint8); + +impl ::core::cmp::PartialEq for SDL_GPUColorComponentFlags { + #[inline(always)] + fn eq(&self, other: &Uint8) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint8 { + #[inline(always)] + fn eq(&self, other: &SDL_GPUColorComponentFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint8 { + #[inline(always)] + fn from(value: SDL_GPUColorComponentFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUColorComponentFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GPUColorComponentFlags(")?; + let all_bits = all_bits | Self::R.0; + if (Self::R != 0 || self.0 == 0) && *self & Self::R == Self::R { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "R")?; + } + let all_bits = all_bits | Self::G.0; + if (Self::G != 0 || self.0 == 0) && *self & Self::G == Self::G { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "G")?; + } + let all_bits = all_bits | Self::B.0; + if (Self::B != 0 || self.0 == 0) && *self & Self::B == Self::B { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "B")?; + } + let all_bits = all_bits | Self::A.0; + if (Self::A != 0 || self.0 == 0) && *self & Self::A == Self::A { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "A")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GPUColorComponentFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GPUColorComponentFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GPUColorComponentFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GPUColorComponentFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GPUColorComponentFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GPUColorComponentFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GPUColorComponentFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GPUColorComponentFlags { + /// the red component + pub const R: Self = Self((1_u32 as Uint8)); + /// the green component + pub const G: Self = Self((2_u32 as Uint8)); + /// the blue component + pub const B: Self = Self((4_u32 as Uint8)); + /// the alpha component + pub const A: Self = Self((8_u32 as Uint8)); +} + +/// the red component +pub const SDL_GPU_COLORCOMPONENT_R: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::R; +/// the green component +pub const SDL_GPU_COLORCOMPONENT_G: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::G; +/// the blue component +pub const SDL_GPU_COLORCOMPONENT_B: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::B; +/// the alpha component +pub const SDL_GPU_COLORCOMPONENT_A: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::A; + +impl SDL_GPUColorComponentFlags { + /// Initialize a `SDL_GPUColorComponentFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint8) -> Self { + Self(value) + } +} + +impl SDL_GPUColorComponentFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint8 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUColorComponentFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUColorComponentFlags; +} + +/// Specifies a filter operation used by a sampler. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUSampler`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NEAREST`](SDL_GPUFilter::NEAREST) | [`SDL_GPU_FILTER_NEAREST`] | Point filtering. | +/// | [`LINEAR`](SDL_GPUFilter::LINEAR) | [`SDL_GPU_FILTER_LINEAR`] | Linear filtering. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUFilter(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUFilter { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUFilter) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUFilter) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUFilter { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NEAREST => "SDL_GPU_FILTER_NEAREST", + Self::LINEAR => "SDL_GPU_FILTER_LINEAR", + + _ => return write!(f, "SDL_GPUFilter({})", self.0), + }) + } +} + +impl SDL_GPUFilter { + /// Point filtering. + pub const NEAREST: Self = Self((0 as ::core::ffi::c_int)); + /// Linear filtering. + pub const LINEAR: Self = Self((1 as ::core::ffi::c_int)); +} + +/// Point filtering. +pub const SDL_GPU_FILTER_NEAREST: SDL_GPUFilter = SDL_GPUFilter::NEAREST; +/// Linear filtering. +pub const SDL_GPU_FILTER_LINEAR: SDL_GPUFilter = SDL_GPUFilter::LINEAR; + +impl SDL_GPUFilter { + /// Initialize a `SDL_GPUFilter` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUFilter { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUFilter { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUFilter; +} + +/// Specifies a mipmap mode used by a sampler. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUSampler`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NEAREST`](SDL_GPUSamplerMipmapMode::NEAREST) | [`SDL_GPU_SAMPLERMIPMAPMODE_NEAREST`] | Point filtering. | +/// | [`LINEAR`](SDL_GPUSamplerMipmapMode::LINEAR) | [`SDL_GPU_SAMPLERMIPMAPMODE_LINEAR`] | Linear filtering. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUSamplerMipmapMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSamplerMipmapMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUSamplerMipmapMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUSamplerMipmapMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUSamplerMipmapMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NEAREST => "SDL_GPU_SAMPLERMIPMAPMODE_NEAREST", + Self::LINEAR => "SDL_GPU_SAMPLERMIPMAPMODE_LINEAR", + + _ => return write!(f, "SDL_GPUSamplerMipmapMode({})", self.0), + }) + } +} + +impl SDL_GPUSamplerMipmapMode { + /// Point filtering. + pub const NEAREST: Self = Self((0 as ::core::ffi::c_int)); + /// Linear filtering. + pub const LINEAR: Self = Self((1 as ::core::ffi::c_int)); +} + +/// Point filtering. +pub const SDL_GPU_SAMPLERMIPMAPMODE_NEAREST: SDL_GPUSamplerMipmapMode = + SDL_GPUSamplerMipmapMode::NEAREST; +/// Linear filtering. +pub const SDL_GPU_SAMPLERMIPMAPMODE_LINEAR: SDL_GPUSamplerMipmapMode = + SDL_GPUSamplerMipmapMode::LINEAR; + +impl SDL_GPUSamplerMipmapMode { + /// Initialize a `SDL_GPUSamplerMipmapMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUSamplerMipmapMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSamplerMipmapMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUSamplerMipmapMode; +} + +/// Specifies behavior of texture sampling when the coordinates exceed the 0-1 +/// range. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUSampler`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`REPEAT`](SDL_GPUSamplerAddressMode::REPEAT) | [`SDL_GPU_SAMPLERADDRESSMODE_REPEAT`] | Specifies that the coordinates will wrap around. | +/// | [`MIRRORED_REPEAT`](SDL_GPUSamplerAddressMode::MIRRORED_REPEAT) | [`SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT`] | Specifies that the coordinates will wrap around mirrored. | +/// | [`CLAMP_TO_EDGE`](SDL_GPUSamplerAddressMode::CLAMP_TO_EDGE) | [`SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE`] | Specifies that the coordinates will clamp to the 0-1 range. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUSamplerAddressMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSamplerAddressMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUSamplerAddressMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUSamplerAddressMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUSamplerAddressMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::REPEAT => "SDL_GPU_SAMPLERADDRESSMODE_REPEAT", + Self::MIRRORED_REPEAT => "SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT", + Self::CLAMP_TO_EDGE => "SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE", + + _ => return write!(f, "SDL_GPUSamplerAddressMode({})", self.0), + }) + } +} + +impl SDL_GPUSamplerAddressMode { + /// Specifies that the coordinates will wrap around. + pub const REPEAT: Self = Self((0 as ::core::ffi::c_int)); + /// Specifies that the coordinates will wrap around mirrored. + pub const MIRRORED_REPEAT: Self = Self((1 as ::core::ffi::c_int)); + /// Specifies that the coordinates will clamp to the 0-1 range. + pub const CLAMP_TO_EDGE: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Specifies that the coordinates will wrap around. +pub const SDL_GPU_SAMPLERADDRESSMODE_REPEAT: SDL_GPUSamplerAddressMode = + SDL_GPUSamplerAddressMode::REPEAT; +/// Specifies that the coordinates will wrap around mirrored. +pub const SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT: SDL_GPUSamplerAddressMode = + SDL_GPUSamplerAddressMode::MIRRORED_REPEAT; +/// Specifies that the coordinates will clamp to the 0-1 range. +pub const SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE: SDL_GPUSamplerAddressMode = + SDL_GPUSamplerAddressMode::CLAMP_TO_EDGE; + +impl SDL_GPUSamplerAddressMode { + /// Initialize a `SDL_GPUSamplerAddressMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUSamplerAddressMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSamplerAddressMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUSamplerAddressMode; +} + +/// Specifies the timing that will be used to present swapchain textures to the +/// OS. +/// +/// VSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be +/// supported on certain systems. +/// +/// It is recommended to query [`SDL_WindowSupportsGPUPresentMode`] after claiming +/// the window if you wish to change the present mode to IMMEDIATE or MAILBOX. +/// +/// - VSYNC: Waits for vblank before presenting. No tearing is possible. If +/// there is a pending image to present, the new image is enqueued for +/// presentation. Disallows tearing at the cost of visual latency. +/// - IMMEDIATE: Immediately presents. Lowest latency option, but tearing may +/// occur. +/// - MAILBOX: Waits for vblank before presenting. No tearing is possible. If +/// there is a pending image to present, the pending image is replaced by the +/// new image. Similar to VSYNC, but with reduced visual latency. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetGPUSwapchainParameters`] +/// - [`SDL_WindowSupportsGPUPresentMode`] +/// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`VSYNC`](SDL_GPUPresentMode::VSYNC) | [`SDL_GPU_PRESENTMODE_VSYNC`] | | +/// | [`IMMEDIATE`](SDL_GPUPresentMode::IMMEDIATE) | [`SDL_GPU_PRESENTMODE_IMMEDIATE`] | | +/// | [`MAILBOX`](SDL_GPUPresentMode::MAILBOX) | [`SDL_GPU_PRESENTMODE_MAILBOX`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUPresentMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUPresentMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUPresentMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUPresentMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUPresentMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::VSYNC => "SDL_GPU_PRESENTMODE_VSYNC", + Self::IMMEDIATE => "SDL_GPU_PRESENTMODE_IMMEDIATE", + Self::MAILBOX => "SDL_GPU_PRESENTMODE_MAILBOX", + + _ => return write!(f, "SDL_GPUPresentMode({})", self.0), + }) + } +} + +impl SDL_GPUPresentMode { + pub const VSYNC: Self = Self((0 as ::core::ffi::c_int)); + pub const IMMEDIATE: Self = Self((1 as ::core::ffi::c_int)); + pub const MAILBOX: Self = Self((2 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_PRESENTMODE_VSYNC: SDL_GPUPresentMode = SDL_GPUPresentMode::VSYNC; +pub const SDL_GPU_PRESENTMODE_IMMEDIATE: SDL_GPUPresentMode = SDL_GPUPresentMode::IMMEDIATE; +pub const SDL_GPU_PRESENTMODE_MAILBOX: SDL_GPUPresentMode = SDL_GPUPresentMode::MAILBOX; + +impl SDL_GPUPresentMode { + /// Initialize a `SDL_GPUPresentMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUPresentMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUPresentMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUPresentMode; +} + +/// Specifies the texture format and colorspace of the swapchain textures. +/// +/// SDR will always be supported. Other compositions may not be supported on +/// certain systems. +/// +/// It is recommended to query [`SDL_WindowSupportsGPUSwapchainComposition`] after +/// claiming the window if you wish to change the swapchain composition from +/// SDR. +/// +/// - SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in sRGB encoding. +/// - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are +/// stored in memory in sRGB encoding but accessed in shaders in "linear +/// sRGB" encoding which is sRGB but with a linear transfer function. +/// - HDR_EXTENDED_LINEAR: R16G16B16A16_FLOAT swapchain. Pixel values are in +/// extended linear sRGB encoding and permits values outside of the \[0, 1\] +/// range. +/// - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in +/// BT.2020 ST2084 (PQ) encoding. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetGPUSwapchainParameters`] +/// - [`SDL_WindowSupportsGPUSwapchainComposition`] +/// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`SDR`](SDL_GPUSwapchainComposition::SDR) | [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR`] | | +/// | [`SDR_LINEAR`](SDL_GPUSwapchainComposition::SDR_LINEAR) | [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR`] | | +/// | [`HDR_EXTENDED_LINEAR`](SDL_GPUSwapchainComposition::HDR_EXTENDED_LINEAR) | [`SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR`] | | +/// | [`HDR10_ST2084`](SDL_GPUSwapchainComposition::HDR10_ST2084) | [`SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GPUSwapchainComposition(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSwapchainComposition { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GPUSwapchainComposition) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GPUSwapchainComposition) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GPUSwapchainComposition { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::SDR => "SDL_GPU_SWAPCHAINCOMPOSITION_SDR", + Self::SDR_LINEAR => "SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR", + Self::HDR_EXTENDED_LINEAR => "SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR", + Self::HDR10_ST2084 => "SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084", + + _ => return write!(f, "SDL_GPUSwapchainComposition({})", self.0), + }) + } +} + +impl SDL_GPUSwapchainComposition { + pub const SDR: Self = Self((0 as ::core::ffi::c_int)); + pub const SDR_LINEAR: Self = Self((1 as ::core::ffi::c_int)); + pub const HDR_EXTENDED_LINEAR: Self = Self((2 as ::core::ffi::c_int)); + pub const HDR10_ST2084: Self = Self((3 as ::core::ffi::c_int)); +} + +pub const SDL_GPU_SWAPCHAINCOMPOSITION_SDR: SDL_GPUSwapchainComposition = + SDL_GPUSwapchainComposition::SDR; +pub const SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR: SDL_GPUSwapchainComposition = + SDL_GPUSwapchainComposition::SDR_LINEAR; +pub const SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR: SDL_GPUSwapchainComposition = + SDL_GPUSwapchainComposition::HDR_EXTENDED_LINEAR; +pub const SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084: SDL_GPUSwapchainComposition = + SDL_GPUSwapchainComposition::HDR10_ST2084; + +impl SDL_GPUSwapchainComposition { + /// Initialize a `SDL_GPUSwapchainComposition` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GPUSwapchainComposition { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSwapchainComposition { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::gpu::METADATA_SDL_GPUSwapchainComposition; +} + +/// A structure specifying a viewport. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetGPUViewport`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUViewport { + /// The left offset of the viewport. + pub x: ::core::ffi::c_float, + /// The top offset of the viewport. + pub y: ::core::ffi::c_float, + /// The width of the viewport. + pub w: ::core::ffi::c_float, + /// The height of the viewport. + pub h: ::core::ffi::c_float, + /// The minimum depth of the viewport. + pub min_depth: ::core::ffi::c_float, + /// The maximum depth of the viewport. + pub max_depth: ::core::ffi::c_float, +} + +/// A structure specifying parameters related to transferring data to or from a +/// texture. +/// +/// If either of `pixels_per_row` or `rows_per_layer` is zero, then width and +/// height of passed [`SDL_GPUTextureRegion`] to [`SDL_UploadToGPUTexture`] or +/// [`SDL_DownloadFromGPUTexture`] are used as default values respectively and data +/// is considered to be tightly packed. +/// +/// **WARNING**: On some older/integrated hardware, Direct3D 12 requires +/// texture data row pitch to be 256 byte aligned, and offsets to be aligned to +/// 512 bytes. If they are not, SDL will make a temporary copy of the data that +/// is properly aligned, but this adds overhead to the transfer process. Apps +/// can avoid this by aligning their data appropriately, or using a different +/// GPU backend than Direct3D 12. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_UploadToGPUTexture`] +/// - [`SDL_DownloadFromGPUTexture`] +/// - [`SDL_GPUTransferBuffer`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTextureTransferInfo { + /// The transfer buffer used in the transfer operation. + pub transfer_buffer: *mut SDL_GPUTransferBuffer, + /// The starting byte of the image data in the transfer buffer. + pub offset: Uint32, + /// The number of pixels from one row to the next. + pub pixels_per_row: Uint32, + /// The number of rows from one layer/depth-slice to the next. + pub rows_per_layer: Uint32, +} + +impl ::core::default::Default for SDL_GPUTextureTransferInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying a location in a transfer buffer. +/// +/// Used when transferring buffer data to or from a transfer buffer. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_UploadToGPUBuffer`] +/// - [`SDL_DownloadFromGPUBuffer`] +/// - [`SDL_GPUTransferBuffer`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTransferBufferLocation { + /// The transfer buffer used in the transfer operation. + pub transfer_buffer: *mut SDL_GPUTransferBuffer, + /// The starting byte of the buffer data in the transfer buffer. + pub offset: Uint32, +} + +impl ::core::default::Default for SDL_GPUTransferBufferLocation { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying a location in a texture. +/// +/// Used when copying data from one texture to another. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CopyGPUTextureToTexture`] +/// - [`SDL_GPUTexture`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTextureLocation { + /// The texture used in the copy operation. + pub texture: *mut SDL_GPUTexture, + /// The mip level index of the location. + pub mip_level: Uint32, + /// The layer index of the location. + pub layer: Uint32, + /// The left offset of the location. + pub x: Uint32, + /// The top offset of the location. + pub y: Uint32, + /// The front offset of the location. + pub z: Uint32, +} + +impl ::core::default::Default for SDL_GPUTextureLocation { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying a region of a texture. +/// +/// Used when transferring data to or from a texture. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_UploadToGPUTexture`] +/// - [`SDL_DownloadFromGPUTexture`] +/// - [`SDL_CreateGPUTexture`] +/// - [`SDL_GPUTexture`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTextureRegion { + /// The texture used in the copy operation. + pub texture: *mut SDL_GPUTexture, + /// The mip level index to transfer. + pub mip_level: Uint32, + /// The layer index to transfer. + pub layer: Uint32, + /// The left offset of the region. + pub x: Uint32, + /// The top offset of the region. + pub y: Uint32, + /// The front offset of the region. + pub z: Uint32, + /// The width of the region. + pub w: Uint32, + /// The height of the region. + pub h: Uint32, + /// The depth of the region. + pub d: Uint32, +} + +impl ::core::default::Default for SDL_GPUTextureRegion { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying a region of a texture used in the blit operation. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BlitGPUTexture`] +/// - [`SDL_GPUTexture`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUBlitRegion { + /// The texture. + pub texture: *mut SDL_GPUTexture, + /// The mip level index of the region. + pub mip_level: Uint32, + /// The layer index or depth plane of the region. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. + pub layer_or_depth_plane: Uint32, + /// The left offset of the region. + pub x: Uint32, + /// The top offset of the region. + pub y: Uint32, + /// The width of the region. + pub w: Uint32, + /// The height of the region. + pub h: Uint32, +} + +impl ::core::default::Default for SDL_GPUBlitRegion { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying a location in a buffer. +/// +/// Used when copying data between buffers. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CopyGPUBufferToBuffer`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUBufferLocation { + /// The buffer. + pub buffer: *mut SDL_GPUBuffer, + /// The starting byte within the buffer. + pub offset: Uint32, +} + +impl ::core::default::Default for SDL_GPUBufferLocation { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying a region of a buffer. +/// +/// Used when transferring data to or from buffers. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_UploadToGPUBuffer`] +/// - [`SDL_DownloadFromGPUBuffer`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUBufferRegion { + /// The buffer. + pub buffer: *mut SDL_GPUBuffer, + /// The starting byte within the buffer. + pub offset: Uint32, + /// The size in bytes of the region. + pub size: Uint32, +} + +impl ::core::default::Default for SDL_GPUBufferRegion { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the parameters of an indirect draw command. +/// +/// Note that the `first_vertex` and `first_instance` parameters are NOT +/// compatible with built-in vertex/instance ID variables in shaders (for +/// example, SV_VertexID); GPU APIs and shader languages do not define these +/// built-in variables consistently, so if your shader depends on them, the +/// only way to keep behavior consistent and portable is to always pass 0 for +/// the correlating parameter in the draw calls. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_DrawGPUPrimitivesIndirect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUIndirectDrawCommand { + /// The number of vertices to draw. + pub num_vertices: Uint32, + /// The number of instances to draw. + pub num_instances: Uint32, + /// The index of the first vertex to draw. + pub first_vertex: Uint32, + /// The ID of the first instance to draw. + pub first_instance: Uint32, +} + +/// A structure specifying the parameters of an indexed indirect draw command. +/// +/// Note that the `first_vertex` and `first_instance` parameters are NOT +/// compatible with built-in vertex/instance ID variables in shaders (for +/// example, SV_VertexID); GPU APIs and shader languages do not define these +/// built-in variables consistently, so if your shader depends on them, the +/// only way to keep behavior consistent and portable is to always pass 0 for +/// the correlating parameter in the draw calls. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_DrawGPUIndexedPrimitivesIndirect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUIndexedIndirectDrawCommand { + /// The number of indices to draw per instance. + pub num_indices: Uint32, + /// The number of instances to draw. + pub num_instances: Uint32, + /// The base index within the index buffer. + pub first_index: Uint32, + /// The value added to the vertex index before indexing into the vertex buffer. + pub vertex_offset: Sint32, + /// The ID of the first instance to draw. + pub first_instance: Uint32, +} + +/// A structure specifying the parameters of an indexed dispatch command. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_DispatchGPUComputeIndirect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUIndirectDispatchCommand { + /// The number of local workgroups to dispatch in the X dimension. + pub groupcount_x: Uint32, + /// The number of local workgroups to dispatch in the Y dimension. + pub groupcount_y: Uint32, + /// The number of local workgroups to dispatch in the Z dimension. + pub groupcount_z: Uint32, +} + +/// A structure specifying the parameters of a sampler. +/// +/// Note that mip_lod_bias is a no-op for the Metal driver. For Metal, LOD bias +/// must be applied via shader instead. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUSampler`] +/// - [`SDL_GPUFilter`] +/// - [`SDL_GPUSamplerMipmapMode`] +/// - [`SDL_GPUSamplerAddressMode`] +/// - [`SDL_GPUCompareOp`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUSamplerCreateInfo { + /// The minification filter to apply to lookups. + pub min_filter: SDL_GPUFilter, + /// The magnification filter to apply to lookups. + pub mag_filter: SDL_GPUFilter, + /// The mipmap filter to apply to lookups. + pub mipmap_mode: SDL_GPUSamplerMipmapMode, + /// The addressing mode for U coordinates outside [0, 1). + pub address_mode_u: SDL_GPUSamplerAddressMode, + /// The addressing mode for V coordinates outside [0, 1). + pub address_mode_v: SDL_GPUSamplerAddressMode, + /// The addressing mode for W coordinates outside [0, 1). + pub address_mode_w: SDL_GPUSamplerAddressMode, + /// The bias to be added to mipmap LOD calculation. + pub mip_lod_bias: ::core::ffi::c_float, + /// The anisotropy value clamp used by the sampler. If enable_anisotropy is false, this is ignored. + pub max_anisotropy: ::core::ffi::c_float, + /// The comparison operator to apply to fetched data before filtering. + pub compare_op: SDL_GPUCompareOp, + /// Clamps the minimum of the computed LOD value. + pub min_lod: ::core::ffi::c_float, + /// Clamps the maximum of the computed LOD value. + pub max_lod: ::core::ffi::c_float, + /// true to enable anisotropic filtering. + pub enable_anisotropy: ::core::primitive::bool, + /// true to enable comparison against a reference value during lookups. + pub enable_compare: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +/// A structure specifying the parameters of vertex buffers used in a graphics +/// pipeline. +/// +/// When you call [`SDL_BindGPUVertexBuffers`], you specify the binding slots of +/// the vertex buffers. For example if you called [`SDL_BindGPUVertexBuffers`] with +/// a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be +/// used by the vertex buffers you pass in. +/// +/// Vertex attributes are linked to buffers via the buffer_slot field of +/// [`SDL_GPUVertexAttribute`]. For example, if an attribute has a buffer_slot of +/// 0, then that attribute belongs to the vertex buffer bound at slot 0. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUVertexAttribute`] +/// - [`SDL_GPUVertexInputRate`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUVertexBufferDescription { + /// The binding slot of the vertex buffer. + pub slot: Uint32, + /// The size of a single element + the offset between elements. + pub pitch: Uint32, + /// Whether attribute addressing is a function of the vertex index or instance index. + pub input_rate: SDL_GPUVertexInputRate, + /// Reserved for future use. Must be set to 0. + pub instance_step_rate: Uint32, +} + +/// A structure specifying a vertex attribute. +/// +/// All vertex attribute locations provided to an [`SDL_GPUVertexInputState`] must +/// be unique. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUVertexBufferDescription`] +/// - [`SDL_GPUVertexInputState`] +/// - [`SDL_GPUVertexElementFormat`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUVertexAttribute { + /// The shader input location index. + pub location: Uint32, + /// The binding slot of the associated vertex buffer. + pub buffer_slot: Uint32, + /// The size and type of the attribute data. + pub format: SDL_GPUVertexElementFormat, + /// The byte offset of this attribute relative to the start of the vertex element. + pub offset: Uint32, +} + +/// A structure specifying the parameters of a graphics pipeline vertex input +/// state. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUGraphicsPipelineCreateInfo`] +/// - [`SDL_GPUVertexBufferDescription`] +/// - [`SDL_GPUVertexAttribute`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUVertexInputState { + /// A pointer to an array of vertex buffer descriptions. + pub vertex_buffer_descriptions: *const SDL_GPUVertexBufferDescription, + /// The number of vertex buffer descriptions in the above array. + pub num_vertex_buffers: Uint32, + /// A pointer to an array of vertex attribute descriptions. + pub vertex_attributes: *const SDL_GPUVertexAttribute, + /// The number of vertex attribute descriptions in the above array. + pub num_vertex_attributes: Uint32, +} + +impl ::core::default::Default for SDL_GPUVertexInputState { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the stencil operation state of a graphics pipeline. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUDepthStencilState`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUStencilOpState { + /// The action performed on samples that fail the stencil test. + pub fail_op: SDL_GPUStencilOp, + /// The action performed on samples that pass the depth and stencil tests. + pub pass_op: SDL_GPUStencilOp, + /// The action performed on samples that pass the stencil test and fail the depth test. + pub depth_fail_op: SDL_GPUStencilOp, + /// The comparison operator used in the stencil test. + pub compare_op: SDL_GPUCompareOp, +} + +/// A structure specifying the blend state of a color target. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetGPUBlendConstants`] +/// - [`SDL_GPUColorTargetDescription`] +/// - [`SDL_GPUBlendFactor`] +/// - [`SDL_GPUBlendOp`] +/// - [`SDL_GPUColorComponentFlags`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUColorTargetBlendState { + /// The value to be multiplied by the source RGB value. + pub src_color_blendfactor: SDL_GPUBlendFactor, + /// The value to be multiplied by the destination RGB value. + pub dst_color_blendfactor: SDL_GPUBlendFactor, + /// The blend operation for the RGB components. + pub color_blend_op: SDL_GPUBlendOp, + /// The value to be multiplied by the source alpha. + pub src_alpha_blendfactor: SDL_GPUBlendFactor, + /// The value to be multiplied by the destination alpha. + pub dst_alpha_blendfactor: SDL_GPUBlendFactor, + /// The blend operation for the alpha component. + pub alpha_blend_op: SDL_GPUBlendOp, + /// A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false. + pub color_write_mask: SDL_GPUColorComponentFlags, + /// Whether blending is enabled for the color target. + pub enable_blend: ::core::primitive::bool, + /// Whether the color write mask is enabled. + pub enable_color_write_mask: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, +} + +/// A structure specifying code and metadata for creating a shader object. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUShader`] +/// - [`SDL_GPUShaderFormat`] +/// - [`SDL_GPUShaderStage`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUShaderCreateInfo { + /// The size in bytes of the code pointed to. + pub code_size: ::core::primitive::usize, + /// A pointer to shader code. + pub code: *const Uint8, + /// A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. + pub entrypoint: *const ::core::ffi::c_char, + /// The format of the shader code. + pub format: SDL_GPUShaderFormat, + /// The stage the shader program corresponds to. + pub stage: SDL_GPUShaderStage, + /// The number of samplers defined in the shader. + pub num_samplers: Uint32, + /// The number of storage textures defined in the shader. + pub num_storage_textures: Uint32, + /// The number of storage buffers defined in the shader. + pub num_storage_buffers: Uint32, + /// The number of uniform buffers defined in the shader. + pub num_uniform_buffers: Uint32, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +impl ::core::default::Default for SDL_GPUShaderCreateInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the parameters of a texture. +/// +/// Usage flags can be bitwise OR'd together for combinations of usages. Note +/// that certain usage combinations are invalid, for example SAMPLER and +/// GRAPHICS_STORAGE. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTexture`] +/// - [`SDL_GPUTextureType`] +/// - [`SDL_GPUTextureFormat`] +/// - [`SDL_GPUTextureUsageFlags`] +/// - [`SDL_GPUSampleCount`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTextureCreateInfo { + /// The base dimensionality of the texture. + pub r#type: SDL_GPUTextureType, + /// The pixel format of the texture. + pub format: SDL_GPUTextureFormat, + /// How the texture is intended to be used by the client. + pub usage: SDL_GPUTextureUsageFlags, + /// The width of the texture. + pub width: Uint32, + /// The height of the texture. + pub height: Uint32, + /// The layer count or depth of the texture. This value is treated as a layer count on 2D array textures, and as a depth value on 3D textures. + pub layer_count_or_depth: Uint32, + /// The number of mip levels in the texture. + pub num_levels: Uint32, + /// The number of samples per texel. Only applies if the texture is used as a render target. + pub sample_count: SDL_GPUSampleCount, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +/// A structure specifying the parameters of a buffer. +/// +/// Usage flags can be bitwise OR'd together for combinations of usages. Note +/// that certain combinations are invalid, for example VERTEX and INDEX. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUBuffer`] +/// - [`SDL_GPUBufferUsageFlags`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUBufferCreateInfo { + /// How the buffer is intended to be used by the client. + pub usage: SDL_GPUBufferUsageFlags, + /// The size in bytes of the buffer. + pub size: Uint32, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +/// A structure specifying the parameters of a transfer buffer. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTransferBuffer`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTransferBufferCreateInfo { + /// How the transfer buffer is intended to be used by the client. + pub usage: SDL_GPUTransferBufferUsage, + /// The size in bytes of the transfer buffer. + pub size: Uint32, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +/// A structure specifying the parameters of the graphics pipeline rasterizer +/// state. +/// +/// Note that [`SDL_GPU_FILLMODE_LINE`] is not supported on many Android devices. +/// For those devices, the fill mode will automatically fall back to FILL. +/// +/// Also note that the D3D12 driver will enable depth clamping even if +/// enable_depth_clip is true. If you need this clamp+clip behavior, consider +/// enabling depth clip and then manually clamping depth in your fragment +/// shaders on Metal and Vulkan. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUGraphicsPipelineCreateInfo`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPURasterizerState { + /// Whether polygons will be filled in or drawn as lines. + pub fill_mode: SDL_GPUFillMode, + /// The facing direction in which triangles will be culled. + pub cull_mode: SDL_GPUCullMode, + /// The vertex winding that will cause a triangle to be determined as front-facing. + pub front_face: SDL_GPUFrontFace, + /// A scalar factor controlling the depth value added to each fragment. + pub depth_bias_constant_factor: ::core::ffi::c_float, + /// The maximum depth bias of a fragment. + pub depth_bias_clamp: ::core::ffi::c_float, + /// A scalar factor applied to a fragment's slope in depth calculations. + pub depth_bias_slope_factor: ::core::ffi::c_float, + /// true to bias fragment depth values. + pub enable_depth_bias: ::core::primitive::bool, + /// true to enable depth clip, false to enable depth clamp. + pub enable_depth_clip: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, +} + +/// A structure specifying the parameters of the graphics pipeline multisample +/// state. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUGraphicsPipelineCreateInfo`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUMultisampleState { + /// The number of samples to be used in rasterization. + pub sample_count: SDL_GPUSampleCount, + /// Reserved for future use. Must be set to 0. + pub sample_mask: Uint32, + /// Reserved for future use. Must be set to false. + pub enable_mask: ::core::primitive::bool, + /// true enables the alpha-to-coverage feature. + pub enable_alpha_to_coverage: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, +} + +/// A structure specifying the parameters of the graphics pipeline depth +/// stencil state. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUGraphicsPipelineCreateInfo`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUDepthStencilState { + /// The comparison operator used for depth testing. + pub compare_op: SDL_GPUCompareOp, + /// The stencil op state for back-facing triangles. + pub back_stencil_state: SDL_GPUStencilOpState, + /// The stencil op state for front-facing triangles. + pub front_stencil_state: SDL_GPUStencilOpState, + /// Selects the bits of the stencil values participating in the stencil test. + pub compare_mask: Uint8, + /// Selects the bits of the stencil values updated by the stencil test. + pub write_mask: Uint8, + /// true enables the depth test. + pub enable_depth_test: ::core::primitive::bool, + /// true enables depth writes. Depth writes are always disabled when enable_depth_test is false. + pub enable_depth_write: ::core::primitive::bool, + /// true enables the stencil test. + pub enable_stencil_test: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, +} + +/// A structure specifying the parameters of color targets used in a graphics +/// pipeline. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUGraphicsPipelineTargetInfo`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUColorTargetDescription { + /// The pixel format of the texture to be used as a color target. + pub format: SDL_GPUTextureFormat, + /// The blend state to be used for the color target. + pub blend_state: SDL_GPUColorTargetBlendState, +} + +/// A structure specifying the descriptions of render targets used in a +/// graphics pipeline. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GPUGraphicsPipelineCreateInfo`] +/// - [`SDL_GPUColorTargetDescription`] +/// - [`SDL_GPUTextureFormat`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUGraphicsPipelineTargetInfo { + /// A pointer to an array of color target descriptions. + pub color_target_descriptions: *const SDL_GPUColorTargetDescription, + /// The number of color target descriptions in the above array. + pub num_color_targets: Uint32, + /// The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. + pub depth_stencil_format: SDL_GPUTextureFormat, + /// true specifies that the pipeline uses a depth-stencil target. + pub has_depth_stencil_target: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, +} + +impl ::core::default::Default for SDL_GPUGraphicsPipelineTargetInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the parameters of a graphics pipeline state. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// - [`SDL_GPUShader`] +/// - [`SDL_GPUVertexInputState`] +/// - [`SDL_GPUPrimitiveType`] +/// - [`SDL_GPURasterizerState`] +/// - [`SDL_GPUMultisampleState`] +/// - [`SDL_GPUDepthStencilState`] +/// - [`SDL_GPUGraphicsPipelineTargetInfo`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUGraphicsPipelineCreateInfo { + /// The vertex shader used by the graphics pipeline. + pub vertex_shader: *mut SDL_GPUShader, + /// The fragment shader used by the graphics pipeline. + pub fragment_shader: *mut SDL_GPUShader, + /// The vertex layout of the graphics pipeline. + pub vertex_input_state: SDL_GPUVertexInputState, + /// The primitive topology of the graphics pipeline. + pub primitive_type: SDL_GPUPrimitiveType, + /// The rasterizer state of the graphics pipeline. + pub rasterizer_state: SDL_GPURasterizerState, + /// The multisample state of the graphics pipeline. + pub multisample_state: SDL_GPUMultisampleState, + /// The depth-stencil state of the graphics pipeline. + pub depth_stencil_state: SDL_GPUDepthStencilState, + /// Formats and blend modes for the render targets of the graphics pipeline. + pub target_info: SDL_GPUGraphicsPipelineTargetInfo, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +impl ::core::default::Default for SDL_GPUGraphicsPipelineCreateInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the parameters of a compute pipeline state. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUComputePipeline`] +/// - [`SDL_GPUShaderFormat`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUComputePipelineCreateInfo { + /// The size in bytes of the compute shader code pointed to. + pub code_size: ::core::primitive::usize, + /// A pointer to compute shader code. + pub code: *const Uint8, + /// A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. + pub entrypoint: *const ::core::ffi::c_char, + /// The format of the compute shader code. + pub format: SDL_GPUShaderFormat, + /// The number of samplers defined in the shader. + pub num_samplers: Uint32, + /// The number of readonly storage textures defined in the shader. + pub num_readonly_storage_textures: Uint32, + /// The number of readonly storage buffers defined in the shader. + pub num_readonly_storage_buffers: Uint32, + /// The number of read-write storage textures defined in the shader. + pub num_readwrite_storage_textures: Uint32, + /// The number of read-write storage buffers defined in the shader. + pub num_readwrite_storage_buffers: Uint32, + /// The number of uniform buffers defined in the shader. + pub num_uniform_buffers: Uint32, + /// The number of threads in the X dimension. This should match the value in the shader. + pub threadcount_x: Uint32, + /// The number of threads in the Y dimension. This should match the value in the shader. + pub threadcount_y: Uint32, + /// The number of threads in the Z dimension. This should match the value in the shader. + pub threadcount_z: Uint32, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +impl ::core::default::Default for SDL_GPUComputePipelineCreateInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the parameters of a color target used by a render +/// pass. +/// +/// The load_op field determines what is done with the texture at the beginning +/// of the render pass. +/// +/// - LOAD: Loads the data currently in the texture. Not recommended for +/// multisample textures as it requires significant memory bandwidth. +/// - CLEAR: Clears the texture to a single color. +/// - DONT_CARE: The driver will do whatever it wants with the texture memory. +/// This is a good option if you know that every single pixel will be touched +/// in the render pass. +/// +/// The store_op field determines what is done with the color results of the +/// render pass. +/// +/// - STORE: Stores the results of the render pass in the texture. Not +/// recommended for multisample textures as it requires significant memory +/// bandwidth. +/// - DONT_CARE: The driver will do whatever it wants with the texture memory. +/// This is often a good option for depth/stencil textures. +/// - RESOLVE: Resolves a multisample texture into resolve_texture, which must +/// have a sample count of 1. Then the driver may discard the multisample +/// texture memory. This is the most performant method of resolving a +/// multisample target. +/// - RESOLVE_AND_STORE: Resolves a multisample texture into the +/// resolve_texture, which must have a sample count of 1. Then the driver +/// stores the multisample texture's contents. Not recommended as it requires +/// significant memory bandwidth. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPURenderPass`] +/// - [`SDL_FColor`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUColorTargetInfo { + /// The texture that will be used as a color target by a render pass. + pub texture: *mut SDL_GPUTexture, + /// The mip level to use as a color target. + pub mip_level: Uint32, + /// The layer index or depth plane to use as a color target. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. + pub layer_or_depth_plane: Uint32, + /// The color to clear the color target to at the start of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used. + pub clear_color: SDL_FColor, + /// What is done with the contents of the color target at the beginning of the render pass. + pub load_op: SDL_GPULoadOp, + /// What is done with the results of the render pass. + pub store_op: SDL_GPUStoreOp, + /// The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used. + pub resolve_texture: *mut SDL_GPUTexture, + /// The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. + pub resolve_mip_level: Uint32, + /// The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. + pub resolve_layer: Uint32, + /// true cycles the texture if the texture is bound and load_op is not LOAD + pub cycle: ::core::primitive::bool, + /// true cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used. + pub cycle_resolve_texture: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, +} + +impl ::core::default::Default for SDL_GPUColorTargetInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying the parameters of a depth-stencil target used by a +/// render pass. +/// +/// The load_op field determines what is done with the depth contents of the +/// texture at the beginning of the render pass. +/// +/// - LOAD: Loads the depth values currently in the texture. +/// - CLEAR: Clears the texture to a single depth. +/// - DONT_CARE: The driver will do whatever it wants with the memory. This is +/// a good option if you know that every single pixel will be touched in the +/// render pass. +/// +/// The store_op field determines what is done with the depth results of the +/// render pass. +/// +/// - STORE: Stores the depth results in the texture. +/// - DONT_CARE: The driver will do whatever it wants with the depth results. +/// This is often a good option for depth/stencil textures that don't need to +/// be reused again. +/// +/// The stencil_load_op field determines what is done with the stencil contents +/// of the texture at the beginning of the render pass. +/// +/// - LOAD: Loads the stencil values currently in the texture. +/// - CLEAR: Clears the stencil values to a single value. +/// - DONT_CARE: The driver will do whatever it wants with the memory. This is +/// a good option if you know that every single pixel will be touched in the +/// render pass. +/// +/// The stencil_store_op field determines what is done with the stencil results +/// of the render pass. +/// +/// - STORE: Stores the stencil results in the texture. +/// - DONT_CARE: The driver will do whatever it wants with the stencil results. +/// This is often a good option for depth/stencil textures that don't need to +/// be reused again. +/// +/// Note that depth/stencil targets do not support multisample resolves. +/// +/// Due to ABI limitations, depth textures with more than 255 layers are not +/// supported. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPURenderPass`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUDepthStencilTargetInfo { + /// The texture that will be used as the depth stencil target by the render pass. + pub texture: *mut SDL_GPUTexture, + /// The value to clear the depth component to at the beginning of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used. + pub clear_depth: ::core::ffi::c_float, + /// What is done with the depth contents at the beginning of the render pass. + pub load_op: SDL_GPULoadOp, + /// What is done with the depth results of the render pass. + pub store_op: SDL_GPUStoreOp, + /// What is done with the stencil contents at the beginning of the render pass. + pub stencil_load_op: SDL_GPULoadOp, + /// What is done with the stencil results of the render pass. + pub stencil_store_op: SDL_GPUStoreOp, + /// true cycles the texture if the texture is bound and any load ops are not LOAD + pub cycle: ::core::primitive::bool, + /// The value to clear the stencil component to at the beginning of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used. + pub clear_stencil: Uint8, + /// The mip level to use as the depth stencil target. + pub mip_level: Uint8, + /// The layer index to use as the depth stencil target. + pub layer: Uint8, +} + +impl ::core::default::Default for SDL_GPUDepthStencilTargetInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure containing parameters for a blit command. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BlitGPUTexture`] +/// - [`SDL_GPUBlitRegion`] +/// - [`SDL_GPULoadOp`] +/// - [`SDL_FColor`] +/// - [`SDL_FlipMode`] +/// - [`SDL_GPUFilter`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUBlitInfo { + /// The source region for the blit. + pub source: SDL_GPUBlitRegion, + /// The destination region for the blit. + pub destination: SDL_GPUBlitRegion, + /// What is done with the contents of the destination before the blit. + pub load_op: SDL_GPULoadOp, + /// The color to clear the destination region to before the blit. Ignored if load_op is not [`SDL_GPU_LOADOP_CLEAR`]. + pub clear_color: SDL_FColor, + /// The flip mode for the source region. + pub flip_mode: SDL_FlipMode, + /// The filter mode used when blitting. + pub filter: SDL_GPUFilter, + /// true cycles the destination texture if it is already bound. + pub cycle: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, +} + +impl ::core::default::Default for SDL_GPUBlitInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying parameters in a buffer binding call. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BindGPUVertexBuffers`] +/// - [`SDL_BindGPUIndexBuffer`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUBufferBinding { + /// The buffer to bind. Must have been created with [`SDL_GPU_BUFFERUSAGE_VERTEX`] for [`SDL_BindGPUVertexBuffers`], or [`SDL_GPU_BUFFERUSAGE_INDEX`] for [`SDL_BindGPUIndexBuffer`]. + pub buffer: *mut SDL_GPUBuffer, + /// The starting byte of the data to bind in the buffer. + pub offset: Uint32, +} + +impl ::core::default::Default for SDL_GPUBufferBinding { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying parameters in a sampler binding call. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BindGPUVertexSamplers`] +/// - [`SDL_BindGPUFragmentSamplers`] +/// - [`SDL_GPUTexture`] +/// - [`SDL_GPUSampler`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUTextureSamplerBinding { + /// The texture to bind. Must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`]. + pub texture: *mut SDL_GPUTexture, + /// The sampler to bind. + pub sampler: *mut SDL_GPUSampler, +} + +impl ::core::default::Default for SDL_GPUTextureSamplerBinding { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying parameters related to binding buffers in a compute +/// pass. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPUComputePass`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUStorageBufferReadWriteBinding { + /// The buffer to bind. Must have been created with [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE`]. + pub buffer: *mut SDL_GPUBuffer, + /// true cycles the buffer if it is already bound. + pub cycle: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, +} + +impl ::core::default::Default for SDL_GPUStorageBufferReadWriteBinding { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// A structure specifying parameters related to binding textures in a compute +/// pass. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPUComputePass`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUStorageTextureReadWriteBinding { + /// The texture to bind. Must have been created with [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE`] or [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`]. + pub texture: *mut SDL_GPUTexture, + /// The mip level index to bind. + pub mip_level: Uint32, + /// The layer index to bind. + pub layer: Uint32, + /// true cycles the texture if it is already bound. + pub cycle: ::core::primitive::bool, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding1: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding3: Uint8, +} + +impl ::core::default::Default for SDL_GPUStorageTextureReadWriteBinding { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Checks for GPU runtime support. + /// + /// ## Parameters + /// - `format_flags`: a bitflag indicating which shader formats the app is + /// able to provide. + /// - `name`: the preferred GPU driver, or NULL to let SDL pick the optimal + /// driver. + /// + /// ## Return value + /// Returns true if supported, false otherwise. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUDevice`] + pub fn SDL_GPUSupportsShaderFormats( + format_flags: SDL_GPUShaderFormat, + name: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Checks for GPU runtime support. + /// + /// ## Parameters + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns true if supported, false otherwise. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUDeviceWithProperties`] + pub fn SDL_GPUSupportsProperties(props: SDL_PropertiesID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Creates a GPU context. + /// + /// The GPU driver name can be one of the following: + /// + /// - "vulkan": [Vulkan](CategoryGPU#vulkan) + /// - "direct3d12": [D3D12](CategoryGPU#d3d12) + /// - "metal": [Metal](CategoryGPU#metal) + /// - NULL: let SDL pick the optimal driver + /// + /// ## Parameters + /// - `format_flags`: a bitflag indicating which shader formats the app is + /// able to provide. + /// - `debug_mode`: enable debug mode properties and validations. + /// - `name`: the preferred GPU driver, or NULL to let SDL pick the optimal + /// driver. + /// + /// ## Return value + /// Returns a GPU context on success or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUDeviceWithProperties`] + /// - [`SDL_GetGPUShaderFormats`] + /// - [`SDL_GetGPUDeviceDriver`] + /// - [`SDL_DestroyGPUDevice`] + /// - [`SDL_GPUSupportsShaderFormats`] + pub fn SDL_CreateGPUDevice( + format_flags: SDL_GPUShaderFormat, + debug_mode: ::core::primitive::bool, + name: *const ::core::ffi::c_char, + ) -> *mut SDL_GPUDevice; +} + +unsafe extern "C" { + /// Creates a GPU context. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN`]\: enable debug mode + /// properties and validations, defaults to true. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN`]\: enable to prefer + /// energy efficiency over maximum GPU performance, defaults to false. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN`]\: enable to automatically log + /// useful debug information on device creation, defaults to true. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`]\: the name of the GPU driver to + /// use, if a specific one is desired. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN`]\: Enable Vulkan + /// device feature shaderClipDistance. If disabled, clip distances are not + /// supported in shader code: gl_ClipDistance\[\] built-ins of GLSL, + /// SV_ClipDistance0/1 semantics of HLSL and \[\[clip_distance\]\] attribute of + /// Metal. Disabling optional features allows the application to run on some + /// older Android devices. Defaults to true. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN`]\: Enable + /// Vulkan device feature depthClamp. If disabled, there is no depth clamp + /// support and enable_depth_clip in [`SDL_GPURasterizerState`] must always be + /// set to true. Disabling optional features allows the application to run on + /// some older Android devices. Defaults to true. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN`]\: + /// Enable Vulkan device feature drawIndirectFirstInstance. If disabled, the + /// argument first_instance of [`SDL_GPUIndirectDrawCommand`] must be set to + /// zero. Disabling optional features allows the application to run on some + /// older Android devices. Defaults to true. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN`]\: Enable Vulkan + /// device feature samplerAnisotropy. If disabled, enable_anisotropy of + /// [`SDL_GPUSamplerCreateInfo`] must be set to false. Disabling optional + /// features allows the application to run on some older Android devices. + /// Defaults to true. + /// + /// These are the current shader format properties: + /// + /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN`]\: The app is able to + /// provide shaders for an NDA platform. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN`]\: The app is able to + /// provide SPIR-V shaders if applicable. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN`]\: The app is able to + /// provide DXBC shaders if applicable + /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`]\: The app is able to + /// provide DXIL shaders if applicable. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN`]\: The app is able to + /// provide MSL shaders if applicable. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN`]\: The app is able to + /// provide Metal shader libraries if applicable. + /// + /// With the D3D12 backend: + /// + /// - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`]\: the prefix to + /// use for all vertex semantics, default is "TEXCOORD". + /// - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN`]\: By + /// default, Resourcing Binding Tier 2 is required for D3D12 support. + /// However, an application can set this property to true to enable Tier 1 + /// support, if (and only if) the application uses 8 or fewer storage + /// resources across all shader stages. As of writing, this property is + /// useful for targeting Intel Haswell and Broadwell GPUs; other hardware + /// either supports Tier 2 Resource Binding or does not support D3D12 in any + /// capacity. Defaults to false. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER`]\: Certain + /// feature checks are only possible on Windows 11 by default. By setting + /// this alongside [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING`] + /// and vendoring D3D12Core.dll from the D3D12 Agility SDK, you can make + /// those feature checks possible on older platforms. The version you provide + /// must match the one given in the DLL. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING`]\: Certain + /// feature checks are only possible on Windows 11 by default. By setting + /// this alongside + /// [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER`] and + /// vendoring D3D12Core.dll from the D3D12 Agility SDK, you can make those + /// feature checks possible on older platforms. The path you provide must be + /// relative to the executable path of your app. Be sure not to put the DLL + /// in the same directory as the exe; Microsoft strongly advises against + /// this! + /// + /// With the Vulkan backend: + /// + /// - [`SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN`]\: + /// By default, Vulkan device enumeration includes drivers of all types, + /// including software renderers (for example, the Lavapipe Mesa driver). + /// This can be useful if your application _requires_ SDL_GPU, but if you can + /// provide your own fallback renderer (for example, an OpenGL renderer) this + /// property can be set to true. Defaults to false. + /// - [`SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER`]\: a pointer to an + /// [`SDL_GPUVulkanOptions`] structure to be processed during device creation. + /// This allows configuring a variety of Vulkan-specific options such as + /// increasing the API version and opting into extensions aside from the + /// minimal set SDL requires. + /// + /// With the Metal backend: - + /// [`SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN`]\: By default, + /// macOS support requires what Apple calls "MTLGPUFamilyMac2" hardware or + /// newer. However, an application can set this property to true to enable + /// support for "MTLGPUFamilyMac1" hardware, if (and only if) the application + /// does not write to sRGB textures. (For history's sake: MacFamily1 also does + /// not support indirect command buffers, MSAA depth resolve, and stencil + /// resolve/feedback, but these are not exposed features in SDL_GPU.) + /// + /// ## Parameters + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns a GPU context on success or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGPUShaderFormats`] + /// - [`SDL_GetGPUDeviceDriver`] + /// - [`SDL_DestroyGPUDevice`] + /// - [`SDL_GPUSupportsProperties`] + pub fn SDL_CreateGPUDeviceWithProperties(props: SDL_PropertiesID) -> *mut SDL_GPUDevice; +} + +pub const SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.debugmode".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.preferlowpower".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.verbose".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.name".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.feature.clip_distance".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.feature.depth_clamping".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN: + *const ::core::ffi::c_char = + c"SDL.gpu.device.create.feature.indirect_draw_first_instance".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.feature.anisotropy".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.shaders.private".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.shaders.spirv".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.shaders.dxbc".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.shaders.dxil".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.shaders.msl".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.shaders.metallib".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN: + *const ::core::ffi::c_char = c"SDL.gpu.device.create.d3d12.allowtier1resourcebinding".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.d3d12.semantic".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.d3d12.agility_sdk_version".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.d3d12.agility_sdk_path".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN: + *const ::core::ffi::c_char = + c"SDL.gpu.device.create.vulkan.requirehardwareacceleration".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.vulkan.options".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.gpu.device.create.metal.allowmacfamily1".as_ptr(); + +/// A structure specifying additional options when using Vulkan. +/// +/// When no such structure is provided, SDL will use Vulkan API version 1.0 and +/// a minimal set of features. The requested API version influences how the +/// feature_list is processed by SDL. When requesting API version 1.0, the +/// feature_list is ignored. Only the vulkan_10_physical_device_features and +/// the extension lists are used. When requesting API version 1.1, the +/// feature_list is scanned for feature structures introduced in Vulkan 1.1. +/// When requesting Vulkan 1.2 or higher, the feature_list is additionally +/// scanned for compound feature structs such as +/// VkPhysicalDeviceVulkan11Features. The device and instance extension lists, +/// as well as vulkan_10_physical_device_features, are always processed. +/// +/// ## Availability +/// This struct is available since SDL 3.4.0. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPUVulkanOptions { + /// The Vulkan API version to request for the instance. Use Vulkan's VK_MAKE_VERSION or VK_MAKE_API_VERSION. + pub vulkan_api_version: Uint32, + /// Pointer to the first element of a chain of Vulkan feature structs. (Requires API version 1.1 or higher.) + pub feature_list: *mut ::core::ffi::c_void, + /// Pointer to a VkPhysicalDeviceFeatures struct to enable additional Vulkan 1.0 features. + pub vulkan_10_physical_device_features: *mut ::core::ffi::c_void, + /// Number of additional device extensions to require. + pub device_extension_count: Uint32, + /// Pointer to a list of additional device extensions to require. + pub device_extension_names: *mut *const ::core::ffi::c_char, + /// Number of additional instance extensions to require. + pub instance_extension_count: Uint32, + /// Pointer to a list of additional instance extensions to require. + pub instance_extension_names: *mut *const ::core::ffi::c_char, +} + +impl ::core::default::Default for SDL_GPUVulkanOptions { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Destroys a GPU context previously returned by [`SDL_CreateGPUDevice`]. + /// + /// ## Parameters + /// - `device`: a GPU Context to destroy. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUDevice`] + pub fn SDL_DestroyGPUDevice(device: *mut SDL_GPUDevice); +} + +unsafe extern "C" { + /// Get the number of GPU drivers compiled into SDL. + /// + /// ## Return value + /// Returns the number of built in GPU drivers. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGPUDriver`] + pub fn SDL_GetNumGPUDrivers() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the name of a built in GPU driver. + /// + /// The GPU drivers are presented in the order in which they are normally + /// checked during initialization. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "vulkan", + /// "metal" or "direct3d12". These never have Unicode characters, and are not + /// meant to be proper names. + /// + /// ## Parameters + /// - `index`: the index of a GPU driver. + /// + /// ## Return value + /// Returns the name of the GPU driver with the given **index**. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumGPUDrivers`] + pub fn SDL_GetGPUDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Returns the name of the backend used to create this GPU context. + /// + /// ## Parameters + /// - `device`: a GPU context to query. + /// + /// ## Return value + /// Returns the name of the device's driver, or NULL on error. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGPUDeviceDriver(device: *mut SDL_GPUDevice) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Returns the supported shader formats for this GPU context. + /// + /// ## Parameters + /// - `device`: a GPU context to query. + /// + /// ## Return value + /// Returns a bitflag indicating which shader formats the driver is able to + /// consume. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGPUShaderFormats(device: *mut SDL_GPUDevice) -> SDL_GPUShaderFormat; +} + +unsafe extern "C" { + /// Get the properties associated with a GPU device. + /// + /// All properties are optional and may differ between GPU backends and SDL + /// versions. + /// + /// The following properties are provided by SDL: + /// + /// [`SDL_PROP_GPU_DEVICE_NAME_STRING`]\: Contains the name of the underlying + /// device as reported by the system driver. This string has no standardized + /// format, is highly inconsistent between hardware devices and drivers, and is + /// able to change at any time. Do not attempt to parse this string as it is + /// bound to fail at some point in the future when system drivers are updated, + /// new hardware devices are introduced, or when SDL adds new GPU backends or + /// modifies existing ones. + /// + /// Strings that have been found in the wild include: + /// + /// - GTX 970 + /// - GeForce GTX 970 + /// - NVIDIA GeForce GTX 970 + /// - Microsoft Direct3D12 (NVIDIA GeForce GTX 970) + /// - NVIDIA Graphics Device + /// - GeForce GPU + /// - P106-100 + /// - AMD 15D8:C9 + /// - AMD Custom GPU 0405 + /// - AMD Radeon (TM) Graphics + /// - ASUS Radeon RX 470 Series + /// - Intel(R) Arc(tm) A380 Graphics (DG2) + /// - Virtio-GPU Venus (NVIDIA TITAN V) + /// - SwiftShader Device (LLVM 16.0.0) + /// - llvmpipe (LLVM 15.0.4, 256 bits) + /// - Microsoft Basic Render Driver + /// - unknown device + /// + /// The above list shows that the same device can have different formats, the + /// vendor name may or may not appear in the string, the included vendor name + /// may not be the vendor of the chipset on the device, some manufacturers + /// include pseudo-legal marks while others don't, some devices may not use a + /// marketing name in the string, the device string may be wrapped by the name + /// of a translation interface, the device may be emulated in software, or the + /// string may contain generic text that does not identify the device at all. + /// + /// [`SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING`]\: Contains the self-reported name + /// of the underlying system driver. + /// + /// Strings that have been found in the wild include: + /// + /// - Intel Corporation + /// - Intel open-source Mesa driver + /// - Qualcomm Technologies Inc. Adreno Vulkan Driver + /// - MoltenVK + /// - Mali-G715 + /// - venus + /// + /// [`SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING`]\: Contains the self-reported + /// version of the underlying system driver. This is a relatively short version + /// string in an unspecified format. If [`SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING`] + /// is available then that property should be preferred over this one as it may + /// contain additional information that is useful for identifying the exact + /// driver version used. + /// + /// Strings that have been found in the wild include: + /// + /// - 53.0.0 + /// - 0.405.2463 + /// - 32.0.15.6614 + /// + /// [`SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING`]\: Contains the detailed version + /// information of the underlying system driver as reported by the driver. This + /// is an arbitrary string with no standardized format and it may contain + /// newlines. This property should be preferred over + /// [`SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING`] if it is available as it usually + /// contains the same information but in a format that is easier to read. + /// + /// Strings that have been found in the wild include: + /// + /// - 101.6559 + /// - 1.2.11 + /// - Mesa 21.2.2 (LLVM 12.0.1) + /// - Mesa 22.2.0-devel (git-f226222 2022-04-14 impish-oibaf-ppa) + /// - v1.r53p0-00eac0.824c4f31403fb1fbf8ee1042422c2129 + /// + /// This string has also been observed to be a multiline string (which has a + /// trailing newline): + /// + /// ```text + /// Driver Build: 85da404, I46ff5fc46f, 1606794520 + /// Date: 11/30/20 + /// Compiler Version: EV031.31.04.01 + /// Driver Branch: promo490_3_Google + /// ``` + /// + /// ## Parameters + /// - `device`: a GPU context to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetGPUDeviceProperties(device: *mut SDL_GPUDevice) -> SDL_PropertiesID; +} + +pub const SDL_PROP_GPU_DEVICE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.name".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.driver_name".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.driver_version".as_ptr(); + +pub const SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.device.driver_info".as_ptr(); + +unsafe extern "C" { + /// Creates a pipeline object to be used in a compute workflow. + /// + /// Shader resource bindings must be authored to follow a particular order + /// depending on the shader format. + /// + /// For SPIR-V shaders, use the following resource sets: + /// + /// - 0: Sampled textures, followed by read-only storage textures, followed by + /// read-only storage buffers + /// - 1: Read-write storage textures, followed by read-write storage buffers + /// - 2: Uniform buffers + /// + /// For DXBC and DXIL shaders, use the following register order: + /// + /// - (t\[n\], space0): Sampled textures, followed by read-only storage textures, + /// followed by read-only storage buffers + /// - (u\[n\], space1): Read-write storage textures, followed by read-write + /// storage buffers + /// - (b\[n\], space2): Uniform buffers + /// + /// For MSL/metallib, use the following order: + /// + /// - \[\[buffer\]\]: Uniform buffers, followed by read-only storage buffers, + /// followed by read-write storage buffers + /// - \[\[texture\]\]: Sampled textures, followed by read-only storage textures, + /// followed by read-write storage textures + /// + /// There are optional properties that can be provided through `props`. These + /// are the supported properties: + /// + /// - [`SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`]\: a name that can be + /// displayed in debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the compute pipeline to + /// create. + /// + /// ## Return value + /// Returns a compute pipeline object on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindGPUComputePipeline`] + /// - [`SDL_ReleaseGPUComputePipeline`] + pub fn SDL_CreateGPUComputePipeline( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUComputePipelineCreateInfo, + ) -> *mut SDL_GPUComputePipeline; +} + +pub const SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.computepipeline.create.name".as_ptr(); + +unsafe extern "C" { + /// Creates a pipeline object to be used in a graphics workflow. + /// + /// There are optional properties that can be provided through `props`. These + /// are the supported properties: + /// + /// - [`SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`]\: a name that can be + /// displayed in debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the graphics pipeline to + /// create. + /// + /// ## Return value + /// Returns a graphics pipeline object on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + /// - [`SDL_BindGPUGraphicsPipeline`] + /// - [`SDL_ReleaseGPUGraphicsPipeline`] + pub fn SDL_CreateGPUGraphicsPipeline( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUGraphicsPipelineCreateInfo, + ) -> *mut SDL_GPUGraphicsPipeline; +} + +pub const SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.graphicspipeline.create.name".as_ptr(); + +unsafe extern "C" { + /// Creates a sampler object to be used when binding textures in a graphics + /// workflow. + /// + /// There are optional properties that can be provided through `props`. These + /// are the supported properties: + /// + /// - [`SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`]\: a name that can be displayed + /// in debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the sampler to create. + /// + /// ## Return value + /// Returns a sampler object on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BindGPUVertexSamplers`] + /// - [`SDL_BindGPUFragmentSamplers`] + /// - [`SDL_ReleaseGPUSampler`] + pub fn SDL_CreateGPUSampler( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUSamplerCreateInfo, + ) -> *mut SDL_GPUSampler; +} + +pub const SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.sampler.create.name".as_ptr(); + +unsafe extern "C" { + /// Creates a shader to be used when creating a graphics pipeline. + /// + /// Shader resource bindings must be authored to follow a particular order + /// depending on the shader format. + /// + /// For SPIR-V shaders, use the following resource sets: + /// + /// For vertex shaders: + /// + /// - 0: Sampled textures, followed by storage textures, followed by storage + /// buffers + /// - 1: Uniform buffers + /// + /// For fragment shaders: + /// + /// - 2: Sampled textures, followed by storage textures, followed by storage + /// buffers + /// - 3: Uniform buffers + /// + /// For DXBC and DXIL shaders, use the following register order: + /// + /// For vertex shaders: + /// + /// - (t\[n\], space0): Sampled textures, followed by storage textures, followed + /// by storage buffers + /// - (s\[n\], space0): Samplers with indices corresponding to the sampled + /// textures + /// - (b\[n\], space1): Uniform buffers + /// + /// For pixel shaders: + /// + /// - (t\[n\], space2): Sampled textures, followed by storage textures, followed + /// by storage buffers + /// - (s\[n\], space2): Samplers with indices corresponding to the sampled + /// textures + /// - (b\[n\], space3): Uniform buffers + /// + /// For MSL/metallib, use the following order: + /// + /// - \[\[texture\]\]: Sampled textures, followed by storage textures + /// - \[\[sampler\]\]: Samplers with indices corresponding to the sampled textures + /// - \[\[buffer\]\]: Uniform buffers, followed by storage buffers. Vertex buffer 0 + /// is bound at \[\[buffer(14)\]\], vertex buffer 1 at \[\[buffer(15)\]\], and so on. + /// Rather than manually authoring vertex buffer indices, use the + /// \[\[stage_in\]\] attribute which will automatically use the vertex input + /// information from the [`SDL_GPUGraphicsPipeline`]. + /// + /// Shader semantics other than system-value semantics do not matter in D3D12 + /// and for ease of use the SDL implementation assumes that non system-value + /// semantics will all be TEXCOORD. If you are using HLSL as the shader source + /// language, your vertex semantics should start at TEXCOORD0 and increment + /// like so: TEXCOORD1, TEXCOORD2, etc. If you wish to change the semantic + /// prefix to something other than TEXCOORD you can use + /// [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`] with + /// [`SDL_CreateGPUDeviceWithProperties()`]. + /// + /// There are optional properties that can be provided through `props`. These + /// are the supported properties: + /// + /// - [`SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`]\: a name that can be displayed in + /// debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the shader to create. + /// + /// ## Return value + /// Returns a shader object on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUGraphicsPipeline`] + /// - [`SDL_ReleaseGPUShader`] + pub fn SDL_CreateGPUShader( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUShaderCreateInfo, + ) -> *mut SDL_GPUShader; +} + +pub const SDL_PROP_GPU_SHADER_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.shader.create.name".as_ptr(); + +unsafe extern "C" { + /// Creates a texture object to be used in graphics or compute workflows. + /// + /// The contents of this texture are undefined until data is written to the + /// texture, either via [`SDL_UploadToGPUTexture`] or by performing a render or + /// compute pass with this texture as a target. + /// + /// Note that certain combinations of usage flags are invalid. For example, a + /// texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags. + /// + /// If you request a sample count higher than the hardware supports, the + /// implementation will automatically fall back to the highest available sample + /// count. + /// + /// There are optional properties that can be provided through + /// SDL_GPUTextureCreateInfo's `props`. These are the supported properties: + /// + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`]\: (Direct3D 12 only) if + /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture + /// to a color with this red intensity. Defaults to zero. + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`]\: (Direct3D 12 only) if + /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture + /// to a color with this green intensity. Defaults to zero. + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`]\: (Direct3D 12 only) if + /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture + /// to a color with this blue intensity. Defaults to zero. + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`]\: (Direct3D 12 only) if + /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture + /// to a color with this alpha intensity. Defaults to zero. + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`]\: (Direct3D 12 only) + /// if the texture usage is [`SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET`], clear + /// the texture to a depth of this value. Defaults to zero. + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER`]\: (Direct3D 12 + /// only) if the texture usage is [`SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET`], + /// clear the texture to a stencil of this Uint8 value. Defaults to zero. + /// - [`SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`]\: a name that can be displayed + /// in debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the texture to create. + /// + /// ## Return value + /// Returns a texture object on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UploadToGPUTexture`] + /// - [`SDL_DownloadFromGPUTexture`] + /// - [`SDL_BeginGPURenderPass`] + /// - [`SDL_BeginGPUComputePass`] + /// - [`SDL_BindGPUVertexSamplers`] + /// - [`SDL_BindGPUVertexStorageTextures`] + /// - [`SDL_BindGPUFragmentSamplers`] + /// - [`SDL_BindGPUFragmentStorageTextures`] + /// - [`SDL_BindGPUComputeStorageTextures`] + /// - [`SDL_BlitGPUTexture`] + /// - [`SDL_ReleaseGPUTexture`] + /// - [`SDL_GPUTextureSupportsFormat`] + pub fn SDL_CreateGPUTexture( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUTextureCreateInfo, + ) -> *mut SDL_GPUTexture; +} + +pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.d3d12.clear.r".as_ptr(); + +pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.d3d12.clear.g".as_ptr(); + +pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.d3d12.clear.b".as_ptr(); + +pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.d3d12.clear.a".as_ptr(); + +pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.d3d12.clear.depth".as_ptr(); + +pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.d3d12.clear.stencil".as_ptr(); + +pub const SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.texture.create.name".as_ptr(); + +unsafe extern "C" { + /// Creates a buffer object to be used in graphics or compute workflows. + /// + /// The contents of this buffer are undefined until data is written to the + /// buffer. + /// + /// Note that certain combinations of usage flags are invalid. For example, a + /// buffer cannot have both the VERTEX and INDEX flags. + /// + /// If you use a STORAGE flag, the data in the buffer must respect std140 + /// layout conventions. In practical terms this means you must ensure that vec3 + /// and vec4 fields are 16-byte aligned. + /// + /// For better understanding of underlying concepts and memory management with + /// SDL GPU API, you may refer + /// [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/) + /// . + /// + /// There are optional properties that can be provided through `props`. These + /// are the supported properties: + /// + /// - [`SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`]\: a name that can be displayed in + /// debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the buffer to create. + /// + /// ## Return value + /// Returns a buffer object on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UploadToGPUBuffer`] + /// - [`SDL_DownloadFromGPUBuffer`] + /// - [`SDL_CopyGPUBufferToBuffer`] + /// - [`SDL_BindGPUVertexBuffers`] + /// - [`SDL_BindGPUIndexBuffer`] + /// - [`SDL_BindGPUVertexStorageBuffers`] + /// - [`SDL_BindGPUFragmentStorageBuffers`] + /// - [`SDL_DrawGPUPrimitivesIndirect`] + /// - [`SDL_DrawGPUIndexedPrimitivesIndirect`] + /// - [`SDL_BindGPUComputeStorageBuffers`] + /// - [`SDL_DispatchGPUComputeIndirect`] + /// - [`SDL_ReleaseGPUBuffer`] + pub fn SDL_CreateGPUBuffer( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUBufferCreateInfo, + ) -> *mut SDL_GPUBuffer; +} + +pub const SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.buffer.create.name".as_ptr(); + +unsafe extern "C" { + /// Creates a transfer buffer to be used when uploading to or downloading from + /// graphics resources. + /// + /// Download buffers can be particularly expensive to create, so it is good + /// practice to reuse them if data will be downloaded regularly. + /// + /// There are optional properties that can be provided through `props`. These + /// are the supported properties: + /// + /// - [`SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`]\: a name that can be + /// displayed in debugging tools. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `createinfo`: a struct describing the state of the transfer buffer to + /// create. + /// + /// ## Return value + /// Returns a transfer buffer on success, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UploadToGPUBuffer`] + /// - [`SDL_DownloadFromGPUBuffer`] + /// - [`SDL_UploadToGPUTexture`] + /// - [`SDL_DownloadFromGPUTexture`] + /// - [`SDL_ReleaseGPUTransferBuffer`] + pub fn SDL_CreateGPUTransferBuffer( + device: *mut SDL_GPUDevice, + createinfo: *const SDL_GPUTransferBufferCreateInfo, + ) -> *mut SDL_GPUTransferBuffer; +} + +pub const SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.gpu.transferbuffer.create.name".as_ptr(); + +unsafe extern "C" { + /// Sets an arbitrary string constant to label a buffer. + /// + /// You should use [`SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`] with + /// [`SDL_CreateGPUBuffer`] instead of this function to avoid thread safety issues. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `buffer`: a buffer to attach the name to. + /// - `text`: a UTF-8 string constant to mark as the name of the buffer. + /// + /// ## Thread safety + /// This function is not thread safe, you must make sure the + /// buffer is not simultaneously used by any other thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUBuffer`] + pub fn SDL_SetGPUBufferName( + device: *mut SDL_GPUDevice, + buffer: *mut SDL_GPUBuffer, + text: *const ::core::ffi::c_char, + ); +} + +unsafe extern "C" { + /// Sets an arbitrary string constant to label a texture. + /// + /// You should use [`SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`] with + /// [`SDL_CreateGPUTexture`] instead of this function to avoid thread safety + /// issues. + /// + /// ## Parameters + /// - `device`: a GPU Context. + /// - `texture`: a texture to attach the name to. + /// - `text`: a UTF-8 string constant to mark as the name of the texture. + /// + /// ## Thread safety + /// This function is not thread safe, you must make sure the + /// texture is not simultaneously used by any other thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUTexture`] + pub fn SDL_SetGPUTextureName( + device: *mut SDL_GPUDevice, + texture: *mut SDL_GPUTexture, + text: *const ::core::ffi::c_char, + ); +} + +unsafe extern "C" { + /// Inserts an arbitrary string label into the command buffer callstream. + /// + /// Useful for debugging. + /// + /// On Direct3D 12, using [`SDL_InsertGPUDebugLabel`] requires + /// WinPixEventRuntime.dll to be in your PATH or in the same directory as your + /// executable. See + /// [here](https://devblogs.microsoft.com/pix/winpixeventruntime/) + /// for instructions on how to obtain it. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `text`: a UTF-8 string constant to insert as the label. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_InsertGPUDebugLabel( + command_buffer: *mut SDL_GPUCommandBuffer, + text: *const ::core::ffi::c_char, + ); +} + +unsafe extern "C" { + /// Begins a debug group with an arbitrary name. + /// + /// Used for denoting groups of calls when viewing the command buffer + /// callstream in a graphics debugging tool. + /// + /// Each call to [`SDL_PushGPUDebugGroup`] must have a corresponding call to + /// [`SDL_PopGPUDebugGroup`]. + /// + /// On Direct3D 12, using [`SDL_PushGPUDebugGroup`] requires WinPixEventRuntime.dll + /// to be in your PATH or in the same directory as your executable. See + /// [here](https://devblogs.microsoft.com/pix/winpixeventruntime/) + /// for instructions on how to obtain it. + /// + /// On some backends (e.g. Metal), pushing a debug group during a + /// render/blit/compute pass will create a group that is scoped to the native + /// pass rather than the command buffer. For best results, if you push a debug + /// group during a pass, always pop it in the same pass. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `name`: a UTF-8 string constant that names the group. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PopGPUDebugGroup`] + pub fn SDL_PushGPUDebugGroup( + command_buffer: *mut SDL_GPUCommandBuffer, + name: *const ::core::ffi::c_char, + ); +} + +unsafe extern "C" { + /// Ends the most-recently pushed debug group. + /// + /// On Direct3D 12, using [`SDL_PopGPUDebugGroup`] requires WinPixEventRuntime.dll + /// to be in your PATH or in the same directory as your executable. See + /// [here](https://devblogs.microsoft.com/pix/winpixeventruntime/) + /// for instructions on how to obtain it. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PushGPUDebugGroup`] + pub fn SDL_PopGPUDebugGroup(command_buffer: *mut SDL_GPUCommandBuffer); +} + +unsafe extern "C" { + /// Frees the given texture as soon as it is safe to do so. + /// + /// You must not reference the texture after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `texture`: a texture to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUTexture(device: *mut SDL_GPUDevice, texture: *mut SDL_GPUTexture); +} + +unsafe extern "C" { + /// Frees the given sampler as soon as it is safe to do so. + /// + /// You must not reference the sampler after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `sampler`: a sampler to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUSampler(device: *mut SDL_GPUDevice, sampler: *mut SDL_GPUSampler); +} + +unsafe extern "C" { + /// Frees the given buffer as soon as it is safe to do so. + /// + /// You must not reference the buffer after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `buffer`: a buffer to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUBuffer(device: *mut SDL_GPUDevice, buffer: *mut SDL_GPUBuffer); +} + +unsafe extern "C" { + /// Frees the given transfer buffer as soon as it is safe to do so. + /// + /// You must not reference the transfer buffer after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `transfer_buffer`: a transfer buffer to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUTransferBuffer( + device: *mut SDL_GPUDevice, + transfer_buffer: *mut SDL_GPUTransferBuffer, + ); +} + +unsafe extern "C" { + /// Frees the given compute pipeline as soon as it is safe to do so. + /// + /// You must not reference the compute pipeline after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `compute_pipeline`: a compute pipeline to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUComputePipeline( + device: *mut SDL_GPUDevice, + compute_pipeline: *mut SDL_GPUComputePipeline, + ); +} + +unsafe extern "C" { + /// Frees the given shader as soon as it is safe to do so. + /// + /// You must not reference the shader after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `shader`: a shader to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUShader(device: *mut SDL_GPUDevice, shader: *mut SDL_GPUShader); +} + +unsafe extern "C" { + /// Frees the given graphics pipeline as soon as it is safe to do so. + /// + /// You must not reference the graphics pipeline after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `graphics_pipeline`: a graphics pipeline to be destroyed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReleaseGPUGraphicsPipeline( + device: *mut SDL_GPUDevice, + graphics_pipeline: *mut SDL_GPUGraphicsPipeline, + ); +} + +unsafe extern "C" { + /// Acquire a command buffer. + /// + /// This command buffer is managed by the implementation and should not be + /// freed by the user. The command buffer may only be used on the thread it was + /// acquired on. The command buffer should be submitted on the thread it was + /// acquired on. + /// + /// It is valid to acquire multiple command buffers on the same thread at once. + /// In fact a common design pattern is to acquire two command buffers per frame + /// where one is dedicated to render and compute passes and the other is + /// dedicated to copy passes and other preparatory work such as generating + /// mipmaps. Interleaving commands between the two command buffers reduces the + /// total amount of passes overall which improves rendering performance. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// + /// ## Return value + /// Returns a command buffer, or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SubmitGPUCommandBuffer`] + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + pub fn SDL_AcquireGPUCommandBuffer(device: *mut SDL_GPUDevice) -> *mut SDL_GPUCommandBuffer; +} + +unsafe extern "C" { + /// Pushes data to a vertex uniform slot on the command buffer. + /// + /// Subsequent draw calls in this command buffer will use this uniform data. + /// + /// The data being pushed must respect std140 layout conventions. In practical + /// terms this means you must ensure that vec3 and vec4 fields are 16-byte + /// aligned. + /// + /// For detailed information about accessing uniform data from a shader, please + /// refer to [`SDL_CreateGPUShader`]. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `slot_index`: the vertex uniform slot to push data to. + /// - `data`: client data to write. + /// - `length`: the length of the data to write. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_PushGPUVertexUniformData( + command_buffer: *mut SDL_GPUCommandBuffer, + slot_index: Uint32, + data: *const ::core::ffi::c_void, + length: Uint32, + ); +} + +unsafe extern "C" { + /// Pushes data to a fragment uniform slot on the command buffer. + /// + /// Subsequent draw calls in this command buffer will use this uniform data. + /// + /// The data being pushed must respect std140 layout conventions. In practical + /// terms this means you must ensure that vec3 and vec4 fields are 16-byte + /// aligned. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `slot_index`: the fragment uniform slot to push data to. + /// - `data`: client data to write. + /// - `length`: the length of the data to write. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_PushGPUFragmentUniformData( + command_buffer: *mut SDL_GPUCommandBuffer, + slot_index: Uint32, + data: *const ::core::ffi::c_void, + length: Uint32, + ); +} + +unsafe extern "C" { + /// Pushes data to a uniform slot on the command buffer. + /// + /// Subsequent draw calls in this command buffer will use this uniform data. + /// + /// The data being pushed must respect std140 layout conventions. In practical + /// terms this means you must ensure that vec3 and vec4 fields are 16-byte + /// aligned. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `slot_index`: the uniform slot to push data to. + /// - `data`: client data to write. + /// - `length`: the length of the data to write. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_PushGPUComputeUniformData( + command_buffer: *mut SDL_GPUCommandBuffer, + slot_index: Uint32, + data: *const ::core::ffi::c_void, + length: Uint32, + ); +} + +unsafe extern "C" { + /// Begins a render pass on a command buffer. + /// + /// A render pass consists of a set of texture subresources (or depth slices in + /// the 3D texture case) which will be rendered to during the render pass, + /// along with corresponding clear values and load/store operations. All + /// operations related to graphics pipelines must take place inside of a render + /// pass. A default viewport and scissor state are automatically set when this + /// is called. You cannot begin another render pass, or begin a compute pass or + /// copy pass until you have ended the render pass. + /// + /// Using [`SDL_GPU_LOADOP_LOAD`] before any contents have been written to the + /// texture subresource will result in undefined behavior. [`SDL_GPU_LOADOP_CLEAR`] + /// will set the contents of the texture subresource to a single value before + /// any rendering is performed. It's fine to do an empty render pass using + /// [`SDL_GPU_STOREOP_STORE`] to clear a texture, but in general it's better to + /// think of clearing not as an independent operation but as something that's + /// done as the beginning of a render pass. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `color_target_infos`: an array of texture subresources with + /// corresponding clear values and load/store ops. + /// - `num_color_targets`: the number of color targets in the + /// color_target_infos array. + /// - `depth_stencil_target_info`: a texture subresource with corresponding + /// clear value and load/store ops, may be + /// NULL. + /// + /// ## Return value + /// Returns a render pass handle. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_EndGPURenderPass`] + pub fn SDL_BeginGPURenderPass( + command_buffer: *mut SDL_GPUCommandBuffer, + color_target_infos: *const SDL_GPUColorTargetInfo, + num_color_targets: Uint32, + depth_stencil_target_info: *const SDL_GPUDepthStencilTargetInfo, + ) -> *mut SDL_GPURenderPass; +} + +unsafe extern "C" { + /// Binds a graphics pipeline on a render pass to be used in rendering. + /// + /// A graphics pipeline must be bound before making any draw calls. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `graphics_pipeline`: the graphics pipeline to bind. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_BindGPUGraphicsPipeline( + render_pass: *mut SDL_GPURenderPass, + graphics_pipeline: *mut SDL_GPUGraphicsPipeline, + ); +} + +unsafe extern "C" { + /// Sets the current viewport state on a command buffer. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `viewport`: the viewport to set. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetGPUViewport( + render_pass: *mut SDL_GPURenderPass, + viewport: *const SDL_GPUViewport, + ); +} + +unsafe extern "C" { + /// Sets the current scissor state on a command buffer. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `scissor`: the scissor area to set. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetGPUScissor(render_pass: *mut SDL_GPURenderPass, scissor: *const SDL_Rect); +} + +unsafe extern "C" { + /// Sets the current blend constants on a command buffer. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `blend_constants`: the blend constant color. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GPU_BLENDFACTOR_CONSTANT_COLOR`] + /// - [`SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR`] + pub fn SDL_SetGPUBlendConstants( + render_pass: *mut SDL_GPURenderPass, + blend_constants: SDL_FColor, + ); +} + +unsafe extern "C" { + /// Sets the current stencil reference value on a command buffer. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `reference`: the stencil reference value to set. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetGPUStencilReference(render_pass: *mut SDL_GPURenderPass, reference: Uint8); +} + +unsafe extern "C" { + /// Binds vertex buffers on a command buffer for use with subsequent draw + /// calls. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the vertex buffer slot to begin binding from. + /// - `bindings`: an array of [`SDL_GPUBufferBinding`] structs containing vertex + /// buffers and offset values. + /// - `num_bindings`: the number of bindings in the bindings array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_BindGPUVertexBuffers( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + bindings: *const SDL_GPUBufferBinding, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds an index buffer on a command buffer for use with subsequent draw + /// calls. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `binding`: a pointer to a struct containing an index buffer and offset. + /// - `index_element_size`: whether the index values in the buffer are 16- or + /// 32-bit. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_BindGPUIndexBuffer( + render_pass: *mut SDL_GPURenderPass, + binding: *const SDL_GPUBufferBinding, + index_element_size: SDL_GPUIndexElementSize, + ); +} + +unsafe extern "C" { + /// Binds texture-sampler pairs for use on the vertex shader. + /// + /// The textures must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUShader()`]. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the vertex sampler slot to begin binding from. + /// - `texture_sampler_bindings`: an array of texture-sampler binding + /// structs. + /// - `num_bindings`: the number of texture-sampler pairs to bind from the + /// array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + pub fn SDL_BindGPUVertexSamplers( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + texture_sampler_bindings: *const SDL_GPUTextureSamplerBinding, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds storage textures for use on the vertex shader. + /// + /// These textures must have been created with + /// [`SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUShader()`]. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the vertex storage texture slot to begin binding from. + /// - `storage_textures`: an array of storage textures. + /// - `num_bindings`: the number of storage texture to bind from the array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + pub fn SDL_BindGPUVertexStorageTextures( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + storage_textures: *const *mut SDL_GPUTexture, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds storage buffers for use on the vertex shader. + /// + /// These buffers must have been created with + /// [`SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUShader()`]. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the vertex storage buffer slot to begin binding from. + /// - `storage_buffers`: an array of buffers. + /// - `num_bindings`: the number of buffers to bind from the array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + pub fn SDL_BindGPUVertexStorageBuffers( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + storage_buffers: *const *mut SDL_GPUBuffer, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds texture-sampler pairs for use on the fragment shader. + /// + /// The textures must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUShader()`]. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the fragment sampler slot to begin binding from. + /// - `texture_sampler_bindings`: an array of texture-sampler binding + /// structs. + /// - `num_bindings`: the number of texture-sampler pairs to bind from the + /// array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + pub fn SDL_BindGPUFragmentSamplers( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + texture_sampler_bindings: *const SDL_GPUTextureSamplerBinding, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds storage textures for use on the fragment shader. + /// + /// These textures must have been created with + /// [`SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUShader()`]. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the fragment storage texture slot to begin binding from. + /// - `storage_textures`: an array of storage textures. + /// - `num_bindings`: the number of storage textures to bind from the array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + pub fn SDL_BindGPUFragmentStorageTextures( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + storage_textures: *const *mut SDL_GPUTexture, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds storage buffers for use on the fragment shader. + /// + /// These buffers must have been created with + /// [`SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUShader()`]. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `first_slot`: the fragment storage buffer slot to begin binding from. + /// - `storage_buffers`: an array of storage buffers. + /// - `num_bindings`: the number of storage buffers to bind from the array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUShader`] + pub fn SDL_BindGPUFragmentStorageBuffers( + render_pass: *mut SDL_GPURenderPass, + first_slot: Uint32, + storage_buffers: *const *mut SDL_GPUBuffer, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Draws data using bound graphics state with an index buffer and instancing + /// enabled. + /// + /// You must not call this function before binding a graphics pipeline. + /// + /// Note that the `first_vertex` and `first_instance` parameters are NOT + /// compatible with built-in vertex/instance ID variables in shaders (for + /// example, SV_VertexID); GPU APIs and shader languages do not define these + /// built-in variables consistently, so if your shader depends on them, the + /// only way to keep behavior consistent and portable is to always pass 0 for + /// the correlating parameter in the draw calls. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `num_indices`: the number of indices to draw per instance. + /// - `num_instances`: the number of instances to draw. + /// - `first_index`: the starting index within the index buffer. + /// - `vertex_offset`: value added to vertex index before indexing into the + /// vertex buffer. + /// - `first_instance`: the ID of the first instance to draw. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DrawGPUIndexedPrimitives( + render_pass: *mut SDL_GPURenderPass, + num_indices: Uint32, + num_instances: Uint32, + first_index: Uint32, + vertex_offset: Sint32, + first_instance: Uint32, + ); +} + +unsafe extern "C" { + /// Draws data using bound graphics state. + /// + /// You must not call this function before binding a graphics pipeline. + /// + /// Note that the `first_vertex` and `first_instance` parameters are NOT + /// compatible with built-in vertex/instance ID variables in shaders (for + /// example, SV_VertexID); GPU APIs and shader languages do not define these + /// built-in variables consistently, so if your shader depends on them, the + /// only way to keep behavior consistent and portable is to always pass 0 for + /// the correlating parameter in the draw calls. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `num_vertices`: the number of vertices to draw. + /// - `num_instances`: the number of instances that will be drawn. + /// - `first_vertex`: the index of the first vertex to draw. + /// - `first_instance`: the ID of the first instance to draw. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DrawGPUPrimitives( + render_pass: *mut SDL_GPURenderPass, + num_vertices: Uint32, + num_instances: Uint32, + first_vertex: Uint32, + first_instance: Uint32, + ); +} + +unsafe extern "C" { + /// Draws data using bound graphics state and with draw parameters set from a + /// buffer. + /// + /// The buffer must consist of tightly-packed draw parameter sets that each + /// match the layout of [`SDL_GPUIndirectDrawCommand`]. You must not call this + /// function before binding a graphics pipeline. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `buffer`: a buffer containing draw parameters. + /// - `offset`: the offset to start reading from the draw buffer. + /// - `draw_count`: the number of draw parameter sets that should be read + /// from the draw buffer. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DrawGPUPrimitivesIndirect( + render_pass: *mut SDL_GPURenderPass, + buffer: *mut SDL_GPUBuffer, + offset: Uint32, + draw_count: Uint32, + ); +} + +unsafe extern "C" { + /// Draws data using bound graphics state with an index buffer enabled and with + /// draw parameters set from a buffer. + /// + /// The buffer must consist of tightly-packed draw parameter sets that each + /// match the layout of [`SDL_GPUIndexedIndirectDrawCommand`]. You must not call + /// this function before binding a graphics pipeline. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// - `buffer`: a buffer containing draw parameters. + /// - `offset`: the offset to start reading from the draw buffer. + /// - `draw_count`: the number of draw parameter sets that should be read + /// from the draw buffer. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DrawGPUIndexedPrimitivesIndirect( + render_pass: *mut SDL_GPURenderPass, + buffer: *mut SDL_GPUBuffer, + offset: Uint32, + draw_count: Uint32, + ); +} + +unsafe extern "C" { + /// Ends the given render pass. + /// + /// All bound graphics state on the render pass command buffer is unset. The + /// render pass handle is now invalid. + /// + /// ## Parameters + /// - `render_pass`: a render pass handle. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EndGPURenderPass(render_pass: *mut SDL_GPURenderPass); +} + +unsafe extern "C" { + /// Begins a compute pass on a command buffer. + /// + /// A compute pass is defined by a set of texture subresources and buffers that + /// may be written to by compute pipelines. These textures and buffers must + /// have been created with the COMPUTE_STORAGE_WRITE bit or the + /// COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture + /// with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the + /// texture in the compute pass. All operations related to compute pipelines + /// must take place inside of a compute pass. You must not begin another + /// compute pass, or a render pass or copy pass before ending the compute pass. + /// + /// A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT + /// implicitly synchronized. This means you may cause data races by both + /// reading and writing a resource region in a compute pass, or by writing + /// multiple times to a resource region. If your compute work depends on + /// reading the completed output from a previous dispatch, you MUST end the + /// current compute pass and begin a new one before you can safely access the + /// data. Otherwise you will receive unexpected results. Reading and writing a + /// texture in the same compute pass is only supported by specific texture + /// formats. Make sure you check the format support! + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `storage_texture_bindings`: an array of writeable storage texture + /// binding structs. + /// - `num_storage_texture_bindings`: the number of storage textures to bind + /// from the array. + /// - `storage_buffer_bindings`: an array of writeable storage buffer binding + /// structs. + /// - `num_storage_buffer_bindings`: the number of storage buffers to bind + /// from the array. + /// + /// ## Return value + /// Returns a compute pass handle. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_EndGPUComputePass`] + pub fn SDL_BeginGPUComputePass( + command_buffer: *mut SDL_GPUCommandBuffer, + storage_texture_bindings: *const SDL_GPUStorageTextureReadWriteBinding, + num_storage_texture_bindings: Uint32, + storage_buffer_bindings: *const SDL_GPUStorageBufferReadWriteBinding, + num_storage_buffer_bindings: Uint32, + ) -> *mut SDL_GPUComputePass; +} + +unsafe extern "C" { + /// Binds a compute pipeline on a command buffer for use in compute dispatch. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// - `compute_pipeline`: a compute pipeline to bind. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_BindGPUComputePipeline( + compute_pass: *mut SDL_GPUComputePass, + compute_pipeline: *mut SDL_GPUComputePipeline, + ); +} + +unsafe extern "C" { + /// Binds texture-sampler pairs for use on the compute shader. + /// + /// The textures must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUComputePipeline()`]. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// - `first_slot`: the compute sampler slot to begin binding from. + /// - `texture_sampler_bindings`: an array of texture-sampler binding + /// structs. + /// - `num_bindings`: the number of texture-sampler bindings to bind from the + /// array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUComputePipeline`] + pub fn SDL_BindGPUComputeSamplers( + compute_pass: *mut SDL_GPUComputePass, + first_slot: Uint32, + texture_sampler_bindings: *const SDL_GPUTextureSamplerBinding, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds storage textures as readonly for use on the compute pipeline. + /// + /// These textures must have been created with + /// [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUComputePipeline()`]. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// - `first_slot`: the compute storage texture slot to begin binding from. + /// - `storage_textures`: an array of storage textures. + /// - `num_bindings`: the number of storage textures to bind from the array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUComputePipeline`] + pub fn SDL_BindGPUComputeStorageTextures( + compute_pass: *mut SDL_GPUComputePass, + first_slot: Uint32, + storage_textures: *const *mut SDL_GPUTexture, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Binds storage buffers as readonly for use on the compute pipeline. + /// + /// These buffers must have been created with + /// [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ`]. + /// + /// Be sure your shader is set up according to the requirements documented in + /// [`SDL_CreateGPUComputePipeline()`]. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// - `first_slot`: the compute storage buffer slot to begin binding from. + /// - `storage_buffers`: an array of storage buffer binding structs. + /// - `num_bindings`: the number of storage buffers to bind from the array. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateGPUComputePipeline`] + pub fn SDL_BindGPUComputeStorageBuffers( + compute_pass: *mut SDL_GPUComputePass, + first_slot: Uint32, + storage_buffers: *const *mut SDL_GPUBuffer, + num_bindings: Uint32, + ); +} + +unsafe extern "C" { + /// Dispatches compute work. + /// + /// You must not call this function before binding a compute pipeline. + /// + /// A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and + /// the dispatches write to the same resource region as each other, there is no + /// guarantee of which order the writes will occur. If the write order matters, + /// you MUST end the compute pass and begin another one. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// - `groupcount_x`: number of local workgroups to dispatch in the X + /// dimension. + /// - `groupcount_y`: number of local workgroups to dispatch in the Y + /// dimension. + /// - `groupcount_z`: number of local workgroups to dispatch in the Z + /// dimension. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DispatchGPUCompute( + compute_pass: *mut SDL_GPUComputePass, + groupcount_x: Uint32, + groupcount_y: Uint32, + groupcount_z: Uint32, + ); +} + +unsafe extern "C" { + /// Dispatches compute work with parameters set from a buffer. + /// + /// The buffer layout should match the layout of + /// [`SDL_GPUIndirectDispatchCommand`]. You must not call this function before + /// binding a compute pipeline. + /// + /// A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and + /// the dispatches write to the same resource region as each other, there is no + /// guarantee of which order the writes will occur. If the write order matters, + /// you MUST end the compute pass and begin another one. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// - `buffer`: a buffer containing dispatch parameters. + /// - `offset`: the offset to start reading from the dispatch buffer. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DispatchGPUComputeIndirect( + compute_pass: *mut SDL_GPUComputePass, + buffer: *mut SDL_GPUBuffer, + offset: Uint32, + ); +} + +unsafe extern "C" { + /// Ends the current compute pass. + /// + /// All bound compute state on the command buffer is unset. The compute pass + /// handle is now invalid. + /// + /// ## Parameters + /// - `compute_pass`: a compute pass handle. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EndGPUComputePass(compute_pass: *mut SDL_GPUComputePass); +} + +unsafe extern "C" { + /// Maps a transfer buffer into application address space. + /// + /// You must unmap the transfer buffer before encoding upload commands. The + /// memory is owned by the graphics driver - do NOT call [`SDL_free()`] on the + /// returned pointer. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `transfer_buffer`: a transfer buffer. + /// - `cycle`: if true, cycles the transfer buffer if it is already bound. + /// + /// ## Return value + /// Returns the address of the mapped transfer buffer memory, or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_MapGPUTransferBuffer( + device: *mut SDL_GPUDevice, + transfer_buffer: *mut SDL_GPUTransferBuffer, + cycle: ::core::primitive::bool, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Unmaps a previously mapped transfer buffer. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `transfer_buffer`: a previously mapped transfer buffer. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UnmapGPUTransferBuffer( + device: *mut SDL_GPUDevice, + transfer_buffer: *mut SDL_GPUTransferBuffer, + ); +} + +unsafe extern "C" { + /// Begins a copy pass on a command buffer. + /// + /// All operations related to copying to or from buffers or textures take place + /// inside a copy pass. You must not begin another copy pass, or a render pass + /// or compute pass before ending the copy pass. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// + /// ## Return value + /// Returns a copy pass handle. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_EndGPUCopyPass`] + pub fn SDL_BeginGPUCopyPass(command_buffer: *mut SDL_GPUCommandBuffer) -> *mut SDL_GPUCopyPass; +} + +unsafe extern "C" { + /// Uploads data from a transfer buffer to a texture. + /// + /// The upload occurs on the GPU timeline. You may assume that the upload has + /// finished in subsequent commands. + /// + /// You must align the data in the transfer buffer to a multiple of the texel + /// size of the texture format. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// - `source`: the source transfer buffer with image layout information. + /// - `destination`: the destination texture region. + /// - `cycle`: if true, cycles the texture if the texture is bound, otherwise + /// overwrites the data. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UploadToGPUTexture( + copy_pass: *mut SDL_GPUCopyPass, + source: *const SDL_GPUTextureTransferInfo, + destination: *const SDL_GPUTextureRegion, + cycle: ::core::primitive::bool, + ); +} + +unsafe extern "C" { + /// Uploads data from a transfer buffer to a buffer. + /// + /// The upload occurs on the GPU timeline. You may assume that the upload has + /// finished in subsequent commands. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// - `source`: the source transfer buffer with offset. + /// - `destination`: the destination buffer with offset and size. + /// - `cycle`: if true, cycles the buffer if it is already bound, otherwise + /// overwrites the data. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UploadToGPUBuffer( + copy_pass: *mut SDL_GPUCopyPass, + source: *const SDL_GPUTransferBufferLocation, + destination: *const SDL_GPUBufferRegion, + cycle: ::core::primitive::bool, + ); +} + +unsafe extern "C" { + /// Performs a texture-to-texture copy. + /// + /// This copy occurs on the GPU timeline. You may assume the copy has finished + /// in subsequent commands. + /// + /// This function does not support copying between depth and color textures. + /// For those, copy the texture to a buffer and then to the destination + /// texture. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// - `source`: a source texture region. + /// - `destination`: a destination texture region. + /// - `w`: the width of the region to copy. + /// - `h`: the height of the region to copy. + /// - `d`: the depth of the region to copy. + /// - `cycle`: if true, cycles the destination texture if the destination + /// texture is bound, otherwise overwrites the data. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CopyGPUTextureToTexture( + copy_pass: *mut SDL_GPUCopyPass, + source: *const SDL_GPUTextureLocation, + destination: *const SDL_GPUTextureLocation, + w: Uint32, + h: Uint32, + d: Uint32, + cycle: ::core::primitive::bool, + ); +} + +unsafe extern "C" { + /// Performs a buffer-to-buffer copy. + /// + /// This copy occurs on the GPU timeline. You may assume the copy has finished + /// in subsequent commands. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// - `source`: the buffer and offset to copy from. + /// - `destination`: the buffer and offset to copy to. + /// - `size`: the length of the buffer to copy. + /// - `cycle`: if true, cycles the destination buffer if it is already bound, + /// otherwise overwrites the data. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CopyGPUBufferToBuffer( + copy_pass: *mut SDL_GPUCopyPass, + source: *const SDL_GPUBufferLocation, + destination: *const SDL_GPUBufferLocation, + size: Uint32, + cycle: ::core::primitive::bool, + ); +} + +unsafe extern "C" { + /// Copies data from a texture to a transfer buffer on the GPU timeline. + /// + /// This data is not guaranteed to be copied until the command buffer fence is + /// signaled. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// - `source`: the source texture region. + /// - `destination`: the destination transfer buffer with image layout + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DownloadFromGPUTexture( + copy_pass: *mut SDL_GPUCopyPass, + source: *const SDL_GPUTextureRegion, + destination: *const SDL_GPUTextureTransferInfo, + ); +} + +unsafe extern "C" { + /// Copies data from a buffer to a transfer buffer on the GPU timeline. + /// + /// This data is not guaranteed to be copied until the command buffer fence is + /// signaled. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// - `source`: the source buffer with offset and size. + /// - `destination`: the destination transfer buffer with offset. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DownloadFromGPUBuffer( + copy_pass: *mut SDL_GPUCopyPass, + source: *const SDL_GPUBufferRegion, + destination: *const SDL_GPUTransferBufferLocation, + ); +} + +unsafe extern "C" { + /// Ends the current copy pass. + /// + /// ## Parameters + /// - `copy_pass`: a copy pass handle. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EndGPUCopyPass(copy_pass: *mut SDL_GPUCopyPass); +} + +unsafe extern "C" { + /// Generates mipmaps for the given texture. + /// + /// This function must not be called inside of any pass. + /// + /// ## Parameters + /// - `command_buffer`: a command_buffer. + /// - `texture`: a texture with more than 1 mip level. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GenerateMipmapsForGPUTexture( + command_buffer: *mut SDL_GPUCommandBuffer, + texture: *mut SDL_GPUTexture, + ); +} + +unsafe extern "C" { + /// Blits from a source texture region to a destination texture region. + /// + /// This function must not be called inside of any pass. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `info`: the blit info struct containing the blit parameters. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_BlitGPUTexture( + command_buffer: *mut SDL_GPUCommandBuffer, + info: *const SDL_GPUBlitInfo, + ); +} + +unsafe extern "C" { + /// Determines whether a swapchain composition is supported by the window. + /// + /// The window must be claimed before calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: an [`SDL_Window`]. + /// - `swapchain_composition`: the swapchain composition to check. + /// + /// ## Return value + /// Returns true if supported, false if unsupported. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClaimWindowForGPUDevice`] + pub fn SDL_WindowSupportsGPUSwapchainComposition( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + swapchain_composition: SDL_GPUSwapchainComposition, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determines whether a presentation mode is supported by the window. + /// + /// The window must be claimed before calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: an [`SDL_Window`]. + /// - `present_mode`: the presentation mode to check. + /// + /// ## Return value + /// Returns true if supported, false if unsupported. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClaimWindowForGPUDevice`] + pub fn SDL_WindowSupportsGPUPresentMode( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + present_mode: SDL_GPUPresentMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Claims a window, creating a swapchain structure for it. + /// + /// This must be called before [`SDL_AcquireGPUSwapchainTexture`] is called using + /// the window. You should only call this function from the thread that created + /// the window. + /// + /// The swapchain will be created with [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR`] and + /// [`SDL_GPU_PRESENTMODE_VSYNC`]. If you want to have different swapchain + /// parameters, you must call [`SDL_SetGPUSwapchainParameters`] after claiming the + /// window. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: an [`SDL_Window`]. + /// + /// ## Return value + /// Returns true on success, or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called from the thread that + /// created the window. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] + /// - [`SDL_ReleaseWindowFromGPUDevice`] + /// - [`SDL_WindowSupportsGPUPresentMode`] + /// - [`SDL_WindowSupportsGPUSwapchainComposition`] + pub fn SDL_ClaimWindowForGPUDevice( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unclaims a window, destroying its swapchain structure. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: an [`SDL_Window`] that has been claimed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClaimWindowForGPUDevice`] + pub fn SDL_ReleaseWindowFromGPUDevice(device: *mut SDL_GPUDevice, window: *mut SDL_Window); +} + +unsafe extern "C" { + /// Changes the swapchain parameters for the given claimed window. + /// + /// This function will fail if the requested present mode or swapchain + /// composition are unsupported by the device. Check if the parameters are + /// supported via [`SDL_WindowSupportsGPUPresentMode`] / + /// [`SDL_WindowSupportsGPUSwapchainComposition`] prior to calling this function. + /// + /// [`SDL_GPU_PRESENTMODE_VSYNC`] with [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR`] is always + /// supported. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: an [`SDL_Window`] that has been claimed. + /// - `swapchain_composition`: the desired composition of the swapchain. + /// - `present_mode`: the desired present mode for the swapchain. + /// + /// ## Return value + /// Returns true if successful, false on error; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WindowSupportsGPUPresentMode`] + /// - [`SDL_WindowSupportsGPUSwapchainComposition`] + pub fn SDL_SetGPUSwapchainParameters( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + swapchain_composition: SDL_GPUSwapchainComposition, + present_mode: SDL_GPUPresentMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Configures the maximum allowed number of frames in flight. + /// + /// The default value when the device is created is 2. This means that after + /// you have submitted 2 frames for presentation, if the GPU has not finished + /// working on the first frame, [`SDL_AcquireGPUSwapchainTexture()`] will fill the + /// swapchain texture pointer with NULL, and + /// [`SDL_WaitAndAcquireGPUSwapchainTexture()`] will block. + /// + /// Higher values increase throughput at the expense of visual latency. Lower + /// values decrease visual latency at the expense of throughput. + /// + /// Note that calling this function will stall and flush the command queue to + /// prevent synchronization issues. + /// + /// The minimum value of allowed frames in flight is 1, and the maximum is 3. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `allowed_frames_in_flight`: the maximum number of frames that can be + /// pending on the GPU. + /// + /// ## Return value + /// Returns true if successful, false on error; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetGPUAllowedFramesInFlight( + device: *mut SDL_GPUDevice, + allowed_frames_in_flight: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Obtains the texture format of the swapchain for the given window. + /// + /// Note that this format can change if the swapchain parameters change. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: an [`SDL_Window`] that has been claimed. + /// + /// ## Return value + /// Returns the texture format of the swapchain. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGPUSwapchainTextureFormat( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + ) -> SDL_GPUTextureFormat; +} + +unsafe extern "C" { + /// Acquire a texture to use in presentation. + /// + /// When a swapchain texture is acquired on a command buffer, it will + /// automatically be submitted for presentation when the command buffer is + /// submitted. The swapchain texture should only be referenced by the command + /// buffer used to acquire it. + /// + /// This function will fill the swapchain texture handle with NULL if too many + /// frames are in flight. This is not an error. This NULL pointer should not be + /// passed back into SDL. Instead, it should be considered as an indication to + /// wait until the swapchain is available. + /// + /// If you use this function, it is possible to create a situation where many + /// command buffers are allocated while the rendering context waits for the GPU + /// to catch up, which will cause memory usage to grow. You should use + /// [`SDL_WaitAndAcquireGPUSwapchainTexture()`] unless you know what you are doing + /// with timing. + /// + /// The swapchain texture is managed by the implementation and must not be + /// freed by the user. You MUST NOT call this function from any thread other + /// than the one that created the window. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `window`: a window that has been claimed. + /// - `swapchain_texture`: a pointer filled in with a swapchain texture + /// handle. + /// - `swapchain_texture_width`: a pointer filled in with the swapchain + /// texture width, may be NULL. + /// - `swapchain_texture_height`: a pointer filled in with the swapchain + /// texture height, may be NULL. + /// + /// ## Return value + /// Returns true on success, false on error; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called from the thread that + /// created the window. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ClaimWindowForGPUDevice`] + /// - [`SDL_SubmitGPUCommandBuffer`] + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + /// - [`SDL_CancelGPUCommandBuffer`] + /// - [`SDL_GetWindowSizeInPixels`] + /// - [`SDL_WaitForGPUSwapchain`] + /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] + /// - [`SDL_SetGPUAllowedFramesInFlight`] + pub fn SDL_AcquireGPUSwapchainTexture( + command_buffer: *mut SDL_GPUCommandBuffer, + window: *mut SDL_Window, + swapchain_texture: *mut *mut SDL_GPUTexture, + swapchain_texture_width: *mut Uint32, + swapchain_texture_height: *mut Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Blocks the thread until a swapchain texture is available to be acquired. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `window`: a window that has been claimed. + /// + /// ## Return value + /// Returns true on success, false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called from the thread that + /// created the window. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AcquireGPUSwapchainTexture`] + /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] + /// - [`SDL_SetGPUAllowedFramesInFlight`] + pub fn SDL_WaitForGPUSwapchain( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Blocks the thread until a swapchain texture is available to be acquired, + /// and then acquires it. + /// + /// When a swapchain texture is acquired on a command buffer, it will + /// automatically be submitted for presentation when the command buffer is + /// submitted. The swapchain texture should only be referenced by the command + /// buffer used to acquire it. It is an error to call + /// [`SDL_CancelGPUCommandBuffer()`] after a swapchain texture is acquired. + /// + /// This function can fill the swapchain texture handle with NULL in certain + /// cases, for example if the window is minimized. This is not an error. You + /// should always make sure to check whether the pointer is NULL before + /// actually using it. + /// + /// The swapchain texture is managed by the implementation and must not be + /// freed by the user. You MUST NOT call this function from any thread other + /// than the one that created the window. + /// + /// The swapchain texture is write-only and cannot be used as a sampler or for + /// another reading operation. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// - `window`: a window that has been claimed. + /// - `swapchain_texture`: a pointer filled in with a swapchain texture + /// handle. + /// - `swapchain_texture_width`: a pointer filled in with the swapchain + /// texture width, may be NULL. + /// - `swapchain_texture_height`: a pointer filled in with the swapchain + /// texture height, may be NULL. + /// + /// ## Return value + /// Returns true on success, false on error; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called from the thread that + /// created the window. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SubmitGPUCommandBuffer`] + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + /// - [`SDL_AcquireGPUSwapchainTexture`] + pub fn SDL_WaitAndAcquireGPUSwapchainTexture( + command_buffer: *mut SDL_GPUCommandBuffer, + window: *mut SDL_Window, + swapchain_texture: *mut *mut SDL_GPUTexture, + swapchain_texture_width: *mut Uint32, + swapchain_texture_height: *mut Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Submits a command buffer so its commands can be processed on the GPU. + /// + /// It is invalid to use the command buffer after this is called. + /// + /// This must be called from the thread the command buffer was acquired on. + /// + /// All commands in the submission are guaranteed to begin executing before any + /// command in a subsequent submission begins executing. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// + /// ## Return value + /// Returns true on success, false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AcquireGPUCommandBuffer`] + /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] + /// - [`SDL_AcquireGPUSwapchainTexture`] + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + pub fn SDL_SubmitGPUCommandBuffer( + command_buffer: *mut SDL_GPUCommandBuffer, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Submits a command buffer so its commands can be processed on the GPU, and + /// acquires a fence associated with the command buffer. + /// + /// You must release this fence when it is no longer needed or it will cause a + /// leak. It is invalid to use the command buffer after this is called. + /// + /// This must be called from the thread the command buffer was acquired on. + /// + /// All commands in the submission are guaranteed to begin executing before any + /// command in a subsequent submission begins executing. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// + /// ## Return value + /// Returns a fence associated with the command buffer, or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AcquireGPUCommandBuffer`] + /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] + /// - [`SDL_AcquireGPUSwapchainTexture`] + /// - [`SDL_SubmitGPUCommandBuffer`] + /// - [`SDL_ReleaseGPUFence`] + pub fn SDL_SubmitGPUCommandBufferAndAcquireFence( + command_buffer: *mut SDL_GPUCommandBuffer, + ) -> *mut SDL_GPUFence; +} + +unsafe extern "C" { + /// Cancels a command buffer. + /// + /// None of the enqueued commands are executed. + /// + /// It is an error to call this function after a swapchain texture has been + /// acquired. + /// + /// This must be called from the thread the command buffer was acquired on. + /// + /// You must not reference the command buffer after calling this function. + /// + /// ## Parameters + /// - `command_buffer`: a command buffer. + /// + /// ## Return value + /// Returns true on success, false on error; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`] + /// - [`SDL_AcquireGPUCommandBuffer`] + /// - [`SDL_AcquireGPUSwapchainTexture`] + pub fn SDL_CancelGPUCommandBuffer( + command_buffer: *mut SDL_GPUCommandBuffer, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Blocks the thread until the GPU is completely idle. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// + /// ## Return value + /// Returns true on success, false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WaitForGPUFences`] + pub fn SDL_WaitForGPUIdle(device: *mut SDL_GPUDevice) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Blocks the thread until the given fences are signaled. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `wait_all`: if 0, wait for any fence to be signaled, if 1, wait for all + /// fences to be signaled. + /// - `fences`: an array of fences to wait on. + /// - `num_fences`: the number of fences in the fences array. + /// + /// ## Return value + /// Returns true on success, false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + /// - [`SDL_WaitForGPUIdle`] + pub fn SDL_WaitForGPUFences( + device: *mut SDL_GPUDevice, + wait_all: ::core::primitive::bool, + fences: *const *mut SDL_GPUFence, + num_fences: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Checks the status of a fence. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `fence`: a fence. + /// + /// ## Return value + /// Returns true if the fence is signaled, false if it is not. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + pub fn SDL_QueryGPUFence( + device: *mut SDL_GPUDevice, + fence: *mut SDL_GPUFence, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Releases a fence obtained from [`SDL_SubmitGPUCommandBufferAndAcquireFence`]. + /// + /// You must not reference the fence after calling this function. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `fence`: a fence. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] + pub fn SDL_ReleaseGPUFence(device: *mut SDL_GPUDevice, fence: *mut SDL_GPUFence); +} + +unsafe extern "C" { + /// Obtains the texel block size for a texture format. + /// + /// ## Parameters + /// - `format`: the texture format you want to know the texel size of. + /// + /// ## Return value + /// Returns the texel block size of the texture format. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UploadToGPUTexture`] + pub fn SDL_GPUTextureFormatTexelBlockSize(format: SDL_GPUTextureFormat) -> Uint32; +} + +unsafe extern "C" { + /// Determines whether a texture format is supported for a given type and + /// usage. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `format`: the texture format to check. + /// - `type`: the type of texture (2D, 3D, Cube). + /// - `usage`: a bitmask of all usage scenarios to check. + /// + /// ## Return value + /// Returns whether the texture format is supported for this type and usage. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GPUTextureSupportsFormat( + device: *mut SDL_GPUDevice, + format: SDL_GPUTextureFormat, + r#type: SDL_GPUTextureType, + usage: SDL_GPUTextureUsageFlags, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Determines if a sample count for a texture format is supported. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// - `format`: the texture format to check. + /// - `sample_count`: the sample count to check. + /// + /// ## Return value + /// Returns whether the sample count is supported for this texture format. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GPUTextureSupportsSampleCount( + device: *mut SDL_GPUDevice, + format: SDL_GPUTextureFormat, + sample_count: SDL_GPUSampleCount, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the size in bytes of a texture format with dimensions. + /// + /// ## Parameters + /// - `format`: a texture format. + /// - `width`: width in pixels. + /// - `height`: height in pixels. + /// - `depth_or_layer_count`: depth for 3D textures or layer count otherwise. + /// + /// ## Return value + /// Returns the size of a texture with this format and dimensions. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CalculateGPUTextureFormatSize( + format: SDL_GPUTextureFormat, + width: Uint32, + height: Uint32, + depth_or_layer_count: Uint32, + ) -> Uint32; +} + +unsafe extern "C" { + /// Get the SDL pixel format corresponding to a GPU texture format. + /// + /// ## Parameters + /// - `format`: a texture format. + /// + /// ## Return value + /// Returns the corresponding pixel format, or [`SDL_PIXELFORMAT_UNKNOWN`] if + /// there is no corresponding pixel format. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub safe fn SDL_GetPixelFormatFromGPUTextureFormat( + format: SDL_GPUTextureFormat, + ) -> SDL_PixelFormat; +} + +unsafe extern "C" { + /// Get the GPU texture format corresponding to an SDL pixel format. + /// + /// ## Parameters + /// - `format`: a pixel format. + /// + /// ## Return value + /// Returns the corresponding GPU texture format, or + /// [`SDL_GPU_TEXTUREFORMAT_INVALID`] if there is no corresponding GPU + /// texture format. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub safe fn SDL_GetGPUTextureFormatFromPixelFormat( + format: SDL_PixelFormat, + ) -> SDL_GPUTextureFormat; +} + +apply_cfg!(#[cfg(any(doc, all(windows, feature = "target-gdk")))] => { + unsafe extern "C" { + /// Call this to suspend GPU operation on Xbox when you receive the + /// [`SDL_EVENT_DID_ENTER_BACKGROUND`] event. + /// + /// Do NOT call any SDL_GPU functions after calling this function! This must + /// also be called before calling [`SDL_GDKSuspendComplete`]. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddEventWatch`] + pub fn SDL_GDKSuspendGPU(device: *mut SDL_GPUDevice); + } + + unsafe extern "C" { + /// Call this to resume GPU operation on Xbox when you receive the + /// [`SDL_EVENT_WILL_ENTER_FOREGROUND`] event. + /// + /// When resuming, this function MUST be called before calling any other + /// SDL_GPU functions. + /// + /// ## Parameters + /// - `device`: a GPU context. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddEventWatch`] + pub fn SDL_GDKResumeGPU(device: *mut SDL_GPUDevice); + } + +}); + +/// An opaque handle representing a buffer. +/// +/// Used for vertices, indices, indirect draw commands, and general compute +/// data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUBuffer`] +/// - [`SDL_UploadToGPUBuffer`] +/// - [`SDL_DownloadFromGPUBuffer`] +/// - [`SDL_CopyGPUBufferToBuffer`] +/// - [`SDL_BindGPUVertexBuffers`] +/// - [`SDL_BindGPUIndexBuffer`] +/// - [`SDL_BindGPUVertexStorageBuffers`] +/// - [`SDL_BindGPUFragmentStorageBuffers`] +/// - [`SDL_DrawGPUPrimitivesIndirect`] +/// - [`SDL_DrawGPUIndexedPrimitivesIndirect`] +/// - [`SDL_BindGPUComputeStorageBuffers`] +/// - [`SDL_DispatchGPUComputeIndirect`] +/// - [`SDL_ReleaseGPUBuffer`] +#[repr(C)] +pub struct SDL_GPUBuffer { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a command buffer. +/// +/// Most state is managed via command buffers. When setting state using a +/// command buffer, that state is local to the command buffer. +/// +/// Commands only begin execution on the GPU once [`SDL_SubmitGPUCommandBuffer`] is +/// called. Once the command buffer is submitted, it is no longer valid to use +/// it. +/// +/// Command buffers are executed in submission order. If you submit command +/// buffer A and then command buffer B all commands in A will begin executing +/// before any command in B begins executing. +/// +/// In multi-threading scenarios, you should only access a command buffer on +/// the thread you acquired it from. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AcquireGPUCommandBuffer`] +/// - [`SDL_SubmitGPUCommandBuffer`] +/// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] +#[repr(C)] +pub struct SDL_GPUCommandBuffer { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a compute pass. +/// +/// This handle is transient and should not be held or referenced after +/// [`SDL_EndGPUComputePass`] is called. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPUComputePass`] +/// - [`SDL_EndGPUComputePass`] +#[repr(C)] +pub struct SDL_GPUComputePass { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a compute pipeline. +/// +/// Used during compute passes. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUComputePipeline`] +/// - [`SDL_BindGPUComputePipeline`] +/// - [`SDL_ReleaseGPUComputePipeline`] +#[repr(C)] +pub struct SDL_GPUComputePipeline { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a copy pass. +/// +/// This handle is transient and should not be held or referenced after +/// [`SDL_EndGPUCopyPass`] is called. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPUCopyPass`] +/// - [`SDL_EndGPUCopyPass`] +#[repr(C)] +pub struct SDL_GPUCopyPass { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing the SDL_GPU context. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_GPUDevice { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a fence. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`] +/// - [`SDL_QueryGPUFence`] +/// - [`SDL_WaitForGPUFences`] +/// - [`SDL_ReleaseGPUFence`] +#[repr(C)] +pub struct SDL_GPUFence { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a graphics pipeline. +/// +/// Used during render passes. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// - [`SDL_BindGPUGraphicsPipeline`] +/// - [`SDL_ReleaseGPUGraphicsPipeline`] +#[repr(C)] +pub struct SDL_GPUGraphicsPipeline { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a render pass. +/// +/// This handle is transient and should not be held or referenced after +/// [`SDL_EndGPURenderPass`] is called. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BeginGPURenderPass`] +/// - [`SDL_EndGPURenderPass`] +#[repr(C)] +pub struct SDL_GPURenderPass { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a sampler. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUSampler`] +/// - [`SDL_BindGPUVertexSamplers`] +/// - [`SDL_BindGPUFragmentSamplers`] +/// - [`SDL_ReleaseGPUSampler`] +#[repr(C)] +pub struct SDL_GPUSampler { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a compiled shader object. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUShader`] +/// - [`SDL_CreateGPUGraphicsPipeline`] +/// - [`SDL_ReleaseGPUShader`] +#[repr(C)] +pub struct SDL_GPUShader { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a texture. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTexture`] +/// - [`SDL_UploadToGPUTexture`] +/// - [`SDL_DownloadFromGPUTexture`] +/// - [`SDL_CopyGPUTextureToTexture`] +/// - [`SDL_BindGPUVertexSamplers`] +/// - [`SDL_BindGPUVertexStorageTextures`] +/// - [`SDL_BindGPUFragmentSamplers`] +/// - [`SDL_BindGPUFragmentStorageTextures`] +/// - [`SDL_BindGPUComputeStorageTextures`] +/// - [`SDL_GenerateMipmapsForGPUTexture`] +/// - [`SDL_BlitGPUTexture`] +/// - [`SDL_ReleaseGPUTexture`] +#[repr(C)] +pub struct SDL_GPUTexture { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a transfer buffer. +/// +/// Used for transferring data to and from the device. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateGPUTransferBuffer`] +/// - [`SDL_MapGPUTransferBuffer`] +/// - [`SDL_UnmapGPUTransferBuffer`] +/// - [`SDL_UploadToGPUBuffer`] +/// - [`SDL_UploadToGPUTexture`] +/// - [`SDL_DownloadFromGPUBuffer`] +/// - [`SDL_DownloadFromGPUTexture`] +/// - [`SDL_ReleaseGPUTransferBuffer`] +#[repr(C)] +pub struct SDL_GPUTransferBuffer { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/guid.rs b/vendor/sdl3-sys/src/generated/guid.rs new file mode 100644 index 00000000..21275c84 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/guid.rs @@ -0,0 +1,95 @@ +//! A GUID is a 128-bit value that represents something that is uniquely +//! identifiable by this value: "globally unique." +//! +//! SDL provides functions to convert a GUID to/from a string. + +use super::stdinc::*; + +/// An [`SDL_GUID`] is a 128-bit identifier for an input device that identifies +/// that device across runs of SDL programs on the same platform. +/// +/// If the device is detached and then re-attached to a different port, or if +/// the base system is rebooted, the device should still report the same GUID. +/// +/// GUIDs are as precise as possible but are not guaranteed to distinguish +/// physically distinct but equivalent devices. For example, two game +/// controllers from the same vendor with the same product ID and revision may +/// have the same GUID. +/// +/// GUIDs may be platform-dependent (i.e., the same device may report different +/// GUIDs on different operating systems). +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GUID { + pub data: [Uint8; 16], +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GUID { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "SDL_GUID({self})") + } +} + +#[cfg(any(feature = "display-impls", feature = "debug-impls"))] +impl ::core::fmt::Display for SDL_GUID { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + for byte in self.data { + write!(f, "{byte:02x}")?; + } + Ok(()) + } +} + +unsafe extern "C" { + /// Get an ASCII string representation for a given [`SDL_GUID`]. + /// + /// ## Parameters + /// - `guid`: the [`SDL_GUID`] you wish to convert to string. + /// - `pszGUID`: buffer in which to write the ASCII string. + /// - `cbGUID`: the size of pszGUID, should be at least 33 bytes. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StringToGUID`] + pub fn SDL_GUIDToString( + guid: SDL_GUID, + pszGUID: *mut ::core::ffi::c_char, + cbGUID: ::core::ffi::c_int, + ); +} + +unsafe extern "C" { + /// Convert a GUID string into a [`SDL_GUID`] structure. + /// + /// Performs no error checking. If this function is given a string containing + /// an invalid GUID, the function will silently succeed, but the GUID generated + /// will not be useful. + /// + /// ## Parameters + /// - `pchGUID`: string containing an ASCII representation of a GUID. + /// + /// ## Return value + /// Returns a [`SDL_GUID`] structure. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GUIDToString`] + pub fn SDL_StringToGUID(pchGUID: *const ::core::ffi::c_char) -> SDL_GUID; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/haptic.rs b/vendor/sdl3-sys/src/generated/haptic.rs new file mode 100644 index 00000000..d9d5a0f1 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/haptic.rs @@ -0,0 +1,2289 @@ +//! The SDL haptic subsystem manages haptic (force feedback) devices. +//! +//! The basic usage is as follows: +//! +//! - Initialize the subsystem ([`SDL_INIT_HAPTIC`]). +//! - Open a haptic device. +//! - [`SDL_OpenHaptic()`] to open from index. +//! - [`SDL_OpenHapticFromJoystick()`] to open from an existing joystick. +//! - Create an effect ([`SDL_HapticEffect`]). +//! - Upload the effect with [`SDL_CreateHapticEffect()`]. +//! - Run the effect with [`SDL_RunHapticEffect()`]. +//! - (optional) Free the effect with [`SDL_DestroyHapticEffect()`]. +//! - Close the haptic device with [`SDL_CloseHaptic()`]. +//! +//! Simple rumble example: +//! +//! ```c +//! SDL_Haptic *haptic = NULL; +//! +//! // Open the device +//! SDL_HapticID *haptics = SDL_GetHaptics(NULL); +//! if (haptics) { +//! haptic = SDL_OpenHaptic(haptics[0]); +//! SDL_free(haptics); +//! } +//! if (haptic == NULL) +//! return; +//! +//! // Initialize simple rumble +//! if (!SDL_InitHapticRumble(haptic)) +//! return; +//! +//! // Play effect at 50% strength for 2 seconds +//! if (!SDL_PlayHapticRumble(haptic, 0.5, 2000)) +//! return; +//! SDL_Delay(2000); +//! +//! // Clean up +//! SDL_CloseHaptic(haptic); +//! ``` +//! +//! Complete example: +//! +//! ```c +//! bool test_haptic(SDL_Joystick *joystick) +//! { +//! SDL_Haptic *haptic; +//! SDL_HapticEffect effect; +//! SDL_HapticEffectID effect_id; +//! +//! // Open the device +//! haptic = SDL_OpenHapticFromJoystick(joystick); +//! if (haptic == NULL) return false; // Most likely joystick isn't haptic +//! +//! // See if it can do sine waves +//! if ((SDL_GetHapticFeatures(haptic) & SDL_HAPTIC_SINE)==0) { +//! SDL_CloseHaptic(haptic); // No sine effect +//! return false; +//! } +//! +//! // Create the effect +//! SDL_memset(&effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default +//! effect.type = SDL_HAPTIC_SINE; +//! effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates +//! effect.periodic.direction.dir[0] = 18000; // Force comes from south +//! effect.periodic.period = 1000; // 1000 ms +//! effect.periodic.magnitude = 20000; // 20000/32767 strength +//! effect.periodic.length = 5000; // 5 seconds long +//! effect.periodic.attack_length = 1000; // Takes 1 second to get max strength +//! effect.periodic.fade_length = 1000; // Takes 1 second to fade away +//! +//! // Upload the effect +//! effect_id = SDL_CreateHapticEffect(haptic, &effect); +//! +//! // Test the effect +//! SDL_RunHapticEffect(haptic, effect_id, 1); +//! SDL_Delay(5000); // Wait for the effect to finish +//! +//! // We destroy the effect, although closing the device also does this +//! SDL_DestroyHapticEffect(haptic, effect_id); +//! +//! // Close the device +//! SDL_CloseHaptic(haptic); +//! +//! return true; // Success +//! } +//! ``` +//! +//! Note that the SDL haptic subsystem is not thread-safe. + +use super::stdinc::*; + +use super::error::*; + +use super::joystick::*; + +/// Used to play a device an infinite number of times. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RunHapticEffect`] +pub const SDL_HAPTIC_INFINITY: ::core::primitive::u32 = 4294967295_u32; + +/// * Type of haptic effect. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`CONSTANT`](SDL_HapticEffectType::CONSTANT) | [`SDL_HAPTIC_CONSTANT`] | Constant effect supported. Constant haptic effect. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticCondition`] | +/// | [`SINE`](SDL_HapticEffectType::SINE) | [`SDL_HAPTIC_SINE`] | Sine wave effect supported. Periodic haptic effect that simulates sine waves. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticPeriodic`] | +/// | [`SQUARE`](SDL_HapticEffectType::SQUARE) | [`SDL_HAPTIC_SQUARE`] | Square wave effect supported. Periodic haptic effect that simulates square waves. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticPeriodic`] | +/// | [`TRIANGLE`](SDL_HapticEffectType::TRIANGLE) | [`SDL_HAPTIC_TRIANGLE`] | Triangle wave effect supported. Periodic haptic effect that simulates triangular waves. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticPeriodic`] | +/// | [`SAWTOOTHUP`](SDL_HapticEffectType::SAWTOOTHUP) | [`SDL_HAPTIC_SAWTOOTHUP`] | Sawtoothup wave effect supported. Periodic haptic effect that simulates saw tooth up waves. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticPeriodic`] | +/// | [`SAWTOOTHDOWN`](SDL_HapticEffectType::SAWTOOTHDOWN) | [`SDL_HAPTIC_SAWTOOTHDOWN`] | Sawtoothdown wave effect supported. Periodic haptic effect that simulates saw tooth down waves. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticPeriodic`] | +/// | [`RAMP`](SDL_HapticEffectType::RAMP) | [`SDL_HAPTIC_RAMP`] | Ramp effect supported. Ramp haptic effect. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticRamp`] | +/// | [`SPRING`](SDL_HapticEffectType::SPRING) | [`SDL_HAPTIC_SPRING`] | Spring effect supported - uses axes position. Condition haptic effect that simulates a spring. Effect is based on the axes position. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticCondition`] | +/// | [`DAMPER`](SDL_HapticEffectType::DAMPER) | [`SDL_HAPTIC_DAMPER`] | Damper effect supported - uses axes velocity. Condition haptic effect that simulates dampening. Effect is based on the axes velocity. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticCondition`] | +/// | [`INERTIA`](SDL_HapticEffectType::INERTIA) | [`SDL_HAPTIC_INERTIA`] | Inertia effect supported - uses axes acceleration. Condition haptic effect that simulates inertia. Effect is based on the axes acceleration. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticCondition`] | +/// | [`FRICTION`](SDL_HapticEffectType::FRICTION) | [`SDL_HAPTIC_FRICTION`] | Friction effect supported - uses axes movement. Condition haptic effect that simulates friction. Effect is based on the axes movement. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticCondition`] | +/// | [`LEFTRIGHT`](SDL_HapticEffectType::LEFTRIGHT) | [`SDL_HAPTIC_LEFTRIGHT`] | Left/Right effect supported. Haptic effect for direct control over high/low frequency motors. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticLeftRight`] | +/// | [`RESERVED1`](SDL_HapticEffectType::RESERVED1) | [`SDL_HAPTIC_RESERVED1`] | Reserved for future use. \since This macro is available since SDL 3.2.0. | +/// | [`RESERVED2`](SDL_HapticEffectType::RESERVED2) | [`SDL_HAPTIC_RESERVED2`] | Reserved for future use. \since This macro is available since SDL 3.2.0. | +/// | [`RESERVED3`](SDL_HapticEffectType::RESERVED3) | [`SDL_HAPTIC_RESERVED3`] | Reserved for future use. \since This macro is available since SDL 3.2.0. | +/// | [`CUSTOM`](SDL_HapticEffectType::CUSTOM) | [`SDL_HAPTIC_CUSTOM`] | Custom effect is supported. User defined custom haptic effect. \since This macro is available since SDL 3.2.0. | +/// | [`GAIN`](SDL_HapticEffectType::GAIN) | [`SDL_HAPTIC_GAIN`] | Device can set global gain. Device supports setting the global gain. \since This macro is available since SDL 3.2.0. \sa [`SDL_SetHapticGain`] | +/// | [`AUTOCENTER`](SDL_HapticEffectType::AUTOCENTER) | [`SDL_HAPTIC_AUTOCENTER`] | Device can set autocenter. Device supports setting autocenter. \since This macro is available since SDL 3.2.0. \sa [`SDL_SetHapticAutocenter`] | +/// | [`STATUS`](SDL_HapticEffectType::STATUS) | [`SDL_HAPTIC_STATUS`] | Device can be queried for effect status. Device supports querying effect status. \since This macro is available since SDL 3.2.0. \sa [`SDL_GetHapticEffectStatus`] | +/// | [`PAUSE`](SDL_HapticEffectType::PAUSE) | [`SDL_HAPTIC_PAUSE`] | Device can be paused. Devices supports being paused. \since This macro is available since SDL 3.2.0. \sa [`SDL_PauseHaptic`] \sa [`SDL_ResumeHaptic`] | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_HapticEffectType(pub Uint16); + +impl ::core::cmp::PartialEq for SDL_HapticEffectType { + #[inline(always)] + fn eq(&self, other: &Uint16) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint16 { + #[inline(always)] + fn eq(&self, other: &SDL_HapticEffectType) -> bool { + self == &other.0 + } +} + +impl From for Uint16 { + #[inline(always)] + fn from(value: SDL_HapticEffectType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_HapticEffectType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_HapticEffectType(")?; + let all_bits = all_bits | Self::CONSTANT.0; + if (Self::CONSTANT != 0 || self.0 == 0) && *self & Self::CONSTANT == Self::CONSTANT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CONSTANT")?; + } + let all_bits = all_bits | Self::SINE.0; + if (Self::SINE != 0 || self.0 == 0) && *self & Self::SINE == Self::SINE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SINE")?; + } + let all_bits = all_bits | Self::SQUARE.0; + if (Self::SQUARE != 0 || self.0 == 0) && *self & Self::SQUARE == Self::SQUARE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SQUARE")?; + } + let all_bits = all_bits | Self::TRIANGLE.0; + if (Self::TRIANGLE != 0 || self.0 == 0) && *self & Self::TRIANGLE == Self::TRIANGLE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "TRIANGLE")?; + } + let all_bits = all_bits | Self::SAWTOOTHUP.0; + if (Self::SAWTOOTHUP != 0 || self.0 == 0) && *self & Self::SAWTOOTHUP == Self::SAWTOOTHUP { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SAWTOOTHUP")?; + } + let all_bits = all_bits | Self::SAWTOOTHDOWN.0; + if (Self::SAWTOOTHDOWN != 0 || self.0 == 0) + && *self & Self::SAWTOOTHDOWN == Self::SAWTOOTHDOWN + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SAWTOOTHDOWN")?; + } + let all_bits = all_bits | Self::RAMP.0; + if (Self::RAMP != 0 || self.0 == 0) && *self & Self::RAMP == Self::RAMP { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RAMP")?; + } + let all_bits = all_bits | Self::SPRING.0; + if (Self::SPRING != 0 || self.0 == 0) && *self & Self::SPRING == Self::SPRING { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SPRING")?; + } + let all_bits = all_bits | Self::DAMPER.0; + if (Self::DAMPER != 0 || self.0 == 0) && *self & Self::DAMPER == Self::DAMPER { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DAMPER")?; + } + let all_bits = all_bits | Self::INERTIA.0; + if (Self::INERTIA != 0 || self.0 == 0) && *self & Self::INERTIA == Self::INERTIA { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INERTIA")?; + } + let all_bits = all_bits | Self::FRICTION.0; + if (Self::FRICTION != 0 || self.0 == 0) && *self & Self::FRICTION == Self::FRICTION { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "FRICTION")?; + } + let all_bits = all_bits | Self::LEFTRIGHT.0; + if (Self::LEFTRIGHT != 0 || self.0 == 0) && *self & Self::LEFTRIGHT == Self::LEFTRIGHT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LEFTRIGHT")?; + } + let all_bits = all_bits | Self::RESERVED1.0; + if (Self::RESERVED1 != 0 || self.0 == 0) && *self & Self::RESERVED1 == Self::RESERVED1 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RESERVED1")?; + } + let all_bits = all_bits | Self::RESERVED2.0; + if (Self::RESERVED2 != 0 || self.0 == 0) && *self & Self::RESERVED2 == Self::RESERVED2 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RESERVED2")?; + } + let all_bits = all_bits | Self::RESERVED3.0; + if (Self::RESERVED3 != 0 || self.0 == 0) && *self & Self::RESERVED3 == Self::RESERVED3 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RESERVED3")?; + } + let all_bits = all_bits | Self::CUSTOM.0; + if (Self::CUSTOM != 0 || self.0 == 0) && *self & Self::CUSTOM == Self::CUSTOM { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CUSTOM")?; + } + let all_bits = all_bits | Self::GAIN.0; + if (Self::GAIN != 0 || self.0 == 0) && *self & Self::GAIN == Self::GAIN { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "GAIN")?; + } + let all_bits = all_bits | Self::AUTOCENTER.0; + if (Self::AUTOCENTER != 0 || self.0 == 0) && *self & Self::AUTOCENTER == Self::AUTOCENTER { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "AUTOCENTER")?; + } + let all_bits = all_bits | Self::STATUS.0; + if (Self::STATUS != 0 || self.0 == 0) && *self & Self::STATUS == Self::STATUS { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "STATUS")?; + } + let all_bits = all_bits | Self::PAUSE.0; + if (Self::PAUSE != 0 || self.0 == 0) && *self & Self::PAUSE == Self::PAUSE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "PAUSE")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_HapticEffectType { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_HapticEffectType { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_HapticEffectType { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_HapticEffectType { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_HapticEffectType { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_HapticEffectType { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_HapticEffectType { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_HapticEffectType { + /// Constant effect supported. + /// + /// Constant haptic effect. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticCondition`] + pub const CONSTANT: Self = Self((1_u32 as Uint16)); + /// Sine wave effect supported. + /// + /// Periodic haptic effect that simulates sine waves. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticPeriodic`] + pub const SINE: Self = Self((2_u32 as Uint16)); + /// Square wave effect supported. + /// + /// Periodic haptic effect that simulates square waves. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticPeriodic`] + pub const SQUARE: Self = Self((4_u32 as Uint16)); + /// Triangle wave effect supported. + /// + /// Periodic haptic effect that simulates triangular waves. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticPeriodic`] + pub const TRIANGLE: Self = Self((8_u32 as Uint16)); + /// Sawtoothup wave effect supported. + /// + /// Periodic haptic effect that simulates saw tooth up waves. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticPeriodic`] + pub const SAWTOOTHUP: Self = Self((16_u32 as Uint16)); + /// Sawtoothdown wave effect supported. + /// + /// Periodic haptic effect that simulates saw tooth down waves. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticPeriodic`] + pub const SAWTOOTHDOWN: Self = Self((32_u32 as Uint16)); + /// Ramp effect supported. + /// + /// Ramp haptic effect. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticRamp`] + pub const RAMP: Self = Self((64_u32 as Uint16)); + /// Spring effect supported - uses axes position. + /// + /// Condition haptic effect that simulates a spring. Effect is based on the + /// axes position. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticCondition`] + pub const SPRING: Self = Self((128_u32 as Uint16)); + /// Damper effect supported - uses axes velocity. + /// + /// Condition haptic effect that simulates dampening. Effect is based on the + /// axes velocity. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticCondition`] + pub const DAMPER: Self = Self((256_u32 as Uint16)); + /// Inertia effect supported - uses axes acceleration. + /// + /// Condition haptic effect that simulates inertia. Effect is based on the axes + /// acceleration. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticCondition`] + pub const INERTIA: Self = Self((512_u32 as Uint16)); + /// Friction effect supported - uses axes movement. + /// + /// Condition haptic effect that simulates friction. Effect is based on the + /// axes movement. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticCondition`] + pub const FRICTION: Self = Self((1024_u32 as Uint16)); + /// Left/Right effect supported. + /// + /// Haptic effect for direct control over high/low frequency motors. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticLeftRight`] + pub const LEFTRIGHT: Self = Self((2048_u32 as Uint16)); + /// Reserved for future use. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const RESERVED1: Self = Self((4096_u32 as Uint16)); + /// Reserved for future use. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const RESERVED2: Self = Self((8192_u32 as Uint16)); + /// Reserved for future use. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const RESERVED3: Self = Self((16384_u32 as Uint16)); + /// Custom effect is supported. + /// + /// User defined custom haptic effect. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const CUSTOM: Self = Self((32768_u32 as Uint16)); + /// Device can set global gain. + /// + /// Device supports setting the global gain. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetHapticGain`] + pub const GAIN: Self = Self((65536_u32 as Uint16)); + /// Device can set autocenter. + /// + /// Device supports setting autocenter. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetHapticAutocenter`] + pub const AUTOCENTER: Self = Self((131072_u32 as Uint16)); + /// Device can be queried for effect status. + /// + /// Device supports querying effect status. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticEffectStatus`] + pub const STATUS: Self = Self((262144_u32 as Uint16)); + /// Device can be paused. + /// + /// Devices supports being paused. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PauseHaptic`] + /// - [`SDL_ResumeHaptic`] + pub const PAUSE: Self = Self((524288_u32 as Uint16)); +} + +/// Constant effect supported. +/// +/// Constant haptic effect. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticCondition`] +pub const SDL_HAPTIC_CONSTANT: SDL_HapticEffectType = SDL_HapticEffectType::CONSTANT; +/// Sine wave effect supported. +/// +/// Periodic haptic effect that simulates sine waves. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticPeriodic`] +pub const SDL_HAPTIC_SINE: SDL_HapticEffectType = SDL_HapticEffectType::SINE; +/// Square wave effect supported. +/// +/// Periodic haptic effect that simulates square waves. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticPeriodic`] +pub const SDL_HAPTIC_SQUARE: SDL_HapticEffectType = SDL_HapticEffectType::SQUARE; +/// Triangle wave effect supported. +/// +/// Periodic haptic effect that simulates triangular waves. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticPeriodic`] +pub const SDL_HAPTIC_TRIANGLE: SDL_HapticEffectType = SDL_HapticEffectType::TRIANGLE; +/// Sawtoothup wave effect supported. +/// +/// Periodic haptic effect that simulates saw tooth up waves. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticPeriodic`] +pub const SDL_HAPTIC_SAWTOOTHUP: SDL_HapticEffectType = SDL_HapticEffectType::SAWTOOTHUP; +/// Sawtoothdown wave effect supported. +/// +/// Periodic haptic effect that simulates saw tooth down waves. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticPeriodic`] +pub const SDL_HAPTIC_SAWTOOTHDOWN: SDL_HapticEffectType = SDL_HapticEffectType::SAWTOOTHDOWN; +/// Ramp effect supported. +/// +/// Ramp haptic effect. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticRamp`] +pub const SDL_HAPTIC_RAMP: SDL_HapticEffectType = SDL_HapticEffectType::RAMP; +/// Spring effect supported - uses axes position. +/// +/// Condition haptic effect that simulates a spring. Effect is based on the +/// axes position. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticCondition`] +pub const SDL_HAPTIC_SPRING: SDL_HapticEffectType = SDL_HapticEffectType::SPRING; +/// Damper effect supported - uses axes velocity. +/// +/// Condition haptic effect that simulates dampening. Effect is based on the +/// axes velocity. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticCondition`] +pub const SDL_HAPTIC_DAMPER: SDL_HapticEffectType = SDL_HapticEffectType::DAMPER; +/// Inertia effect supported - uses axes acceleration. +/// +/// Condition haptic effect that simulates inertia. Effect is based on the axes +/// acceleration. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticCondition`] +pub const SDL_HAPTIC_INERTIA: SDL_HapticEffectType = SDL_HapticEffectType::INERTIA; +/// Friction effect supported - uses axes movement. +/// +/// Condition haptic effect that simulates friction. Effect is based on the +/// axes movement. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticCondition`] +pub const SDL_HAPTIC_FRICTION: SDL_HapticEffectType = SDL_HapticEffectType::FRICTION; +/// Left/Right effect supported. +/// +/// Haptic effect for direct control over high/low frequency motors. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticLeftRight`] +pub const SDL_HAPTIC_LEFTRIGHT: SDL_HapticEffectType = SDL_HapticEffectType::LEFTRIGHT; +/// Reserved for future use. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_HAPTIC_RESERVED1: SDL_HapticEffectType = SDL_HapticEffectType::RESERVED1; +/// Reserved for future use. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_HAPTIC_RESERVED2: SDL_HapticEffectType = SDL_HapticEffectType::RESERVED2; +/// Reserved for future use. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_HAPTIC_RESERVED3: SDL_HapticEffectType = SDL_HapticEffectType::RESERVED3; +/// Custom effect is supported. +/// +/// User defined custom haptic effect. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_HAPTIC_CUSTOM: SDL_HapticEffectType = SDL_HapticEffectType::CUSTOM; +/// Device can set global gain. +/// +/// Device supports setting the global gain. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetHapticGain`] +pub const SDL_HAPTIC_GAIN: SDL_HapticEffectType = SDL_HapticEffectType::GAIN; +/// Device can set autocenter. +/// +/// Device supports setting autocenter. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetHapticAutocenter`] +pub const SDL_HAPTIC_AUTOCENTER: SDL_HapticEffectType = SDL_HapticEffectType::AUTOCENTER; +/// Device can be queried for effect status. +/// +/// Device supports querying effect status. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetHapticEffectStatus`] +pub const SDL_HAPTIC_STATUS: SDL_HapticEffectType = SDL_HapticEffectType::STATUS; +/// Device can be paused. +/// +/// Devices supports being paused. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_PauseHaptic`] +/// - [`SDL_ResumeHaptic`] +pub const SDL_HAPTIC_PAUSE: SDL_HapticEffectType = SDL_HapticEffectType::PAUSE; + +impl SDL_HapticEffectType { + /// Initialize a `SDL_HapticEffectType` from a raw value. + #[inline(always)] + pub const fn new(value: Uint16) -> Self { + Self(value) + } +} + +impl SDL_HapticEffectType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint16 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_HapticEffectType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::haptic::METADATA_SDL_HapticEffectType; +} + +/// * Type of coordinates used for haptic direction. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`POLAR`](SDL_HapticDirectionType::POLAR) | [`SDL_HAPTIC_POLAR`] | Uses polar coordinates for the direction. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticDirection`] | +/// | [`CARTESIAN`](SDL_HapticDirectionType::CARTESIAN) | [`SDL_HAPTIC_CARTESIAN`] | Uses cartesian coordinates for the direction. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticDirection`] | +/// | [`SPHERICAL`](SDL_HapticDirectionType::SPHERICAL) | [`SDL_HAPTIC_SPHERICAL`] | Uses spherical coordinates for the direction. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticDirection`] | +/// | [`STEERING_AXIS`](SDL_HapticDirectionType::STEERING_AXIS) | [`SDL_HAPTIC_STEERING_AXIS`] | Use this value to play an effect on the steering wheel axis. This provides better compatibility across platforms and devices as SDL will guess the correct axis. \since This macro is available since SDL 3.2.0. \sa [`SDL_HapticDirection`] | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_HapticDirectionType(pub Uint8); + +impl ::core::cmp::PartialEq for SDL_HapticDirectionType { + #[inline(always)] + fn eq(&self, other: &Uint8) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint8 { + #[inline(always)] + fn eq(&self, other: &SDL_HapticDirectionType) -> bool { + self == &other.0 + } +} + +impl From for Uint8 { + #[inline(always)] + fn from(value: SDL_HapticDirectionType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_HapticDirectionType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::POLAR => "SDL_HAPTIC_POLAR", + Self::CARTESIAN => "SDL_HAPTIC_CARTESIAN", + Self::SPHERICAL => "SDL_HAPTIC_SPHERICAL", + Self::STEERING_AXIS => "SDL_HAPTIC_STEERING_AXIS", + + _ => return write!(f, "SDL_HapticDirectionType({})", self.0), + }) + } +} + +impl SDL_HapticDirectionType { + /// Uses polar coordinates for the direction. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticDirection`] + pub const POLAR: Self = Self((0 as Uint8)); + /// Uses cartesian coordinates for the direction. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticDirection`] + pub const CARTESIAN: Self = Self((1 as Uint8)); + /// Uses spherical coordinates for the direction. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticDirection`] + pub const SPHERICAL: Self = Self((2 as Uint8)); + /// Use this value to play an effect on the steering wheel axis. + /// + /// This provides better compatibility across platforms and devices as SDL will + /// guess the correct axis. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticDirection`] + pub const STEERING_AXIS: Self = Self((3 as Uint8)); +} + +/// Uses polar coordinates for the direction. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticDirection`] +pub const SDL_HAPTIC_POLAR: SDL_HapticDirectionType = SDL_HapticDirectionType::POLAR; +/// Uses cartesian coordinates for the direction. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticDirection`] +pub const SDL_HAPTIC_CARTESIAN: SDL_HapticDirectionType = SDL_HapticDirectionType::CARTESIAN; +/// Uses spherical coordinates for the direction. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticDirection`] +pub const SDL_HAPTIC_SPHERICAL: SDL_HapticDirectionType = SDL_HapticDirectionType::SPHERICAL; +/// Use this value to play an effect on the steering wheel axis. +/// +/// This provides better compatibility across platforms and devices as SDL will +/// guess the correct axis. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticDirection`] +pub const SDL_HAPTIC_STEERING_AXIS: SDL_HapticDirectionType = + SDL_HapticDirectionType::STEERING_AXIS; + +impl SDL_HapticDirectionType { + /// Initialize a `SDL_HapticDirectionType` from a raw value. + #[inline(always)] + pub const fn new(value: Uint8) -> Self { + Self(value) + } +} + +impl SDL_HapticDirectionType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint8 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_HapticDirectionType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::haptic::METADATA_SDL_HapticDirectionType; +} + +/// ID for haptic effects. +/// +/// This is -1 if the ID is invalid. +/// +/// ## See also +/// - [`SDL_CreateHapticEffect`] +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticEffectID(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_HapticEffectID { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_HapticEffectID) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_HapticEffectID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_HapticEffectID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + <::core::ffi::c_int as ::core::fmt::Display>::fmt(&self.0, f) + } +} + +impl SDL_HapticEffectID { + /// Initialize a `SDL_HapticEffectID` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_HapticEffectID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_HapticEffectID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::haptic::METADATA_SDL_HapticEffectID; +} + +/// Structure that represents a haptic direction. +/// +/// This is the direction where the force comes from, instead of the direction +/// in which the force is exerted. +/// +/// Directions can be specified by: +/// +/// - [`SDL_HAPTIC_POLAR`] : Specified by polar coordinates. +/// - [`SDL_HAPTIC_CARTESIAN`] : Specified by cartesian coordinates. +/// - [`SDL_HAPTIC_SPHERICAL`] : Specified by spherical coordinates. +/// +/// Cardinal directions of the haptic device are relative to the positioning of +/// the device. North is considered to be away from the user. +/// +/// The following diagram represents the cardinal directions: +/// +/// ```text +/// .--. +/// |__| .-------. +/// |=.| |.-----.| +/// |--| || || +/// | | |'-----'| +/// |__|~')_____(' +/// [ COMPUTER ] +/// +/// +/// North (0,-1) +/// ^ +/// | +/// | +/// (-1,0) West <----[ HAPTIC ]----> East (1,0) +/// | +/// | +/// v +/// South (0,1) +/// +/// +/// [ USER ] +/// \|||/ +/// (o o) +/// ---ooO-(_)-Ooo--- +/// ``` +/// +/// If type is [`SDL_HAPTIC_POLAR`], direction is encoded by hundredths of a degree +/// starting north and turning clockwise. [`SDL_HAPTIC_POLAR`] only uses the first +/// `dir` parameter. The cardinal directions would be: +/// +/// - North: 0 (0 degrees) +/// - East: 9000 (90 degrees) +/// - South: 18000 (180 degrees) +/// - West: 27000 (270 degrees) +/// +/// If type is [`SDL_HAPTIC_CARTESIAN`], direction is encoded by three positions (X +/// axis, Y axis and Z axis (with 3 axes)). [`SDL_HAPTIC_CARTESIAN`] uses the first +/// three `dir` parameters. The cardinal directions would be: +/// +/// - North: 0,-1, 0 +/// - East: 1, 0, 0 +/// - South: 0, 1, 0 +/// - West: -1, 0, 0 +/// +/// The Z axis represents the height of the effect if supported, otherwise it's +/// unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can +/// use any multiple you want, only the direction matters. +/// +/// If type is [`SDL_HAPTIC_SPHERICAL`], direction is encoded by two rotations. The +/// first two `dir` parameters are used. The `dir` parameters are as follows +/// (all values are in hundredths of degrees): +/// +/// - Degrees from (1, 0) rotated towards (0, 1). +/// - Degrees towards (0, 0, 1) (device needs at least 3 axes). +/// +/// Example of force coming from the south with all encodings (force coming +/// from the south means the user will have to pull the stick to counteract): +/// +/// ```c +/// SDL_HapticDirection direction; +/// +/// // Cartesian directions +/// direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. +/// direction.dir[0] = 0; // X position +/// direction.dir[1] = 1; // Y position +/// // Assuming the device has 2 axes, we don't need to specify third parameter. +/// +/// // Polar directions +/// direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. +/// direction.dir[0] = 18000; // Polar only uses first parameter +/// +/// // Spherical coordinates +/// direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding +/// direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. +/// ``` +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HAPTIC_POLAR`] +/// - [`SDL_HAPTIC_CARTESIAN`] +/// - [`SDL_HAPTIC_SPHERICAL`] +/// - [`SDL_HAPTIC_STEERING_AXIS`] +/// - [`SDL_HapticEffect`] +/// - [`SDL_GetNumHapticAxes`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticDirection { + /// The type of encoding. + pub r#type: SDL_HapticDirectionType, + /// The encoded direction. + pub dir: [Sint32; 3], +} + +/// A structure containing a template for a Constant effect. +/// +/// This struct is exclusively for the [`SDL_HAPTIC_CONSTANT`] effect. +/// +/// A constant effect applies a constant force in the specified direction to +/// the joystick. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HAPTIC_CONSTANT`] +/// - [`SDL_HapticEffect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticConstant { + /// [`SDL_HAPTIC_CONSTANT`] + pub r#type: SDL_HapticEffectType, + /// Direction of the effect. + pub direction: SDL_HapticDirection, + /// Duration of the effect. + pub length: Uint32, + /// Delay before starting the effect. + pub delay: Uint16, + /// Button that triggers the effect. + pub button: Uint16, + /// How soon it can be triggered again after button. + pub interval: Uint16, + /// Strength of the constant effect. + pub level: Sint16, + /// Duration of the attack. + pub attack_length: Uint16, + /// Level at the start of the attack. + pub attack_level: Uint16, + /// Duration of the fade. + pub fade_length: Uint16, + /// Level at the end of the fade. + pub fade_level: Uint16, +} + +/// A structure containing a template for a Periodic effect. +/// +/// The struct handles the following effects: +/// +/// - [`SDL_HAPTIC_SINE`] +/// - [`SDL_HAPTIC_SQUARE`] +/// - [`SDL_HAPTIC_TRIANGLE`] +/// - [`SDL_HAPTIC_SAWTOOTHUP`] +/// - [`SDL_HAPTIC_SAWTOOTHDOWN`] +/// +/// A periodic effect consists in a wave-shaped effect that repeats itself over +/// time. The type determines the shape of the wave and the parameters +/// determine the dimensions of the wave. +/// +/// Phase is given by hundredth of a degree meaning that giving the phase a +/// value of 9000 will displace it 25% of its period. Here are sample values: +/// +/// - 0: No phase displacement. +/// - 9000: Displaced 25% of its period. +/// - 18000: Displaced 50% of its period. +/// - 27000: Displaced 75% of its period. +/// - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. +/// +/// Examples: +/// +/// ```text +/// SDL_HAPTIC_SINE +/// __ __ __ __ +/// / \ / \ / \ / +/// / \__/ \__/ \__/ +/// +/// SDL_HAPTIC_SQUARE +/// __ __ __ __ __ +/// | | | | | | | | | | +/// | |__| |__| |__| |__| | +/// +/// SDL_HAPTIC_TRIANGLE +/// /\ /\ /\ /\ /\ +/// / \ / \ / \ / \ / +/// / \/ \/ \/ \/ +/// +/// SDL_HAPTIC_SAWTOOTHUP +/// /| /| /| /| /| /| /| +/// / | / | / | / | / | / | / | +/// / |/ |/ |/ |/ |/ |/ | +/// +/// SDL_HAPTIC_SAWTOOTHDOWN +/// \ |\ |\ |\ |\ |\ |\ | +/// \ | \ | \ | \ | \ | \ | \ | +/// \| \| \| \| \| \| \| +/// ``` +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HAPTIC_SINE`] +/// - [`SDL_HAPTIC_SQUARE`] +/// - [`SDL_HAPTIC_TRIANGLE`] +/// - [`SDL_HAPTIC_SAWTOOTHUP`] +/// - [`SDL_HAPTIC_SAWTOOTHDOWN`] +/// - [`SDL_HapticEffect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticPeriodic { + /// [`SDL_HAPTIC_SINE`], [`SDL_HAPTIC_SQUARE`] + /// [`SDL_HAPTIC_TRIANGLE`], [`SDL_HAPTIC_SAWTOOTHUP`] or + /// [`SDL_HAPTIC_SAWTOOTHDOWN`] + pub r#type: SDL_HapticEffectType, + /// Direction of the effect. + pub direction: SDL_HapticDirection, + /// Duration of the effect. + pub length: Uint32, + /// Delay before starting the effect. + pub delay: Uint16, + /// Button that triggers the effect. + pub button: Uint16, + /// How soon it can be triggered again after button. + pub interval: Uint16, + /// Period of the wave. + pub period: Uint16, + /// Peak value; if negative, equivalent to 180 degrees extra phase shift. + pub magnitude: Sint16, + /// Mean value of the wave. + pub offset: Sint16, + /// Positive phase shift given by hundredth of a degree. + pub phase: Uint16, + /// Duration of the attack. + pub attack_length: Uint16, + /// Level at the start of the attack. + pub attack_level: Uint16, + /// Duration of the fade. + pub fade_length: Uint16, + /// Level at the end of the fade. + pub fade_level: Uint16, +} + +/// A structure containing a template for a Condition effect. +/// +/// The struct handles the following effects: +/// +/// - [`SDL_HAPTIC_SPRING`]\: Effect based on axes position. +/// - [`SDL_HAPTIC_DAMPER`]\: Effect based on axes velocity. +/// - [`SDL_HAPTIC_INERTIA`]\: Effect based on axes acceleration. +/// - [`SDL_HAPTIC_FRICTION`]\: Effect based on axes movement. +/// +/// Direction is handled by condition internals instead of a direction member. +/// The condition effect specific members have three parameters. The first +/// refers to the X axis, the second refers to the Y axis and the third refers +/// to the Z axis. The right terms refer to the positive side of the axis and +/// the left terms refer to the negative side of the axis. Please refer to the +/// [`SDL_HapticDirection`] diagram for which side is positive and which is +/// negative. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticDirection`] +/// - [`SDL_HAPTIC_SPRING`] +/// - [`SDL_HAPTIC_DAMPER`] +/// - [`SDL_HAPTIC_INERTIA`] +/// - [`SDL_HAPTIC_FRICTION`] +/// - [`SDL_HapticEffect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticCondition { + /// [`SDL_HAPTIC_SPRING`], [`SDL_HAPTIC_DAMPER`], + /// [`SDL_HAPTIC_INERTIA`] or [`SDL_HAPTIC_FRICTION`] + pub r#type: SDL_HapticEffectType, + /// Direction of the effect. + pub direction: SDL_HapticDirection, + /// Duration of the effect. + pub length: Uint32, + /// Delay before starting the effect. + pub delay: Uint16, + /// Button that triggers the effect. + pub button: Uint16, + /// How soon it can be triggered again after button. + pub interval: Uint16, + /// Level when joystick is to the positive side; max 0xFFFF. + pub right_sat: [Uint16; 3], + /// Level when joystick is to the negative side; max 0xFFFF. + pub left_sat: [Uint16; 3], + /// How fast to increase the force towards the positive side. + pub right_coeff: [Sint16; 3], + /// How fast to increase the force towards the negative side. + pub left_coeff: [Sint16; 3], + /// Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. + pub deadband: [Uint16; 3], + /// Position of the dead zone. + pub center: [Sint16; 3], +} + +/// A structure containing a template for a Ramp effect. +/// +/// This struct is exclusively for the [`SDL_HAPTIC_RAMP`] effect. +/// +/// The ramp effect starts at start strength and ends at end strength. It +/// augments in linear fashion. If you use attack and fade with a ramp the +/// effects get added to the ramp effect making the effect become quadratic +/// instead of linear. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HAPTIC_RAMP`] +/// - [`SDL_HapticEffect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticRamp { + /// [`SDL_HAPTIC_RAMP`] + pub r#type: SDL_HapticEffectType, + /// Direction of the effect. + pub direction: SDL_HapticDirection, + /// Duration of the effect. + pub length: Uint32, + /// Delay before starting the effect. + pub delay: Uint16, + /// Button that triggers the effect. + pub button: Uint16, + /// How soon it can be triggered again after button. + pub interval: Uint16, + /// Beginning strength level. + pub start: Sint16, + /// Ending strength level. + pub end: Sint16, + /// Duration of the attack. + pub attack_length: Uint16, + /// Level at the start of the attack. + pub attack_level: Uint16, + /// Duration of the fade. + pub fade_length: Uint16, + /// Level at the end of the fade. + pub fade_level: Uint16, +} + +/// A structure containing a template for a Left/Right effect. +/// +/// This struct is exclusively for the [`SDL_HAPTIC_LEFTRIGHT`] effect. +/// +/// The Left/Right effect is used to explicitly control the large and small +/// motors, commonly found in modern game controllers. The small (right) motor +/// is high frequency, and the large (left) motor is low frequency. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HAPTIC_LEFTRIGHT`] +/// - [`SDL_HapticEffect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticLeftRight { + /// [`SDL_HAPTIC_LEFTRIGHT`] + pub r#type: SDL_HapticEffectType, + /// Duration of the effect in milliseconds. + pub length: Uint32, + /// Control of the large controller motor. + pub large_magnitude: Uint16, + /// Control of the small controller motor. + pub small_magnitude: Uint16, +} + +/// A structure containing a template for the [`SDL_HAPTIC_CUSTOM`] effect. +/// +/// This struct is exclusively for the [`SDL_HAPTIC_CUSTOM`] effect. +/// +/// A custom force feedback effect is much like a periodic effect, where the +/// application can define its exact shape. You will have to allocate the data +/// yourself. Data should consist of channels * samples Uint16 samples. +/// +/// If channels is one, the effect is rotated using the defined direction. +/// Otherwise it uses the samples in data for the different axes. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HAPTIC_CUSTOM`] +/// - [`SDL_HapticEffect`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticCustom { + /// [`SDL_HAPTIC_CUSTOM`] + pub r#type: SDL_HapticEffectType, + /// Direction of the effect. + pub direction: SDL_HapticDirection, + /// Duration of the effect. + pub length: Uint32, + /// Delay before starting the effect. + pub delay: Uint16, + /// Button that triggers the effect. + pub button: Uint16, + /// How soon it can be triggered again after button. + pub interval: Uint16, + /// Axes to use, minimum of one. + pub channels: Uint8, + /// Sample periods. + pub period: Uint16, + /// Amount of samples. + pub samples: Uint16, + /// Should contain channels*samples items. + pub data: *mut Uint16, + /// Duration of the attack. + pub attack_length: Uint16, + /// Level at the start of the attack. + pub attack_level: Uint16, + /// Duration of the fade. + pub fade_length: Uint16, + /// Level at the end of the fade. + pub fade_level: Uint16, +} + +impl ::core::default::Default for SDL_HapticCustom { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// The generic template for any haptic effect. +/// +/// All values max at 32767 (0x7FFF). Signed values also can be negative. Time +/// values unless specified otherwise are in milliseconds. +/// +/// You can also pass [`SDL_HAPTIC_INFINITY`] to length instead of a 0-32767 value. +/// Neither delay, interval, attack_length nor fade_length support +/// [`SDL_HAPTIC_INFINITY`]. Fade will also not be used since effect never ends. +/// +/// Additionally, the [`SDL_HAPTIC_RAMP`] effect does not support a duration of +/// [`SDL_HAPTIC_INFINITY`]. +/// +/// Button triggers may not be supported on all devices, it is advised to not +/// use them if possible. Buttons start at index 1 instead of index 0 like the +/// joystick. +/// +/// If both attack_length and fade_level are 0, the envelope is not used, +/// otherwise both values are used. +/// +/// Common parts: +/// +/// ```c +/// // Replay - All effects have this +/// Uint32 length; // Duration of effect (ms). +/// Uint16 delay; // Delay before starting effect. +/// +/// // Trigger - All effects have this +/// Uint16 button; // Button that triggers effect. +/// Uint16 interval; // How soon before effect can be triggered again. +/// +/// // Envelope - All effects except condition effects have this +/// Uint16 attack_length; // Duration of the attack (ms). +/// Uint16 attack_level; // Level at the start of the attack. +/// Uint16 fade_length; // Duration of the fade out (ms). +/// Uint16 fade_level; // Level at the end of the fade. +/// ``` +/// +/// Here we have an example of a constant effect evolution in time: +/// +/// ```text +/// Strength +/// ^ +/// | +/// | effect level --> _________________ +/// | / \ +/// | / \ +/// | / \ +/// | / \ +/// | attack_level --> | \ +/// | | | <--- fade_level +/// | +/// +--------------------------------------------------> Time +/// [--] [---] +/// attack_length fade_length +/// +/// [------------------][-----------------------] +/// delay length +/// ``` +/// +/// Note either the attack_level or the fade_level may be above the actual +/// effect level. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HapticConstant`] +/// - [`SDL_HapticPeriodic`] +/// - [`SDL_HapticCondition`] +/// - [`SDL_HapticRamp`] +/// - [`SDL_HapticLeftRight`] +/// - [`SDL_HapticCustom`] +#[repr(C)] +#[derive(Clone, Copy)] +pub union SDL_HapticEffect { + /// Effect type. + pub r#type: SDL_HapticEffectType, + /// Constant effect. + pub constant: SDL_HapticConstant, + /// Periodic effect. + pub periodic: SDL_HapticPeriodic, + /// Condition effect. + pub condition: SDL_HapticCondition, + /// Ramp effect. + pub ramp: SDL_HapticRamp, + /// Left/Right effect. + pub leftright: SDL_HapticLeftRight, + /// Custom effect. + pub custom: SDL_HapticCustom, +} + +impl ::core::default::Default for SDL_HapticEffect { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// This is a unique ID for a haptic device for the time it is connected to the +/// system, and is never reused for the lifetime of the application. +/// +/// If the haptic device is disconnected and reconnected, it will get a new ID. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_HapticID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_HapticID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_HapticID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_HapticID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_HapticID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_HapticID { + /// Initialize a `SDL_HapticID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_HapticID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_HapticID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::haptic::METADATA_SDL_HapticID; +} + +unsafe extern "C" { + /// Get a list of currently connected haptic devices. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of haptic devices + /// returned, may be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of haptic device instance IDs or NULL on + /// failure; call [`SDL_GetError()`] for more information. This should be + /// freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenHaptic`] + pub fn SDL_GetHaptics(count: *mut ::core::ffi::c_int) -> *mut SDL_HapticID; +} + +unsafe extern "C" { + /// Get the implementation dependent name of a haptic device. + /// + /// This can be called before any haptic devices are opened. + /// + /// ## Parameters + /// - `instance_id`: the haptic device instance ID. + /// + /// ## Return value + /// Returns the name of the selected haptic device. If no name can be found, + /// this function returns NULL; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticName`] + /// - [`SDL_OpenHaptic`] + pub fn SDL_GetHapticNameForID(instance_id: SDL_HapticID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Open a haptic device for use. + /// + /// The index passed as an argument refers to the N'th haptic device on this + /// system. + /// + /// When opening a haptic device, its gain will be set to maximum and + /// autocenter will be disabled. To modify these values use [`SDL_SetHapticGain()`] + /// and [`SDL_SetHapticAutocenter()`]. + /// + /// ## Parameters + /// - `instance_id`: the haptic device instance ID. + /// + /// ## Return value + /// Returns the device identifier or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseHaptic`] + /// - [`SDL_GetHaptics`] + /// - [`SDL_OpenHapticFromJoystick`] + /// - [`SDL_OpenHapticFromMouse`] + /// - [`SDL_SetHapticAutocenter`] + /// - [`SDL_SetHapticGain`] + pub fn SDL_OpenHaptic(instance_id: SDL_HapticID) -> *mut SDL_Haptic; +} + +unsafe extern "C" { + /// Get the [`SDL_Haptic`] associated with an instance ID, if it has been opened. + /// + /// ## Parameters + /// - `instance_id`: the instance ID to get the [`SDL_Haptic`] for. + /// + /// ## Return value + /// Returns an [`SDL_Haptic`] on success or NULL on failure or if it hasn't been + /// opened yet; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetHapticFromID(instance_id: SDL_HapticID) -> *mut SDL_Haptic; +} + +unsafe extern "C" { + /// Get the instance ID of an opened haptic device. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query. + /// + /// ## Return value + /// Returns the instance ID of the specified haptic device on success or 0 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetHapticID(haptic: *mut SDL_Haptic) -> SDL_HapticID; +} + +unsafe extern "C" { + /// Get the implementation dependent name of a haptic device. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the name of the selected haptic device. If no name can be found, + /// this function returns NULL; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticNameForID`] + pub fn SDL_GetHapticName(haptic: *mut SDL_Haptic) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Query whether or not the current mouse has haptic capabilities. + /// + /// ## Return value + /// Returns true if the mouse is haptic or false if it isn't. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenHapticFromMouse`] + pub fn SDL_IsMouseHaptic() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Try to open a haptic device from the current mouse. + /// + /// ## Return value + /// Returns the haptic device identifier or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseHaptic`] + /// - [`SDL_IsMouseHaptic`] + pub fn SDL_OpenHapticFromMouse() -> *mut SDL_Haptic; +} + +unsafe extern "C" { + /// Query if a joystick has haptic features. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] to test for haptic capabilities. + /// + /// ## Return value + /// Returns true if the joystick is haptic or false if it isn't. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenHapticFromJoystick`] + pub fn SDL_IsJoystickHaptic(joystick: *mut SDL_Joystick) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Open a haptic device for use from a joystick device. + /// + /// You must still close the haptic device separately. It will not be closed + /// with the joystick. + /// + /// When opened from a joystick you should first close the haptic device before + /// closing the joystick device. If not, on some implementations the haptic + /// device will also get unallocated and you'll be unable to use force feedback + /// on that device. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] to create a haptic device from. + /// + /// ## Return value + /// Returns a valid haptic device identifier on success or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseHaptic`] + /// - [`SDL_IsJoystickHaptic`] + pub fn SDL_OpenHapticFromJoystick(joystick: *mut SDL_Joystick) -> *mut SDL_Haptic; +} + +unsafe extern "C" { + /// Close a haptic device previously opened with [`SDL_OpenHaptic()`]. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to close. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenHaptic`] + pub fn SDL_CloseHaptic(haptic: *mut SDL_Haptic); +} + +unsafe extern "C" { + /// Get the number of effects a haptic device can store. + /// + /// On some platforms this isn't fully supported, and therefore is an + /// approximation. Always check to see if your created effect was actually + /// created and do not rely solely on [`SDL_GetMaxHapticEffects()`]. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query. + /// + /// ## Return value + /// Returns the number of effects the haptic device can store or a negative + /// error code on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMaxHapticEffectsPlaying`] + /// - [`SDL_GetHapticFeatures`] + pub fn SDL_GetMaxHapticEffects(haptic: *mut SDL_Haptic) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of effects a haptic device can play at the same time. + /// + /// This is not supported on all platforms, but will always return a value. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query maximum playing effects. + /// + /// ## Return value + /// Returns the number of effects the haptic device can play at the same time + /// or -1 on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMaxHapticEffects`] + /// - [`SDL_GetHapticFeatures`] + pub fn SDL_GetMaxHapticEffectsPlaying(haptic: *mut SDL_Haptic) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the haptic device's supported features in bitwise manner. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query. + /// + /// ## Return value + /// Returns a list of supported haptic features in bitwise manner (OR'd), or 0 + /// on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HapticEffectSupported`] + /// - [`SDL_GetMaxHapticEffects`] + pub fn SDL_GetHapticFeatures(haptic: *mut SDL_Haptic) -> Uint32; +} + +unsafe extern "C" { + /// Get the number of haptic axes the device has. + /// + /// The number of haptic axes might be useful if working with the + /// [`SDL_HapticDirection`] effect. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query. + /// + /// ## Return value + /// Returns the number of axes on success or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetNumHapticAxes(haptic: *mut SDL_Haptic) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Check to see if an effect is supported by a haptic device. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query. + /// - `effect`: the desired effect to query. + /// + /// ## Return value + /// Returns true if the effect is supported or false if it isn't. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateHapticEffect`] + /// - [`SDL_GetHapticFeatures`] + pub fn SDL_HapticEffectSupported( + haptic: *mut SDL_Haptic, + effect: *const SDL_HapticEffect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create a new haptic effect on a specified device. + /// + /// ## Parameters + /// - `haptic`: an [`SDL_Haptic`] device to create the effect on. + /// - `effect`: an [`SDL_HapticEffect`] structure containing the properties of + /// the effect to create. + /// + /// ## Return value + /// Returns the ID of the effect on success or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyHapticEffect`] + /// - [`SDL_RunHapticEffect`] + /// - [`SDL_UpdateHapticEffect`] + pub fn SDL_CreateHapticEffect( + haptic: *mut SDL_Haptic, + effect: *const SDL_HapticEffect, + ) -> SDL_HapticEffectID; +} + +unsafe extern "C" { + /// Update the properties of an effect. + /// + /// Can be used dynamically, although behavior when dynamically changing + /// direction may be strange. Specifically the effect may re-upload itself and + /// start playing from the start. You also cannot change the type either when + /// running [`SDL_UpdateHapticEffect()`]. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device that has the effect. + /// - `effect`: the identifier of the effect to update. + /// - `data`: an [`SDL_HapticEffect`] structure containing the new effect + /// properties to use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateHapticEffect`] + /// - [`SDL_RunHapticEffect`] + pub fn SDL_UpdateHapticEffect( + haptic: *mut SDL_Haptic, + effect: SDL_HapticEffectID, + data: *const SDL_HapticEffect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Run the haptic effect on its associated haptic device. + /// + /// To repeat the effect over and over indefinitely, set `iterations` to + /// [`SDL_HAPTIC_INFINITY`]. (Repeats the envelope - attack and fade.) To make + /// one instance of the effect last indefinitely (so the effect does not fade), + /// set the effect's `length` in its structure/union to [`SDL_HAPTIC_INFINITY`] + /// instead. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to run the effect on. + /// - `effect`: the ID of the haptic effect to run. + /// - `iterations`: the number of iterations to run the effect; use + /// [`SDL_HAPTIC_INFINITY`] to repeat forever. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticEffectStatus`] + /// - [`SDL_StopHapticEffect`] + /// - [`SDL_StopHapticEffects`] + pub fn SDL_RunHapticEffect( + haptic: *mut SDL_Haptic, + effect: SDL_HapticEffectID, + iterations: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Stop the haptic effect on its associated haptic device. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to stop the effect on. + /// - `effect`: the ID of the haptic effect to stop. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RunHapticEffect`] + /// - [`SDL_StopHapticEffects`] + pub fn SDL_StopHapticEffect( + haptic: *mut SDL_Haptic, + effect: SDL_HapticEffectID, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy a haptic effect on the device. + /// + /// This will stop the effect if it's running. Effects are automatically + /// destroyed when the device is closed. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to destroy the effect on. + /// - `effect`: the ID of the haptic effect to destroy. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateHapticEffect`] + pub fn SDL_DestroyHapticEffect(haptic: *mut SDL_Haptic, effect: SDL_HapticEffectID); +} + +unsafe extern "C" { + /// Get the status of the current effect on the specified haptic device. + /// + /// Device must support the [`SDL_HAPTIC_STATUS`] feature. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to query for the effect status on. + /// - `effect`: the ID of the haptic effect to query its status. + /// + /// ## Return value + /// Returns true if it is playing, false if it isn't playing or haptic status + /// isn't supported. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticFeatures`] + pub fn SDL_GetHapticEffectStatus( + haptic: *mut SDL_Haptic, + effect: SDL_HapticEffectID, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the global gain of the specified haptic device. + /// + /// Device must support the [`SDL_HAPTIC_GAIN`] feature. + /// + /// The user may specify the maximum gain by setting the environment variable + /// `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to + /// [`SDL_SetHapticGain()`] will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the + /// maximum. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to set the gain on. + /// - `gain`: value to set the gain to, should be between 0 and 100 (0 - + /// 100). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticFeatures`] + pub fn SDL_SetHapticGain( + haptic: *mut SDL_Haptic, + gain: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the global autocenter of the device. + /// + /// Autocenter should be between 0 and 100. Setting it to 0 will disable + /// autocentering. + /// + /// Device must support the [`SDL_HAPTIC_AUTOCENTER`] feature. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to set autocentering on. + /// - `autocenter`: value to set autocenter to (0-100). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHapticFeatures`] + pub fn SDL_SetHapticAutocenter( + haptic: *mut SDL_Haptic, + autocenter: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Pause a haptic device. + /// + /// Device must support the [`SDL_HAPTIC_PAUSE`] feature. Call [`SDL_ResumeHaptic()`] + /// to resume playback. + /// + /// Do not modify the effects nor add new ones while the device is paused. That + /// can cause all sorts of weird errors. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to pause. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ResumeHaptic`] + pub fn SDL_PauseHaptic(haptic: *mut SDL_Haptic) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Resume a haptic device. + /// + /// Call to unpause after [`SDL_PauseHaptic()`]. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to unpause. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PauseHaptic`] + pub fn SDL_ResumeHaptic(haptic: *mut SDL_Haptic) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Stop all the currently playing effects on a haptic device. + /// + /// ## Parameters + /// - `haptic`: the [`SDL_Haptic`] device to stop. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RunHapticEffect`] + /// - [`SDL_StopHapticEffect`] + pub fn SDL_StopHapticEffects(haptic: *mut SDL_Haptic) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Check whether rumble is supported on a haptic device. + /// + /// ## Parameters + /// - `haptic`: haptic device to check for rumble support. + /// + /// ## Return value + /// Returns true if the effect is supported or false if it isn't. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_InitHapticRumble`] + pub fn SDL_HapticRumbleSupported(haptic: *mut SDL_Haptic) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Initialize a haptic device for simple rumble playback. + /// + /// ## Parameters + /// - `haptic`: the haptic device to initialize for simple rumble playback. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PlayHapticRumble`] + /// - [`SDL_StopHapticRumble`] + /// - [`SDL_HapticRumbleSupported`] + pub fn SDL_InitHapticRumble(haptic: *mut SDL_Haptic) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Run a simple rumble effect on a haptic device. + /// + /// ## Parameters + /// - `haptic`: the haptic device to play the rumble effect on. + /// - `strength`: strength of the rumble to play as a 0-1 float value. + /// - `length`: length of the rumble to play in milliseconds. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_InitHapticRumble`] + /// - [`SDL_StopHapticRumble`] + pub fn SDL_PlayHapticRumble( + haptic: *mut SDL_Haptic, + strength: ::core::ffi::c_float, + length: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Stop the simple rumble on a haptic device. + /// + /// ## Parameters + /// - `haptic`: the haptic device to stop the rumble effect on. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PlayHapticRumble`] + pub fn SDL_StopHapticRumble(haptic: *mut SDL_Haptic) -> ::core::primitive::bool; +} + +/// The haptic structure used to identify an SDL haptic. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_OpenHaptic`] +/// - [`SDL_OpenHapticFromJoystick`] +/// - [`SDL_CloseHaptic`] +#[repr(C)] +pub struct SDL_Haptic { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/hidapi.rs b/vendor/sdl3-sys/src/generated/hidapi.rs new file mode 100644 index 00000000..e05bf244 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/hidapi.rs @@ -0,0 +1,764 @@ +//! Header file for SDL HIDAPI functions. +//! +//! This is an adaptation of the original HIDAPI interface by Alan Ott, and +//! includes source code licensed under the following license: +//! +//! ```text +//! HIDAPI - Multi-Platform library for +//! communication with HID devices. +//! +//! Copyright 2009, Alan Ott, Signal 11 Software. +//! All Rights Reserved. +//! +//! This software may be used by anyone for any reason so +//! long as the copyright notice in the source files +//! remains intact. +//! ``` +//! +//! (Note that this license is the same as item three of SDL's zlib license, so +//! it adds no new requirements on the user.) +//! +//! If you would like a version of SDL without this code, you can build SDL +//! with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for +//! example on iOS or tvOS to avoid a dependency on the CoreBluetooth +//! framework. + +use super::stdinc::*; + +use super::error::*; + +use super::properties::*; + +/// HID underlying bus types. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_hid_bus_type::UNKNOWN) | [`SDL_HID_API_BUS_UNKNOWN`] | Unknown bus type | +/// | [`USB`](SDL_hid_bus_type::USB) | [`SDL_HID_API_BUS_USB`] | USB bus Specifications: | +/// | [`BLUETOOTH`](SDL_hid_bus_type::BLUETOOTH) | [`SDL_HID_API_BUS_BLUETOOTH`] | Bluetooth or Bluetooth LE bus Specifications: | +/// | [`I2C`](SDL_hid_bus_type::I2C) | [`SDL_HID_API_BUS_I2C`] | I2C bus Specifications: | +/// | [`SPI`](SDL_hid_bus_type::SPI) | [`SDL_HID_API_BUS_SPI`] | SPI bus Specifications: | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_hid_bus_type(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_hid_bus_type { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_hid_bus_type) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_hid_bus_type) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_hid_bus_type { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_HID_API_BUS_UNKNOWN", + Self::USB => "SDL_HID_API_BUS_USB", + Self::BLUETOOTH => "SDL_HID_API_BUS_BLUETOOTH", + Self::I2C => "SDL_HID_API_BUS_I2C", + Self::SPI => "SDL_HID_API_BUS_SPI", + + _ => return write!(f, "SDL_hid_bus_type({})", self.0), + }) + } +} + +impl SDL_hid_bus_type { + /// Unknown bus type + pub const UNKNOWN: Self = Self((0x00 as ::core::ffi::c_int)); + /// USB bus + /// Specifications: + /// + pub const USB: Self = Self((0x01 as ::core::ffi::c_int)); + /// Bluetooth or Bluetooth LE bus + /// Specifications: + /// + /// + /// + pub const BLUETOOTH: Self = Self((0x02 as ::core::ffi::c_int)); + /// I2C bus + /// Specifications: + /// + pub const I2C: Self = Self((0x03 as ::core::ffi::c_int)); + /// SPI bus + /// Specifications: + /// + pub const SPI: Self = Self((0x04 as ::core::ffi::c_int)); +} + +/// Unknown bus type +pub const SDL_HID_API_BUS_UNKNOWN: SDL_hid_bus_type = SDL_hid_bus_type::UNKNOWN; +/// USB bus +/// Specifications: +/// +pub const SDL_HID_API_BUS_USB: SDL_hid_bus_type = SDL_hid_bus_type::USB; +/// Bluetooth or Bluetooth LE bus +/// Specifications: +/// +/// +/// +pub const SDL_HID_API_BUS_BLUETOOTH: SDL_hid_bus_type = SDL_hid_bus_type::BLUETOOTH; +/// I2C bus +/// Specifications: +/// +pub const SDL_HID_API_BUS_I2C: SDL_hid_bus_type = SDL_hid_bus_type::I2C; +/// SPI bus +/// Specifications: +/// +pub const SDL_HID_API_BUS_SPI: SDL_hid_bus_type = SDL_hid_bus_type::SPI; + +impl SDL_hid_bus_type { + /// Initialize a `SDL_hid_bus_type` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_hid_bus_type { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_hid_bus_type { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::hidapi::METADATA_SDL_hid_bus_type; +} + +/// Information about a connected HID device +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_hid_device_info { + /// Platform-specific device path + pub path: *mut ::core::ffi::c_char, + /// Device Vendor ID + pub vendor_id: ::core::ffi::c_ushort, + /// Device Product ID + pub product_id: ::core::ffi::c_ushort, + /// Serial Number + pub serial_number: *mut crate::ffi::c_wchar_t, + /// Device Release Number in binary-coded decimal, + /// also known as Device Version Number + pub release_number: ::core::ffi::c_ushort, + /// Manufacturer String + pub manufacturer_string: *mut crate::ffi::c_wchar_t, + /// Product string + pub product_string: *mut crate::ffi::c_wchar_t, + /// Usage Page for this Device/Interface + /// (Windows/Mac/hidraw only) + pub usage_page: ::core::ffi::c_ushort, + /// Usage for this Device/Interface + /// (Windows/Mac/hidraw only) + pub usage: ::core::ffi::c_ushort, + /// The USB interface which this logical device + /// represents. + /// + /// Valid only if the device is a USB HID device. + /// Set to -1 in all other cases. + pub interface_number: ::core::ffi::c_int, + /// Additional information about the USB interface. + /// Valid on libusb and Android implementations. + pub interface_class: ::core::ffi::c_int, + pub interface_subclass: ::core::ffi::c_int, + pub interface_protocol: ::core::ffi::c_int, + /// Underlying bus type + pub bus_type: SDL_hid_bus_type, + /// Pointer to the next device + pub next: *mut SDL_hid_device_info, +} + +impl ::core::default::Default for SDL_hid_device_info { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Initialize the HIDAPI library. + /// + /// This function initializes the HIDAPI library. Calling it is not strictly + /// necessary, as it will be called automatically by [`SDL_hid_enumerate()`] and + /// any of the SDL_hid_open_*() functions if it is needed. This function should + /// be called at the beginning of execution however, if there is a chance of + /// HIDAPI handles being opened by different threads simultaneously. + /// + /// Each call to this function should have a matching call to [`SDL_hid_exit()`] + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_hid_exit`] + pub fn SDL_hid_init() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Finalize the HIDAPI library. + /// + /// This function frees all of the static data associated with HIDAPI. It + /// should be called at the end of execution to avoid memory leaks. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_hid_init`] + pub fn SDL_hid_exit() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Check to see if devices may have been added or removed. + /// + /// Enumerating the HID devices is an expensive operation, so you can call this + /// to see if there have been any system device changes since the last call to + /// this function. A change in the counter returned doesn't necessarily mean + /// that anything has changed, but you can call [`SDL_hid_enumerate()`] to get an + /// updated device list. + /// + /// Calling this function for the first time may cause a thread or other system + /// resource to be allocated to track device change notifications. + /// + /// ## Return value + /// Returns a change counter that is incremented with each potential device + /// change, or 0 if device change detection isn't available. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_hid_enumerate`] + pub fn SDL_hid_device_change_count() -> Uint32; +} + +unsafe extern "C" { + /// Enumerate the HID Devices. + /// + /// This function returns a linked list of all the HID devices attached to the + /// system which match vendor_id and product_id. If `vendor_id` is set to 0 + /// then any vendor matches. If `product_id` is set to 0 then any product + /// matches. If `vendor_id` and `product_id` are both set to 0, then all HID + /// devices will be returned. + /// + /// By default SDL will only enumerate controllers, to reduce risk of hanging + /// or crashing on bad drivers, but [`SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS`] + /// can be set to "0" to enumerate all HID devices. + /// + /// ## Parameters + /// - `vendor_id`: the Vendor ID (VID) of the types of device to open, or 0 + /// to match any vendor. + /// - `product_id`: the Product ID (PID) of the types of device to open, or 0 + /// to match any product. + /// + /// ## Return value + /// Returns a pointer to a linked list of type [`SDL_hid_device_info`], containing + /// information about the HID devices attached to the system, or NULL + /// in the case of failure. Free this linked list by calling + /// [`SDL_hid_free_enumeration()`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_hid_device_change_count`] + pub fn SDL_hid_enumerate( + vendor_id: ::core::ffi::c_ushort, + product_id: ::core::ffi::c_ushort, + ) -> *mut SDL_hid_device_info; +} + +unsafe extern "C" { + /// Free an enumeration linked list. + /// + /// This function frees a linked list created by [`SDL_hid_enumerate()`]. + /// + /// ## Parameters + /// - `devs`: pointer to a list of struct_device returned from + /// [`SDL_hid_enumerate()`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_free_enumeration(devs: *mut SDL_hid_device_info); +} + +unsafe extern "C" { + /// Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally + /// a serial number. + /// + /// If `serial_number` is NULL, the first device with the specified VID and PID + /// is opened. + /// + /// ## Parameters + /// - `vendor_id`: the Vendor ID (VID) of the device to open. + /// - `product_id`: the Product ID (PID) of the device to open. + /// - `serial_number`: the Serial Number of the device to open (Optionally + /// NULL). + /// + /// ## Return value + /// Returns a pointer to a [`SDL_hid_device`] object on success or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_open( + vendor_id: ::core::ffi::c_ushort, + product_id: ::core::ffi::c_ushort, + serial_number: *const crate::ffi::c_wchar_t, + ) -> *mut SDL_hid_device; +} + +unsafe extern "C" { + /// Open a HID device by its path name. + /// + /// The path name be determined by calling [`SDL_hid_enumerate()`], or a + /// platform-specific path name can be used (eg: /dev/hidraw0 on Linux). + /// + /// ## Parameters + /// - `path`: the path name of the device to open. + /// + /// ## Return value + /// Returns a pointer to a [`SDL_hid_device`] object on success or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_open_path(path: *const ::core::ffi::c_char) -> *mut SDL_hid_device; +} + +unsafe extern "C" { + /// Get the properties associated with an [`SDL_hid_device`]. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER`]\: the libusb_device_handle + /// associated with the device, if it was opened using libusb. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_hid_get_properties(dev: *mut SDL_hid_device) -> SDL_PropertiesID; +} + +pub const SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER: *const ::core::ffi::c_char = + c"SDL.hidapi.libusb.device.handle".as_ptr(); + +unsafe extern "C" { + /// Write an Output report to a HID device. + /// + /// The first byte of `data` must contain the Report ID. For devices which only + /// support a single report, this must be set to 0x0. The remaining bytes + /// contain the report data. Since the Report ID is mandatory, calls to + /// [`SDL_hid_write()`] will always contain one more byte than the report contains. + /// For example, if a hid report is 16 bytes long, 17 bytes must be passed to + /// [`SDL_hid_write()`], the Report ID (or 0x0, for devices with a single report), + /// followed by the report data (16 bytes). In this example, the length passed + /// in would be 17. + /// + /// [`SDL_hid_write()`] will send the data on the first OUT endpoint, if one + /// exists. If it does not, it will send the data through the Control Endpoint + /// (Endpoint 0). + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `data`: the data to send, including the report number as the first + /// byte. + /// - `length`: the length in bytes of the data to send. + /// + /// ## Return value + /// Returns the actual number of bytes written and -1 on on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_write( + dev: *mut SDL_hid_device, + data: *const ::core::ffi::c_uchar, + length: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Read an Input report from a HID device with timeout. + /// + /// Input reports are returned to the host through the INTERRUPT IN endpoint. + /// The first byte will contain the Report number if the device uses numbered + /// reports. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `data`: a buffer to put the read data into. + /// - `length`: the number of bytes to read. For devices with multiple + /// reports, make sure to read an extra byte for the report + /// number. + /// - `milliseconds`: timeout in milliseconds or -1 for blocking wait. + /// + /// ## Return value + /// Returns the actual number of bytes read and -1 on on failure; call + /// [`SDL_GetError()`] for more information. If no packet was available to + /// be read within the timeout period, this function returns 0. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_read_timeout( + dev: *mut SDL_hid_device, + data: *mut ::core::ffi::c_uchar, + length: ::core::primitive::usize, + milliseconds: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Read an Input report from a HID device. + /// + /// Input reports are returned to the host through the INTERRUPT IN endpoint. + /// The first byte will contain the Report number if the device uses numbered + /// reports. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `data`: a buffer to put the read data into. + /// - `length`: the number of bytes to read. For devices with multiple + /// reports, make sure to read an extra byte for the report + /// number. + /// + /// ## Return value + /// Returns the actual number of bytes read and -1 on failure; call + /// [`SDL_GetError()`] for more information. If no packet was available to + /// be read and the handle is in non-blocking mode, this function + /// returns 0. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_read( + dev: *mut SDL_hid_device, + data: *mut ::core::ffi::c_uchar, + length: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Set the device handle to be non-blocking. + /// + /// In non-blocking mode calls to [`SDL_hid_read()`] will return immediately with a + /// value of 0 if there is no data to be read. In blocking mode, [`SDL_hid_read()`] + /// will wait (block) until there is data to read before returning. + /// + /// Nonblocking can be turned on and off at any time. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `nonblock`: enable or not the nonblocking reads - 1 to enable + /// nonblocking - 0 to disable nonblocking. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_set_nonblocking( + dev: *mut SDL_hid_device, + nonblock: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Send a Feature report to the device. + /// + /// Feature reports are sent over the Control endpoint as a Set_Report + /// transfer. The first byte of `data` must contain the Report ID. For devices + /// which only support a single report, this must be set to 0x0. The remaining + /// bytes contain the report data. Since the Report ID is mandatory, calls to + /// [`SDL_hid_send_feature_report()`] will always contain one more byte than the + /// report contains. For example, if a hid report is 16 bytes long, 17 bytes + /// must be passed to [`SDL_hid_send_feature_report()`]\: the Report ID (or 0x0, for + /// devices which do not use numbered reports), followed by the report data (16 + /// bytes). In this example, the length passed in would be 17. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `data`: the data to send, including the report number as the first + /// byte. + /// - `length`: the length in bytes of the data to send, including the report + /// number. + /// + /// ## Return value + /// Returns the actual number of bytes written and -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_send_feature_report( + dev: *mut SDL_hid_device, + data: *const ::core::ffi::c_uchar, + length: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get a feature report from a HID device. + /// + /// Set the first byte of `data` to the Report ID of the report to be read. + /// Make sure to allow space for this extra byte in `data`. Upon return, the + /// first byte will still contain the Report ID, and the report data will start + /// in data\[1\]. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `data`: a buffer to put the read data into, including the Report ID. + /// Set the first byte of `data` to the Report ID of the report to + /// be read, or set it to zero if your device does not use numbered + /// reports. + /// - `length`: the number of bytes to read, including an extra byte for the + /// report ID. The buffer can be longer than the actual report. + /// + /// ## Return value + /// Returns the number of bytes read plus one for the report ID (which is + /// still in the first byte), or -1 on on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_feature_report( + dev: *mut SDL_hid_device, + data: *mut ::core::ffi::c_uchar, + length: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get an input report from a HID device. + /// + /// Set the first byte of `data` to the Report ID of the report to be read. + /// Make sure to allow space for this extra byte in `data`. Upon return, the + /// first byte will still contain the Report ID, and the report data will start + /// in data\[1\]. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `data`: a buffer to put the read data into, including the Report ID. + /// Set the first byte of `data` to the Report ID of the report to + /// be read, or set it to zero if your device does not use numbered + /// reports. + /// - `length`: the number of bytes to read, including an extra byte for the + /// report ID. The buffer can be longer than the actual report. + /// + /// ## Return value + /// Returns the number of bytes read plus one for the report ID (which is + /// still in the first byte), or -1 on on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_input_report( + dev: *mut SDL_hid_device, + data: *mut ::core::ffi::c_uchar, + length: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Close a HID device. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_close(dev: *mut SDL_hid_device) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get The Manufacturer String from a HID device. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `string`: a wide string buffer to put the data into. + /// - `maxlen`: the length of the buffer in multiples of wchar_t. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_manufacturer_string( + dev: *mut SDL_hid_device, + string: *mut crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get The Product String from a HID device. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `string`: a wide string buffer to put the data into. + /// - `maxlen`: the length of the buffer in multiples of wchar_t. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_product_string( + dev: *mut SDL_hid_device, + string: *mut crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get The Serial Number String from a HID device. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `string`: a wide string buffer to put the data into. + /// - `maxlen`: the length of the buffer in multiples of wchar_t. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_serial_number_string( + dev: *mut SDL_hid_device, + string: *mut crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get a string from a HID device, based on its string index. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `string_index`: the index of the string to get. + /// - `string`: a wide string buffer to put the data into. + /// - `maxlen`: the length of the buffer in multiples of wchar_t. + /// + /// ## Return value + /// Returns 0 on success or a negative error code on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_indexed_string( + dev: *mut SDL_hid_device, + string_index: ::core::ffi::c_int, + string: *mut crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the device info from a HID device. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// + /// ## Return value + /// Returns a pointer to the [`SDL_hid_device_info`] for this hid_device or NULL + /// on failure; call [`SDL_GetError()`] for more information. This struct + /// is valid until the device is closed with [`SDL_hid_close()`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_device_info(dev: *mut SDL_hid_device) -> *mut SDL_hid_device_info; +} + +unsafe extern "C" { + /// Get a report descriptor from a HID device. + /// + /// User has to provide a preallocated buffer where descriptor will be copied + /// to. The recommended size for a preallocated buffer is 4096 bytes. + /// + /// ## Parameters + /// - `dev`: a device handle returned from [`SDL_hid_open()`]. + /// - `buf`: the buffer to copy descriptor into. + /// - `buf_size`: the size of the buffer in bytes. + /// + /// ## Return value + /// Returns the number of bytes actually copied or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_get_report_descriptor( + dev: *mut SDL_hid_device, + buf: *mut ::core::ffi::c_uchar, + buf_size: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers. + /// + /// ## Parameters + /// - `active`: true to start the scan, false to stop the scan. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_hid_ble_scan(active: ::core::primitive::bool); +} + +/// An opaque handle representing an open HID device. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_hid_device { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/hints.rs b/vendor/sdl3-sys/src/generated/hints.rs new file mode 100644 index 00000000..c24e640f --- /dev/null +++ b/vendor/sdl3-sys/src/generated/hints.rs @@ -0,0 +1,5075 @@ +//! This file contains functions to set and get configuration hints, as well as +//! listing each of them alphabetically. +//! +//! The convention for naming hints is SDL_HINT_X, where "SDL_X" is the +//! environment variable that can be used to override the default. +//! +//! In general these hints are just that - they may or may not be supported or +//! applicable on any given platform, but they provide a way for an application +//! or user to give the library a hint as to how they would like the library to +//! work. + +use super::error::*; + +use super::stdinc::*; + +/// Specify the behavior of Alt+Tab while the keyboard is grabbed. +/// +/// By default, SDL emulates Alt+Tab functionality while the keyboard is +/// grabbed and your window is full-screen. This prevents the user from getting +/// stuck in your application if you've enabled keyboard grab. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will not handle Alt+Tab. Your application is responsible for +/// handling Alt+Tab while the keyboard is grabbed. +/// - "1": SDL will minimize your window when Alt+Tab is pressed (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED: *const ::core::ffi::c_char = + c"SDL_ALLOW_ALT_TAB_WHILE_GRABBED".as_ptr(); + +/// A variable to control whether the SDL activity is allowed to be re-created. +/// +/// If this hint is true, the activity can be recreated on demand by the OS, +/// and Java static data and C++ static data remain with their current values. +/// If this hint is false, then SDL will call exit() when you return from your +/// main function and the application will be terminated and then started fresh +/// each time. +/// +/// The variable can be set to the following values: +/// +/// - "0": The application starts fresh at each launch. (default) +/// - "1": The application activity can be recreated by the OS. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY: *const ::core::ffi::c_char = + c"SDL_ANDROID_ALLOW_RECREATE_ACTIVITY".as_ptr(); + +/// A variable to control whether the event loop will block itself when the app +/// is paused. +/// +/// The variable can be set to the following values: +/// +/// - "0": Non blocking. +/// - "1": Blocking. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ANDROID_BLOCK_ON_PAUSE: *const ::core::ffi::c_char = + c"SDL_ANDROID_BLOCK_ON_PAUSE".as_ptr(); + +/// A variable to control whether low latency audio should be enabled. +/// +/// Some devices have poor quality output when this is enabled, but this is +/// usually an improvement in audio latency. +/// +/// The variable can be set to the following values: +/// +/// - "0": Low latency audio is not enabled. +/// - "1": Low latency audio is enabled. (default) +/// +/// This hint should be set before SDL audio is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ANDROID_LOW_LATENCY_AUDIO: *const ::core::ffi::c_char = + c"SDL_ANDROID_LOW_LATENCY_AUDIO".as_ptr(); + +/// A variable to control Android's AAudio input preset. +/// +/// This hint only applies to SDL's "aaudio" backend on Android 9+ devices. +/// +/// Some devices choose the wrong microphone by default (between the one meant +/// to be spoken in when the phone is held to the user's ear for a phone call, +/// or an external microphone that's meant to be used when recording video), +/// or have DSP effects applied to the recorded audio, and changing the input +/// preset can help control this. +/// +/// This can be any number that maps to an `AAUDIO_INPUT_PRESET_*` enum from +/// the Android NDK headers. The most reasonable choices are 5 ("camcorder", +/// for external microphones) and 7 ("voice communication", for speaking +/// directly into the device like a mobile phone). 6 ("voice recognition") +/// might also be a useful choice. +/// +/// If unset (the default), SDL will not specify an input preset at all, which +/// lets the system choose. This is usually the correct thing to do unless +/// your app is having problems. +/// +/// This hint should be set before a recording audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.4.16. +pub const SDL_HINT_ANDROID_AAUDIO_INPUT_PRESET: *const ::core::ffi::c_char = + c"SDL_ANDROID_AAUDIO_INPUT_PRESET".as_ptr(); + +/// A variable to control whether we trap the Android back button to handle it +/// manually. +/// +/// This is necessary for the right mouse button to work on some Android +/// devices, or to be able to trap the back button for use in your code +/// reliably. If this hint is true, the back button will show up as an +/// [`SDL_EVENT_KEY_DOWN`] / [`SDL_EVENT_KEY_UP`] pair with a keycode of +/// [`SDL_SCANCODE_AC_BACK`]. +/// +/// The variable can be set to the following values: +/// +/// - "0": Back button will be handled as usual for system. (default) +/// - "1": Back button will be trapped, allowing you to handle the key press +/// manually. (This will also let right mouse click work on systems where the +/// right mouse button functions as back.) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ANDROID_TRAP_BACK_BUTTON: *const ::core::ffi::c_char = + c"SDL_ANDROID_TRAP_BACK_BUTTON".as_ptr(); + +/// A variable setting the app ID string. +/// +/// This string is used by desktop compositors to identify and group windows +/// together, as well as match applications with associated desktop settings +/// and icons. +/// +/// This will override [`SDL_PROP_APP_METADATA_IDENTIFIER_STRING`], if set by the +/// application. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_APP_ID: *const ::core::ffi::c_char = c"SDL_APP_ID".as_ptr(); + +/// A variable setting the application name. +/// +/// This hint lets you specify the application name sent to the OS when +/// required. For example, this will often appear in volume control applets for +/// audio streams, and in lists of applications which are inhibiting the +/// screensaver. You should use a string that describes your program ("My Game +/// 2: The Revenge") +/// +/// This will override [`SDL_PROP_APP_METADATA_NAME_STRING`], if set by the +/// application. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_APP_NAME: *const ::core::ffi::c_char = c"SDL_APP_NAME".as_ptr(); + +/// A variable controlling whether controllers used with the Apple TV generate +/// UI events. +/// +/// When UI events are generated by controller input, the app will be +/// backgrounded when the Apple TV remote's menu button is pressed, and when +/// the pause or B buttons on gamepads are pressed. +/// +/// More information about properly making use of controllers for the Apple TV +/// can be found here: +/// +/// +/// The variable can be set to the following values: +/// +/// - "0": Controller input does not generate UI events. (default) +/// - "1": Controller input generates UI events. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS: *const ::core::ffi::c_char = + c"SDL_APPLE_TV_CONTROLLER_UI_EVENTS".as_ptr(); + +/// A variable controlling whether the Apple TV remote's joystick axes will +/// automatically match the rotation of the remote. +/// +/// The variable can be set to the following values: +/// +/// - "0": Remote orientation does not affect joystick axes. (default) +/// - "1": Joystick axes are based on the orientation of the remote. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION: *const ::core::ffi::c_char = + c"SDL_APPLE_TV_REMOTE_ALLOW_ROTATION".as_ptr(); + +/// Specify the default ALSA audio device name. +/// +/// This variable is a specific audio device to open when the "default" audio +/// device is used. +/// +/// This hint will be ignored when opening the default playback device if +/// [`SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE`] is set, or when opening the +/// default recording device if [`SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE`] is +/// set. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE`] +/// - [`SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE`] +pub const SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE: *const ::core::ffi::c_char = + c"SDL_AUDIO_ALSA_DEFAULT_DEVICE".as_ptr(); + +/// Specify the default ALSA audio playback device name. +/// +/// This variable is a specific audio device to open for playback, when the +/// "default" audio device is used. +/// +/// If this hint isn't set, SDL will check [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`] +/// before choosing a reasonable default. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE`] +/// - [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`] +pub const SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE: *const ::core::ffi::c_char = + c"SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE".as_ptr(); + +/// Specify the default ALSA audio recording device name. +/// +/// This variable is a specific audio device to open for recording, when the +/// "default" audio device is used. +/// +/// If this hint isn't set, SDL will check [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`] +/// before choosing a reasonable default. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE`] +/// - [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`] +pub const SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE: *const ::core::ffi::c_char = + c"SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE".as_ptr(); + +/// A variable controlling the audio category on iOS and macOS. +/// +/// The variable can be set to the following values: +/// +/// - "ambient": Use the AVAudioSessionCategoryAmbient audio category, will be +/// muted by the phone mute switch (default) +/// - "playback": Use the AVAudioSessionCategoryPlayback category. +/// +/// For more information, see Apple's documentation: +/// +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_CATEGORY: *const ::core::ffi::c_char = c"SDL_AUDIO_CATEGORY".as_ptr(); + +/// A variable controlling the default audio channel count. +/// +/// If the application doesn't specify the audio channel count when opening the +/// device, this hint can be used to specify a default channel count that will +/// be used. This defaults to "1" for recording and "2" for playback devices. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_CHANNELS: *const ::core::ffi::c_char = c"SDL_AUDIO_CHANNELS".as_ptr(); + +/// Specify an application icon name for an audio device. +/// +/// Some audio backends (such as Pulseaudio and Pipewire) allow you to set an +/// XDG icon name for your application. Among other things, this icon might +/// show up in a system control panel that lets the user adjust the volume on +/// specific audio streams instead of using one giant master volume slider. +/// Note that this is unrelated to the icon used by the windowing system, which +/// may be set with [`SDL_SetWindowIcon`] (or via desktop file on Wayland). +/// +/// Setting this to "" or leaving it unset will have SDL use a reasonable +/// default, "applications-games", which is likely to be installed. See +/// +/// and +/// +/// for the relevant XDG icon specs. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME: *const ::core::ffi::c_char = + c"SDL_AUDIO_DEVICE_APP_ICON_NAME".as_ptr(); + +/// A variable controlling device buffer size. +/// +/// This hint is an integer > 0, that represents the size of the device's +/// buffer in sample frames (stereo audio data in 16-bit format is 4 bytes per +/// sample frame, for example). +/// +/// SDL3 generally decides this value on behalf of the app, but if for some +/// reason the app needs to dictate this (because they want either lower +/// latency or higher throughput AND ARE WILLING TO DEAL WITH what that might +/// require of the app), they can specify it. +/// +/// SDL will try to accommodate this value, but there is no promise you'll get +/// the buffer size requested. Many platforms won't honor this request at all, +/// or might adjust it. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES: *const ::core::ffi::c_char = + c"SDL_AUDIO_DEVICE_SAMPLE_FRAMES".as_ptr(); + +/// Specify an audio stream name for an audio device. +/// +/// Some audio backends (such as PulseAudio) allow you to describe your audio +/// stream. Among other things, this description might show up in a system +/// control panel that lets the user adjust the volume on specific audio +/// streams instead of using one giant master volume slider. +/// +/// This hints lets you transmit that information to the OS. The contents of +/// this hint are used while opening an audio device. You should use a string +/// that describes your what your program is playing ("audio stream" is +/// probably sufficient in many cases, but this could be useful for something +/// like "team chat" if you have a headset playing VoIP audio separately). +/// +/// Setting this to "" or leaving it unset will have SDL use a reasonable +/// default: "audio stream" or something similar. +/// +/// Note that while this talks about audio streams, this is an OS-level +/// concept, so it applies to a physical audio device in this case, and not an +/// [`SDL_AudioStream`], nor an SDL logical audio device. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DEVICE_STREAM_NAME: *const ::core::ffi::c_char = + c"SDL_AUDIO_DEVICE_STREAM_NAME".as_ptr(); + +/// Specify an application role for an audio device. +/// +/// Some audio backends (such as Pipewire) allow you to describe the role of +/// your audio stream. Among other things, this description might show up in a +/// system control panel or software for displaying and manipulating media +/// playback/recording graphs. +/// +/// This hints lets you transmit that information to the OS. The contents of +/// this hint are used while opening an audio device. You should use a string +/// that describes your what your program is playing (Game, Music, Movie, +/// etc...). +/// +/// Setting this to "" or leaving it unset will have SDL use a reasonable +/// default: "Game" or something similar. +/// +/// Note that while this talks about audio streams, this is an OS-level +/// concept, so it applies to a physical audio device in this case, and not an +/// [`SDL_AudioStream`], nor an SDL logical audio device. +/// +/// For Windows WASAPI audio, the following roles are supported, and map to +/// `AUDIO_STREAM_CATEGORY`: +/// +/// - "Other" (default) +/// - "Communications" - Real-time communications, such as VOIP or chat +/// - "Game" - Game audio +/// - "GameChat" - Game chat audio, similar to "Communications" except that +/// this will not attenuate other audio streams +/// - "Movie" - Music or sound with dialog +/// - "Media" - Music or sound without dialog +/// +/// Android's AAudio target supports this hint as of SDL 3.4.4. Android does +/// not support the exact same options as WASAPI, but for portability, will +/// attempt to map these same strings to the `aaudio_usage_t` constants. For +/// example, "Movie" and "Media" will both map to `AAUDIO_USAGE_MEDIA`, etc. +/// +/// If your application applies its own echo cancellation, gain control, and +/// noise reduction it should also set [`SDL_HINT_AUDIO_DEVICE_RAW_STREAM`]. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DEVICE_STREAM_ROLE: *const ::core::ffi::c_char = + c"SDL_AUDIO_DEVICE_STREAM_ROLE".as_ptr(); + +/// Specify whether this audio device should do audio processing. +/// +/// Some operating systems perform echo cancellation, gain control, and noise +/// reduction as needed. If your application already handles these, you can set +/// this hint to prevent the OS from doing additional audio processing. +/// +/// This corresponds to the WASAPI audio option `AUDCLNT_STREAMOPTIONS_RAW`. +/// +/// The variable can be set to the following values: +/// +/// - "0": audio processing can be done by the OS. (default) +/// - "1": audio processing is done by the application. +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_AUDIO_DEVICE_RAW_STREAM: *const ::core::ffi::c_char = + c"SDL_AUDIO_DEVICE_RAW_STREAM".as_ptr(); + +/// Specify the input file when recording audio using the disk audio driver. +/// +/// This defaults to "sdlaudio-in.raw" +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DISK_INPUT_FILE: *const ::core::ffi::c_char = + c"SDL_AUDIO_DISK_INPUT_FILE".as_ptr(); + +/// Specify the output file when playing audio using the disk audio driver. +/// +/// This defaults to "sdlaudio.raw" +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DISK_OUTPUT_FILE: *const ::core::ffi::c_char = + c"SDL_AUDIO_DISK_OUTPUT_FILE".as_ptr(); + +/// A variable controlling the audio rate when using the disk audio driver. +/// +/// The disk audio driver normally simulates real-time for the audio rate that +/// was specified, but you can use this variable to adjust this rate higher or +/// lower down to 0. The default value is "1.0". +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DISK_TIMESCALE: *const ::core::ffi::c_char = + c"SDL_AUDIO_DISK_TIMESCALE".as_ptr(); + +/// A variable that specifies an audio backend to use. +/// +/// By default, SDL will try all available audio backends in a reasonable order +/// until it finds one that can work, but this hint allows the app or user to +/// force a specific driver, such as "pipewire" if, say, you are on PulseAudio +/// but want to try talking to the lower level instead. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DRIVER: *const ::core::ffi::c_char = c"SDL_AUDIO_DRIVER".as_ptr(); + +/// A variable controlling the audio rate when using the dummy audio driver. +/// +/// The dummy audio driver normally simulates real-time for the audio rate that +/// was specified, but you can use this variable to adjust this rate higher or +/// lower down to 0. The default value is "1.0". +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_DUMMY_TIMESCALE: *const ::core::ffi::c_char = + c"SDL_AUDIO_DUMMY_TIMESCALE".as_ptr(); + +/// A variable controlling the default audio format. +/// +/// If the application doesn't specify the audio format when opening the +/// device, this hint can be used to specify a default format that will be +/// used. +/// +/// The variable can be set to the following values: +/// +/// - "U8": Unsigned 8-bit audio +/// - "S8": Signed 8-bit audio +/// - "S16LE": Signed 16-bit little-endian audio +/// - "S16BE": Signed 16-bit big-endian audio +/// - "S16": Signed 16-bit native-endian audio (default) +/// - "S32LE": Signed 32-bit little-endian audio +/// - "S32BE": Signed 32-bit big-endian audio +/// - "S32": Signed 32-bit native-endian audio +/// - "F32LE": Floating point little-endian audio +/// - "F32BE": Floating point big-endian audio +/// - "F32": Floating point native-endian audio +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_FORMAT: *const ::core::ffi::c_char = c"SDL_AUDIO_FORMAT".as_ptr(); + +/// A variable controlling the default audio frequency. +/// +/// If the application doesn't specify the audio frequency when opening the +/// device, this hint can be used to specify a default frequency that will be +/// used. This defaults to "44100". +/// +/// This hint should be set before an audio device is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_FREQUENCY: *const ::core::ffi::c_char = c"SDL_AUDIO_FREQUENCY".as_ptr(); + +/// A variable that causes SDL to not ignore audio "monitors". +/// +/// This is currently only used by the PulseAudio driver. +/// +/// By default, SDL ignores audio devices that aren't associated with physical +/// hardware. Changing this hint to "1" will expose anything SDL sees that +/// appears to be an audio source or sink. This will add "devices" to the list +/// that the user probably doesn't want or need, but it can be useful in +/// scenarios where you want to hook up SDL to some sort of virtual device, +/// etc. +/// +/// The variable can be set to the following values: +/// +/// - "0": Audio monitor devices will be ignored. (default) +/// - "1": Audio monitor devices will show up in the device list. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUDIO_INCLUDE_MONITORS: *const ::core::ffi::c_char = + c"SDL_AUDIO_INCLUDE_MONITORS".as_ptr(); + +/// A variable controlling whether SDL updates joystick state when getting +/// input events. +/// +/// The variable can be set to the following values: +/// +/// - "0": You'll call [`SDL_UpdateJoysticks()`] manually. +/// - "1": SDL will automatically call [`SDL_UpdateJoysticks()`]. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUTO_UPDATE_JOYSTICKS: *const ::core::ffi::c_char = + c"SDL_AUTO_UPDATE_JOYSTICKS".as_ptr(); + +/// A variable controlling whether SDL updates sensor state when getting input +/// events. +/// +/// The variable can be set to the following values: +/// +/// - "0": You'll call [`SDL_UpdateSensors()`] manually. +/// - "1": SDL will automatically call [`SDL_UpdateSensors()`]. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_AUTO_UPDATE_SENSORS: *const ::core::ffi::c_char = + c"SDL_AUTO_UPDATE_SENSORS".as_ptr(); + +/// Prevent SDL from using version 4 of the bitmap header when saving BMPs. +/// +/// The bitmap header version 4 is required for proper alpha channel support +/// and SDL will use it when required. Should this not be desired, this hint +/// can force the use of the 40 byte header version which is supported +/// everywhere. +/// +/// The variable can be set to the following values: +/// +/// - "0": Surfaces with a colorkey or an alpha channel are saved to a 32-bit +/// BMP file with an alpha mask. SDL will use the bitmap header version 4 and +/// set the alpha mask accordingly. (default) +/// - "1": Surfaces with a colorkey or an alpha channel are saved to a 32-bit +/// BMP file without an alpha mask. The alpha channel data will be in the +/// file, but applications are going to ignore it. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_BMP_SAVE_LEGACY_FORMAT: *const ::core::ffi::c_char = + c"SDL_BMP_SAVE_LEGACY_FORMAT".as_ptr(); + +/// A variable that decides what camera backend to use. +/// +/// By default, SDL will try all available camera backends in a reasonable +/// order until it finds one that can work, but this hint allows the app or +/// user to force a specific target, such as "directshow" if, say, you are on +/// Windows Media Foundations but want to try DirectShow instead. +/// +/// The default value is unset, in which case SDL will try to figure out the +/// best camera backend on your behalf. This hint needs to be set before +/// [`SDL_Init()`] is called to be useful. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_CAMERA_DRIVER: *const ::core::ffi::c_char = c"SDL_CAMERA_DRIVER".as_ptr(); + +/// A variable that limits what CPU features are available. +/// +/// By default, SDL marks all features the current CPU supports as available. +/// This hint allows the enabled features to be limited to a subset. +/// +/// When the hint is unset, or empty, SDL will enable all detected CPU +/// features. +/// +/// The variable can be set to a comma separated list containing the following +/// items: +/// +/// - "all" +/// - "altivec" +/// - "sse" +/// - "sse2" +/// - "sse3" +/// - "sse41" +/// - "sse42" +/// - "avx" +/// - "avx2" +/// - "avx512f" +/// - "arm-simd" +/// - "neon" +/// - "lsx" +/// - "lasx" +/// +/// The items can be prefixed by '+'/'-' to add/remove features. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_CPU_FEATURE_MASK: *const ::core::ffi::c_char = c"SDL_CPU_FEATURE_MASK".as_ptr(); + +/// A variable controlling whether DirectInput should be used for controllers. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable DirectInput detection. +/// - "1": Enable DirectInput detection. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_DIRECTINPUT: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_DIRECTINPUT".as_ptr(); + +/// A variable that specifies a dialog backend to use. +/// +/// By default, SDL will try all available dialog backends in a reasonable +/// order until it finds one that can work, but this hint allows the app or +/// user to force a specific target. +/// +/// If the specified target does not exist or is not available, the +/// dialog-related function calls will fail. +/// +/// This hint currently only applies to platforms using the generic "Unix" +/// dialog implementation, but may be extended to more platforms in the future. +/// Note that some Unix and Unix-like platforms have their own implementation, +/// such as macOS and Haiku. +/// +/// The variable can be set to the following values: +/// +/// - NULL: Select automatically (default, all platforms) +/// - "portal": Use XDG Portals through DBus (Unix only) +/// - "zenity": Use the Zenity program (Unix only) +/// +/// More options may be added in the future. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_FILE_DIALOG_DRIVER: *const ::core::ffi::c_char = + c"SDL_FILE_DIALOG_DRIVER".as_ptr(); + +/// Override for [`SDL_GetDisplayUsableBounds()`]. +/// +/// If set, this hint will override the expected results for +/// [`SDL_GetDisplayUsableBounds()`] for display index 0. Generally you don't want +/// to do this, but this allows an embedded system to request that some of the +/// screen be reserved for other uses when paired with a well-behaved +/// application. +/// +/// The contents of this hint must be 4 comma-separated integers, the first is +/// the bounds x, then y, width and height, in that order. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_DISPLAY_USABLE_BOUNDS: *const ::core::ffi::c_char = + c"SDL_DISPLAY_USABLE_BOUNDS".as_ptr(); + +/// Set the level of checking for invalid parameters passed to SDL functions. +/// +/// The variable can be set to the following values: +/// +/// - "1": Enable fast parameter error checking, e.g. quick NULL checks, etc. +/// - "2": Enable full parameter error checking, e.g. validating objects are +/// the correct type, etc. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_INVALID_PARAM_CHECKS: *const ::core::ffi::c_char = + c"SDL_INVALID_PARAM_CHECKS".as_ptr(); + +/// Disable giving back control to the browser automatically when running with +/// asyncify. +/// +/// With -s ASYNCIFY, SDL calls emscripten_sleep during operations such as +/// refreshing the screen or polling events. +/// +/// This hint only applies to the emscripten platform. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable emscripten_sleep calls (if you give back browser control +/// manually or use asyncify for other purposes). +/// - "1": Enable emscripten_sleep calls. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_EMSCRIPTEN_ASYNCIFY: *const ::core::ffi::c_char = + c"SDL_EMSCRIPTEN_ASYNCIFY".as_ptr(); + +/// Specify the CSS selector used for the "default" window/canvas. +/// +/// This hint only applies to the emscripten platform. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR: *const ::core::ffi::c_char = + c"SDL_EMSCRIPTEN_CANVAS_SELECTOR".as_ptr(); + +/// Override the binding element for keyboard inputs for Emscripten builds. +/// +/// This hint only applies to the emscripten platform. +/// +/// The variable can be one of: +/// +/// - "#window": the javascript window object +/// - "#document": the javascript document object +/// - "#screen": the javascript window.screen object +/// - "#canvas": the WebGL canvas element +/// - "#none": Don't bind anything at all +/// - any other string without a leading # sign applies to the element on the +/// page with that ID. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT: *const ::core::ffi::c_char = + c"SDL_EMSCRIPTEN_KEYBOARD_ELEMENT".as_ptr(); + +/// A variable that controls whether the on-screen keyboard should be shown +/// when text input is active. +/// +/// The variable can be set to the following values: +/// +/// - "auto": The on-screen keyboard will be shown if there is no physical +/// keyboard attached. (default) +/// - "0": Do not show the on-screen keyboard. +/// - "1": Show the on-screen keyboard, if available. +/// +/// This hint must be set before [`SDL_StartTextInput()`] is called +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ENABLE_SCREEN_KEYBOARD: *const ::core::ffi::c_char = + c"SDL_ENABLE_SCREEN_KEYBOARD".as_ptr(); + +/// A variable that controls whether the Steam on-screen keyboard should be +/// shown when text input is active. +/// +/// Steam will set this hint via environment variable for games launched in Big +/// Picture mode. To override this you should call [`SDL_SetHintWithPriority()`] +/// with priority [`SDL_HINT_OVERRIDE`]. +/// +/// The variable can be set to the following values: +/// +/// - "0": Do not show the Steam on-screen keyboard. +/// - "1": Show the Steam on-screen keyboard. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.4.12. +pub const SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD: *const ::core::ffi::c_char = + c"SDL_ENABLE_STEAM_SCREEN_KEYBOARD".as_ptr(); + +/// A variable containing a list of evdev devices to use if udev is not +/// available. +/// +/// The list of devices is in the form: +/// +/// deviceclass:path\[,deviceclass:path\[,...\]\] +/// +/// where device class is an integer representing the SDL_UDEV_deviceclass and +/// path is the full path to the event device. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_EVDEV_DEVICES: *const ::core::ffi::c_char = c"SDL_EVDEV_DEVICES".as_ptr(); + +/// A variable controlling verbosity of the logging of SDL events pushed onto +/// the internal queue. +/// +/// The variable can be set to the following values, from least to most +/// verbose: +/// +/// - "0": Don't log any events. (default) +/// - "1": Log most events (other than the really spammy ones). +/// - "2": Include mouse and finger motion events. +/// +/// This is generally meant to be used to debug SDL itself, but can be useful +/// for application developers that need better visibility into what is going +/// on in the event queue. Logged events are sent through [`SDL_Log()`], which +/// means by default they appear on stdout on most platforms or maybe +/// OutputDebugString() on Windows, and can be funneled by the app with +/// [`SDL_SetLogOutputFunction()`], etc. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_EVENT_LOGGING: *const ::core::ffi::c_char = c"SDL_EVENT_LOGGING".as_ptr(); + +/// A variable controlling whether raising the window should be done more +/// forcefully. +/// +/// The variable can be set to the following values: +/// +/// - "0": Honor the OS policy for raising windows. (default) +/// - "1": Force the window to be raised, overriding any OS policy. +/// +/// At present, this is only an issue under MS Windows, which makes it nearly +/// impossible to programmatically move a window to the foreground, for +/// "security" reasons. See for a +/// discussion. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_FORCE_RAISEWINDOW: *const ::core::ffi::c_char = + c"SDL_FORCE_RAISEWINDOW".as_ptr(); + +/// A variable controlling how 3D acceleration is used to accelerate the SDL +/// screen surface. +/// +/// SDL can try to accelerate the SDL screen surface by using streaming +/// textures with a 3D rendering engine. This variable controls whether and how +/// this is done. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable 3D acceleration +/// - "1": Enable 3D acceleration, using the default renderer. (default) +/// - "X": Enable 3D acceleration, using X where X is one of the valid +/// rendering drivers. (e.g. "direct3d", "opengl", etc.) +/// +/// This hint should be set before calling [`SDL_GetWindowSurface()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_FRAMEBUFFER_ACCELERATION: *const ::core::ffi::c_char = + c"SDL_FRAMEBUFFER_ACCELERATION".as_ptr(); + +/// A variable that lets you manually hint extra gamecontroller db entries. +/// +/// The variable should be newline delimited rows of gamecontroller config +/// data, see SDL_gamepad.h +/// +/// You can update mappings after SDL is initialized with +/// [`SDL_GetGamepadMappingForGUID()`] and [`SDL_AddGamepadMapping()`] +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GAMECONTROLLERCONFIG: *const ::core::ffi::c_char = + c"SDL_GAMECONTROLLERCONFIG".as_ptr(); + +/// A variable that lets you provide a file with extra gamecontroller db +/// entries. +/// +/// The file should contain lines of gamecontroller config data, see +/// SDL_gamepad.h +/// +/// You can update mappings after SDL is initialized with +/// [`SDL_GetGamepadMappingForGUID()`] and [`SDL_AddGamepadMapping()`] +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GAMECONTROLLERCONFIG_FILE: *const ::core::ffi::c_char = + c"SDL_GAMECONTROLLERCONFIG_FILE".as_ptr(); + +/// A variable that overrides the automatic controller type detection. +/// +/// The variable should be comma separated entries, in the form: VID/PID=type +/// +/// The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd +/// +/// This hint affects what low level protocol is used with the HIDAPI driver. +/// +/// The variable can be set to the following values: +/// +/// - "Xbox360" +/// - "XboxOne" +/// - "PS3" +/// - "PS4" +/// - "PS5" +/// - "SwitchPro" +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GAMECONTROLLERTYPE: *const ::core::ffi::c_char = + c"SDL_GAMECONTROLLERTYPE".as_ptr(); + +/// A variable containing a list of devices to skip when scanning for game +/// controllers. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// 0xAAAA/0xBBBB,0xCCCC/0xDDDD +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES: *const ::core::ffi::c_char = + c"SDL_GAMECONTROLLER_IGNORE_DEVICES".as_ptr(); + +/// If set, all devices will be skipped when scanning for game controllers +/// except for the ones listed in this variable. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// 0xAAAA/0xBBBB,0xCCCC/0xDDDD +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT: *const ::core::ffi::c_char = + c"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT".as_ptr(); + +/// A variable that controls whether the device's built-in accelerometer and +/// gyro should be used as sensors for gamepads. +/// +/// The variable can be set to the following values: +/// +/// - "0": Sensor fusion is disabled +/// - "1": Sensor fusion is enabled for all controllers that lack sensors +/// +/// Or the variable can be a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// 0xAAAA/0xBBBB,0xCCCC/0xDDDD +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint should be set before a gamepad is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GAMECONTROLLER_SENSOR_FUSION: *const ::core::ffi::c_char = + c"SDL_GAMECONTROLLER_SENSOR_FUSION".as_ptr(); + +/// This variable sets the default text of the TextInput window on GDK +/// platforms. +/// +/// This hint is available only if SDL_GDK_TEXTINPUT defined. +/// +/// This hint should be set before calling [`SDL_StartTextInput()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT: *const ::core::ffi::c_char = + c"SDL_GDK_TEXTINPUT_DEFAULT_TEXT".as_ptr(); + +/// This variable sets the description of the TextInput window on GDK +/// platforms. +/// +/// This hint is available only if SDL_GDK_TEXTINPUT defined. +/// +/// This hint should be set before calling [`SDL_StartTextInput()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GDK_TEXTINPUT_DESCRIPTION: *const ::core::ffi::c_char = + c"SDL_GDK_TEXTINPUT_DESCRIPTION".as_ptr(); + +/// This variable sets the maximum input length of the TextInput window on GDK +/// platforms. +/// +/// The value must be a stringified integer, for example "10" to allow for up +/// to 10 characters of text input. +/// +/// This hint is available only if SDL_GDK_TEXTINPUT defined. +/// +/// This hint should be set before calling [`SDL_StartTextInput()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH: *const ::core::ffi::c_char = + c"SDL_GDK_TEXTINPUT_MAX_LENGTH".as_ptr(); + +/// This variable sets the input scope of the TextInput window on GDK +/// platforms. +/// +/// Set this hint to change the XGameUiTextEntryInputScope value that will be +/// passed to the window creation function. The value must be a stringified +/// integer, for example "0" for XGameUiTextEntryInputScope::Default. +/// +/// This hint is available only if SDL_GDK_TEXTINPUT defined. +/// +/// This hint should be set before calling [`SDL_StartTextInput()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GDK_TEXTINPUT_SCOPE: *const ::core::ffi::c_char = + c"SDL_GDK_TEXTINPUT_SCOPE".as_ptr(); + +/// This variable sets the title of the TextInput window on GDK platforms. +/// +/// This hint is available only if SDL_GDK_TEXTINPUT defined. +/// +/// This hint should be set before calling [`SDL_StartTextInput()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GDK_TEXTINPUT_TITLE: *const ::core::ffi::c_char = + c"SDL_GDK_TEXTINPUT_TITLE".as_ptr(); + +/// A variable to control whether HIDAPI uses libusb for device access. +/// +/// By default libusb will only be used for a few devices that require direct +/// USB access, and this can be controlled with +/// [`SDL_HINT_HIDAPI_LIBUSB_WHITELIST`]. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI will not use libusb for device access. +/// - "1": HIDAPI will use libusb for device access if available. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_HIDAPI_LIBUSB: *const ::core::ffi::c_char = c"SDL_HIDAPI_LIBUSB".as_ptr(); + +/// A variable to control whether HIDAPI uses libusb for GameCube adapters. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI will not use libusb for GameCube adapters. +/// - "1": HIDAPI will use libusb for GameCube adapters if available. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_HIDAPI_LIBUSB_GAMECUBE: *const ::core::ffi::c_char = + c"SDL_HIDAPI_LIBUSB_GAMECUBE".as_ptr(); + +/// A variable to control whether HIDAPI uses libusb only for whitelisted +/// devices. +/// +/// By default libusb will only be used for a few devices that require direct +/// USB access. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI will use libusb for all device access. +/// - "1": HIDAPI will use libusb only for whitelisted devices. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_HIDAPI_LIBUSB_WHITELIST: *const ::core::ffi::c_char = + c"SDL_HIDAPI_LIBUSB_WHITELIST".as_ptr(); + +/// A variable to control whether HIDAPI uses udev for device detection. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI will poll for device changes. +/// - "1": HIDAPI will use udev for device detection. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_HIDAPI_UDEV: *const ::core::ffi::c_char = c"SDL_HIDAPI_UDEV".as_ptr(); + +/// A variable that specifies a GPU backend to use. +/// +/// By default, SDL will try all available GPU backends in a reasonable order +/// until it finds one that can work, but this hint allows the app or user to +/// force a specific target, such as "direct3d12" if, say, your hardware +/// supports Vulkan but you want to try using D3D12 instead. +/// +/// This hint should be set before any GPU functions are called. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_GPU_DRIVER: *const ::core::ffi::c_char = c"SDL_GPU_DRIVER".as_ptr(); + +/// A variable to control whether [`SDL_hid_enumerate()`] enumerates all HID +/// devices or only controllers. +/// +/// The variable can be set to the following values: +/// +/// - "0": [`SDL_hid_enumerate()`] will enumerate all HID devices. +/// - "1": [`SDL_hid_enumerate()`] will only enumerate controllers. (default) +/// +/// By default SDL will only enumerate controllers, to reduce risk of hanging +/// or crashing on devices with bad drivers and avoiding macOS keyboard capture +/// permission prompts. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS: *const ::core::ffi::c_char = + c"SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS".as_ptr(); + +/// A variable containing a list of devices to ignore in [`SDL_hid_enumerate()`]. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// For example, to ignore the Shanwan DS3 controller and any Valve controller, +/// you might use the string "0x2563/0x0523,0x28de/0x0000" +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_HIDAPI_IGNORE_DEVICES: *const ::core::ffi::c_char = + c"SDL_HIDAPI_IGNORE_DEVICES".as_ptr(); + +/// A variable describing what IME UI elements the application can display. +/// +/// By default IME UI is handled using native components by the OS where +/// possible, however this can interfere with or not be visible when exclusive +/// fullscreen mode is used. +/// +/// The variable can be set to a comma separated list containing the following +/// items: +/// +/// - "none" or "0": The application can't render any IME elements, and native +/// UI should be used. (default) +/// - "composition": The application handles [`SDL_EVENT_TEXT_EDITING`] events and +/// can render the composition text. +/// - "candidates": The application handles [`SDL_EVENT_TEXT_EDITING_CANDIDATES`] +/// and can render the candidate list. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_IME_IMPLEMENTED_UI: *const ::core::ffi::c_char = + c"SDL_IME_IMPLEMENTED_UI".as_ptr(); + +/// A variable controlling whether the home indicator bar on iPhone X and later +/// should be hidden. +/// +/// The variable can be set to the following values: +/// +/// - "0": The indicator bar is not hidden. (default for windowed applications) +/// - "1": The indicator bar is hidden and is shown when the screen is touched +/// (useful for movie playback applications). +/// - "2": The indicator bar is dim and the first swipe makes it visible and +/// the second swipe performs the "home" action. (default for fullscreen +/// applications) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_IOS_HIDE_HOME_INDICATOR: *const ::core::ffi::c_char = + c"SDL_IOS_HIDE_HOME_INDICATOR".as_ptr(); + +/// A variable that lets you enable joystick (and gamecontroller) events even +/// when your app is in the background. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable joystick & gamecontroller input events when the application +/// is in the background. (default) +/// - "1": Enable joystick & gamecontroller input events when the application +/// is in the background. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS".as_ptr(); + +/// A variable containing a list of arcade stick style controllers. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_ARCADESTICK_DEVICES".as_ptr(); + +/// A variable containing a list of devices that are not arcade stick style +/// controllers. +/// +/// This will override [`SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES`] and the built in +/// device list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED".as_ptr(); + +/// A variable containing a list of devices that should not be considered +/// joysticks. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_BLACKLIST_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_BLACKLIST_DEVICES".as_ptr(); + +/// A variable containing a list of devices that should be considered +/// joysticks. +/// +/// This will override [`SDL_HINT_JOYSTICK_BLACKLIST_DEVICES`] and the built in +/// device list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED".as_ptr(); + +/// A variable containing a comma separated list of devices to open as +/// joysticks. +/// +/// This variable is currently only used by the Linux joystick driver. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_DEVICE: *const ::core::ffi::c_char = c"SDL_JOYSTICK_DEVICE".as_ptr(); + +/// A variable controlling whether enhanced reports should be used for +/// controllers when using the HIDAPI driver. +/// +/// Enhanced reports allow rumble and effects on Bluetooth PlayStation +/// controllers and gyro on Nintendo Switch controllers, but break Windows +/// DirectInput for other applications that don't use SDL. +/// +/// Once enhanced reports are enabled, they can't be disabled on PlayStation +/// controllers without power cycling the controller. +/// +/// The variable can be set to the following values: +/// +/// - "0": enhanced reports are not enabled. +/// - "1": enhanced reports are enabled. (default) +/// - "auto": enhanced features are advertised to the application, but SDL +/// doesn't change the controller report mode unless the application uses +/// them. +/// +/// This hint can be enabled anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_ENHANCED_REPORTS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_ENHANCED_REPORTS".as_ptr(); + +/// A variable containing a list of flightstick style controllers. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of @file, in which case the named file +/// will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_FLIGHTSTICK_DEVICES".as_ptr(); + +/// A variable containing a list of devices that are not flightstick style +/// controllers. +/// +/// This will override [`SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES`] and the built in +/// device list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED".as_ptr(); + +/// A variable controlling whether GameInput should be used for controller +/// handling on Windows. +/// +/// The variable can be set to the following values: +/// +/// - "0": GameInput is not used. +/// - "1": GameInput is used. +/// +/// The default is "1" on GDK platforms, and "0" otherwise. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_GAMEINPUT: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_GAMEINPUT".as_ptr(); + +/// A variable controlling whether GameInput should be used for handling +/// GIP devices that require raw report processing, but aren't supported +/// by HIDRAW, such as Xbox One Guitars. +/// +/// Note that this is only supported with GameInput 3 or newer. +/// +/// The variable can be set to the following values: +/// +/// - "0": GameInput is not used to handle raw GIP devices. +/// - "1": GameInput is used. +/// +/// The default is "1" when using GameInput 3 or newer, and is "0" otherwise. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.4.4. +pub const SDL_HINT_JOYSTICK_GAMEINPUT_RAW: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_GAMEINPUT_RAW".as_ptr(); + +/// A variable containing a list of devices known to have a GameCube form +/// factor. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_GAMECUBE_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_GAMECUBE_DEVICES".as_ptr(); + +/// A variable containing a list of devices known not to have a GameCube form +/// factor. +/// +/// This will override [`SDL_HINT_JOYSTICK_GAMECUBE_DEVICES`] and the built in +/// device list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED".as_ptr(); + +/// A variable controlling whether the HIDAPI joystick drivers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI drivers are not used. +/// - "1": HIDAPI drivers are used. (default) +/// +/// This variable is the default for all drivers, but can be overridden by the +/// hints for specific drivers below. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI: *const ::core::ffi::c_char = c"SDL_JOYSTICK_HIDAPI".as_ptr(); + +/// A variable controlling whether Nintendo Switch Joy-Con controllers will be +/// combined into a single Pro-like controller when using the HIDAPI driver. +/// +/// The variable can be set to the following values: +/// +/// - "0": Left and right Joy-Con controllers will not be combined and each +/// will be a mini-gamepad. +/// - "1": Left and right Joy-Con controllers will be combined into a single +/// controller. (default) +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Nintendo GameCube +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`] +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_GAMECUBE".as_ptr(); + +/// A variable controlling whether rumble is used to implement the GameCube +/// controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2). +/// +/// This is useful for applications that need full compatibility for things +/// like ADSR envelopes. - Stop is implemented by setting low_frequency_rumble +/// to 0 and high_frequency_rumble >0 - Rumble is both at any arbitrary value - +/// StopHard is implemented by setting both low_frequency_rumble and +/// high_frequency_rumble to 0 +/// +/// The variable can be set to the following values: +/// +/// - "0": Normal rumble behavior is behavior is used. (default) +/// - "1": Proper GameCube controller rumble behavior is used. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Nintendo Switch +/// Joy-Cons should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_JOY_CONS".as_ptr(); + +/// A variable controlling whether the Home button LED should be turned on when +/// a Nintendo Switch Joy-Con controller is opened. +/// +/// The variable can be set to the following values: +/// +/// - "0": home button LED is turned off +/// - "1": home button LED is turned on +/// +/// By default the Home button LED state is not changed. This hint can also be +/// set to a floating point value between 0.0 and 1.0 which controls the +/// brightness of the Home button LED. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Amazon Luna +/// controllers connected via Bluetooth should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_LUNA: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_LUNA".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Nintendo Online +/// classic controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for PS3 controllers should +/// be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`] on macOS, and "0" on +/// other platforms. +/// +/// For official Sony driver (sixaxis.sys) use +/// [`SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER`]. See +/// for an alternative driver on Windows. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_PS3: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_PS3".as_ptr(); + +/// A variable controlling whether the Sony driver (sixaxis.sys) for PS3 +/// controllers (Sixaxis/DualShock 3) should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": Sony driver (sixaxis.sys) is not used. +/// - "1": Sony driver (sixaxis.sys) is used. +/// +/// The default value is 0. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for PS4 controllers should +/// be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_PS4: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_PS4".as_ptr(); + +/// A variable controlling the update rate of the PS4 controller over Bluetooth +/// when using the HIDAPI driver. +/// +/// This defaults to 4 ms, to match the behavior over USB, and to be more +/// friendly to other Bluetooth devices and older Bluetooth hardware on the +/// computer. It can be set to "1" (1000Hz), "2" (500Hz) and "4" (250Hz) +/// +/// This hint can be set anytime, but only takes effect when extended input +/// reports are enabled. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for PS5 controllers should +/// be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_PS5: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_PS5".as_ptr(); + +/// A variable controlling whether the player LEDs should be lit to indicate +/// which player is associated with a PS5 controller. +/// +/// The variable can be set to the following values: +/// +/// - "0": player LEDs are not enabled. +/// - "1": player LEDs are enabled. (default) +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for NVIDIA SHIELD +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_SHIELD: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_SHIELD".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Google Stadia +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_STADIA: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_STADIA".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Bluetooth Steam +/// Controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. (default) +/// - "1": HIDAPI driver is used for Steam Controllers, which requires +/// Bluetooth access and may prompt the user for permission on iOS and +/// Android. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_STEAM: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_STEAM".as_ptr(); + +/// A variable controlling whether the Steam button LED should be turned on +/// when a Steam controller is opened. +/// +/// The variable can be set to the following values: +/// +/// - "0": Steam button LED is turned off. +/// - "1": Steam button LED is turned on. +/// +/// By default the Steam button LED state is not changed. This hint can also be +/// set to a floating point value between 0.0 and 1.0 which controls the +/// brightness of the Steam button LED. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for the Steam Deck builtin +/// controller should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_STEAMDECK".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for HORI licensed Steam +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_STEAM_HORI".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for some Logitech wheels +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_LG4FF: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_LG4FF".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for 8BitDo controllers +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_8BITDO: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_8BITDO".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for SInput controllers +/// should be used. +/// +/// More info - +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_SINPUT: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_SINPUT".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for ZUIKI controllers +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_ZUIKI: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_ZUIKI".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Flydigi controllers +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_FLYDIGI".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Nintendo Switch +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_SWITCH: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_SWITCH".as_ptr(); + +/// A variable controlling whether the Home button LED should be turned on when +/// a Nintendo Switch Pro controller is opened. +/// +/// The variable can be set to the following values: +/// +/// - "0": Home button LED is turned off. +/// - "1": Home button LED is turned on. +/// +/// By default the Home button LED state is not changed. This hint can also be +/// set to a floating point value between 0.0 and 1.0 which controls the +/// brightness of the Home button LED. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED".as_ptr(); + +/// A variable controlling whether the player LEDs should be lit to indicate +/// which player is associated with a Nintendo Switch controller. +/// +/// The variable can be set to the following values: +/// +/// - "0": Player LEDs are not enabled. +/// - "1": Player LEDs are enabled. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Nintendo Switch 2 +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_SWITCH2: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_SWITCH2".as_ptr(); + +/// A variable controlling whether Nintendo Switch Joy-Con controllers will be +/// in vertical mode when using the HIDAPI driver. +/// +/// The variable can be set to the following values: +/// +/// - "0": Left and right Joy-Con controllers will not be in vertical mode. +/// (default) +/// - "1": Left and right Joy-Con controllers will be in vertical mode. +/// +/// This hint should be set before opening a Joy-Con controller. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// This driver doesn't work with the dolphinbar, so the default is false for +/// now. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_WII: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_WII".as_ptr(); + +/// A variable controlling whether the player LEDs should be lit to indicate +/// which player is associated with a Wii controller. +/// +/// The variable can be set to the following values: +/// +/// - "0": Player LEDs are not enabled. +/// - "1": Player LEDs are enabled. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for XBox controllers +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is "0" on Windows, otherwise the value of +/// [`SDL_HINT_JOYSTICK_HIDAPI`] +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_XBOX: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_XBOX".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for XBox 360 controllers +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX`] +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_XBOX_360: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_XBOX_360".as_ptr(); + +/// A variable controlling whether the player LEDs should be lit to indicate +/// which player is associated with an Xbox 360 controller. +/// +/// The variable can be set to the following values: +/// +/// - "0": Player LEDs are not enabled. +/// - "1": Player LEDs are enabled. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for XBox 360 wireless +/// controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX_360`] +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS".as_ptr(); + +/// A variable controlling whether the HIDAPI driver for XBox One controllers +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_XBOX_ONE".as_ptr(); + +/// A variable controlling whether the Home button LED should be turned on when +/// an Xbox One controller is opened. +/// +/// The variable can be set to the following values: +/// +/// - "0": Home button LED is turned off. +/// - "1": Home button LED is turned on. +/// +/// By default the Home button LED state is not changed. This hint can also be +/// set to a floating point value between 0.0 and 1.0 which controls the +/// brightness of the Home button LED. The default brightness is 0.4. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED".as_ptr(); + +/// A variable controlling whether the new HIDAPI driver for wired Xbox One +/// (GIP) controllers should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": HIDAPI driver is not used. +/// - "1": HIDAPI driver is used. +/// +/// The default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE`]. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_GIP: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_GIP".as_ptr(); + +/// A variable controlling whether the new HIDAPI driver for wired Xbox One +/// (GIP) controllers should reset the controller if it can't get the metadata +/// from the controller. +/// +/// The variable can be set to the following values: +/// +/// - "0": Assume this is a generic controller. +/// - "1": Reset the controller to get metadata. +/// +/// By default the controller is reset. This is so we can properly detect +/// the controller type. +/// +/// This hint should be set before initializing joysticks and gamepads. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA".as_ptr(); + +/// A variable controlling whether IOKit should be used for controller +/// handling. +/// +/// The variable can be set to the following values: +/// +/// - "0": IOKit is not used. +/// - "1": IOKit is used. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_IOKIT: *const ::core::ffi::c_char = c"SDL_JOYSTICK_IOKIT".as_ptr(); + +/// A variable controlling whether to use the classic /dev/input/js* joystick +/// interface or the newer /dev/input/event* joystick interface on Linux. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use /dev/input/event* (default) +/// - "1": Use /dev/input/js* +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_LINUX_CLASSIC: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_LINUX_CLASSIC".as_ptr(); + +/// A variable controlling whether joysticks on Linux adhere to their +/// HID-defined deadzones or return unfiltered values. +/// +/// The variable can be set to the following values: +/// +/// - "0": Return unfiltered joystick axis values. (default) +/// - "1": Return axis values with deadzones taken into account. +/// +/// This hint should be set before a controller is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_LINUX_DEADZONES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_LINUX_DEADZONES".as_ptr(); + +/// A variable controlling whether joysticks on Linux will always treat 'hat' +/// axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking +/// whether they may be analog. +/// +/// The variable can be set to the following values: +/// +/// - "0": Only map hat axis inputs to digital hat outputs if the input axes +/// appear to actually be digital. (default) +/// - "1": Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as +/// digital hats. +/// +/// This hint should be set before a controller is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_LINUX_DIGITAL_HATS".as_ptr(); + +/// A variable controlling whether digital hats on Linux will apply deadzones +/// to their underlying input axes or use unfiltered values. +/// +/// The variable can be set to the following values: +/// +/// - "0": Return digital hat values based on unfiltered input axis values. +/// - "1": Return digital hat values with deadzones on the input axes taken +/// into account. (default) +/// +/// This hint should be set before a controller is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_LINUX_HAT_DEADZONES".as_ptr(); + +/// A variable controlling whether GCController should be used for controller +/// handling. +/// +/// The variable can be set to the following values: +/// +/// - "0": GCController is not used. +/// - "1": GCController is used. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_MFI: *const ::core::ffi::c_char = c"SDL_JOYSTICK_MFI".as_ptr(); + +/// A variable controlling whether the RAWINPUT joystick drivers should be used +/// for better handling XInput-capable devices. +/// +/// The variable can be set to the following values: +/// +/// - "0": RAWINPUT drivers are not used. (default) +/// - "1": RAWINPUT drivers are used. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_RAWINPUT: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_RAWINPUT".as_ptr(); + +/// A variable controlling whether the RAWINPUT driver should pull correlated +/// data from XInput. +/// +/// The variable can be set to the following values: +/// +/// - "0": RAWINPUT driver will only use data from raw input APIs. +/// - "1": RAWINPUT driver will also pull data from XInput and +/// Windows.Gaming.Input, providing better trigger axes, guide button +/// presses, and rumble support for Xbox controllers. (default) +/// +/// This hint should be set before a gamepad is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT".as_ptr(); + +/// A variable controlling whether the ROG Chakram mice should show up as +/// joysticks. +/// +/// The variable can be set to the following values: +/// +/// - "0": ROG Chakram mice do not show up as joysticks. (default) +/// - "1": ROG Chakram mice show up as joysticks. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_ROG_CHAKRAM: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_ROG_CHAKRAM".as_ptr(); + +/// A variable controlling whether a separate thread should be used for +/// handling joystick detection and raw input messages on Windows. +/// +/// The variable can be set to the following values: +/// +/// - "0": A separate thread is not used. +/// - "1": A separate thread is used for handling raw input messages. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_THREAD: *const ::core::ffi::c_char = c"SDL_JOYSTICK_THREAD".as_ptr(); + +/// A variable containing a list of throttle style controllers. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_THROTTLE_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_THROTTLE_DEVICES".as_ptr(); + +/// A variable containing a list of devices that are not throttle style +/// controllers. +/// +/// This will override [`SDL_HINT_JOYSTICK_THROTTLE_DEVICES`] and the built in +/// device list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED".as_ptr(); + +/// A variable controlling whether Windows.Gaming.Input should be used for +/// controller handling. +/// +/// The variable can be set to the following values: +/// +/// - "0": WGI is not used. (default) +/// - "1": WGI is used. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_WGI: *const ::core::ffi::c_char = c"SDL_JOYSTICK_WGI".as_ptr(); + +/// A variable containing a list of wheel style controllers. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_WHEEL_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_WHEEL_DEVICES".as_ptr(); + +/// A variable containing a list of devices that are not wheel style +/// controllers. +/// +/// This will override [`SDL_HINT_JOYSTICK_WHEEL_DEVICES`] and the built in device +/// list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED".as_ptr(); + +/// A variable containing a list of devices known to have all axes centered at +/// zero. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint should be set before a controller is opened. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_ZERO_CENTERED_DEVICES".as_ptr(); + +/// A variable containing a list of devices and their desired number of haptic +/// (force feedback) enabled axis. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form plus the number of desired axes, e.g. +/// +/// `0xAAAA/0xBBBB/1,0xCCCC/0xDDDD/3` +/// +/// This hint supports a "wildcard" device that will set the number of haptic +/// axes on all initialized haptic devices which were not defined explicitly in +/// this hint. +/// +/// `0xFFFF/0xFFFF/1` +/// +/// This hint should be set before a controller is opened. The number of haptic +/// axes won't exceed the number of real axes found on the device. +/// +/// ## Availability +/// This hint is available since SDL 3.2.5. +pub const SDL_HINT_JOYSTICK_HAPTIC_AXES: *const ::core::ffi::c_char = + c"SDL_JOYSTICK_HAPTIC_AXES".as_ptr(); + +/// A variable that controls keycode representation in keyboard events. +/// +/// This variable is a comma separated set of options for translating keycodes +/// in events: +/// +/// - "none": Keycode options are cleared, this overrides other options. +/// - "hide_numpad": The numpad keysyms will be translated into their +/// non-numpad versions based on the current NumLock state. For example, +/// SDLK_KP_4 would become SDLK_4 if [`SDL_KMOD_NUM`] is set in the event +/// modifiers, and SDLK_LEFT if it is unset. +/// - "french_numbers": The number row on French keyboards is inverted, so +/// pressing the 1 key would yield the keycode SDLK_1, or '1', instead of +/// SDLK_AMPERSAND, or '&' +/// - "latin_letters": For keyboards using non-Latin letters, such as Russian +/// or Thai, the letter keys generate keycodes as though it had an English +/// QWERTY layout. e.g. pressing the key associated with [`SDL_SCANCODE_A`] on a +/// Russian keyboard would yield 'a' instead of a Cyrillic letter. +/// +/// The default value for this hint is "french_numbers,latin_letters" +/// +/// Some platforms like Emscripten only provide modified keycodes and the +/// options are not used. +/// +/// These options do not affect the return value of [`SDL_GetKeyFromScancode()`] or +/// [`SDL_GetScancodeFromKey()`], they just apply to the keycode included in key +/// events. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_KEYCODE_OPTIONS: *const ::core::ffi::c_char = c"SDL_KEYCODE_OPTIONS".as_ptr(); + +/// A variable that controls what KMSDRM device to use. +/// +/// SDL might open something like "/dev/dri/cardNN" to access KMSDRM +/// functionality, where "NN" is a device index number. SDL makes a guess at +/// the best index to use (usually zero), but the app or user can set this hint +/// to a number between 0 and 99 to force selection. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_KMSDRM_DEVICE_INDEX: *const ::core::ffi::c_char = + c"SDL_KMSDRM_DEVICE_INDEX".as_ptr(); + +/// A variable that controls whether SDL requires DRM master access in order to +/// initialize the KMSDRM video backend. +/// +/// The DRM subsystem has a concept of a "DRM master" which is a DRM client +/// that has the ability to set planes, set cursor, etc. When SDL is DRM +/// master, it can draw to the screen using the SDL rendering APIs. Without DRM +/// master, SDL is still able to process input and query attributes of attached +/// displays, but it cannot change display state or draw to the screen +/// directly. +/// +/// In some cases, it can be useful to have the KMSDRM backend even if it +/// cannot be used for rendering. An app may want to use SDL for input +/// processing while using another rendering API (such as an MMAL overlay on +/// Raspberry Pi) or using its own code to render to DRM overlays that SDL +/// doesn't support. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will allow usage of the KMSDRM backend without DRM master. +/// - "1": SDL Will require DRM master to use the KMSDRM backend. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER: *const ::core::ffi::c_char = + c"SDL_KMSDRM_REQUIRE_DRM_MASTER".as_ptr(); + +/// A variable that controls whether KMSDRM will use "atomic" functionality. +/// +/// The KMSDRM backend can use atomic commits, if both DRM_CLIENT_CAP_ATOMIC +/// and DRM_CLIENT_CAP_UNIVERSAL_PLANES is supported by the system. As of SDL +/// 3.4.0, it will favor this functionality, but in case this doesn't work well +/// on a given system or other surprises, this hint can be used to disable it. +/// +/// This hint can not enable the functionality if it isn't available. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will not use the KMSDRM "atomic" functionality. +/// - "1": SDL will allow usage of the KMSDRM "atomic" functionality. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_KMSDRM_ATOMIC: *const ::core::ffi::c_char = c"SDL_KMSDRM_ATOMIC".as_ptr(); + +/// A variable controlling the default SDL log levels. +/// +/// This variable is a comma separated set of category=level tokens that define +/// the default logging levels for SDL applications. +/// +/// The category can be a numeric category, one of "app", "error", "assert", +/// "system", "audio", "video", "render", "input", "test", or `*` for any +/// unspecified category. +/// +/// The level can be a numeric level, one of "verbose", "debug", "info", +/// "warn", "error", "critical", or "quiet" to disable that category. +/// +/// You can omit the category if you want to set the logging level for all +/// categories. +/// +/// If this hint isn't set, the default log levels are equivalent to: +/// +/// `app=info,assert=warn,test=verbose,*=error` +/// +/// If the `DEBUG_INVOCATION` environment variable is set to "1", the default +/// log levels are equivalent to: +/// +/// `assert=warn,test=verbose,*=debug` +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_LOGGING: *const ::core::ffi::c_char = c"SDL_LOGGING".as_ptr(); + +/// A variable controlling whether to force the application to become the +/// foreground process when launched on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": The application is brought to the foreground when launched. +/// (default) +/// - "1": The application may remain in the background when launched. +/// +/// This hint needs to be set before [`SDL_Init()`]. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MAC_BACKGROUND_APP: *const ::core::ffi::c_char = + c"SDL_MAC_BACKGROUND_APP".as_ptr(); + +/// A variable that determines whether Ctrl+Click should generate a right-click +/// event on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": Ctrl+Click does not generate a right mouse button click event. +/// (default) +/// - "1": Ctrl+Click generated a right mouse button click event. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK: *const ::core::ffi::c_char = + c"SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK".as_ptr(); + +/// A variable controlling whether dispatching OpenGL context updates should +/// block the dispatching thread until the main thread finishes processing on +/// macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": Dispatching OpenGL context updates will block the dispatching thread +/// until the main thread finishes processing. (default) +/// - "1": Dispatching OpenGL context updates will allow the dispatching thread +/// to continue execution. +/// +/// Generally you want the default, but if you have OpenGL code in a background +/// thread on a Mac, and the main thread hangs because it's waiting for that +/// background thread, but that background thread is also hanging because it's +/// waiting for the main thread to do an update, this might fix your issue. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH: *const ::core::ffi::c_char = + c"SDL_MAC_OPENGL_ASYNC_DISPATCH".as_ptr(); + +/// A variable controlling whether the Option key on macOS should be remapped +/// to act as the Alt key. +/// +/// The variable can be set to the following values: +/// +/// - "none": The Option key is not remapped to Alt. (default) +/// - "only_left": Only the left Option key is remapped to Alt. +/// - "only_right": Only the right Option key is remapped to Alt. +/// - "both": Both Option keys are remapped to Alt. +/// +/// This will prevent the triggering of key compositions that rely on the +/// Option key, but will still send the Alt modifier for keyboard events. In +/// the case that both Alt and Option are pressed, the Option key will be +/// ignored. This is particularly useful for applications like terminal +/// emulators and graphical user interfaces (GUIs) that rely on Alt key +/// functionality for shortcuts or navigation. This does not apply to +/// [`SDL_GetKeyFromScancode`] and only has an effect if IME is enabled. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MAC_OPTION_AS_ALT: *const ::core::ffi::c_char = + c"SDL_MAC_OPTION_AS_ALT".as_ptr(); + +/// A variable controlling whether [`SDL_EVENT_MOUSE_WHEEL`] event values will have +/// momentum on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": The mouse wheel events will have no momentum. (default) +/// - "1": The mouse wheel events will have momentum. +/// +/// This hint needs to be set before [`SDL_Init()`]. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MAC_SCROLL_MOMENTUM: *const ::core::ffi::c_char = + c"SDL_MAC_SCROLL_MOMENTUM".as_ptr(); + +/// A variable controlling whether holding down a key will repeat the pressed +/// key or open the accents menu on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": Holding a key will repeat the pressed key. +/// - "1": Holding a key will open the accents menu for that key. (default) +/// +/// This hint needs to be set before [`SDL_Init()`]. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_MAC_PRESS_AND_HOLD: *const ::core::ffi::c_char = + c"SDL_MAC_PRESS_AND_HOLD".as_ptr(); + +/// Request [`SDL_AppIterate()`] be called at a specific rate. +/// +/// If this is set to a number, it represents Hz, so "60" means try to iterate +/// 60 times per second. "0" means to iterate as fast as possible. Negative +/// values are illegal, but reserved, in case they are useful in a future +/// revision of SDL. +/// +/// There are other strings that have special meaning. If set to "waitevent", +/// [`SDL_AppIterate`] will not be called until new event(s) have arrived (and been +/// processed by [`SDL_AppEvent`]). This can be useful for apps that are completely +/// idle except in response to input. +/// +/// On some platforms, or if you are using [`SDL_main`] instead of [`SDL_AppIterate`], +/// this hint is ignored. When the hint can be used, it is allowed to be +/// changed at any time. +/// +/// This defaults to 0, and specifying NULL for the hint's value will restore +/// the default. +/// +/// This doesn't have to be an integer value. For example, "59.94" won't be +/// rounded to an integer rate; the digits after the decimal are actually +/// respected. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MAIN_CALLBACK_RATE: *const ::core::ffi::c_char = + c"SDL_MAIN_CALLBACK_RATE".as_ptr(); + +/// A variable controlling whether the mouse is captured while mouse buttons +/// are pressed. +/// +/// The variable can be set to the following values: +/// +/// - "0": The mouse is not captured while mouse buttons are pressed. +/// - "1": The mouse is captured while mouse buttons are pressed. +/// +/// By default the mouse is captured while mouse buttons are pressed so if the +/// mouse is dragged outside the window, the application continues to receive +/// mouse events until the button is released. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_AUTO_CAPTURE: *const ::core::ffi::c_char = + c"SDL_MOUSE_AUTO_CAPTURE".as_ptr(); + +/// A variable setting the double click radius, in pixels. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS: *const ::core::ffi::c_char = + c"SDL_MOUSE_DOUBLE_CLICK_RADIUS".as_ptr(); + +/// A variable setting the double click time, in milliseconds. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_DOUBLE_CLICK_TIME: *const ::core::ffi::c_char = + c"SDL_MOUSE_DOUBLE_CLICK_TIME".as_ptr(); + +/// A variable setting which system cursor to use as the default cursor. +/// +/// This should be an integer corresponding to the [`SDL_SystemCursor`] enum. The +/// default value is zero ([`SDL_SYSTEM_CURSOR_DEFAULT`]). +/// +/// This hint needs to be set before [`SDL_Init()`]. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR: *const ::core::ffi::c_char = + c"SDL_MOUSE_DEFAULT_SYSTEM_CURSOR".as_ptr(); + +/// A variable setting whether we should scale cursors by the current display +/// scale. +/// +/// The variable can be set to the following values: +/// +/// - "0": Cursors will not change size based on the display content scale. +/// (default) +/// - "1": Cursors will automatically match the display content scale (e.g. a +/// 2x sized cursor will be used when the window is on a monitor with 200% +/// scale). This is currently implemented on Windows. +/// +/// This hint needs to be set before creating cursors. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_MOUSE_DPI_SCALE_CURSORS: *const ::core::ffi::c_char = + c"SDL_MOUSE_DPI_SCALE_CURSORS".as_ptr(); + +/// A variable controlling whether warping a hidden mouse cursor will activate +/// relative mouse mode. +/// +/// When this hint is set, the mouse cursor is hidden, and multiple warps to +/// the window center occur within a short time period, SDL will emulate mouse +/// warps using relative mouse mode. This can provide smoother and more +/// reliable mouse motion for some older games, which continuously calculate +/// the distance traveled by the mouse pointer and warp it back to the center +/// of the window, rather than using relative mouse motion. +/// +/// Note that relative mouse mode may have different mouse acceleration +/// behavior than pointer warps. +/// +/// If your application needs to repeatedly warp the hidden mouse cursor at a +/// high-frequency for other purposes, it should disable this hint. +/// +/// The variable can be set to the following values: +/// +/// - "0": Attempts to warp the mouse will always be made. +/// - "1": Some mouse warps will be emulated by forcing relative mouse mode. +/// (default) +/// +/// If not set, this is automatically enabled unless an application uses +/// relative mouse mode directly. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE: *const ::core::ffi::c_char = + c"SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE".as_ptr(); + +/// Allow mouse click events when clicking to focus an SDL window. +/// +/// The variable can be set to the following values: +/// +/// - "0": Ignore mouse clicks that activate a window. (default) +/// - "1": Generate events for mouse clicks that activate a window. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH: *const ::core::ffi::c_char = + c"SDL_MOUSE_FOCUS_CLICKTHROUGH".as_ptr(); + +/// A variable setting the speed scale for mouse motion, in floating point, +/// when the mouse is not in relative mode. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_NORMAL_SPEED_SCALE: *const ::core::ffi::c_char = + c"SDL_MOUSE_NORMAL_SPEED_SCALE".as_ptr(); + +/// A variable controlling whether relative mouse mode constrains the mouse to +/// the center of the window. +/// +/// Constraining to the center of the window works better for FPS games and +/// when the application is running over RDP. Constraining to the whole window +/// works better for 2D games and increases the chance that the mouse will be +/// in the correct position when using high DPI mice. +/// +/// The variable can be set to the following values: +/// +/// - "0": Relative mouse mode constrains the mouse to the window. +/// - "1": Relative mouse mode constrains the mouse to the center of the +/// window. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_RELATIVE_MODE_CENTER: *const ::core::ffi::c_char = + c"SDL_MOUSE_RELATIVE_MODE_CENTER".as_ptr(); + +/// A variable setting the scale for mouse motion, in floating point, when the +/// mouse is in relative mode. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE: *const ::core::ffi::c_char = + c"SDL_MOUSE_RELATIVE_SPEED_SCALE".as_ptr(); + +/// A variable controlling whether the system mouse acceleration curve is used +/// for relative mouse motion. +/// +/// The variable can be set to the following values: +/// +/// - "0": Relative mouse motion will be unscaled. (default) +/// - "1": Relative mouse motion will be scaled using the system mouse +/// acceleration curve. +/// +/// If [`SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE`] is set, that will be applied after +/// system speed scale. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE: *const ::core::ffi::c_char = + c"SDL_MOUSE_RELATIVE_SYSTEM_SCALE".as_ptr(); + +/// A variable controlling whether a motion event should be generated for mouse +/// warping in relative mode. +/// +/// The variable can be set to the following values: +/// +/// - "0": Warping the mouse will not generate a motion event in relative mode +/// - "1": Warping the mouse will generate a motion event in relative mode +/// +/// By default warping the mouse will not generate motion events in relative +/// mode. This avoids the application having to filter out large relative +/// motion due to warping. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_RELATIVE_WARP_MOTION: *const ::core::ffi::c_char = + c"SDL_MOUSE_RELATIVE_WARP_MOTION".as_ptr(); + +/// A variable controlling whether the hardware cursor stays visible when +/// relative mode is active. +/// +/// This variable can be set to the following values: +/// +/// - "0": The cursor will be hidden while relative mode is active (default) +/// - "1": The cursor will remain visible while relative mode is active +/// +/// Note that for systems without raw hardware inputs, relative mode is +/// implemented using warping, so the hardware cursor will visibly warp between +/// frames if this is enabled on those systems. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE: *const ::core::ffi::c_char = + c"SDL_MOUSE_RELATIVE_CURSOR_VISIBLE".as_ptr(); + +/// A variable controlling whether mouse events should generate synthetic touch +/// events. +/// +/// The variable can be set to the following values: +/// +/// - "0": Mouse events will not generate touch events. (default for desktop +/// platforms) +/// - "1": Mouse events will generate touch events. (default for mobile +/// platforms, such as Android and iOS) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MOUSE_TOUCH_EVENTS: *const ::core::ffi::c_char = + c"SDL_MOUSE_TOUCH_EVENTS".as_ptr(); + +/// A variable controlling whether the keyboard should be muted on the console. +/// +/// Normally the keyboard is muted while SDL applications are running so that +/// keyboard input doesn't show up as key strokes on the console. This hint +/// allows you to turn that off for debugging purposes. +/// +/// The variable can be set to the following values: +/// +/// - "0": Allow keystrokes to go through to the console. +/// - "1": Mute keyboard input so it doesn't show up on the console. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_MUTE_CONSOLE_KEYBOARD: *const ::core::ffi::c_char = + c"SDL_MUTE_CONSOLE_KEYBOARD".as_ptr(); + +/// Tell SDL not to catch the SIGINT or SIGTERM signals on POSIX platforms. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will install a SIGINT and SIGTERM handler, and when it catches a +/// signal, convert it into an [`SDL_EVENT_QUIT`] event. (default) +/// - "1": SDL will not install a signal handler at all. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_NO_SIGNAL_HANDLERS: *const ::core::ffi::c_char = + c"SDL_NO_SIGNAL_HANDLERS".as_ptr(); + +/// Specify the OpenGL library to load. +/// +/// This hint should be set before creating an OpenGL window or creating an +/// OpenGL context. If this hint isn't set, SDL will choose a reasonable +/// default. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_OPENGL_LIBRARY: *const ::core::ffi::c_char = c"SDL_OPENGL_LIBRARY".as_ptr(); + +/// Specify the EGL library to load. +/// +/// This hint should be set before creating an OpenGL window or creating an +/// OpenGL context. This hint is only considered if SDL is using EGL to manage +/// OpenGL contexts. If this hint isn't set, SDL will choose a reasonable +/// default. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_EGL_LIBRARY: *const ::core::ffi::c_char = c"SDL_EGL_LIBRARY".as_ptr(); + +/// A variable controlling what driver to use for OpenGL ES contexts. +/// +/// On some platforms, currently Windows and X11, OpenGL drivers may support +/// creating contexts with an OpenGL ES profile. By default SDL uses these +/// profiles, when available, otherwise it attempts to load an OpenGL ES +/// library, e.g. that provided by the ANGLE project. This variable controls +/// whether SDL follows this default behaviour or will always load an OpenGL ES +/// library. +/// +/// Circumstances where this is useful include - Testing an app with a +/// particular OpenGL ES implementation, e.g ANGLE, or emulator, e.g. those +/// from ARM, Imagination or Qualcomm. - Resolving OpenGL ES function addresses +/// at link time by linking with the OpenGL ES library instead of querying them +/// at run time with [`SDL_GL_GetProcAddress()`]. +/// +/// Caution: for an application to work with the default behaviour across +/// different OpenGL drivers it must query the OpenGL ES function addresses at +/// run time using [`SDL_GL_GetProcAddress()`]. +/// +/// This variable is ignored on most platforms because OpenGL ES is native or +/// not supported. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use ES profile of OpenGL, if available. (default) +/// - "1": Load OpenGL ES library using the default library names. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_OPENGL_ES_DRIVER: *const ::core::ffi::c_char = c"SDL_OPENGL_ES_DRIVER".as_ptr(); + +/// A variable controlling whether to force an sRGB-capable OpenGL context. +/// +/// At OpenGL context creation time, some platforms can request an sRGB-capable +/// context. However, sometimes any form of the request can cause surprising +/// results on some drivers, platforms, and hardware. Usually the surprise is +/// in the form of rendering that is either a little darker or a little +/// brighter than intended. +/// +/// This hint allows the user to override the app's sRGB requests and either +/// force a specific value, or avoid requesting anything at all, depending on +/// what makes things work correctly for their system. +/// +/// This is meant as a fail-safe; apps should probably not explicitly set this, +/// and most users should not, either. +/// +/// Note that some platforms cannot make this request at all, and on all +/// platforms this request can be denied by the operating system. +/// +/// In addition to attempting to obtain the type of sRGB-capable OpenGL context +/// requested by this hint, SDL will try to force the state of +/// GL_FRAMEBUFFER_SRGB on the new context, if appropriate. +/// +/// The variable can be set to the following values: +/// +/// - "0": Force a request for an OpenGL context that is _not_ sRGB-capable. +/// - "1": Force a request for an OpenGL context that _is_ sRGB-capable. +/// - "skip": Don't make any request for an sRGB-capable context (don't specify +/// the attribute at all during context creation time). +/// - any other string is undefined behavior. +/// +/// If unset, or set to an empty string, SDL will make a request using the +/// value the app specified with the [`SDL_GL_FRAMEBUFFER_SRGB_CAPABLE`] attribute. +/// +/// This hint should be set before an OpenGL context is created. +/// +/// ## Availability +/// This hint is available since SDL 3.4.2. +pub const SDL_HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER: *const ::core::ffi::c_char = + c"SDL_OPENGL_FORCE_SRGB_FRAMEBUFFER".as_ptr(); + +/// Mechanism to specify openvr_api library location +/// +/// By default, when using the OpenVR driver, it will search for the API +/// library in the current folder. But, if you wish to use a system API you can +/// specify that by using this hint. This should be the full or relative path +/// to a .dll on Windows or .so on Linux. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_OPENVR_LIBRARY: *const ::core::ffi::c_char = c"SDL_OPENVR_LIBRARY".as_ptr(); + +/// A variable controlling which orientations are allowed on iOS/Android. +/// +/// In some circumstances it is necessary to be able to explicitly control +/// which UI orientations are allowed. +/// +/// This variable is a space delimited list of the following values: +/// +/// - "LandscapeLeft" +/// - "LandscapeRight" +/// - "Portrait" +/// - "PortraitUpsideDown" +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ORIENTATIONS: *const ::core::ffi::c_char = c"SDL_ORIENTATIONS".as_ptr(); + +/// A variable controlling the use of a sentinel event when polling the event +/// queue. +/// +/// When polling for events, [`SDL_PumpEvents`] is used to gather new events from +/// devices. If a device keeps producing new events between calls to +/// [`SDL_PumpEvents`], a poll loop will become stuck until the new events stop. +/// This is most noticeable when moving a high frequency mouse. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable poll sentinels. +/// - "1": Enable poll sentinels. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_POLL_SENTINEL: *const ::core::ffi::c_char = c"SDL_POLL_SENTINEL".as_ptr(); + +/// Override for [`SDL_GetPreferredLocales()`]. +/// +/// If set, this will be favored over anything the OS might report for the +/// user's preferred locales. Changing this hint at runtime will not generate a +/// [`SDL_EVENT_LOCALE_CHANGED`] event (but if you can change the hint, you can +/// push your own event, if you want). +/// +/// The format of this hint is a comma-separated list of language and locale, +/// combined with an underscore, as is a common format: "en_GB". Locale is +/// optional: "en". So you might have a list like this: "en_GB,jp,es_PT" +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_PREFERRED_LOCALES: *const ::core::ffi::c_char = + c"SDL_PREFERRED_LOCALES".as_ptr(); + +/// A variable that decides whether to send [`SDL_EVENT_QUIT`] when closing the +/// last window. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will not send an [`SDL_EVENT_QUIT`] event when the last window is +/// requesting to close. Note that in this case, there are still other +/// legitimate reasons one might get an [`SDL_EVENT_QUIT`] event: choosing "Quit" +/// from the macOS menu bar, sending a SIGINT (ctrl-c) on Unix, etc. +/// - "1": SDL will send a quit event when the last window is requesting to +/// close. (default) +/// +/// If there is at least one active system tray icon, [`SDL_EVENT_QUIT`] will +/// instead be sent when both the last window will be closed and the last tray +/// icon will be destroyed. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE: *const ::core::ffi::c_char = + c"SDL_QUIT_ON_LAST_WINDOW_CLOSE".as_ptr(); + +/// A variable controlling whether the Direct3D device is initialized for +/// thread-safe operations. +/// +/// The variable can be set to the following values: +/// +/// - "0": Thread-safety is not enabled. (default) +/// - "1": Thread-safety is enabled. +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_DIRECT3D_THREADSAFE: *const ::core::ffi::c_char = + c"SDL_RENDER_DIRECT3D_THREADSAFE".as_ptr(); + +/// A variable controlling whether to enable Direct3D 11+'s Debug Layer. +/// +/// This variable does not have any effect on the Direct3D 9 based renderer. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable Debug Layer use. (default) +/// - "1": Enable Debug Layer use. +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_DIRECT3D11_DEBUG: *const ::core::ffi::c_char = + c"SDL_RENDER_DIRECT3D11_DEBUG".as_ptr(); + +/// A variable controlling whether to use the Direct3D 11 WARP software +/// rasterizer. +/// +/// For more information, see: +/// +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable WARP rasterizer. (default) +/// - "1": Enable WARP rasterizer. +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_RENDER_DIRECT3D11_WARP: *const ::core::ffi::c_char = + c"SDL_RENDER_DIRECT3D11_WARP".as_ptr(); + +/// A variable controlling whether to enable Vulkan Validation Layers. +/// +/// This variable can be set to the following values: +/// +/// - "0": Disable Validation Layer use +/// - "1": Enable Validation Layer use +/// +/// By default, SDL does not use Vulkan Validation Layers. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_VULKAN_DEBUG: *const ::core::ffi::c_char = + c"SDL_RENDER_VULKAN_DEBUG".as_ptr(); + +/// A variable controlling whether to create the GPU device in debug mode. +/// +/// This variable can be set to the following values: +/// +/// - "0": Disable debug mode use (default) +/// - "1": Enable debug mode use +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_GPU_DEBUG: *const ::core::ffi::c_char = c"SDL_RENDER_GPU_DEBUG".as_ptr(); + +/// A variable controlling whether to prefer a low-power GPU on multi-GPU +/// systems. +/// +/// This variable can be set to the following values: +/// +/// - "0": Prefer high-performance GPU (default) +/// - "1": Prefer low-power GPU +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_GPU_LOW_POWER: *const ::core::ffi::c_char = + c"SDL_RENDER_GPU_LOW_POWER".as_ptr(); + +/// A variable specifying which render driver to use. +/// +/// If the application doesn't pick a specific renderer to use, this variable +/// specifies the name of the preferred renderer. If the preferred renderer +/// can't be initialized, creating a renderer will fail. +/// +/// This variable is case insensitive and can be set to the following values: +/// +/// - "direct3d" +/// - "direct3d11" +/// - "direct3d12" +/// - "opengl" +/// - "opengles2" +/// - "opengles" +/// - "metal" +/// - "vulkan" +/// - "gpu" +/// - "software" +/// +/// This hint accepts a comma-separated list of driver names, and each will be +/// tried in the order listed when creating a renderer until one succeeds or +/// all of them fail. +/// +/// The default varies by platform, but it's the first one in the list that is +/// available on the current platform. +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_DRIVER: *const ::core::ffi::c_char = c"SDL_RENDER_DRIVER".as_ptr(); + +/// A variable controlling how the 2D render API renders lines. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use the default line drawing method (Bresenham's line algorithm) +/// - "1": Use the driver point API using Bresenham's line algorithm (correct, +/// draws many points) +/// - "2": Use the driver line API (occasionally misses line endpoints based on +/// hardware driver quirks +/// - "3": Use the driver geometry API (correct, draws thicker diagonal lines) +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_LINE_METHOD: *const ::core::ffi::c_char = + c"SDL_RENDER_LINE_METHOD".as_ptr(); + +/// A variable controlling whether the Metal render driver select low power +/// device over default one. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use the preferred OS device. (default) +/// - "1": Select a low power device. +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE: *const ::core::ffi::c_char = + c"SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE".as_ptr(); + +/// A variable controlling whether updates to the SDL screen surface should be +/// synchronized with the vertical refresh, to avoid tearing. +/// +/// This hint overrides the application preference when creating a renderer. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable vsync. (default) +/// - "1": Enable vsync. +/// +/// This hint should be set before creating a renderer. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RENDER_VSYNC: *const ::core::ffi::c_char = c"SDL_RENDER_VSYNC".as_ptr(); + +/// A variable to control whether the return key on the soft keyboard should +/// hide the soft keyboard on Android and iOS. +/// +/// This hint sets the default value of [`SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN`]. +/// +/// The variable can be set to the following values: +/// +/// - "0": The return key will be handled as a key event. (default) +/// - "1": The return key will hide the keyboard. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RETURN_KEY_HIDES_IME: *const ::core::ffi::c_char = + c"SDL_RETURN_KEY_HIDES_IME".as_ptr(); + +/// A variable containing a list of ROG gamepad capable mice. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED`] +pub const SDL_HINT_ROG_GAMEPAD_MICE: *const ::core::ffi::c_char = c"SDL_ROG_GAMEPAD_MICE".as_ptr(); + +/// A variable containing a list of devices that are not ROG gamepad capable +/// mice. +/// +/// This will override [`SDL_HINT_ROG_GAMEPAD_MICE`] and the built in device list. +/// +/// The format of the string is a comma separated list of USB VID/PID pairs in +/// hexadecimal form, e.g. +/// +/// `0xAAAA/0xBBBB,0xCCCC/0xDDDD` +/// +/// The variable can also take the form of "@file", in which case the named +/// file will be loaded and interpreted as the value of the variable. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED: *const ::core::ffi::c_char = + c"SDL_ROG_GAMEPAD_MICE_EXCLUDED".as_ptr(); + +/// A variable controlling the width of the PS2's framebuffer in pixels. +/// +/// By default, the variable is "640". +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_PS2_GS_WIDTH: *const ::core::ffi::c_char = c"SDL_PS2_GS_WIDTH".as_ptr(); + +/// A variable controlling the height of the PS2's framebuffer in pixels. +/// +/// By default, the variable is "448". +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_PS2_GS_HEIGHT: *const ::core::ffi::c_char = c"SDL_PS2_GS_HEIGHT".as_ptr(); + +/// A variable controlling whether the signal is interlaced or progressive. +/// +/// The variable can be set to the following values: +/// +/// - "0": Image is interlaced. (default) +/// - "1": Image is progressive. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_PS2_GS_PROGRESSIVE: *const ::core::ffi::c_char = + c"SDL_PS2_GS_PROGRESSIVE".as_ptr(); + +/// A variable controlling the video mode of the console. +/// +/// The variable can be set to the following values: +/// +/// - "": Console-native. (default) +/// - "NTSC": 60hz region. +/// - "PAL": 50hz region. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_PS2_GS_MODE: *const ::core::ffi::c_char = c"SDL_PS2_GS_MODE".as_ptr(); + +/// A variable controlling which Dispmanx layer to use on a Raspberry PI. +/// +/// Also known as Z-order. The variable can take a negative or positive value. +/// The default is 10000. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_RPI_VIDEO_LAYER: *const ::core::ffi::c_char = c"SDL_RPI_VIDEO_LAYER".as_ptr(); + +/// Specify an "activity name" for screensaver inhibition. +/// +/// Some platforms, notably Linux desktops, list the applications which are +/// inhibiting the screensaver or other power-saving features. +/// +/// This hint lets you specify the "activity name" sent to the OS when +/// [`SDL_DisableScreenSaver()`] is used (or the screensaver is automatically +/// disabled). The contents of this hint are used when the screensaver is +/// disabled. You should use a string that describes what your program is doing +/// (and, therefore, why the screensaver is disabled). For example, "Playing a +/// game" or "Watching a video". +/// +/// Setting this to "" or leaving it unset will have SDL use a reasonable +/// default: "Playing a game" or something similar. +/// +/// This hint should be set before calling [`SDL_DisableScreenSaver()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME: *const ::core::ffi::c_char = + c"SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME".as_ptr(); + +/// A variable controlling whether SDL calls dbus_shutdown() on quit. +/// +/// This is useful as a debug tool to validate memory leaks, but shouldn't ever +/// be set in production applications, as other libraries used by the +/// application might use dbus under the hood and this can cause crashes if +/// they continue after [`SDL_Quit()`]. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will not call dbus_shutdown() on quit. (default) +/// - "1": SDL will call dbus_shutdown() on quit. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_SHUTDOWN_DBUS_ON_QUIT: *const ::core::ffi::c_char = + c"SDL_SHUTDOWN_DBUS_ON_QUIT".as_ptr(); + +/// A variable that specifies a backend to use for title storage. +/// +/// By default, SDL will try all available storage backends in a reasonable +/// order until it finds one that can work, but this hint allows the app or +/// user to force a specific target, such as "pc" if, say, you are on Steam but +/// want to avoid SteamRemoteStorage for title data. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_STORAGE_TITLE_DRIVER: *const ::core::ffi::c_char = + c"SDL_STORAGE_TITLE_DRIVER".as_ptr(); + +/// A variable that specifies a backend to use for user storage. +/// +/// By default, SDL will try all available storage backends in a reasonable +/// order until it finds one that can work, but this hint allows the app or +/// user to force a specific target, such as "pc" if, say, you are on Steam but +/// want to avoid SteamRemoteStorage for user data. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_STORAGE_USER_DRIVER: *const ::core::ffi::c_char = + c"SDL_STORAGE_USER_DRIVER".as_ptr(); + +/// Specifies whether [`SDL_THREAD_PRIORITY_TIME_CRITICAL`] should be treated as +/// realtime. +/// +/// On some platforms, like Linux, a realtime priority thread may be subject to +/// restrictions that require special handling by the application. This hint +/// exists to let SDL know that the app is prepared to handle said +/// restrictions. +/// +/// On Linux, SDL will apply the following configuration to any thread that +/// becomes realtime: +/// +/// - The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, +/// - An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. +/// - Exceeding this limit will result in the kernel sending SIGKILL to the +/// app, refer to the man pages for more information. +/// +/// The variable can be set to the following values: +/// +/// - "0": default platform specific behaviour +/// - "1": Force [`SDL_THREAD_PRIORITY_TIME_CRITICAL`] to a realtime scheduling +/// policy +/// +/// This hint should be set before calling [`SDL_SetCurrentThreadPriority()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL: *const ::core::ffi::c_char = + c"SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL".as_ptr(); + +/// A string specifying additional information to use with +/// [`SDL_SetCurrentThreadPriority`]. +/// +/// By default [`SDL_SetCurrentThreadPriority`] will make appropriate system +/// changes in order to apply a thread priority. For example on systems using +/// pthreads the scheduler policy is changed automatically to a policy that +/// works well with a given priority. Code which has specific requirements can +/// override SDL's default behavior with this hint. +/// +/// pthread hint values are "current", "other", "fifo" and "rr". Currently no +/// other platform hint values are defined but may be in the future. +/// +/// On Linux, the kernel may send SIGKILL to realtime tasks which exceed the +/// distro configured execution budget for rtkit. This budget can be queried +/// through RLIMIT_RTTIME after calling [`SDL_SetCurrentThreadPriority()`]. +/// +/// This hint should be set before calling [`SDL_SetCurrentThreadPriority()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_THREAD_PRIORITY_POLICY: *const ::core::ffi::c_char = + c"SDL_THREAD_PRIORITY_POLICY".as_ptr(); + +/// A variable that controls the timer resolution, in milliseconds. +/// +/// The higher resolution the timer, the more frequently the CPU services timer +/// interrupts, and the more precise delays are, but this takes up power and +/// CPU time. This hint is only used on Windows. +/// +/// See this blog post for more information: +/// +/// +/// The default value is "1". +/// +/// If this variable is set to "0", the system timer resolution is not set. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_TIMER_RESOLUTION: *const ::core::ffi::c_char = c"SDL_TIMER_RESOLUTION".as_ptr(); + +/// A variable controlling whether touch events should generate synthetic mouse +/// events. +/// +/// The variable can be set to the following values: +/// +/// - "0": Touch events will not generate mouse events. +/// - "1": Touch events will generate mouse events. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_TOUCH_MOUSE_EVENTS: *const ::core::ffi::c_char = + c"SDL_TOUCH_MOUSE_EVENTS".as_ptr(); + +/// A variable controlling whether trackpads should be treated as touch +/// devices. +/// +/// On macOS (and possibly other platforms in the future), SDL will report +/// touches on a trackpad as mouse input, which is generally what users expect +/// from this device; however, these are often actually full multitouch-capable +/// touch devices, so it might be preferable to some apps to treat them as +/// such. +/// +/// The variable can be set to the following values: +/// +/// - "0": Trackpad will send mouse events. (default) +/// - "1": Trackpad will send touch events. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_TRACKPAD_IS_TOUCH_ONLY: *const ::core::ffi::c_char = + c"SDL_TRACKPAD_IS_TOUCH_ONLY".as_ptr(); + +/// A variable controlling whether the Android / tvOS remotes should be listed +/// as joystick devices, instead of sending keyboard events. +/// +/// The variable can be set to the following values: +/// +/// - "0": Remotes send enter/escape/arrow key events. +/// - "1": Remotes are available as 2 axis, 2 button joysticks. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_TV_REMOTE_AS_JOYSTICK: *const ::core::ffi::c_char = + c"SDL_TV_REMOTE_AS_JOYSTICK".as_ptr(); + +/// A variable controlling whether the screensaver is enabled. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable screensaver. (default) +/// - "1": Enable screensaver. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_ALLOW_SCREENSAVER: *const ::core::ffi::c_char = + c"SDL_VIDEO_ALLOW_SCREENSAVER".as_ptr(); + +/// A comma separated list containing the names of the displays that SDL should +/// sort to the front of the display list. +/// +/// When this hint is set, displays with matching name strings will be +/// prioritized in the list of displays, as exposed by calling +/// [`SDL_GetDisplays()`], with the first listed becoming the primary display. The +/// naming convention can vary depending on the environment, but it is usually +/// a connector name (e.g. 'DP-1', 'DP-2', 'HDMI-A-1', etc...). +/// +/// On Wayland desktops, the connector names associated with displays can be +/// found in the `name` property of the info output from `wayland-info -i +/// wl_output`. On X11 desktops, the `xrandr` utility can be used to retrieve +/// the connector names associated with displays. +/// +/// This hint is currently supported on the following drivers: +/// +/// - KMSDRM (kmsdrm) +/// - Wayland (wayland) +/// - X11 (x11) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_DISPLAY_PRIORITY: *const ::core::ffi::c_char = + c"SDL_VIDEO_DISPLAY_PRIORITY".as_ptr(); + +/// Tell the video driver that we only want a double buffer. +/// +/// By default, most lowlevel 2D APIs will use a triple buffer scheme that +/// wastes no CPU time on waiting for vsync after issuing a flip, but +/// introduces a frame of latency. On the other hand, using a double buffer +/// scheme instead is recommended for cases where low latency is an important +/// factor because we save a whole frame of latency. +/// +/// We do so by waiting for vsync immediately after issuing a flip, usually +/// just after eglSwapBuffers call in the backend's *_SwapWindow function. +/// +/// This hint is currently supported on the following drivers: +/// +/// - Raspberry Pi (raspberrypi) +/// - Wayland (wayland) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_DOUBLE_BUFFER: *const ::core::ffi::c_char = + c"SDL_VIDEO_DOUBLE_BUFFER".as_ptr(); + +/// A variable that specifies a video backend to use. +/// +/// By default, SDL will try all available video backends in a reasonable order +/// until it finds one that can work, but this hint allows the app or user to +/// force a specific target, such as "x11" if, say, you are on Wayland but want +/// to try talking to the X server instead. +/// +/// This hint accepts a comma-separated list of driver names, and each will be +/// tried in the order listed during init, until one succeeds or all of them +/// fail. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_DRIVER: *const ::core::ffi::c_char = c"SDL_VIDEO_DRIVER".as_ptr(); + +/// A variable controlling whether the dummy video driver saves output frames. +/// +/// - "0": Video frames are not saved to disk. (default) +/// - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", +/// where X is the window ID, and Y is the frame number. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES: *const ::core::ffi::c_char = + c"SDL_VIDEO_DUMMY_SAVE_FRAMES".as_ptr(); + +/// If eglGetPlatformDisplay fails, fall back to calling eglGetDisplay. +/// +/// The variable can be set to one of the following values: +/// +/// - "0": Do not fall back to eglGetDisplay. +/// - "1": Fall back to eglGetDisplay if eglGetPlatformDisplay fails. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK: *const ::core::ffi::c_char = + c"SDL_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK".as_ptr(); + +/// A variable controlling whether the OpenGL context should be created with +/// EGL. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use platform-specific GL context creation API (GLX, WGL, CGL, etc). +/// (default) +/// - "1": Use EGL +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_FORCE_EGL: *const ::core::ffi::c_char = c"SDL_VIDEO_FORCE_EGL".as_ptr(); + +/// A variable that specifies the policy for fullscreen Spaces on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable Spaces support (FULLSCREEN_DESKTOP won't use them and +/// [`SDL_WINDOW_RESIZABLE`] windows won't offer the "fullscreen" button on their +/// titlebars). +/// - "1": Enable Spaces support (FULLSCREEN_DESKTOP will use them and +/// [`SDL_WINDOW_RESIZABLE`] windows will offer the "fullscreen" button on their +/// titlebars). (default) +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES: *const ::core::ffi::c_char = + c"SDL_VIDEO_MAC_FULLSCREEN_SPACES".as_ptr(); + +/// A variable that specifies the menu visibility when a window is fullscreen +/// in Spaces on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": The menu will be hidden when the window is in a fullscreen space, +/// and not accessible by moving the mouse to the top of the screen. +/// - "1": The menu will be accessible when the window is in a fullscreen +/// space. +/// - "auto": The menu will be hidden if fullscreen mode was toggled on +/// programmatically via `SDL_SetWindowFullscreen()`, and accessible if +/// fullscreen was entered via the "fullscreen" button on the window title +/// bar. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY: *const ::core::ffi::c_char = + c"SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY".as_ptr(); + +/// A variable indicating whether the metal layer drawable size should be +/// updated for the [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event on macOS. +/// +/// The variable can be set to the following values: +/// +/// - "0": the metal layer drawable size will not be updated on the +/// [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event. +/// - "1": the metal layer drawable size will be updated on the +/// [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event. (default) +/// +/// This hint should be set before [`SDL_Metal_CreateView`] called. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_VIDEO_METAL_AUTO_RESIZE_DRAWABLE: *const ::core::ffi::c_char = + c"SDL_VIDEO_METAL_AUTO_RESIZE_DRAWABLE".as_ptr(); + +/// A variable controlling whether SDL will attempt to automatically set the +/// destination display to a mode most closely matching that of the previous +/// display if an exclusive fullscreen window is moved onto it. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will not attempt to automatically set a matching mode on the +/// destination display. If an exclusive fullscreen window is moved to a new +/// display, the window will become fullscreen desktop. +/// - "1": SDL will attempt to automatically set a mode on the destination +/// display that most closely matches the mode of the display that the +/// exclusive fullscreen window was previously on. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE: *const ::core::ffi::c_char = + c"SDL_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE".as_ptr(); + +/// A variable controlling whether fullscreen windows are minimized when they +/// lose focus. +/// +/// The variable can be set to the following values: +/// +/// - "0": Fullscreen windows will not be minimized when they lose focus. +/// - "1": Fullscreen windows are minimized when they lose focus. +/// - "auto": Fullscreen windows are minimized when they lose focus if they use +/// exclusive fullscreen modes, so the desktop video mode is restored. +/// (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS: *const ::core::ffi::c_char = + c"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS".as_ptr(); + +/// A variable controlling whether the offscreen video driver saves output +/// frames. +/// +/// This only saves frames that are generated using software rendering, not +/// accelerated OpenGL rendering. +/// +/// - "0": Video frames are not saved to disk. (default) +/// - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", +/// where X is the window ID, and Y is the frame number. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES: *const ::core::ffi::c_char = + c"SDL_VIDEO_OFFSCREEN_SAVE_FRAMES".as_ptr(); + +/// A variable controlling whether all window operations will block until +/// complete. +/// +/// Window systems that run asynchronously may not have the results of window +/// operations that resize or move the window applied immediately upon the +/// return of the requesting function. Setting this hint will cause such +/// operations to block after every call until the pending operation has +/// completed. Setting this to '1' is the equivalent of calling +/// [`SDL_SyncWindow()`] after every function call. +/// +/// Be aware that amount of time spent blocking while waiting for window +/// operations to complete can be quite lengthy, as animations may have to +/// complete, which can take upwards of multiple seconds in some cases. +/// +/// The variable can be set to the following values: +/// +/// - "0": Window operations are non-blocking. (default) +/// - "1": Window operations will block until completed. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS: *const ::core::ffi::c_char = + c"SDL_VIDEO_SYNC_WINDOW_OPERATIONS".as_ptr(); + +/// A variable controlling whether the libdecor Wayland backend is allowed to +/// be used. +/// +/// libdecor is used over xdg-shell when xdg-decoration protocol is +/// unavailable. +/// +/// The variable can be set to the following values: +/// +/// - "0": libdecor use is disabled. +/// - "1": libdecor use is enabled. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR: *const ::core::ffi::c_char = + c"SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR".as_ptr(); + +/// A variable controlling whether video mode emulation is enabled under +/// Wayland. +/// +/// When this hint is set, a standard set of emulated CVT video modes will be +/// exposed for use by the application. If it is disabled, the only modes +/// exposed will be the logical desktop size and, in the case of a scaled +/// desktop, the native display resolution. +/// +/// The variable can be set to the following values: +/// +/// - "0": Video mode emulation is disabled. +/// - "1": Video mode emulation is enabled. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION: *const ::core::ffi::c_char = + c"SDL_VIDEO_WAYLAND_MODE_EMULATION".as_ptr(); + +/// A variable controlling how modes with a non-native aspect ratio are +/// displayed under Wayland. +/// +/// When this hint is set, the requested scaling will be used when displaying +/// fullscreen video modes that don't match the display's native aspect ratio. +/// This is contingent on compositor viewport support. +/// +/// The variable can be set to the following values: +/// +/// - "aspect" - Video modes will be displayed scaled, in their proper aspect +/// ratio, with black bars. +/// - "stretch" - Video modes will be scaled to fill the entire display. +/// (default) +/// - "none" - Video modes will be displayed as 1:1 with no scaling. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_WAYLAND_MODE_SCALING: *const ::core::ffi::c_char = + c"SDL_VIDEO_WAYLAND_MODE_SCALING".as_ptr(); + +/// A variable controlling whether the libdecor Wayland backend is preferred +/// over native decorations. +/// +/// When this hint is set, libdecor will be used to provide window decorations, +/// even if xdg-decoration is available. (Note that, by default, libdecor will +/// use xdg-decoration itself if available). +/// +/// The variable can be set to the following values: +/// +/// - "0": libdecor is enabled only if server-side decorations are unavailable. +/// (default) +/// - "1": libdecor is always enabled if available. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR: *const ::core::ffi::c_char = + c"SDL_VIDEO_WAYLAND_PREFER_LIBDECOR".as_ptr(); + +/// A variable forcing non-DPI-aware Wayland windows to output at 1:1 scaling. +/// +/// This must be set before initializing the video subsystem. +/// +/// When this hint is set, Wayland windows that are not flagged as being +/// DPI-aware will be output with scaling designed to force 1:1 pixel mapping. +/// +/// This is intended to allow legacy applications to be displayed without +/// desktop scaling being applied, and has issues with certain display +/// configurations, as this forces the window to behave in a way that Wayland +/// desktops were not designed to accommodate: +/// +/// - Rounding errors can result with odd window sizes and/or desktop scales, +/// which can cause the window contents to appear slightly blurry. +/// - Positioning the window may be imprecise due to unit conversions and +/// rounding. +/// - The window may be unusably small on scaled desktops. +/// - The window may jump in size when moving between displays of different +/// scale factors. +/// - Displays may appear to overlap when using a multi-monitor setup with +/// scaling enabled. +/// - Possible loss of cursor precision due to the logical size of the window +/// being reduced. +/// +/// New applications should be designed with proper DPI awareness handling +/// instead of enabling this. +/// +/// The variable can be set to the following values: +/// +/// - "0": Windows will be scaled normally. +/// - "1": Windows will be forced to scale to achieve 1:1 output. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY: *const ::core::ffi::c_char = + c"SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY".as_ptr(); + +/// A variable specifying which shader compiler to preload when using the +/// Chrome ANGLE binaries. +/// +/// SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It can +/// use two different sets of binaries, those compiled by the user from source +/// or those provided by the Chrome browser. In the later case, these binaries +/// require that SDL loads a DLL providing the shader compiler. +/// +/// The variable can be set to the following values: +/// +/// - "d3dcompiler_46.dll" - best for Vista or later. (default) +/// - "d3dcompiler_43.dll" - for XP support. +/// - "none" - do not load any library, useful if you compiled ANGLE from +/// source and included the compiler in your binaries. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_WIN_D3DCOMPILER: *const ::core::ffi::c_char = + c"SDL_VIDEO_WIN_D3DCOMPILER".as_ptr(); + +/// A variable controlling whether the X Synchronization Extension is enabled. +/// +/// If set, this can result in smoother window resizing when rendering using +/// OpenGL, however, there are some conditions: +/// +/// - It is only activated on windows created with the [`SDL_WINDOW_OPENGL`] flag +/// (windows using an SDL OpenGL renderer have this automatically set). +/// - When activated, presentation must be done with `SDL_GL_SwapWindow()` +/// (`SDL_RenderPresent()` calls this internally for OpenGL renderers as well). +/// +/// Enabling this and presenting via an external mechanism will result in sync +/// requests not being acked, and hangs and other odd window behavior may result. +/// +/// The variable can be set to the following values: +/// +/// - "0": The X Synchronization Extension is disabled. (default) +/// - "1": The X Synchronization Extension is enabled. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.4.10. +pub const SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_ENABLE_XSYNC_EXT".as_ptr(); + +/// A variable controlling whether SDL should call XSelectInput() to enable +/// input events on X11 windows wrapped by SDL windows. +/// +/// The variable can be set to the following values: +/// +/// - "0": Don't call XSelectInput(), assuming the native window code has done +/// it already. +/// - "1": Call XSelectInput() to enable input events. (default) +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.10. +pub const SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_EXTERNAL_WINDOW_INPUT".as_ptr(); + +/// A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint +/// should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable _NET_WM_BYPASS_COMPOSITOR. +/// - "1": Enable _NET_WM_BYPASS_COMPOSITOR. (default) +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR".as_ptr(); + +/// A variable controlling whether the X11 _NET_WM_PING protocol should be +/// supported. +/// +/// By default SDL will use _NET_WM_PING, but for applications that know they +/// will not always be able to respond to ping requests in a timely manner they +/// can turn it off to avoid the window manager thinking the app is hung. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable _NET_WM_PING. +/// - "1": Enable _NET_WM_PING. (default) +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_NET_WM_PING: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_NET_WM_PING".as_ptr(); + +/// A variable controlling whether SDL uses DirectColor visuals. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable DirectColor visuals. +/// - "1": Enable DirectColor visuals. (default) +/// +/// This hint should be set before initializing the video subsystem. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_NODIRECTCOLOR: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_NODIRECTCOLOR".as_ptr(); + +/// A variable forcing the content scaling factor for X11 displays. +/// +/// The variable can be set to a floating point value in the range 1.0-10.0f +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_SCALING_FACTOR: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_SCALING_FACTOR".as_ptr(); + +/// A variable forcing the visual ID used for X11 display modes. +/// +/// This hint should be set before initializing the video subsystem. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_VISUALID: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_VISUALID".as_ptr(); + +/// A variable forcing the visual ID chosen for new X11 windows. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_WINDOW_VISUALID: *const ::core::ffi::c_char = + c"SDL_VIDEO_X11_WINDOW_VISUALID".as_ptr(); + +/// A variable controlling whether the X11 XRandR extension should be used. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable XRandR. +/// - "1": Enable XRandR. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VIDEO_X11_XRANDR: *const ::core::ffi::c_char = c"SDL_VIDEO_X11_XRANDR".as_ptr(); + +/// A variable controlling whether touch should be enabled on the back panel of +/// the PlayStation Vita. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable touch on the back panel. +/// - "1": Enable touch on the back panel. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_ENABLE_BACK_TOUCH: *const ::core::ffi::c_char = + c"SDL_VITA_ENABLE_BACK_TOUCH".as_ptr(); + +/// A variable controlling whether touch should be enabled on the front panel +/// of the PlayStation Vita. +/// +/// The variable can be set to the following values: +/// +/// - "0": Disable touch on the front panel. +/// - "1": Enable touch on the front panel. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_ENABLE_FRONT_TOUCH: *const ::core::ffi::c_char = + c"SDL_VITA_ENABLE_FRONT_TOUCH".as_ptr(); + +/// A variable controlling the module path on the PlayStation Vita. +/// +/// This hint defaults to "app0:module" +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_MODULE_PATH: *const ::core::ffi::c_char = c"SDL_VITA_MODULE_PATH".as_ptr(); + +/// A variable controlling whether to perform PVR initialization on the +/// PlayStation Vita. +/// +/// - "0": Skip PVR initialization. +/// - "1": Perform the normal PVR initialization. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_PVR_INIT: *const ::core::ffi::c_char = c"SDL_VITA_PVR_INIT".as_ptr(); + +/// A variable overriding the resolution reported on the PlayStation Vita. +/// +/// The variable can be set to the following values: +/// +/// - "544": 544p (default) +/// - "720": 725p for PSTV +/// - "1080": 1088i for PSTV +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_RESOLUTION: *const ::core::ffi::c_char = c"SDL_VITA_RESOLUTION".as_ptr(); + +/// A variable controlling whether OpenGL should be used instead of OpenGL ES +/// on the PlayStation Vita. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use OpenGL ES. (default) +/// - "1": Use OpenGL. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_PVR_OPENGL: *const ::core::ffi::c_char = c"SDL_VITA_PVR_OPENGL".as_ptr(); + +/// A variable controlling which touchpad should generate synthetic mouse +/// events. +/// +/// The variable can be set to the following values: +/// +/// - "0": Only front touchpad should generate mouse events. (default) +/// - "1": Only back touchpad should generate mouse events. +/// - "2": Both touchpads should generate mouse events. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: *const ::core::ffi::c_char = + c"SDL_VITA_TOUCH_MOUSE_DEVICE".as_ptr(); + +/// A variable overriding the display index used in [`SDL_Vulkan_CreateSurface()`] +/// +/// The display index starts at 0, which is the default. +/// +/// This hint should be set before calling [`SDL_Vulkan_CreateSurface()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VULKAN_DISPLAY: *const ::core::ffi::c_char = c"SDL_VULKAN_DISPLAY".as_ptr(); + +/// Specify the Vulkan library to load. +/// +/// This hint should be set before creating a Vulkan window or calling +/// [`SDL_Vulkan_LoadLibrary()`]. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_VULKAN_LIBRARY: *const ::core::ffi::c_char = c"SDL_VULKAN_LIBRARY".as_ptr(); + +/// A variable controlling how the fact chunk affects the loading of a WAVE +/// file. +/// +/// The fact chunk stores information about the number of samples of a WAVE +/// file. The Standards Update from Microsoft notes that this value can be used +/// to 'determine the length of the data in seconds'. This is especially useful +/// for compressed formats (for which this is a mandatory chunk) if they +/// produce multiple sample frames per block and truncating the block is not +/// allowed. The fact chunk can exactly specify how many sample frames there +/// should be in this case. +/// +/// Unfortunately, most application seem to ignore the fact chunk and so SDL +/// ignores it by default as well. +/// +/// The variable can be set to the following values: +/// +/// - "truncate" - Use the number of samples to truncate the wave data if the +/// fact chunk is present and valid. +/// - "strict" - Like "truncate", but raise an error if the fact chunk is +/// invalid, not present for non-PCM formats, or if the data chunk doesn't +/// have that many samples. +/// - "ignorezero" - Like "truncate", but ignore fact chunk if the number of +/// samples is zero. +/// - "ignore" - Ignore fact chunk entirely. (default) +/// +/// This hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WAVE_FACT_CHUNK: *const ::core::ffi::c_char = c"SDL_WAVE_FACT_CHUNK".as_ptr(); + +/// A variable controlling the maximum number of chunks in a WAVE file. +/// +/// This sets an upper bound on the number of chunks in a WAVE file to avoid +/// wasting time on malformed or corrupt WAVE files. This defaults to "10000". +/// +/// This hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WAVE_CHUNK_LIMIT: *const ::core::ffi::c_char = c"SDL_WAVE_CHUNK_LIMIT".as_ptr(); + +/// A variable controlling how the size of the RIFF chunk affects the loading +/// of a WAVE file. +/// +/// The size of the RIFF chunk (which includes all the sub-chunks of the WAVE +/// file) is not always reliable. In case the size is wrong, it's possible to +/// just ignore it and step through the chunks until a fixed limit is reached. +/// +/// Note that files that have trailing data unrelated to the WAVE file or +/// corrupt files may slow down the loading process without a reliable +/// boundary. By default, SDL stops after 10000 chunks to prevent wasting time. +/// Use [`SDL_HINT_WAVE_CHUNK_LIMIT`] to adjust this value. +/// +/// The variable can be set to the following values: +/// +/// - "force" - Always use the RIFF chunk size as a boundary for the chunk +/// search. +/// - "ignorezero" - Like "force", but a zero size searches up to 4 GiB. +/// (default) +/// - "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB. +/// - "maximum" - Search for chunks until the end of file. (not recommended) +/// +/// This hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WAVE_RIFF_CHUNK_SIZE: *const ::core::ffi::c_char = + c"SDL_WAVE_RIFF_CHUNK_SIZE".as_ptr(); + +/// A variable controlling how a truncated WAVE file is handled. +/// +/// A WAVE file is considered truncated if any of the chunks are incomplete or +/// the data chunk size is not a multiple of the block size. By default, SDL +/// decodes until the first incomplete block, as most applications seem to do. +/// +/// The variable can be set to the following values: +/// +/// - "verystrict" - Raise an error if the file is truncated. +/// - "strict" - Like "verystrict", but the size of the RIFF chunk is ignored. +/// - "dropframe" - Decode until the first incomplete sample frame. +/// - "dropblock" - Decode until the first incomplete block. (default) +/// +/// This hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`] +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WAVE_TRUNCATION: *const ::core::ffi::c_char = c"SDL_WAVE_TRUNCATION".as_ptr(); + +/// A variable controlling whether the window is activated when the +/// [`SDL_RaiseWindow`] function is called. +/// +/// The variable can be set to the following values: +/// +/// - "0": The window is not activated when the [`SDL_RaiseWindow`] function is +/// called. +/// - "1": The window is activated when the [`SDL_RaiseWindow`] function is called. +/// (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED: *const ::core::ffi::c_char = + c"SDL_WINDOW_ACTIVATE_WHEN_RAISED".as_ptr(); + +/// A variable controlling whether the window is activated when the +/// [`SDL_ShowWindow`] function is called. +/// +/// The variable can be set to the following values: +/// +/// - "0": The window is not activated when the [`SDL_ShowWindow`] function is +/// called. +/// - "1": The window is activated when the [`SDL_ShowWindow`] function is called. +/// (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN: *const ::core::ffi::c_char = + c"SDL_WINDOW_ACTIVATE_WHEN_SHOWN".as_ptr(); + +/// If set to "0" then never set the top-most flag on an SDL Window even if the +/// application requests it. +/// +/// This is a debugging aid for developers and not expected to be used by end +/// users. +/// +/// The variable can be set to the following values: +/// +/// - "0": don't allow topmost +/// - "1": allow topmost (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOW_ALLOW_TOPMOST: *const ::core::ffi::c_char = + c"SDL_WINDOW_ALLOW_TOPMOST".as_ptr(); + +/// A variable controlling whether the window frame and title bar are +/// interactive when the cursor is hidden. +/// +/// The variable can be set to the following values: +/// +/// - "0": The window frame is not interactive when the cursor is hidden (no +/// move, resize, etc). +/// - "1": The window frame is interactive when the cursor is hidden. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN: *const ::core::ffi::c_char = + c"SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN".as_ptr(); + +/// A variable controlling whether SDL generates window-close events for Alt+F4 +/// on Windows. +/// +/// The variable can be set to the following values: +/// +/// - "0": SDL will only do normal key handling for Alt+F4. +/// - "1": SDL will generate a window-close event when it sees Alt+F4. +/// (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4: *const ::core::ffi::c_char = + c"SDL_WINDOWS_CLOSE_ON_ALT_F4".as_ptr(); + +/// A variable controlling whether menus can be opened with their keyboard +/// shortcut (Alt+mnemonic). +/// +/// If the mnemonics are enabled, then menus can be opened by pressing the Alt +/// key and the corresponding mnemonic (for example, Alt+F opens the File +/// menu). However, in case an invalid mnemonic is pressed, Windows makes an +/// audible beep to convey that nothing happened. This is true even if the +/// window has no menu at all! +/// +/// Because most SDL applications don't have menus, and some want to use the +/// Alt key for other purposes, SDL disables mnemonics (and the beeping) by +/// default. +/// +/// Note: This also affects keyboard events: with mnemonics enabled, when a +/// menu is opened from the keyboard, you will not receive a KEYUP event for +/// the mnemonic key, and *might* not receive one for Alt. +/// +/// The variable can be set to the following values: +/// +/// - "0": Alt+mnemonic does nothing, no beeping. (default) +/// - "1": Alt+mnemonic opens menus, invalid mnemonics produce a beep. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS: *const ::core::ffi::c_char = + c"SDL_WINDOWS_ENABLE_MENU_MNEMONICS".as_ptr(); + +/// A variable controlling whether the windows message loop is processed by +/// SDL. +/// +/// The variable can be set to the following values: +/// +/// - "0": The window message loop is not run. +/// - "1": The window message loop is processed in [`SDL_PumpEvents()`]. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP: *const ::core::ffi::c_char = + c"SDL_WINDOWS_ENABLE_MESSAGELOOP".as_ptr(); + +/// A variable controlling whether GameInput is used for raw keyboard and mouse +/// on Windows. +/// +/// The variable can be set to the following values: +/// +/// - "0": GameInput is not used for raw keyboard and mouse events. (default) +/// - "1": GameInput is used for raw keyboard and mouse events, if available. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_GAMEINPUT: *const ::core::ffi::c_char = + c"SDL_WINDOWS_GAMEINPUT".as_ptr(); + +/// A variable controlling whether raw keyboard events are used on Windows. +/// +/// The variable can be set to the following values: +/// +/// - "0": The Windows message loop is used for keyboard events. (default) +/// - "1": Low latency raw keyboard events are used. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_RAW_KEYBOARD: *const ::core::ffi::c_char = + c"SDL_WINDOWS_RAW_KEYBOARD".as_ptr(); + +/// A variable controlling whether or not the RIDEV_NOHOTKEYS flag is set when +/// enabling Windows raw keyboard events. +/// +/// This blocks any hotkeys that have been registered by applications from +/// having any effect beyond generating raw WM_INPUT events. +/// +/// This flag does not affect system-hotkeys like ALT-TAB or CTRL-ALT-DEL, but +/// does affect the Windows Logo key since it is a userland hotkey registered +/// by explorer.exe. +/// +/// The variable can be set to the following values: +/// +/// - "0": Hotkeys are not excluded. (default) +/// - "1": Hotkeys are excluded. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.4.0. +pub const SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS: *const ::core::ffi::c_char = + c"SDL_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS".as_ptr(); + +/// A variable controlling whether the RIDEV_INPUTSINK flag is set when +/// enabling Windows raw keyboard events. +/// +/// This enables the window to still receive input even if not in foreground. +/// +/// Focused windows that receive text input will still prevent input events from triggering. +/// +/// - "0": Input is not received when not in focus or foreground. (default) +/// - "1": Input will be received even when not in focus or foreground. +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.4.4. +pub const SDL_HINT_WINDOWS_RAW_KEYBOARD_INPUTSINK: *const ::core::ffi::c_char = + c"SDL_WINDOWS_RAW_KEYBOARD_INPUTSINK".as_ptr(); + +/// A variable controlling whether SDL uses Kernel Semaphores on Windows. +/// +/// Kernel Semaphores are inter-process and require a context switch on every +/// interaction. On Windows 8 and newer, the WaitOnAddress API is available. +/// Using that and atomics to implement semaphores increases performance. SDL +/// will fall back to Kernel Objects on older OS versions or if forced to by +/// this hint. +/// +/// The variable can be set to the following values: +/// +/// - "0": Use Atomics and WaitOnAddress API when available, otherwise fall +/// back to Kernel Objects. (default) +/// - "1": Force the use of Kernel Objects in all cases. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL: *const ::core::ffi::c_char = + c"SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL".as_ptr(); + +/// A variable to specify custom icon resource id from RC file on Windows +/// platform. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_INTRESOURCE_ICON: *const ::core::ffi::c_char = + c"SDL_WINDOWS_INTRESOURCE_ICON".as_ptr(); + +/// A variable to specify custom icon resource id from RC file on Windows +/// platform. +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL: *const ::core::ffi::c_char = + c"SDL_WINDOWS_INTRESOURCE_ICON_SMALL".as_ptr(); + +/// A variable controlling whether SDL uses the D3D9Ex API introduced in +/// Windows Vista, instead of normal D3D9. +/// +/// Direct3D 9Ex contains changes to state management that can eliminate device +/// loss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may +/// require some changes to your application to cope with the new behavior, so +/// this is disabled by default. +/// +/// For more information on Direct3D 9Ex, see: +/// +/// - +/// - +/// +/// The variable can be set to the following values: +/// +/// - "0": Use the original Direct3D 9 API. (default) +/// - "1": Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex +/// is unavailable) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_USE_D3D9EX: *const ::core::ffi::c_char = + c"SDL_WINDOWS_USE_D3D9EX".as_ptr(); + +/// A variable controlling whether SDL will clear the window contents when the +/// WM_ERASEBKGND message is received. +/// +/// The variable can be set to the following values: +/// +/// - "0"/"never": Never clear the window. +/// - "1"/"initial": Clear the window when the first WM_ERASEBKGND event fires. +/// (default) +/// - "2"/"always": Clear the window on every WM_ERASEBKGND event. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE: *const ::core::ffi::c_char = + c"SDL_WINDOWS_ERASE_BACKGROUND_MODE".as_ptr(); + +/// A variable controlling whether X11 windows are marked as override-redirect. +/// +/// If set, this _might_ increase framerate at the expense of the desktop not +/// working as expected. Override-redirect windows aren't noticed by the window +/// manager at all. +/// +/// You should probably only use this for fullscreen windows, and you probably +/// shouldn't even use it for that. But it's here if you want to try! +/// +/// The variable can be set to the following values: +/// +/// - "0": Do not mark the window as override-redirect. (default) +/// - "1": Mark the window as override-redirect. +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT: *const ::core::ffi::c_char = + c"SDL_X11_FORCE_OVERRIDE_REDIRECT".as_ptr(); + +/// A variable specifying the type of an X11 window. +/// +/// During [`SDL_CreateWindow`], SDL uses the _NET_WM_WINDOW_TYPE X11 property to +/// report to the window manager the type of window it wants to create. This +/// might be set to various things if [`SDL_WINDOW_TOOLTIP`] or +/// [`SDL_WINDOW_POPUP_MENU`], etc, were specified. For "normal" windows that +/// haven't set a specific type, this hint can be used to specify a custom +/// type. For example, a dock window might set this to +/// "_NET_WM_WINDOW_TYPE_DOCK". +/// +/// This hint should be set before creating a window. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_X11_WINDOW_TYPE: *const ::core::ffi::c_char = c"SDL_X11_WINDOW_TYPE".as_ptr(); + +/// Specify the XCB library to load for the X11 driver. +/// +/// The default is platform-specific, often "libX11-xcb.so.1". +/// +/// This hint should be set before initializing the video subsystem. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_X11_XCB_LIBRARY: *const ::core::ffi::c_char = c"SDL_X11_XCB_LIBRARY".as_ptr(); + +/// A variable controlling whether XInput should be used for controller +/// handling. +/// +/// The variable can be set to the following values: +/// +/// - "0": XInput is not enabled. +/// - "1": XInput is enabled. (default) +/// +/// This hint should be set before SDL is initialized. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_XINPUT_ENABLED: *const ::core::ffi::c_char = c"SDL_XINPUT_ENABLED".as_ptr(); + +/// A variable controlling response to [`SDL_assert`] failures. +/// +/// The variable can be set to the following case-sensitive values: +/// +/// - "abort": Program terminates immediately. +/// - "break": Program triggers a debugger breakpoint. +/// - "retry": Program reruns the SDL_assert's test again. +/// - "ignore": Program continues on, ignoring this assertion failure this +/// time. +/// - "always_ignore": Program continues on, ignoring this assertion failure +/// for the rest of the run. +/// +/// Note that [`SDL_SetAssertionHandler`] offers a programmatic means to deal with +/// assertion failures through a callback, and this hint is largely intended to +/// be used via environment variables by end users and automated tools. +/// +/// This hint should be set before an assertion failure is triggered and can be +/// changed at any time. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_ASSERT: *const ::core::ffi::c_char = c"SDL_ASSERT".as_ptr(); + +/// A variable controlling whether pen events should generate synthetic mouse +/// events. +/// +/// The variable can be set to the following values: +/// +/// - "0": Pen events will not generate mouse events. +/// - "1": Pen events will generate mouse events. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_PEN_MOUSE_EVENTS: *const ::core::ffi::c_char = c"SDL_PEN_MOUSE_EVENTS".as_ptr(); + +/// A variable controlling whether pen events should generate synthetic touch +/// events. +/// +/// The variable can be set to the following values: +/// +/// - "0": Pen events will not generate touch events. +/// - "1": Pen events will generate touch events. (default) +/// +/// This hint can be set anytime. +/// +/// ## Availability +/// This hint is available since SDL 3.2.0. +pub const SDL_HINT_PEN_TOUCH_EVENTS: *const ::core::ffi::c_char = c"SDL_PEN_TOUCH_EVENTS".as_ptr(); + +/// An enumeration of hint priorities. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DEFAULT`](SDL_HintPriority::DEFAULT) | [`SDL_HINT_DEFAULT`] | | +/// | [`NORMAL`](SDL_HintPriority::NORMAL) | [`SDL_HINT_NORMAL`] | | +/// | [`OVERRIDE`](SDL_HintPriority::OVERRIDE) | [`SDL_HINT_OVERRIDE`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_HintPriority(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_HintPriority { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_HintPriority) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_HintPriority) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_HintPriority { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::DEFAULT => "SDL_HINT_DEFAULT", + Self::NORMAL => "SDL_HINT_NORMAL", + Self::OVERRIDE => "SDL_HINT_OVERRIDE", + + _ => return write!(f, "SDL_HintPriority({})", self.0), + }) + } +} + +impl SDL_HintPriority { + pub const DEFAULT: Self = Self((0 as ::core::ffi::c_int)); + pub const NORMAL: Self = Self((1 as ::core::ffi::c_int)); + pub const OVERRIDE: Self = Self((2 as ::core::ffi::c_int)); +} + +pub const SDL_HINT_DEFAULT: SDL_HintPriority = SDL_HintPriority::DEFAULT; +pub const SDL_HINT_NORMAL: SDL_HintPriority = SDL_HintPriority::NORMAL; +pub const SDL_HINT_OVERRIDE: SDL_HintPriority = SDL_HintPriority::OVERRIDE; + +impl SDL_HintPriority { + /// Initialize a `SDL_HintPriority` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_HintPriority { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_HintPriority { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::hints::METADATA_SDL_HintPriority; +} + +unsafe extern "C" { + /// Set a hint with a specific priority. + /// + /// The priority controls the behavior when setting a hint that already has a + /// value. Hints will replace existing hints of their priority and lower. + /// Environment variables are considered to have override priority. + /// + /// ## Parameters + /// - `name`: the hint to set. + /// - `value`: the value of the hint variable. + /// - `priority`: the [`SDL_HintPriority`] level for the hint. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHint`] + /// - [`SDL_ResetHint`] + /// - [`SDL_SetHint`] + pub fn SDL_SetHintWithPriority( + name: *const ::core::ffi::c_char, + value: *const ::core::ffi::c_char, + priority: SDL_HintPriority, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a hint with normal priority. + /// + /// Hints will not be set if there is an existing override hint or environment + /// variable that takes precedence. You can use [`SDL_SetHintWithPriority()`] to + /// set the hint with override priority instead. + /// + /// ## Parameters + /// - `name`: the hint to set. + /// - `value`: the value of the hint variable. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHint`] + /// - [`SDL_ResetHint`] + /// - [`SDL_SetHintWithPriority`] + pub fn SDL_SetHint( + name: *const ::core::ffi::c_char, + value: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Reset a hint to the default value. + /// + /// This will reset a hint to the value of the environment variable, or NULL if + /// the environment isn't set. Callbacks will be called normally with this + /// change. + /// + /// ## Parameters + /// - `name`: the hint to set. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetHint`] + /// - [`SDL_ResetHints`] + pub fn SDL_ResetHint(name: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Reset all hints to the default values. + /// + /// This will reset all hints to the value of the associated environment + /// variable, or NULL if the environment isn't set. Callbacks will be called + /// normally with this change. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ResetHint`] + pub fn SDL_ResetHints(); +} + +unsafe extern "C" { + /// Get the value of a hint. + /// + /// ## Parameters + /// - `name`: the hint to query. + /// + /// ## Return value + /// Returns the string value of a hint or NULL if the hint isn't set. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetHint`] + /// - [`SDL_SetHintWithPriority`] + pub fn SDL_GetHint(name: *const ::core::ffi::c_char) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the boolean value of a hint variable. + /// + /// ## Parameters + /// - `name`: the name of the hint to get the boolean value from. + /// - `default_value`: the value to return if the hint does not exist. + /// + /// ## Return value + /// Returns the boolean value of a hint or the provided default value if the + /// hint does not exist. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetHint`] + /// - [`SDL_SetHint`] + pub fn SDL_GetHintBoolean( + name: *const ::core::ffi::c_char, + default_value: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +/// A callback used to send notifications of hint value changes. +/// +/// This is called an initial time during [`SDL_AddHintCallback`] with the hint's +/// current value, and then again each time the hint's value changes. In the +/// initial call, the current value is in both `oldValue` and `newValue`. +/// +/// ## Parameters +/// - `userdata`: what was passed as `userdata` to [`SDL_AddHintCallback()`]. +/// - `name`: what was passed as `name` to [`SDL_AddHintCallback()`]. +/// - `oldValue`: the previous hint value. +/// - `newValue`: the new value hint is to be set to. +/// +/// ## Thread safety +/// This callback is fired from whatever thread is setting a new +/// hint value. SDL holds a lock on the hint subsystem when +/// calling this callback. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AddHintCallback`] +pub type SDL_HintCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + name: *const ::core::ffi::c_char, + oldValue: *const ::core::ffi::c_char, + newValue: *const ::core::ffi::c_char, + ), +>; + +unsafe extern "C" { + /// Add a function to watch a particular hint. + /// + /// The callback function is called _during_ this function, to provide it an + /// initial value, and again each time the hint's value changes. + /// + /// ## Parameters + /// - `name`: the hint to watch. + /// - `callback`: An [`SDL_HintCallback`] function that will be called when the + /// hint value changes. + /// - `userdata`: a pointer to pass to the callback function. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RemoveHintCallback`] + pub fn SDL_AddHintCallback( + name: *const ::core::ffi::c_char, + callback: SDL_HintCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Remove a function watching a particular hint. + /// + /// ## Parameters + /// - `name`: the hint being watched. + /// - `callback`: an [`SDL_HintCallback`] function that will be called when the + /// hint value changes. + /// - `userdata`: a pointer being passed to the callback function. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddHintCallback`] + pub fn SDL_RemoveHintCallback( + name: *const ::core::ffi::c_char, + callback: SDL_HintCallback, + userdata: *mut ::core::ffi::c_void, + ); +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/init.rs b/vendor/sdl3-sys/src/generated/init.rs new file mode 100644 index 00000000..40a82668 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/init.rs @@ -0,0 +1,865 @@ +//! All SDL programs need to initialize the library before starting to work +//! with it. +//! +//! Almost everything can simply call [`SDL_Init()`] near startup, with a handful +//! of flags to specify subsystems to touch. These are here to make sure SDL +//! does not even attempt to touch low-level pieces of the operating system +//! that you don't intend to use. For example, you might be using SDL for video +//! and input but chose an external library for audio, and in this case you +//! would just need to leave off the [`SDL_INIT_AUDIO`] flag to make sure that +//! external library has complete control. +//! +//! Most apps, when terminating, should call [`SDL_Quit()`]. This will clean up +//! (nearly) everything that SDL might have allocated, and crucially, it'll +//! make sure that the display's resolution is back to what the user expects if +//! you had previously changed it for your game. +//! +//! SDL3 apps are strongly encouraged to call [`SDL_SetAppMetadata()`] at startup +//! to fill in details about the program. This is completely optional, but it +//! helps in small ways (we can provide an About dialog box for the macOS menu, +//! we can name the app in the system's audio mixer, etc). Those that want to +//! provide a _lot_ of information should look at the more-detailed +//! [`SDL_SetAppMetadataProperty()`]. + +use super::stdinc::*; + +use super::error::*; + +use super::events::*; + +/// Initialization flags for [`SDL_Init`] and/or [`SDL_InitSubSystem`] +/// +/// These are the flags which may be passed to [`SDL_Init()`]. You should specify +/// the subsystems which you will be using in your application. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_Init`] +/// - [`SDL_Quit`] +/// - [`SDL_InitSubSystem`] +/// - [`SDL_QuitSubSystem`] +/// - [`SDL_WasInit`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`AUDIO`](SDL_InitFlags::AUDIO) | [`SDL_INIT_AUDIO`] | [`SDL_INIT_AUDIO`] implies [`SDL_INIT_EVENTS`] | +/// | [`VIDEO`](SDL_InitFlags::VIDEO) | [`SDL_INIT_VIDEO`] | [`SDL_INIT_VIDEO`] implies [`SDL_INIT_EVENTS`], should be initialized on the main thread | +/// | [`JOYSTICK`](SDL_InitFlags::JOYSTICK) | [`SDL_INIT_JOYSTICK`] | [`SDL_INIT_JOYSTICK`] implies [`SDL_INIT_EVENTS`] | +/// | [`HAPTIC`](SDL_InitFlags::HAPTIC) | [`SDL_INIT_HAPTIC`] | | +/// | [`GAMEPAD`](SDL_InitFlags::GAMEPAD) | [`SDL_INIT_GAMEPAD`] | [`SDL_INIT_GAMEPAD`] implies [`SDL_INIT_JOYSTICK`] | +/// | [`EVENTS`](SDL_InitFlags::EVENTS) | [`SDL_INIT_EVENTS`] | | +/// | [`SENSOR`](SDL_InitFlags::SENSOR) | [`SDL_INIT_SENSOR`] | [`SDL_INIT_SENSOR`] implies [`SDL_INIT_EVENTS`] | +/// | [`CAMERA`](SDL_InitFlags::CAMERA) | [`SDL_INIT_CAMERA`] | [`SDL_INIT_CAMERA`] implies [`SDL_INIT_EVENTS`] | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_InitFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_InitFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_InitFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_InitFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_InitFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_InitFlags(")?; + let all_bits = all_bits | Self::AUDIO.0; + if (Self::AUDIO != 0 || self.0 == 0) && *self & Self::AUDIO == Self::AUDIO { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "AUDIO")?; + } + let all_bits = all_bits | Self::VIDEO.0; + if (Self::VIDEO != 0 || self.0 == 0) && *self & Self::VIDEO == Self::VIDEO { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "VIDEO")?; + } + let all_bits = all_bits | Self::JOYSTICK.0; + if (Self::JOYSTICK != 0 || self.0 == 0) && *self & Self::JOYSTICK == Self::JOYSTICK { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "JOYSTICK")?; + } + let all_bits = all_bits | Self::HAPTIC.0; + if (Self::HAPTIC != 0 || self.0 == 0) && *self & Self::HAPTIC == Self::HAPTIC { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "HAPTIC")?; + } + let all_bits = all_bits | Self::GAMEPAD.0; + if (Self::GAMEPAD != 0 || self.0 == 0) && *self & Self::GAMEPAD == Self::GAMEPAD { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "GAMEPAD")?; + } + let all_bits = all_bits | Self::EVENTS.0; + if (Self::EVENTS != 0 || self.0 == 0) && *self & Self::EVENTS == Self::EVENTS { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "EVENTS")?; + } + let all_bits = all_bits | Self::SENSOR.0; + if (Self::SENSOR != 0 || self.0 == 0) && *self & Self::SENSOR == Self::SENSOR { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SENSOR")?; + } + let all_bits = all_bits | Self::CAMERA.0; + if (Self::CAMERA != 0 || self.0 == 0) && *self & Self::CAMERA == Self::CAMERA { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CAMERA")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_InitFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_InitFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_InitFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_InitFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_InitFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_InitFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_InitFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_InitFlags { + /// [`SDL_INIT_AUDIO`] implies [`SDL_INIT_EVENTS`] + pub const AUDIO: Self = Self((0x00000010 as Uint32)); + /// [`SDL_INIT_VIDEO`] implies [`SDL_INIT_EVENTS`], should be initialized on the main thread + pub const VIDEO: Self = Self((0x00000020 as Uint32)); + /// [`SDL_INIT_JOYSTICK`] implies [`SDL_INIT_EVENTS`] + pub const JOYSTICK: Self = Self((0x00000200 as Uint32)); + pub const HAPTIC: Self = Self((0x00001000 as Uint32)); + /// [`SDL_INIT_GAMEPAD`] implies [`SDL_INIT_JOYSTICK`] + pub const GAMEPAD: Self = Self((0x00002000 as Uint32)); + pub const EVENTS: Self = Self((0x00004000 as Uint32)); + /// [`SDL_INIT_SENSOR`] implies [`SDL_INIT_EVENTS`] + pub const SENSOR: Self = Self((0x00008000 as Uint32)); + /// [`SDL_INIT_CAMERA`] implies [`SDL_INIT_EVENTS`] + pub const CAMERA: Self = Self((0x00010000 as Uint32)); +} + +/// [`SDL_INIT_AUDIO`] implies [`SDL_INIT_EVENTS`] +pub const SDL_INIT_AUDIO: SDL_InitFlags = SDL_InitFlags::AUDIO; +/// [`SDL_INIT_VIDEO`] implies [`SDL_INIT_EVENTS`], should be initialized on the main thread +pub const SDL_INIT_VIDEO: SDL_InitFlags = SDL_InitFlags::VIDEO; +/// [`SDL_INIT_JOYSTICK`] implies [`SDL_INIT_EVENTS`] +pub const SDL_INIT_JOYSTICK: SDL_InitFlags = SDL_InitFlags::JOYSTICK; +pub const SDL_INIT_HAPTIC: SDL_InitFlags = SDL_InitFlags::HAPTIC; +/// [`SDL_INIT_GAMEPAD`] implies [`SDL_INIT_JOYSTICK`] +pub const SDL_INIT_GAMEPAD: SDL_InitFlags = SDL_InitFlags::GAMEPAD; +pub const SDL_INIT_EVENTS: SDL_InitFlags = SDL_InitFlags::EVENTS; +/// [`SDL_INIT_SENSOR`] implies [`SDL_INIT_EVENTS`] +pub const SDL_INIT_SENSOR: SDL_InitFlags = SDL_InitFlags::SENSOR; +/// [`SDL_INIT_CAMERA`] implies [`SDL_INIT_EVENTS`] +pub const SDL_INIT_CAMERA: SDL_InitFlags = SDL_InitFlags::CAMERA; + +impl SDL_InitFlags { + /// Initialize a `SDL_InitFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_InitFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_InitFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::init::METADATA_SDL_InitFlags; +} + +/// Return values for optional main callbacks. +/// +/// Returning [`SDL_APP_SUCCESS`] or [`SDL_APP_FAILURE`] from [`SDL_AppInit`], +/// [`SDL_AppEvent`], or [`SDL_AppIterate`] will terminate the program and report +/// success/failure to the operating system. What that means is +/// platform-dependent. On Unix, for example, on success, the process error +/// code will be zero, and on failure it will be 1. This interface doesn't +/// allow you to return specific exit codes, just whether there was an error +/// generally or not. +/// +/// Returning [`SDL_APP_CONTINUE`] from these functions will let the app continue +/// to run. +/// +/// See +/// [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README-main-functions#main-callbacks-in-sdl3) +/// for complete details. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`CONTINUE`](SDL_AppResult::CONTINUE) | [`SDL_APP_CONTINUE`] | Value that requests that the app continue from the main callbacks. | +/// | [`SUCCESS`](SDL_AppResult::SUCCESS) | [`SDL_APP_SUCCESS`] | Value that requests termination with success from the main callbacks. | +/// | [`FAILURE`](SDL_AppResult::FAILURE) | [`SDL_APP_FAILURE`] | Value that requests termination with error from the main callbacks. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_AppResult(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_AppResult { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_AppResult) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_AppResult) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_AppResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::CONTINUE => "SDL_APP_CONTINUE", + Self::SUCCESS => "SDL_APP_SUCCESS", + Self::FAILURE => "SDL_APP_FAILURE", + + _ => return write!(f, "SDL_AppResult({})", self.0), + }) + } +} + +impl SDL_AppResult { + /// Value that requests that the app continue from the main callbacks. + pub const CONTINUE: Self = Self((0 as ::core::ffi::c_int)); + /// Value that requests termination with success from the main callbacks. + pub const SUCCESS: Self = Self((1 as ::core::ffi::c_int)); + /// Value that requests termination with error from the main callbacks. + pub const FAILURE: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Value that requests that the app continue from the main callbacks. +pub const SDL_APP_CONTINUE: SDL_AppResult = SDL_AppResult::CONTINUE; +/// Value that requests termination with success from the main callbacks. +pub const SDL_APP_SUCCESS: SDL_AppResult = SDL_AppResult::SUCCESS; +/// Value that requests termination with error from the main callbacks. +pub const SDL_APP_FAILURE: SDL_AppResult = SDL_AppResult::FAILURE; + +impl SDL_AppResult { + /// Initialize a `SDL_AppResult` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_AppResult { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_AppResult { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::init::METADATA_SDL_AppResult; +} + +/// Function pointer typedef for [`SDL_AppInit`]. +/// +/// These are used by [`SDL_EnterAppMainCallbacks`]. This mechanism operates behind +/// the scenes for apps using the optional main callbacks. Apps that want to +/// use this should just implement [`SDL_AppInit`] directly. +/// +/// ## Parameters +/// - `appstate`: a place where the app can optionally store a pointer for +/// future use. +/// - `argc`: the standard ANSI C main's argc; number of elements in `argv`. +/// - `argv`: the standard ANSI C main's argv; array of command line +/// arguments. +/// +/// ## Return value +/// Returns [`SDL_APP_FAILURE`] to terminate with an error, [`SDL_APP_SUCCESS`] to +/// terminate with success, [`SDL_APP_CONTINUE`] to continue. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_AppInit_func = ::core::option::Option< + unsafe extern "C" fn( + appstate: *mut *mut ::core::ffi::c_void, + argc: ::core::ffi::c_int, + argv: *mut *mut ::core::ffi::c_char, + ) -> SDL_AppResult, +>; + +/// Function pointer typedef for [`SDL_AppIterate`]. +/// +/// These are used by [`SDL_EnterAppMainCallbacks`]. This mechanism operates behind +/// the scenes for apps using the optional main callbacks. Apps that want to +/// use this should just implement [`SDL_AppIterate`] directly. +/// +/// ## Parameters +/// - `appstate`: an optional pointer, provided by the app in [`SDL_AppInit`]. +/// +/// ## Return value +/// Returns [`SDL_APP_FAILURE`] to terminate with an error, [`SDL_APP_SUCCESS`] to +/// terminate with success, [`SDL_APP_CONTINUE`] to continue. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_AppIterate_func = ::core::option::Option< + unsafe extern "C" fn(appstate: *mut ::core::ffi::c_void) -> SDL_AppResult, +>; + +/// Function pointer typedef for [`SDL_AppEvent`]. +/// +/// These are used by [`SDL_EnterAppMainCallbacks`]. This mechanism operates behind +/// the scenes for apps using the optional main callbacks. Apps that want to +/// use this should just implement [`SDL_AppEvent`] directly. +/// +/// ## Parameters +/// - `appstate`: an optional pointer, provided by the app in [`SDL_AppInit`]. +/// - `event`: the new event for the app to examine. +/// +/// ## Return value +/// Returns [`SDL_APP_FAILURE`] to terminate with an error, [`SDL_APP_SUCCESS`] to +/// terminate with success, [`SDL_APP_CONTINUE`] to continue. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_AppEvent_func = ::core::option::Option< + unsafe extern "C" fn( + appstate: *mut ::core::ffi::c_void, + event: *mut SDL_Event, + ) -> SDL_AppResult, +>; + +/// Function pointer typedef for [`SDL_AppQuit`]. +/// +/// These are used by [`SDL_EnterAppMainCallbacks`]. This mechanism operates behind +/// the scenes for apps using the optional main callbacks. Apps that want to +/// use this should just implement [`SDL_AppEvent`] directly. +/// +/// ## Parameters +/// - `appstate`: an optional pointer, provided by the app in [`SDL_AppInit`]. +/// - `result`: the result code that terminated the app (success or failure). +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_AppQuit_func = ::core::option::Option< + unsafe extern "C" fn(appstate: *mut ::core::ffi::c_void, result: SDL_AppResult), +>; + +unsafe extern "C" { + /// Initialize the SDL library. + /// + /// [`SDL_Init()`] simply forwards to calling [`SDL_InitSubSystem()`]. Therefore, the + /// two may be used interchangeably. Though for readability of your code + /// [`SDL_InitSubSystem()`] might be preferred. + /// + /// The file I/O (for example: [`SDL_IOFromFile`]) and threading ([`SDL_CreateThread`]) + /// subsystems are initialized by default. Message boxes + /// ([`SDL_ShowSimpleMessageBox`]) also attempt to work without initializing the + /// video subsystem, in hopes of being useful in showing an error dialog when + /// [`SDL_Init`] fails. You must specifically initialize other subsystems if you + /// use them in your application. + /// + /// Logging (such as [`SDL_Log`]) works without initialization, too. + /// + /// `flags` may be any of the following OR'd together: + /// + /// - [`SDL_INIT_AUDIO`]\: audio subsystem; automatically initializes the events + /// subsystem + /// - [`SDL_INIT_VIDEO`]\: video subsystem; automatically initializes the events + /// subsystem, should be initialized on the main thread. + /// - [`SDL_INIT_JOYSTICK`]\: joystick subsystem; automatically initializes the + /// events subsystem + /// - [`SDL_INIT_HAPTIC`]\: haptic (force feedback) subsystem + /// - [`SDL_INIT_GAMEPAD`]\: gamepad subsystem; automatically initializes the + /// joystick subsystem + /// - [`SDL_INIT_EVENTS`]\: events subsystem + /// - [`SDL_INIT_SENSOR`]\: sensor subsystem; automatically initializes the events + /// subsystem + /// - [`SDL_INIT_CAMERA`]\: camera subsystem; automatically initializes the events + /// subsystem + /// + /// Subsystem initialization is ref-counted, you must call [`SDL_QuitSubSystem()`] + /// for each [`SDL_InitSubSystem()`] to correctly shutdown a subsystem manually (or + /// call [`SDL_Quit()`] to force shutdown). If a subsystem is already loaded then + /// this call will increase the ref-count and return. + /// + /// Consider reporting some basic metadata about your application before + /// calling [`SDL_Init`], using either [`SDL_SetAppMetadata()`] or + /// [`SDL_SetAppMetadataProperty()`]. + /// + /// ## Parameters + /// - `flags`: subsystem initialization flags. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAppMetadata`] + /// - [`SDL_SetAppMetadataProperty`] + /// - [`SDL_InitSubSystem`] + /// - [`SDL_Quit`] + /// - [`SDL_SetMainReady`] + /// - [`SDL_WasInit`] + pub fn SDL_Init(flags: SDL_InitFlags) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Compatibility function to initialize the SDL library. + /// + /// This function and [`SDL_Init()`] are interchangeable. + /// + /// ## Parameters + /// - `flags`: any of the flags used by [`SDL_Init()`]; see [`SDL_Init`] for details. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Init`] + /// - [`SDL_Quit`] + /// - [`SDL_QuitSubSystem`] + pub fn SDL_InitSubSystem(flags: SDL_InitFlags) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Shut down specific SDL subsystems. + /// + /// You still need to call [`SDL_Quit()`] even if you close all open subsystems + /// with [`SDL_QuitSubSystem()`]. + /// + /// ## Parameters + /// - `flags`: any of the flags used by [`SDL_Init()`]; see [`SDL_Init`] for details. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_InitSubSystem`] + /// - [`SDL_Quit`] + pub fn SDL_QuitSubSystem(flags: SDL_InitFlags); +} + +unsafe extern "C" { + /// Get a mask of the specified subsystems which are currently initialized. + /// + /// ## Parameters + /// - `flags`: any of the flags used by [`SDL_Init()`]; see [`SDL_Init`] for details. + /// + /// ## Return value + /// Returns a mask of all initialized subsystems if `flags` is 0, otherwise it + /// returns the initialization status of the specified subsystems. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Init`] + /// - [`SDL_InitSubSystem`] + pub fn SDL_WasInit(flags: SDL_InitFlags) -> SDL_InitFlags; +} + +unsafe extern "C" { + /// Clean up all initialized subsystems. + /// + /// You should call this function even if you have already shutdown each + /// initialized subsystem with [`SDL_QuitSubSystem()`]. It is safe to call this + /// function even in the case of errors in initialization. + /// + /// You can use this function with atexit() to ensure that it is run when your + /// application is shutdown, but it is not wise to do this from a library or + /// other dynamically loaded code. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Init`] + /// - [`SDL_QuitSubSystem`] + pub fn SDL_Quit(); +} + +unsafe extern "C" { + /// Return whether this is the main thread. + /// + /// On Apple platforms, the main thread is the thread that runs your program's + /// main() entry point. On other platforms, the main thread is the one that + /// calls SDL_Init([`SDL_INIT_VIDEO`]), which should usually be the one that runs + /// your program's main() entry point. If you are using the main callbacks, + /// [`SDL_AppInit()`], [`SDL_AppIterate()`], and [`SDL_AppQuit()`] are all called on the + /// main thread. + /// + /// ## Return value + /// Returns true if this thread is the main thread, or false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RunOnMainThread`] + pub fn SDL_IsMainThread() -> ::core::primitive::bool; +} + +/// Callback run on the main thread. +/// +/// ## Parameters +/// - `userdata`: an app-controlled pointer that is passed to the callback. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RunOnMainThread`] +pub type SDL_MainThreadCallback = + ::core::option::Option; + +unsafe extern "C" { + /// Call a function on the main thread during event processing. + /// + /// If this is called on the main thread, the callback is executed immediately. + /// If this is called on another thread, this callback is queued for execution + /// on the main thread during event processing. + /// + /// Be careful of deadlocks when using this functionality. You should not have + /// the main thread wait for the current thread while this function is being + /// called with `wait_complete` true. + /// + /// ## Parameters + /// - `callback`: the callback to call on the main thread. + /// - `userdata`: a pointer that is passed to `callback`. + /// - `wait_complete`: true to wait for the callback to complete, false to + /// return immediately. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_IsMainThread`] + pub fn SDL_RunOnMainThread( + callback: SDL_MainThreadCallback, + userdata: *mut ::core::ffi::c_void, + wait_complete: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Specify basic metadata about your app. + /// + /// You can optionally provide metadata about your app to SDL. This is not + /// required, but strongly encouraged. + /// + /// There are several locations where SDL can make use of metadata (an "About" + /// box in the macOS menu bar, the name of the app can be shown on some audio + /// mixers, etc). Any piece of metadata can be left as NULL, if a specific + /// detail doesn't make sense for the app. + /// + /// This function should be called as early as possible, before [`SDL_Init`]. + /// Multiple calls to this function are allowed, but various state might not + /// change once it has been set up with a previous call to this function. + /// + /// Passing a NULL removes any previous metadata. + /// + /// This is a simplified interface for the most important information. You can + /// supply significantly more detailed metadata with + /// [`SDL_SetAppMetadataProperty()`]. + /// + /// ## Parameters + /// - `appname`: The name of the application ("My Game 2: Bad Guy's + /// Revenge!"). + /// - `appversion`: The version of the application ("1.0.0beta5" or a git + /// hash, or whatever makes sense). + /// - `appidentifier`: A unique string in reverse-domain format that + /// identifies this app ("com.example.mygame2"). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAppMetadataProperty`] + pub fn SDL_SetAppMetadata( + appname: *const ::core::ffi::c_char, + appversion: *const ::core::ffi::c_char, + appidentifier: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Specify metadata about your app through a set of properties. + /// + /// You can optionally provide metadata about your app to SDL. This is not + /// required, but strongly encouraged. + /// + /// There are several locations where SDL can make use of metadata (an "About" + /// box in the macOS menu bar, the name of the app can be shown on some audio + /// mixers, etc). Any piece of metadata can be left out, if a specific detail + /// doesn't make sense for the app. + /// + /// This function should be called as early as possible, before [`SDL_Init`]. + /// Multiple calls to this function are allowed, but various state might not + /// change once it has been set up with a previous call to this function. + /// + /// Once set, this metadata can be read using [`SDL_GetAppMetadataProperty()`]. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_APP_METADATA_NAME_STRING`]\: The human-readable name of the + /// application, like "My Game 2: Bad Guy's Revenge!". This will show up + /// anywhere the OS shows the name of the application separately from window + /// titles, such as volume control applets, etc. This defaults to "SDL + /// Application". + /// - [`SDL_PROP_APP_METADATA_VERSION_STRING`]\: The version of the app that is + /// running; there are no rules on format, so "1.0.3beta2" and "April 22nd, + /// 2024" and a git hash are all valid options. This has no default. + /// - [`SDL_PROP_APP_METADATA_IDENTIFIER_STRING`]\: A unique string that + /// identifies this app. This must be in reverse-domain format, like + /// "com.example.mygame2". This string is used by desktop compositors to + /// identify and group windows together, as well as match applications with + /// associated desktop settings and icons. If you plan to package your + /// application in a container such as Flatpak, the app ID should match the + /// name of your Flatpak container as well. This has no default. + /// - [`SDL_PROP_APP_METADATA_CREATOR_STRING`]\: The human-readable name of the + /// creator/developer/maker of this app, like "MojoWorkshop, LLC" + /// - [`SDL_PROP_APP_METADATA_COPYRIGHT_STRING`]\: The human-readable copyright + /// notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this + /// to one line, don't paste a copy of a whole software license in here. This + /// has no default. + /// - [`SDL_PROP_APP_METADATA_URL_STRING`]\: A URL to the app on the web. Maybe a + /// product page, or a storefront, or even a GitHub repository, for user's + /// further information This has no default. + /// - [`SDL_PROP_APP_METADATA_TYPE_STRING`]\: The type of application this is. + /// Currently this string can be "game" for a video game, "mediaplayer" for a + /// media player, or generically "application" if nothing else applies. + /// Future versions of SDL might add new types. This defaults to + /// "application". + /// + /// ## Parameters + /// - `name`: the name of the metadata property to set. + /// - `value`: the value of the property, or NULL to remove that property. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAppMetadataProperty`] + /// - [`SDL_SetAppMetadata`] + pub fn SDL_SetAppMetadataProperty( + name: *const ::core::ffi::c_char, + value: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +pub const SDL_PROP_APP_METADATA_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.name".as_ptr(); + +pub const SDL_PROP_APP_METADATA_VERSION_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.version".as_ptr(); + +pub const SDL_PROP_APP_METADATA_IDENTIFIER_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.identifier".as_ptr(); + +pub const SDL_PROP_APP_METADATA_CREATOR_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.creator".as_ptr(); + +pub const SDL_PROP_APP_METADATA_COPYRIGHT_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.copyright".as_ptr(); + +pub const SDL_PROP_APP_METADATA_URL_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.url".as_ptr(); + +pub const SDL_PROP_APP_METADATA_TYPE_STRING: *const ::core::ffi::c_char = + c"SDL.app.metadata.type".as_ptr(); + +unsafe extern "C" { + /// Get metadata about your app. + /// + /// This returns metadata previously set using [`SDL_SetAppMetadata()`] or + /// [`SDL_SetAppMetadataProperty()`]. See [`SDL_SetAppMetadataProperty()`] for the list + /// of available properties and their meanings. + /// + /// ## Parameters + /// - `name`: the name of the metadata property to get. + /// + /// ## Return value + /// Returns the current value of the metadata property, or the default if it + /// is not set, NULL for properties with no default. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, although + /// the string returned is not protected and could potentially be + /// freed if you call [`SDL_SetAppMetadataProperty()`] to set that + /// property from another thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetAppMetadata`] + /// - [`SDL_SetAppMetadataProperty`] + pub fn SDL_GetAppMetadataProperty( + name: *const ::core::ffi::c_char, + ) -> *const ::core::ffi::c_char; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/iostream.rs b/vendor/sdl3-sys/src/generated/iostream.rs new file mode 100644 index 00000000..f764bef9 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/iostream.rs @@ -0,0 +1,1823 @@ +//! SDL provides an abstract interface for reading and writing data streams. It +//! offers implementations for files, memory, etc, and the app can provide +//! their own implementations, too. +//! +//! [`SDL_IOStream`] is not related to the standard C++ iostream class, other than +//! both are abstract interfaces to read/write data. + +use super::stdinc::*; + +use super::error::*; + +use super::properties::*; + +/// [`SDL_IOStream`] status, set by a read or write operation. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`READY`](SDL_IOStatus::READY) | [`SDL_IO_STATUS_READY`] | Everything is ready (no errors and not EOF). | +/// | [`ERROR`](SDL_IOStatus::ERROR) | [`SDL_IO_STATUS_ERROR`] | Read or write I/O error | +/// | [`EOF`](SDL_IOStatus::EOF) | [`SDL_IO_STATUS_EOF`] | End of file | +/// | [`NOT_READY`](SDL_IOStatus::NOT_READY) | [`SDL_IO_STATUS_NOT_READY`] | Non blocking I/O, not ready | +/// | [`READONLY`](SDL_IOStatus::READONLY) | [`SDL_IO_STATUS_READONLY`] | Tried to write a read-only buffer | +/// | [`WRITEONLY`](SDL_IOStatus::WRITEONLY) | [`SDL_IO_STATUS_WRITEONLY`] | Tried to read a write-only buffer | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_IOStatus(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_IOStatus { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_IOStatus) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_IOStatus) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_IOStatus { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::READY => "SDL_IO_STATUS_READY", + Self::ERROR => "SDL_IO_STATUS_ERROR", + Self::EOF => "SDL_IO_STATUS_EOF", + Self::NOT_READY => "SDL_IO_STATUS_NOT_READY", + Self::READONLY => "SDL_IO_STATUS_READONLY", + Self::WRITEONLY => "SDL_IO_STATUS_WRITEONLY", + + _ => return write!(f, "SDL_IOStatus({})", self.0), + }) + } +} + +impl SDL_IOStatus { + /// Everything is ready (no errors and not EOF). + pub const READY: Self = Self((0 as ::core::ffi::c_int)); + /// Read or write I/O error + pub const ERROR: Self = Self((1 as ::core::ffi::c_int)); + /// End of file + pub const EOF: Self = Self((2 as ::core::ffi::c_int)); + /// Non blocking I/O, not ready + pub const NOT_READY: Self = Self((3 as ::core::ffi::c_int)); + /// Tried to write a read-only buffer + pub const READONLY: Self = Self((4 as ::core::ffi::c_int)); + /// Tried to read a write-only buffer + pub const WRITEONLY: Self = Self((5 as ::core::ffi::c_int)); +} + +/// Everything is ready (no errors and not EOF). +pub const SDL_IO_STATUS_READY: SDL_IOStatus = SDL_IOStatus::READY; +/// Read or write I/O error +pub const SDL_IO_STATUS_ERROR: SDL_IOStatus = SDL_IOStatus::ERROR; +/// End of file +pub const SDL_IO_STATUS_EOF: SDL_IOStatus = SDL_IOStatus::EOF; +/// Non blocking I/O, not ready +pub const SDL_IO_STATUS_NOT_READY: SDL_IOStatus = SDL_IOStatus::NOT_READY; +/// Tried to write a read-only buffer +pub const SDL_IO_STATUS_READONLY: SDL_IOStatus = SDL_IOStatus::READONLY; +/// Tried to read a write-only buffer +pub const SDL_IO_STATUS_WRITEONLY: SDL_IOStatus = SDL_IOStatus::WRITEONLY; + +impl SDL_IOStatus { + /// Initialize a `SDL_IOStatus` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_IOStatus { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_IOStatus { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::iostream::METADATA_SDL_IOStatus; +} + +/// Possible `whence` values for [`SDL_IOStream`] seeking. +/// +/// These map to the same "whence" concept that `fseek` or `lseek` use in the +/// standard C runtime. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`SET`](SDL_IOWhence::SET) | [`SDL_IO_SEEK_SET`] | Seek from the beginning of data | +/// | [`CUR`](SDL_IOWhence::CUR) | [`SDL_IO_SEEK_CUR`] | Seek relative to current read point | +/// | [`END`](SDL_IOWhence::END) | [`SDL_IO_SEEK_END`] | Seek relative to the end of data | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_IOWhence(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_IOWhence { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_IOWhence) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_IOWhence) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_IOWhence { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::SET => "SDL_IO_SEEK_SET", + Self::CUR => "SDL_IO_SEEK_CUR", + Self::END => "SDL_IO_SEEK_END", + + _ => return write!(f, "SDL_IOWhence({})", self.0), + }) + } +} + +impl SDL_IOWhence { + /// Seek from the beginning of data + pub const SET: Self = Self((0 as ::core::ffi::c_int)); + /// Seek relative to current read point + pub const CUR: Self = Self((1 as ::core::ffi::c_int)); + /// Seek relative to the end of data + pub const END: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Seek from the beginning of data +pub const SDL_IO_SEEK_SET: SDL_IOWhence = SDL_IOWhence::SET; +/// Seek relative to current read point +pub const SDL_IO_SEEK_CUR: SDL_IOWhence = SDL_IOWhence::CUR; +/// Seek relative to the end of data +pub const SDL_IO_SEEK_END: SDL_IOWhence = SDL_IOWhence::END; + +impl SDL_IOWhence { + /// Initialize a `SDL_IOWhence` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_IOWhence { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_IOWhence { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::iostream::METADATA_SDL_IOWhence; +} + +/// The function pointers that drive an [`SDL_IOStream`]. +/// +/// Applications can provide this struct to [`SDL_OpenIO()`] to create their own +/// implementation of [`SDL_IOStream`]. This is not necessarily required, as SDL +/// already offers several common types of I/O streams, via functions like +/// [`SDL_IOFromFile()`] and [`SDL_IOFromMem()`]. +/// +/// This structure should be initialized using [`SDL_INIT_INTERFACE()`] +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_INIT_INTERFACE`] +/// +/// ## Notes for `sdl3-sys` +/// This interface struct can be initialized with [`SDL_IOStreamInterface::new()`] or `Default::default()`. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_IOStreamInterface { + pub version: Uint32, + /// Return the number of bytes in this [`SDL_IOStream`] + /// + /// \return the total size of the data stream, or -1 on error. + pub size: + ::core::option::Option Sint64>, + /// Seek to `offset` relative to `whence`, one of stdio's whence values: + /// [`SDL_IO_SEEK_SET`], [`SDL_IO_SEEK_CUR`], [`SDL_IO_SEEK_END`] + /// + /// \return the final offset in the data stream, or -1 on error. + pub seek: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + offset: Sint64, + whence: SDL_IOWhence, + ) -> Sint64, + >, + /// Read up to `size` bytes from the data stream to the area pointed + /// at by `ptr`. `size` will always be > 0. + /// + /// On an incomplete read, you should set `*status` to a value from the + /// [`SDL_IOStatus`] enum. You do not have to explicitly set this on + /// a complete, successful read. + /// + /// \return the number of bytes read + pub read: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + ptr: *mut ::core::ffi::c_void, + size: ::core::primitive::usize, + status: *mut SDL_IOStatus, + ) -> ::core::primitive::usize, + >, + /// Write exactly `size` bytes from the area pointed at by `ptr` + /// to data stream. `size` will always be > 0. + /// + /// On an incomplete write, you should set `*status` to a value from the + /// [`SDL_IOStatus`] enum. You do not have to explicitly set this on + /// a complete, successful write. + /// + /// \return the number of bytes written + pub write: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + ptr: *const ::core::ffi::c_void, + size: ::core::primitive::usize, + status: *mut SDL_IOStatus, + ) -> ::core::primitive::usize, + >, + /// If the stream is buffering, make sure the data is written out. + /// + /// On failure, you should set `*status` to a value from the + /// [`SDL_IOStatus`] enum. You do not have to explicitly set this on + /// a successful flush. + /// + /// \return true if successful or false on write error when flushing data. + pub flush: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + status: *mut SDL_IOStatus, + ) -> ::core::primitive::bool, + >, + /// Close and free any allocated resources. + /// + /// This does not guarantee file writes will sync to physical media; they + /// can be in the system's file cache, waiting to go to disk. + /// + /// The [`SDL_IOStream`] is still destroyed even if this fails, so clean up anything + /// even if flushing buffers, etc, returns an error. + /// + /// \return true if successful or false on write error when flushing data. + pub close: ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> ::core::primitive::bool, + >, +} + +impl SDL_IOStreamInterface { + /// Create a new `SDL_IOStreamInterface` initialized with `SDL_INIT_INTERFACE` + #[inline] + pub const fn new() -> Self { + const { ::core::assert!(::core::mem::size_of::() <= ::core::primitive::u32::MAX as usize) }; + let mut this = unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() }; + this.version = ::core::mem::size_of::() as ::core::primitive::u32; + this + } +} + +impl ::core::default::Default for SDL_IOStreamInterface { + /// Create a new `SDL_IOStreamInterface` initialized with `SDL_INIT_INTERFACE` + #[inline(always)] + fn default() -> Self { + Self::new() + } +} + +const _: () = ::core::assert!( + (((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 4_usize) + && (::core::mem::size_of::() == 28_usize)) + || ((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 8_usize) + && (::core::mem::size_of::() == 56_usize))) +); + +unsafe extern "C" { + /// Use this function to create a new [`SDL_IOStream`] structure for reading from + /// and/or writing to a named file. + /// + /// The `mode` string is treated roughly the same as in a call to the C + /// library's fopen(), even if SDL doesn't happen to use fopen() behind the + /// scenes. + /// + /// Available `mode` strings: + /// + /// - "r": Open a file for reading. The file must exist. + /// - "w": Create an empty file for writing. If a file with the same name + /// already exists its content is erased and the file is treated as a new + /// empty file. + /// - "wx": Create an empty file for writing. If a file with the same name + /// already exists, the call fails. + /// - "a": Append to a file. Writing operations append data at the end of the + /// file. The file is created if it does not exist. + /// - "r+": Open a file for update both reading and writing. The file must + /// exist. + /// - "w+": Create an empty file for both reading and writing. If a file with + /// the same name already exists its content is erased and the file is + /// treated as a new empty file. + /// - "w+x": Create an empty file for both reading and writing. If a file with + /// the same name already exists, the call fails. + /// - "a+": Open a file for reading and appending. All writing operations are + /// performed at the end of the file, protecting the previous content to be + /// overwritten. You can reposition (fseek, rewind) the internal pointer to + /// anywhere in the file for reading, but writing operations will move it + /// back to the end of file. The file is created if it does not exist. + /// + /// **NOTE**: In order to open a file as a binary file, a "b" character has to + /// be included in the `mode` string. This additional "b" character can either + /// be appended at the end of the string (thus making the following compound + /// modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the + /// letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+"). + /// Additional characters may follow the sequence, although they should have no + /// effect. For example, "t" is sometimes appended to make explicit the file is + /// a text file. + /// + /// This function supports Unicode filenames, but they must be encoded in UTF-8 + /// format, regardless of the underlying operating system. + /// + /// In Android, [`SDL_IOFromFile()`] can be used to open content:// URIs. As a + /// fallback, [`SDL_IOFromFile()`] will transparently open a matching filename in + /// the app's `assets`. + /// + /// Closing the [`SDL_IOStream`] will close SDL's internal file handle. + /// + /// The following properties may be set at creation time by SDL: + /// + /// - [`SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`]\: a pointer, that can be cast + /// to a win32 `HANDLE`, that this [`SDL_IOStream`] is using to access the + /// filesystem. If the program isn't running on Windows, or SDL used some + /// other method to access the filesystem, this property will not be set. + /// - [`SDL_PROP_IOSTREAM_STDIO_FILE_POINTER`]\: a pointer, that can be cast to a + /// stdio `FILE *`, that this [`SDL_IOStream`] is using to access the filesystem. + /// If SDL used some other method to access the filesystem, this property + /// will not be set. PLEASE NOTE that if SDL is using a different C runtime + /// than your app, trying to use this pointer will almost certainly result in + /// a crash! This is mostly a problem on Windows; make sure you build SDL and + /// your app with the same compiler and settings to avoid it. + /// - [`SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`]\: a file descriptor that this + /// [`SDL_IOStream`] is using to access the filesystem. + /// - [`SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER`]\: a pointer, that can be cast + /// to an Android NDK `AAsset *`, that this [`SDL_IOStream`] is using to access + /// the filesystem. If SDL used some other method to access the filesystem, + /// this property will not be set. + /// + /// ## Parameters + /// - `file`: a UTF-8 string representing the filename to open. + /// - `mode`: an ASCII string representing the mode to be used for opening + /// the file. + /// + /// ## Return value + /// Returns a pointer to the [`SDL_IOStream`] structure that is created or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseIO`] + /// - [`SDL_FlushIO`] + /// - [`SDL_ReadIO`] + /// - [`SDL_SeekIO`] + /// - [`SDL_TellIO`] + /// - [`SDL_WriteIO`] + pub fn SDL_IOFromFile( + file: *const ::core::ffi::c_char, + mode: *const ::core::ffi::c_char, + ) -> *mut SDL_IOStream; +} + +pub const SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER: *const ::core::ffi::c_char = + c"SDL.iostream.windows.handle".as_ptr(); + +pub const SDL_PROP_IOSTREAM_STDIO_FILE_POINTER: *const ::core::ffi::c_char = + c"SDL.iostream.stdio.file".as_ptr(); + +pub const SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER: *const ::core::ffi::c_char = + c"SDL.iostream.file_descriptor".as_ptr(); + +pub const SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER: *const ::core::ffi::c_char = + c"SDL.iostream.android.aasset".as_ptr(); + +unsafe extern "C" { + /// Use this function to prepare a read-write memory buffer for use with + /// [`SDL_IOStream`]. + /// + /// This function sets up an [`SDL_IOStream`] struct based on a memory area of a + /// certain size, for both read and write access. + /// + /// This memory buffer is not copied by the [`SDL_IOStream`]; the pointer you + /// provide must remain valid until you close the stream. + /// + /// If you need to make sure the [`SDL_IOStream`] never writes to the memory + /// buffer, you should use [`SDL_IOFromConstMem()`] with a read-only buffer of + /// memory instead. + /// + /// The following properties will be set at creation time by SDL: + /// + /// - [`SDL_PROP_IOSTREAM_MEMORY_POINTER`]\: this will be the `mem` parameter that + /// was passed to this function. + /// - [`SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`]\: this will be the `size` parameter + /// that was passed to this function. + /// + /// Additionally, the following properties are recognized: + /// + /// - [`SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER`]\: if this property is set to + /// a non-NULL value it will be interpreted as a function of [`SDL_free_func`] + /// type and called with the passed `mem` pointer when closing the stream. By + /// default it is unset, i.e., the memory will not be freed. + /// + /// ## Parameters + /// - `mem`: a pointer to a buffer to feed an [`SDL_IOStream`] stream. + /// - `size`: the buffer size, in bytes. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_IOStream`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_IOFromConstMem`] + /// - [`SDL_CloseIO`] + /// - [`SDL_FlushIO`] + /// - [`SDL_ReadIO`] + /// - [`SDL_SeekIO`] + /// - [`SDL_TellIO`] + /// - [`SDL_WriteIO`] + pub fn SDL_IOFromMem( + mem: *mut ::core::ffi::c_void, + size: ::core::primitive::usize, + ) -> *mut SDL_IOStream; +} + +pub const SDL_PROP_IOSTREAM_MEMORY_POINTER: *const ::core::ffi::c_char = + c"SDL.iostream.memory.base".as_ptr(); + +pub const SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER: *const ::core::ffi::c_char = + c"SDL.iostream.memory.size".as_ptr(); + +pub const SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER: *const ::core::ffi::c_char = + c"SDL.iostream.memory.free".as_ptr(); + +unsafe extern "C" { + /// Use this function to prepare a read-only memory buffer for use with + /// [`SDL_IOStream`]. + /// + /// This function sets up an [`SDL_IOStream`] struct based on a memory area of a + /// certain size. It assumes the memory area is not writable. + /// + /// Attempting to write to this [`SDL_IOStream`] stream will report an error + /// without writing to the memory buffer. + /// + /// This memory buffer is not copied by the [`SDL_IOStream`]; the pointer you + /// provide must remain valid until you close the stream. + /// + /// If you need to write to a memory buffer, you should use [`SDL_IOFromMem()`] + /// with a writable buffer of memory instead. + /// + /// The following properties will be set at creation time by SDL: + /// + /// - [`SDL_PROP_IOSTREAM_MEMORY_POINTER`]\: this will be the `mem` parameter that + /// was passed to this function. + /// - [`SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`]\: this will be the `size` parameter + /// that was passed to this function. + /// + /// Additionally, the following properties are recognized: + /// + /// - [`SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER`]\: if this property is set to + /// a non-NULL value it will be interpreted as a function of [`SDL_free_func`] + /// type and called with the passed `mem` pointer when closing the stream. By + /// default it is unset, i.e., the memory will not be freed. + /// + /// ## Parameters + /// - `mem`: a pointer to a read-only buffer to feed an [`SDL_IOStream`] stream. + /// - `size`: the buffer size, in bytes. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_IOStream`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_IOFromMem`] + /// - [`SDL_CloseIO`] + /// - [`SDL_ReadIO`] + /// - [`SDL_SeekIO`] + /// - [`SDL_TellIO`] + pub fn SDL_IOFromConstMem( + mem: *const ::core::ffi::c_void, + size: ::core::primitive::usize, + ) -> *mut SDL_IOStream; +} + +unsafe extern "C" { + /// Use this function to create an [`SDL_IOStream`] that is backed by dynamically + /// allocated memory. + /// + /// This supports the following properties to provide access to the memory and + /// control over allocations: + /// + /// - [`SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER`]\: a pointer to the internal + /// memory of the stream. This can be set to NULL to transfer ownership of + /// the memory to the application, which should free the memory with + /// [`SDL_free()`]. If this is done, the next operation on the stream must be + /// [`SDL_CloseIO()`]. + /// - [`SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER`]\: memory will be allocated in + /// multiples of this size, defaulting to 1024. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_IOStream`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseIO`] + /// - [`SDL_ReadIO`] + /// - [`SDL_SeekIO`] + /// - [`SDL_TellIO`] + /// - [`SDL_WriteIO`] + pub fn SDL_IOFromDynamicMem() -> *mut SDL_IOStream; +} + +pub const SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER: *const ::core::ffi::c_char = + c"SDL.iostream.dynamic.memory".as_ptr(); + +pub const SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER: *const ::core::ffi::c_char = + c"SDL.iostream.dynamic.chunksize".as_ptr(); + +unsafe extern "C" { + /// Create a custom [`SDL_IOStream`]. + /// + /// Applications do not need to use this function unless they are providing + /// their own [`SDL_IOStream`] implementation. If you just need an [`SDL_IOStream`] to + /// read/write a common data source, you should use the built-in + /// implementations in SDL, like [`SDL_IOFromFile()`] or [`SDL_IOFromMem()`], etc. + /// + /// This function makes a copy of `iface` and the caller does not need to keep + /// it around after this call. + /// + /// ## Parameters + /// - `iface`: the interface that implements this [`SDL_IOStream`], initialized + /// using [`SDL_INIT_INTERFACE()`]. + /// - `userdata`: the pointer that will be passed to the interface functions. + /// + /// ## Return value + /// Returns a pointer to the allocated memory on success or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseIO`] + /// - [`SDL_INIT_INTERFACE`] + /// - [`SDL_IOFromConstMem`] + /// - [`SDL_IOFromFile`] + /// - [`SDL_IOFromMem`] + pub fn SDL_OpenIO( + iface: *const SDL_IOStreamInterface, + userdata: *mut ::core::ffi::c_void, + ) -> *mut SDL_IOStream; +} + +unsafe extern "C" { + /// Close and free an allocated [`SDL_IOStream`] structure. + /// + /// [`SDL_CloseIO()`] closes and cleans up the [`SDL_IOStream`] stream. It releases any + /// resources used by the stream and frees the [`SDL_IOStream`] itself. This + /// returns true on success, or false if the stream failed to flush to its + /// output (e.g. to disk). + /// + /// Note that if this fails to flush the stream for any reason, this function + /// reports an error, but the [`SDL_IOStream`] is still invalid once this function + /// returns. + /// + /// This call flushes any buffered writes to the operating system, but there + /// are no guarantees that those writes have gone to physical media; they might + /// be in the OS's file cache, waiting to go to disk later. If it's absolutely + /// crucial that writes go to disk immediately, so they are definitely stored + /// even if the power fails before the file cache would have caught up, one + /// should call [`SDL_FlushIO()`] before closing. Note that flushing takes time and + /// makes the system and your app operate less efficiently, so do so sparingly. + /// + /// ## Parameters + /// - `context`: [`SDL_IOStream`] structure to close. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenIO`] + pub fn SDL_CloseIO(context: *mut SDL_IOStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the properties associated with an [`SDL_IOStream`]. + /// + /// ## Parameters + /// - `context`: a pointer to an [`SDL_IOStream`] structure. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetIOProperties(context: *mut SDL_IOStream) -> SDL_PropertiesID; +} + +unsafe extern "C" { + /// Query the stream status of an [`SDL_IOStream`]. + /// + /// This information can be useful to decide if a short read or write was due + /// to an error, an EOF, or a non-blocking operation that isn't yet ready to + /// complete. + /// + /// An SDL_IOStream's status is only expected to change after a [`SDL_ReadIO`] or + /// [`SDL_WriteIO`] call; don't expect it to change if you just call this query + /// function in a tight loop. + /// + /// ## Parameters + /// - `context`: the [`SDL_IOStream`] to query. + /// + /// ## Return value + /// Returns an [`SDL_IOStatus`] enum with the current state. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetIOStatus(context: *mut SDL_IOStream) -> SDL_IOStatus; +} + +unsafe extern "C" { + /// Use this function to get the size of the data stream in an [`SDL_IOStream`]. + /// + /// ## Parameters + /// - `context`: the [`SDL_IOStream`] to get the size of the data stream from. + /// + /// ## Return value + /// Returns the size of the data stream in the [`SDL_IOStream`] on success or a + /// negative error code on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetIOSize(context: *mut SDL_IOStream) -> Sint64; +} + +unsafe extern "C" { + /// Seek within an [`SDL_IOStream`] data stream. + /// + /// This function seeks to byte `offset`, relative to `whence`. + /// + /// `whence` may be any of the following values: + /// + /// - [`SDL_IO_SEEK_SET`]\: seek from the beginning of data + /// - [`SDL_IO_SEEK_CUR`]\: seek relative to current read point + /// - [`SDL_IO_SEEK_END`]\: seek relative to the end of data + /// + /// If this stream can not seek, it will return -1. + /// + /// ## Parameters + /// - `context`: a pointer to an [`SDL_IOStream`] structure. + /// - `offset`: an offset in bytes, relative to `whence` location; can be + /// negative. + /// - `whence`: any of [`SDL_IO_SEEK_SET`], [`SDL_IO_SEEK_CUR`], + /// [`SDL_IO_SEEK_END`]. + /// + /// ## Return value + /// Returns the final offset in the data stream after the seek or -1 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_TellIO`] + pub fn SDL_SeekIO(context: *mut SDL_IOStream, offset: Sint64, whence: SDL_IOWhence) -> Sint64; +} + +unsafe extern "C" { + /// Determine the current read/write offset in an [`SDL_IOStream`] data stream. + /// + /// [`SDL_TellIO`] is actually a wrapper function that calls the SDL_IOStream's + /// `seek` method, with an offset of 0 bytes from [`SDL_IO_SEEK_CUR`], to + /// simplify application development. + /// + /// ## Parameters + /// - `context`: an [`SDL_IOStream`] data stream object from which to get the + /// current offset. + /// + /// ## Return value + /// Returns the current offset in the stream, or -1 if the information can not + /// be determined. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SeekIO`] + pub fn SDL_TellIO(context: *mut SDL_IOStream) -> Sint64; +} + +unsafe extern "C" { + /// Read from a data source. + /// + /// This function reads up `size` bytes from the data source to the area + /// pointed at by `ptr`. This function may read less bytes than requested. + /// + /// This function will return zero when the data stream is completely read, and + /// [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If zero is returned and + /// the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different error + /// value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// A request for zero bytes on a valid stream will return zero immediately + /// without accessing the stream, so the stream status (EOF, err, etc) will not + /// change. + /// + /// ## Parameters + /// - `context`: a pointer to an [`SDL_IOStream`] structure. + /// - `ptr`: a pointer to a buffer to read data into. + /// - `size`: the number of bytes to read from the data source. + /// + /// ## Return value + /// Returns the number of bytes read, or 0 on end of file or other failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WriteIO`] + /// - [`SDL_GetIOStatus`] + pub fn SDL_ReadIO( + context: *mut SDL_IOStream, + ptr: *mut ::core::ffi::c_void, + size: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Write to an [`SDL_IOStream`] data stream. + /// + /// This function writes exactly `size` bytes from the area pointed at by `ptr` + /// to the stream. If this fails for any reason, it'll return less than `size` + /// to demonstrate how far the write progressed. On success, it returns `size`. + /// + /// On error, this function still attempts to write as much as possible, so it + /// might return a positive value less than the requested write size. + /// + /// The caller can use [`SDL_GetIOStatus()`] to determine if the problem is + /// recoverable, such as a non-blocking write that can simply be retried later, + /// or a fatal error. + /// + /// A request for zero bytes on a valid stream will return zero immediately + /// without accessing the stream, so the stream status (EOF, err, etc) will not + /// change. + /// + /// ## Parameters + /// - `context`: a pointer to an [`SDL_IOStream`] structure. + /// - `ptr`: a pointer to a buffer containing data to write. + /// - `size`: the number of bytes to write. + /// + /// ## Return value + /// Returns the number of bytes written, which will be less than `size` on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_IOprintf`] + /// - [`SDL_ReadIO`] + /// - [`SDL_SeekIO`] + /// - [`SDL_FlushIO`] + /// - [`SDL_GetIOStatus`] + pub fn SDL_WriteIO( + context: *mut SDL_IOStream, + ptr: *const ::core::ffi::c_void, + size: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Print to an [`SDL_IOStream`] data stream. + /// + /// This function does formatted printing to the stream. + /// + /// ## Parameters + /// - `context`: a pointer to an [`SDL_IOStream`] structure. + /// - `fmt`: a printf() style format string. + /// - `...`: additional parameters matching % tokens in the `fmt` string, if + /// any. + /// + /// ## Return value + /// Returns the number of bytes written or 0 on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_IOvprintf`] + /// - [`SDL_WriteIO`] + pub fn SDL_IOprintf( + context: *mut SDL_IOStream, + fmt: *const ::core::ffi::c_char, + ... + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Print to an [`SDL_IOStream`] data stream. + /// + /// This function does formatted printing to the stream. + /// + /// ## Parameters + /// - `context`: a pointer to an [`SDL_IOStream`] structure. + /// - `fmt`: a printf() style format string. + /// - `ap`: a variable argument list. + /// + /// ## Return value + /// Returns the number of bytes written or 0 on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_IOprintf`] + /// - [`SDL_WriteIO`] + pub fn SDL_IOvprintf( + context: *mut SDL_IOStream, + fmt: *const ::core::ffi::c_char, + ap: crate::ffi::VaList, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Flush any buffered data in the stream. + /// + /// This function makes sure that any buffered data is written to the stream. + /// Normally this isn't necessary but if the stream is a pipe or socket it + /// guarantees that any pending data is sent. + /// + /// ## Parameters + /// - `context`: [`SDL_IOStream`] structure to flush. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenIO`] + /// - [`SDL_WriteIO`] + pub fn SDL_FlushIO(context: *mut SDL_IOStream) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Load all the data from an SDL data stream. + /// + /// The data is allocated with a zero byte at the end (null terminated) for + /// convenience. This extra byte is not included in the value reported via + /// `datasize`. + /// + /// The data should be freed with [`SDL_free()`]. + /// + /// ## Parameters + /// - `src`: the [`SDL_IOStream`] to read all available data from. + /// - `datasize`: a pointer filled in with the number of bytes read, may be + /// NULL. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns the data or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadFile`] + /// - [`SDL_SaveFile_IO`] + pub fn SDL_LoadFile_IO( + src: *mut SDL_IOStream, + datasize: *mut ::core::primitive::usize, + closeio: ::core::primitive::bool, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Load all the data from a file path. + /// + /// The data is allocated with a zero byte at the end (null terminated) for + /// convenience. This extra byte is not included in the value reported via + /// `datasize`. + /// + /// The data should be freed with [`SDL_free()`]. + /// + /// ## Parameters + /// - `file`: the path to read all available data from. + /// - `datasize`: if not NULL, will store the number of bytes read. + /// + /// ## Return value + /// Returns the data or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadFile_IO`] + /// - [`SDL_SaveFile`] + pub fn SDL_LoadFile( + file: *const ::core::ffi::c_char, + datasize: *mut ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Save all the data into an SDL data stream. + /// + /// ## Parameters + /// - `src`: the [`SDL_IOStream`] to write all data to. + /// - `data`: the data to be written. If datasize is 0, may be NULL or a + /// invalid pointer. + /// - `datasize`: the number of bytes to be written. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SaveFile`] + /// - [`SDL_LoadFile_IO`] + pub fn SDL_SaveFile_IO( + src: *mut SDL_IOStream, + data: *const ::core::ffi::c_void, + datasize: ::core::primitive::usize, + closeio: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Save all the data into a file path. + /// + /// ## Parameters + /// - `file`: the path to write all available data into. + /// - `data`: the data to be written. If datasize is 0, may be NULL or a + /// invalid pointer. + /// - `datasize`: the number of bytes to be written. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SaveFile_IO`] + /// - [`SDL_LoadFile`] + pub fn SDL_SaveFile( + file: *const ::core::ffi::c_char, + data: *const ::core::ffi::c_void, + datasize: ::core::primitive::usize, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read a byte from an [`SDL_IOStream`]. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the [`SDL_IOStream`] to read from. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on success or false on failure or EOF; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU8(src: *mut SDL_IOStream, value: *mut Uint8) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read a signed byte from an [`SDL_IOStream`]. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the [`SDL_IOStream`] to read from. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS8(src: *mut SDL_IOStream, value: *mut Sint8) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 16 bits of little-endian data from an + /// [`SDL_IOStream`] and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU16LE(src: *mut SDL_IOStream, value: *mut Uint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 16 bits of little-endian data from an + /// [`SDL_IOStream`] and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS16LE(src: *mut SDL_IOStream, value: *mut Sint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 16 bits of big-endian data from an [`SDL_IOStream`] + /// and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU16BE(src: *mut SDL_IOStream, value: *mut Uint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 16 bits of big-endian data from an [`SDL_IOStream`] + /// and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS16BE(src: *mut SDL_IOStream, value: *mut Sint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 32 bits of little-endian data from an + /// [`SDL_IOStream`] and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU32LE(src: *mut SDL_IOStream, value: *mut Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 32 bits of little-endian data from an + /// [`SDL_IOStream`] and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS32LE(src: *mut SDL_IOStream, value: *mut Sint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 32 bits of big-endian data from an [`SDL_IOStream`] + /// and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU32BE(src: *mut SDL_IOStream, value: *mut Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 32 bits of big-endian data from an [`SDL_IOStream`] + /// and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS32BE(src: *mut SDL_IOStream, value: *mut Sint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 64 bits of little-endian data from an + /// [`SDL_IOStream`] and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU64LE(src: *mut SDL_IOStream, value: *mut Uint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 64 bits of little-endian data from an + /// [`SDL_IOStream`] and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS64LE(src: *mut SDL_IOStream, value: *mut Sint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 64 bits of big-endian data from an [`SDL_IOStream`] + /// and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadU64BE(src: *mut SDL_IOStream, value: *mut Uint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to read 64 bits of big-endian data from an [`SDL_IOStream`] + /// and return in native format. + /// + /// SDL byteswaps the data only if necessary, so the data returned will be in + /// the native byte order. + /// + /// This function will return false when the data stream is completely read, + /// and [`SDL_GetIOStatus()`] will return [`SDL_IO_STATUS_EOF`]. If false is returned + /// and the stream is not at EOF, [`SDL_GetIOStatus()`] will return a different + /// error value and [`SDL_GetError()`] will offer a human-readable message. + /// + /// ## Parameters + /// - `src`: the stream from which to read data. + /// - `value`: a pointer filled in with the data read. + /// + /// ## Return value + /// Returns true on successful read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadS64BE(src: *mut SDL_IOStream, value: *mut Sint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write a byte to an [`SDL_IOStream`]. + /// + /// ## Parameters + /// - `dst`: the [`SDL_IOStream`] to write to. + /// - `value`: the byte value to write. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU8(dst: *mut SDL_IOStream, value: Uint8) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write a signed byte to an [`SDL_IOStream`]. + /// + /// ## Parameters + /// - `dst`: the [`SDL_IOStream`] to write to. + /// - `value`: the byte value to write. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS8(dst: *mut SDL_IOStream, value: Sint8) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as + /// little-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in little-endian + /// format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU16LE(dst: *mut SDL_IOStream, value: Uint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as + /// little-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in little-endian + /// format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS16LE(dst: *mut SDL_IOStream, value: Sint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as + /// big-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in big-endian format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU16BE(dst: *mut SDL_IOStream, value: Uint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 16 bits in native format to an [`SDL_IOStream`] as + /// big-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in big-endian format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS16BE(dst: *mut SDL_IOStream, value: Sint16) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as + /// little-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in little-endian + /// format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU32LE(dst: *mut SDL_IOStream, value: Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as + /// little-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in little-endian + /// format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS32LE(dst: *mut SDL_IOStream, value: Sint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as + /// big-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in big-endian format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU32BE(dst: *mut SDL_IOStream, value: Uint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 32 bits in native format to an [`SDL_IOStream`] as + /// big-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in big-endian format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS32BE(dst: *mut SDL_IOStream, value: Sint32) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as + /// little-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in little-endian + /// format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU64LE(dst: *mut SDL_IOStream, value: Uint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as + /// little-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in little-endian + /// format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS64LE(dst: *mut SDL_IOStream, value: Sint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as + /// big-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in big-endian format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteU64BE(dst: *mut SDL_IOStream, value: Uint64) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Use this function to write 64 bits in native format to an [`SDL_IOStream`] as + /// big-endian data. + /// + /// SDL byteswaps the data only if necessary, so the application always + /// specifies native format, and the data written will be in big-endian format. + /// + /// ## Parameters + /// - `dst`: the stream to which data will be written. + /// - `value`: the data to be written, in native format. + /// + /// ## Return value + /// Returns true on successful write or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// Do not use the same [`SDL_IOStream`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteS64BE(dst: *mut SDL_IOStream, value: Sint64) -> ::core::primitive::bool; +} + +/// The read/write operation structure. +/// +/// This operates as an opaque handle. There are several APIs to create various +/// types of I/O streams, or an app can supply an [`SDL_IOStreamInterface`] to +/// [`SDL_OpenIO()`] to provide their own stream implementation behind this +/// struct's abstract interface. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_IOStream { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/joystick.rs b/vendor/sdl3-sys/src/generated/joystick.rs new file mode 100644 index 00000000..008b6dd0 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/joystick.rs @@ -0,0 +1,2063 @@ +//! SDL joystick support. +//! +//! This is the lower-level joystick handling. If you want the simpler option, +//! where what each button does is well-defined, you should use the gamepad API +//! instead. +//! +//! The term "instance_id" is the current instantiation of a joystick device in +//! the system. If the joystick is removed and then re-inserted then it will +//! get a new instance_id. instance_id's are monotonically increasing +//! identifiers of a joystick plugged in. +//! +//! The term "player_index" is the number assigned to a player on a specific +//! controller. For XInput controllers this returns the XInput user index. Many +//! joysticks will not be able to supply this information. +//! +//! [`SDL_GUID`] is used as a stable 128-bit identifier for a joystick device that +//! does not change over time. It identifies class of the device (a X360 wired +//! controller for example). This identifier is platform dependent. +//! +//! In order to use these functions, [`SDL_Init()`] must have been called with the +//! [`SDL_INIT_JOYSTICK`] flag. This causes SDL to scan the system for joysticks, +//! and load appropriate drivers. +//! +//! If you would like to receive joystick updates while the application is in +//! the background, you should set the following hint before calling +//! [`SDL_Init()`]\: [`SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS`] +//! +//! SDL can provide virtual joysticks as well: the app defines an imaginary +//! controller with [`SDL_AttachVirtualJoystick()`], and then can provide inputs +//! for it via [`SDL_SetJoystickVirtualAxis()`], [`SDL_SetJoystickVirtualButton()`], +//! etc. As this data is supplied, it will look like a normal joystick to SDL, +//! just not backed by a hardware driver. This has been used to make unusual +//! devices, like VR headset controllers, look like normal joysticks, or +//! provide recording/playback of game inputs, etc. + +use super::stdinc::*; + +use super::error::*; + +use super::guid::*; + +use super::mutex::*; + +use super::power::*; + +use super::properties::*; + +use super::sensor::*; + +/// This is a unique ID for a joystick for the time it is connected to the +/// system, and is never reused for the lifetime of the application. +/// +/// If the joystick is disconnected and reconnected, it will get a new ID. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_JoystickID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_JoystickID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_JoystickID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_JoystickID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_JoystickID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_JoystickID { + /// Initialize a `SDL_JoystickID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_JoystickID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_JoystickID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::joystick::METADATA_SDL_JoystickID; +} + +/// An enum of some common joystick types. +/// +/// In some cases, SDL can identify a low-level joystick as being a certain +/// type of device, and will report it through [`SDL_GetJoystickType`] (or +/// [`SDL_GetJoystickTypeForID`]). +/// +/// This is by no means a complete list of everything that can be plugged into +/// a computer. +/// +/// You may refer to +/// [XInput Controller Types](https://learn.microsoft.com/en-us/windows/win32/xinput/xinput-and-controller-subtypes) +/// table for a general understanding of each joystick type. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_JoystickType::UNKNOWN) | [`SDL_JOYSTICK_TYPE_UNKNOWN`] | | +/// | [`GAMEPAD`](SDL_JoystickType::GAMEPAD) | [`SDL_JOYSTICK_TYPE_GAMEPAD`] | | +/// | [`WHEEL`](SDL_JoystickType::WHEEL) | [`SDL_JOYSTICK_TYPE_WHEEL`] | | +/// | [`ARCADE_STICK`](SDL_JoystickType::ARCADE_STICK) | [`SDL_JOYSTICK_TYPE_ARCADE_STICK`] | | +/// | [`FLIGHT_STICK`](SDL_JoystickType::FLIGHT_STICK) | [`SDL_JOYSTICK_TYPE_FLIGHT_STICK`] | | +/// | [`DANCE_PAD`](SDL_JoystickType::DANCE_PAD) | [`SDL_JOYSTICK_TYPE_DANCE_PAD`] | | +/// | [`GUITAR`](SDL_JoystickType::GUITAR) | [`SDL_JOYSTICK_TYPE_GUITAR`] | | +/// | [`DRUM_KIT`](SDL_JoystickType::DRUM_KIT) | [`SDL_JOYSTICK_TYPE_DRUM_KIT`] | | +/// | [`ARCADE_PAD`](SDL_JoystickType::ARCADE_PAD) | [`SDL_JOYSTICK_TYPE_ARCADE_PAD`] | | +/// | [`THROTTLE`](SDL_JoystickType::THROTTLE) | [`SDL_JOYSTICK_TYPE_THROTTLE`] | | +/// | [`COUNT`](SDL_JoystickType::COUNT) | [`SDL_JOYSTICK_TYPE_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_JoystickType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_JoystickType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_JoystickType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_JoystickType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_JoystickType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_JOYSTICK_TYPE_UNKNOWN", + Self::GAMEPAD => "SDL_JOYSTICK_TYPE_GAMEPAD", + Self::WHEEL => "SDL_JOYSTICK_TYPE_WHEEL", + Self::ARCADE_STICK => "SDL_JOYSTICK_TYPE_ARCADE_STICK", + Self::FLIGHT_STICK => "SDL_JOYSTICK_TYPE_FLIGHT_STICK", + Self::DANCE_PAD => "SDL_JOYSTICK_TYPE_DANCE_PAD", + Self::GUITAR => "SDL_JOYSTICK_TYPE_GUITAR", + Self::DRUM_KIT => "SDL_JOYSTICK_TYPE_DRUM_KIT", + Self::ARCADE_PAD => "SDL_JOYSTICK_TYPE_ARCADE_PAD", + Self::THROTTLE => "SDL_JOYSTICK_TYPE_THROTTLE", + Self::COUNT => "SDL_JOYSTICK_TYPE_COUNT", + + _ => return write!(f, "SDL_JoystickType({})", self.0), + }) + } +} + +impl SDL_JoystickType { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const GAMEPAD: Self = Self((1 as ::core::ffi::c_int)); + pub const WHEEL: Self = Self((2 as ::core::ffi::c_int)); + pub const ARCADE_STICK: Self = Self((3 as ::core::ffi::c_int)); + pub const FLIGHT_STICK: Self = Self((4 as ::core::ffi::c_int)); + pub const DANCE_PAD: Self = Self((5 as ::core::ffi::c_int)); + pub const GUITAR: Self = Self((6 as ::core::ffi::c_int)); + pub const DRUM_KIT: Self = Self((7 as ::core::ffi::c_int)); + pub const ARCADE_PAD: Self = Self((8 as ::core::ffi::c_int)); + pub const THROTTLE: Self = Self((9 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((10 as ::core::ffi::c_int)); +} + +pub const SDL_JOYSTICK_TYPE_UNKNOWN: SDL_JoystickType = SDL_JoystickType::UNKNOWN; +pub const SDL_JOYSTICK_TYPE_GAMEPAD: SDL_JoystickType = SDL_JoystickType::GAMEPAD; +pub const SDL_JOYSTICK_TYPE_WHEEL: SDL_JoystickType = SDL_JoystickType::WHEEL; +pub const SDL_JOYSTICK_TYPE_ARCADE_STICK: SDL_JoystickType = SDL_JoystickType::ARCADE_STICK; +pub const SDL_JOYSTICK_TYPE_FLIGHT_STICK: SDL_JoystickType = SDL_JoystickType::FLIGHT_STICK; +pub const SDL_JOYSTICK_TYPE_DANCE_PAD: SDL_JoystickType = SDL_JoystickType::DANCE_PAD; +pub const SDL_JOYSTICK_TYPE_GUITAR: SDL_JoystickType = SDL_JoystickType::GUITAR; +pub const SDL_JOYSTICK_TYPE_DRUM_KIT: SDL_JoystickType = SDL_JoystickType::DRUM_KIT; +pub const SDL_JOYSTICK_TYPE_ARCADE_PAD: SDL_JoystickType = SDL_JoystickType::ARCADE_PAD; +pub const SDL_JOYSTICK_TYPE_THROTTLE: SDL_JoystickType = SDL_JoystickType::THROTTLE; +pub const SDL_JOYSTICK_TYPE_COUNT: SDL_JoystickType = SDL_JoystickType::COUNT; + +impl SDL_JoystickType { + /// Initialize a `SDL_JoystickType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_JoystickType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_JoystickType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::joystick::METADATA_SDL_JoystickType; +} + +/// Possible connection states for a joystick device. +/// +/// This is used by [`SDL_GetJoystickConnectionState`] to report how a device is +/// connected to the system. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_JoystickConnectionState::INVALID) | [`SDL_JOYSTICK_CONNECTION_INVALID`] | | +/// | [`UNKNOWN`](SDL_JoystickConnectionState::UNKNOWN) | [`SDL_JOYSTICK_CONNECTION_UNKNOWN`] | | +/// | [`WIRED`](SDL_JoystickConnectionState::WIRED) | [`SDL_JOYSTICK_CONNECTION_WIRED`] | | +/// | [`WIRELESS`](SDL_JoystickConnectionState::WIRELESS) | [`SDL_JOYSTICK_CONNECTION_WIRELESS`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_JoystickConnectionState(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_JoystickConnectionState { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_JoystickConnectionState) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_JoystickConnectionState) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_JoystickConnectionState { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_JOYSTICK_CONNECTION_INVALID", + Self::UNKNOWN => "SDL_JOYSTICK_CONNECTION_UNKNOWN", + Self::WIRED => "SDL_JOYSTICK_CONNECTION_WIRED", + Self::WIRELESS => "SDL_JOYSTICK_CONNECTION_WIRELESS", + + _ => return write!(f, "SDL_JoystickConnectionState({})", self.0), + }) + } +} + +impl SDL_JoystickConnectionState { + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + pub const UNKNOWN: Self = Self((0_i32 as ::core::ffi::c_int)); + pub const WIRED: Self = Self((1_i32 as ::core::ffi::c_int)); + pub const WIRELESS: Self = Self((2_i32 as ::core::ffi::c_int)); +} + +pub const SDL_JOYSTICK_CONNECTION_INVALID: SDL_JoystickConnectionState = + SDL_JoystickConnectionState::INVALID; +pub const SDL_JOYSTICK_CONNECTION_UNKNOWN: SDL_JoystickConnectionState = + SDL_JoystickConnectionState::UNKNOWN; +pub const SDL_JOYSTICK_CONNECTION_WIRED: SDL_JoystickConnectionState = + SDL_JoystickConnectionState::WIRED; +pub const SDL_JOYSTICK_CONNECTION_WIRELESS: SDL_JoystickConnectionState = + SDL_JoystickConnectionState::WIRELESS; + +impl SDL_JoystickConnectionState { + /// Initialize a `SDL_JoystickConnectionState` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_JoystickConnectionState { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_JoystickConnectionState { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::joystick::METADATA_SDL_JoystickConnectionState; +} + +/// The largest value an SDL_Joystick's axis can report. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_JOYSTICK_AXIS_MIN`] +pub const SDL_JOYSTICK_AXIS_MAX: Sint16 = (32767 as Sint16); + +/// The smallest value an SDL_Joystick's axis can report. +/// +/// This is a negative number! +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_JOYSTICK_AXIS_MAX`] +pub const SDL_JOYSTICK_AXIS_MIN: Sint16 = (-32768_i32 as Sint16); + +unsafe extern "C" { + /// Locking for atomic access to the joystick API. + /// + /// The SDL joystick functions are thread-safe, however you can lock the + /// joysticks while processing to guarantee that the joystick list won't change + /// and joystick and gamepad events will not be delivered. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_LockJoysticks(); +} + +unsafe extern "C" { + /// Unlocking for atomic access to the joystick API. + /// + /// ## Thread safety + /// This should be called from the same thread that called + /// [`SDL_LockJoysticks()`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UnlockJoysticks(); +} + +unsafe extern "C" { + /// Return whether a joystick is currently connected. + /// + /// ## Return value + /// Returns true if a joystick is connected, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoysticks`] + pub fn SDL_HasJoystick() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a list of currently connected joysticks. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of joysticks returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of joystick instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasJoystick`] + /// - [`SDL_OpenJoystick`] + pub fn SDL_GetJoysticks(count: *mut ::core::ffi::c_int) -> *mut SDL_JoystickID; +} + +unsafe extern "C" { + /// Get the implementation dependent name of a joystick. + /// + /// This can be called before any joysticks are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the name of the selected joystick. If no name can be found, this + /// function returns NULL; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickName`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickNameForID(instance_id: SDL_JoystickID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the implementation dependent path of a joystick. + /// + /// This can be called before any joysticks are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the path of the selected joystick. If no path can be found, this + /// function returns NULL; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickPath`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickPathForID(instance_id: SDL_JoystickID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the player index of a joystick. + /// + /// This can be called before any joysticks are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the player index of a joystick, or -1 if it's not available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickPlayerIndex`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickPlayerIndexForID(instance_id: SDL_JoystickID) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the implementation-dependent GUID of a joystick. + /// + /// This can be called before any joysticks are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the GUID of the selected joystick. If called with an invalid + /// instance_id, this function returns a zero GUID. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickGUID`] + /// - [`SDL_GUIDToString`] + pub fn SDL_GetJoystickGUIDForID(instance_id: SDL_JoystickID) -> SDL_GUID; +} + +unsafe extern "C" { + /// Get the USB vendor ID of a joystick, if available. + /// + /// This can be called before any joysticks are opened. If the vendor ID isn't + /// available this function returns 0. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the USB vendor ID of the selected joystick. If called with an + /// invalid instance_id, this function returns 0. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickVendor`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickVendorForID(instance_id: SDL_JoystickID) -> Uint16; +} + +unsafe extern "C" { + /// Get the USB product ID of a joystick, if available. + /// + /// This can be called before any joysticks are opened. If the product ID isn't + /// available this function returns 0. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the USB product ID of the selected joystick. If called with an + /// invalid instance_id, this function returns 0. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickProduct`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickProductForID(instance_id: SDL_JoystickID) -> Uint16; +} + +unsafe extern "C" { + /// Get the product version of a joystick, if available. + /// + /// This can be called before any joysticks are opened. If the product version + /// isn't available this function returns 0. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the product version of the selected joystick. If called with an + /// invalid instance_id, this function returns 0. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickProductVersion`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickProductVersionForID(instance_id: SDL_JoystickID) -> Uint16; +} + +unsafe extern "C" { + /// Get the type of a joystick, if available. + /// + /// This can be called before any joysticks are opened. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns the [`SDL_JoystickType`] of the selected joystick. If called with an + /// invalid instance_id, this function returns + /// [`SDL_JOYSTICK_TYPE_UNKNOWN`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickType`] + /// - [`SDL_GetJoysticks`] + pub fn SDL_GetJoystickTypeForID(instance_id: SDL_JoystickID) -> SDL_JoystickType; +} + +unsafe extern "C" { + /// Open a joystick for use. + /// + /// The joystick subsystem must be initialized before a joystick can be opened + /// for use. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns a joystick identifier or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseJoystick`] + pub fn SDL_OpenJoystick(instance_id: SDL_JoystickID) -> *mut SDL_Joystick; +} + +unsafe extern "C" { + /// Get the [`SDL_Joystick`] associated with an instance ID, if it has been opened. + /// + /// ## Parameters + /// - `instance_id`: the instance ID to get the [`SDL_Joystick`] for. + /// + /// ## Return value + /// Returns an [`SDL_Joystick`] on success or NULL on failure or if it hasn't been + /// opened yet; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickFromID(instance_id: SDL_JoystickID) -> *mut SDL_Joystick; +} + +unsafe extern "C" { + /// Get the [`SDL_Joystick`] associated with a player index. + /// + /// ## Parameters + /// - `player_index`: the player index to get the [`SDL_Joystick`] for. + /// + /// ## Return value + /// Returns an [`SDL_Joystick`] on success or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickPlayerIndex`] + /// - [`SDL_SetJoystickPlayerIndex`] + pub fn SDL_GetJoystickFromPlayerIndex(player_index: ::core::ffi::c_int) -> *mut SDL_Joystick; +} + +/// The structure that describes a virtual joystick touchpad. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_VirtualJoystickDesc`] +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_VirtualJoystickTouchpadDesc { + /// the number of simultaneous fingers on this touchpad + pub nfingers: Uint16, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding: [Uint16; 3], +} + +/// The structure that describes a virtual joystick sensor. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_VirtualJoystickDesc`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_VirtualJoystickSensorDesc { + /// the type of this sensor + pub r#type: SDL_SensorType, + /// the update frequency of this sensor, may be 0.0f + pub rate: ::core::ffi::c_float, +} + +/// The structure that describes a virtual joystick. +/// +/// This structure should be initialized using [`SDL_INIT_INTERFACE()`]. All +/// elements of this structure are optional. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AttachVirtualJoystick`] +/// - [`SDL_INIT_INTERFACE`] +/// - [`SDL_VirtualJoystickSensorDesc`] +/// - [`SDL_VirtualJoystickTouchpadDesc`] +/// +/// ## Notes for `sdl3-sys` +/// - This interface struct can be initialized with [`SDL_VirtualJoystickDesc::new()`] or `Default::default()`. +/// - This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_VirtualJoystickDesc { + /// the version of this interface + pub version: Uint32, + /// [`SDL_JoystickType`] + pub r#type: Uint16, + /// unused + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding: Uint16, + /// the USB vendor ID of this joystick + pub vendor_id: Uint16, + /// the USB product ID of this joystick + pub product_id: Uint16, + /// the number of axes on this joystick + pub naxes: Uint16, + /// the number of buttons on this joystick + pub nbuttons: Uint16, + /// the number of balls on this joystick + pub nballs: Uint16, + /// the number of hats on this joystick + pub nhats: Uint16, + /// the number of touchpads on this joystick, requires `touchpads` to point at valid descriptions + pub ntouchpads: Uint16, + /// the number of sensors on this joystick, requires `sensors` to point at valid descriptions + pub nsensors: Uint16, + /// unused + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding2: [Uint16; 2], + /// A mask of which buttons are valid for this controller + /// e.g. (1 << [`SDL_GAMEPAD_BUTTON_SOUTH`]) + pub button_mask: Uint32, + /// A mask of which axes are valid for this controller + /// e.g. (1 << [`SDL_GAMEPAD_AXIS_LEFTX`]) + pub axis_mask: Uint32, + /// the name of the joystick + pub name: *const ::core::ffi::c_char, + /// A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 + pub touchpads: *const SDL_VirtualJoystickTouchpadDesc, + /// A pointer to an array of sensor descriptions, required if `nsensors` is > 0 + pub sensors: *const SDL_VirtualJoystickSensorDesc, + /// User data pointer passed to callbacks + pub userdata: *mut ::core::ffi::c_void, + /// Called when the joystick state should be updated + pub Update: ::core::option::Option, + /// Called when the player index is set + pub SetPlayerIndex: ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void, player_index: ::core::ffi::c_int), + >, + /// Implements [`SDL_RumbleJoystick()`] + pub Rumble: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + low_frequency_rumble: Uint16, + high_frequency_rumble: Uint16, + ) -> ::core::primitive::bool, + >, + /// Implements [`SDL_RumbleJoystickTriggers()`] + pub RumbleTriggers: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + left_rumble: Uint16, + right_rumble: Uint16, + ) -> ::core::primitive::bool, + >, + /// Implements [`SDL_SetJoystickLED()`] + pub SetLED: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + red: Uint8, + green: Uint8, + blue: Uint8, + ) -> ::core::primitive::bool, + >, + /// Implements [`SDL_SendJoystickEffect()`] + pub SendEffect: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + data: *const ::core::ffi::c_void, + size: ::core::ffi::c_int, + ) -> ::core::primitive::bool, + >, + /// Implements [`SDL_SetGamepadSensorEnabled()`] + pub SetSensorsEnabled: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + enabled: ::core::primitive::bool, + ) -> ::core::primitive::bool, + >, + /// Cleans up the userdata when the joystick is detached + pub Cleanup: ::core::option::Option, +} + +impl SDL_VirtualJoystickDesc { + /// Create a new `SDL_VirtualJoystickDesc` initialized with `SDL_INIT_INTERFACE` + #[inline] + pub const fn new() -> Self { + const { ::core::assert!(::core::mem::size_of::() <= ::core::primitive::u32::MAX as usize) }; + let mut this = unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() }; + this.version = ::core::mem::size_of::() as ::core::primitive::u32; + this + } +} + +impl ::core::default::Default for SDL_VirtualJoystickDesc { + /// Create a new `SDL_VirtualJoystickDesc` initialized with `SDL_INIT_INTERFACE` + #[inline(always)] + fn default() -> Self { + Self::new() + } +} + +const _: () = ::core::assert!( + (((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 4_usize) + && (::core::mem::size_of::() == 84_usize)) + || ((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 8_usize) + && (::core::mem::size_of::() == 136_usize))) +); + +unsafe extern "C" { + /// Attach a new virtual joystick. + /// + /// Apps can create virtual joysticks, that exist without hardware directly + /// backing them, and have program-supplied inputs. Once attached, a virtual + /// joystick looks like any other joystick that SDL can access. These can be + /// used to make other things look like joysticks, or provide pre-recorded + /// input, etc. + /// + /// Once attached, the app can send joystick inputs to the new virtual joystick + /// using [`SDL_SetJoystickVirtualAxis()`], etc. + /// + /// When no longer needed, the virtual joystick can be removed by calling + /// [`SDL_DetachVirtualJoystick()`]. + /// + /// ## Parameters + /// - `desc`: joystick description, initialized using [`SDL_INIT_INTERFACE()`]. + /// + /// ## Return value + /// Returns the joystick instance ID, or 0 on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DetachVirtualJoystick`] + /// - [`SDL_SetJoystickVirtualAxis`] + /// - [`SDL_SetJoystickVirtualButton`] + /// - [`SDL_SetJoystickVirtualBall`] + /// - [`SDL_SetJoystickVirtualHat`] + /// - [`SDL_SetJoystickVirtualTouchpad`] + /// - [`SDL_SetJoystickVirtualSensorData`] + pub fn SDL_AttachVirtualJoystick(desc: *const SDL_VirtualJoystickDesc) -> SDL_JoystickID; +} + +unsafe extern "C" { + /// Detach a virtual joystick. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID, previously returned from + /// [`SDL_AttachVirtualJoystick()`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AttachVirtualJoystick`] + pub fn SDL_DetachVirtualJoystick(instance_id: SDL_JoystickID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Query whether or not a joystick is virtual. + /// + /// ## Parameters + /// - `instance_id`: the joystick instance ID. + /// + /// ## Return value + /// Returns true if the joystick is virtual, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_IsJoystickVirtual(instance_id: SDL_JoystickID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the state of an axis on an opened virtual joystick. + /// + /// Please note that values set here will not be applied until the next call to + /// [`SDL_UpdateJoysticks`], which can either be called directly, or can be called + /// indirectly through various other SDL APIs, including, but not limited to + /// the following: [`SDL_PollEvent`], [`SDL_PumpEvents`], [`SDL_WaitEventTimeout`], + /// [`SDL_WaitEvent`]. + /// + /// Note that when sending trigger axes, you should scale the value to the full + /// range of Sint16. For example, a trigger at rest would have the value of + /// [`SDL_JOYSTICK_AXIS_MIN`]. + /// + /// ## Parameters + /// - `joystick`: the virtual joystick on which to set state. + /// - `axis`: the index of the axis on the virtual joystick to update. + /// - `value`: the new value for the specified axis. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickVirtualButton`] + /// - [`SDL_SetJoystickVirtualBall`] + /// - [`SDL_SetJoystickVirtualHat`] + /// - [`SDL_SetJoystickVirtualTouchpad`] + /// - [`SDL_SetJoystickVirtualSensorData`] + pub fn SDL_SetJoystickVirtualAxis( + joystick: *mut SDL_Joystick, + axis: ::core::ffi::c_int, + value: Sint16, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Generate ball motion on an opened virtual joystick. + /// + /// Please note that values set here will not be applied until the next call to + /// [`SDL_UpdateJoysticks`], which can either be called directly, or can be called + /// indirectly through various other SDL APIs, including, but not limited to + /// the following: [`SDL_PollEvent`], [`SDL_PumpEvents`], [`SDL_WaitEventTimeout`], + /// [`SDL_WaitEvent`]. + /// + /// ## Parameters + /// - `joystick`: the virtual joystick on which to set state. + /// - `ball`: the index of the ball on the virtual joystick to update. + /// - `xrel`: the relative motion on the X axis. + /// - `yrel`: the relative motion on the Y axis. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickVirtualAxis`] + /// - [`SDL_SetJoystickVirtualButton`] + /// - [`SDL_SetJoystickVirtualHat`] + /// - [`SDL_SetJoystickVirtualTouchpad`] + /// - [`SDL_SetJoystickVirtualSensorData`] + pub fn SDL_SetJoystickVirtualBall( + joystick: *mut SDL_Joystick, + ball: ::core::ffi::c_int, + xrel: Sint16, + yrel: Sint16, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the state of a button on an opened virtual joystick. + /// + /// Please note that values set here will not be applied until the next call to + /// [`SDL_UpdateJoysticks`], which can either be called directly, or can be called + /// indirectly through various other SDL APIs, including, but not limited to + /// the following: [`SDL_PollEvent`], [`SDL_PumpEvents`], [`SDL_WaitEventTimeout`], + /// [`SDL_WaitEvent`]. + /// + /// ## Parameters + /// - `joystick`: the virtual joystick on which to set state. + /// - `button`: the index of the button on the virtual joystick to update. + /// - `down`: true if the button is pressed, false otherwise. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickVirtualAxis`] + /// - [`SDL_SetJoystickVirtualBall`] + /// - [`SDL_SetJoystickVirtualHat`] + /// - [`SDL_SetJoystickVirtualTouchpad`] + /// - [`SDL_SetJoystickVirtualSensorData`] + pub fn SDL_SetJoystickVirtualButton( + joystick: *mut SDL_Joystick, + button: ::core::ffi::c_int, + down: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the state of a hat on an opened virtual joystick. + /// + /// Please note that values set here will not be applied until the next call to + /// [`SDL_UpdateJoysticks`], which can either be called directly, or can be called + /// indirectly through various other SDL APIs, including, but not limited to + /// the following: [`SDL_PollEvent`], [`SDL_PumpEvents`], [`SDL_WaitEventTimeout`], + /// [`SDL_WaitEvent`]. + /// + /// ## Parameters + /// - `joystick`: the virtual joystick on which to set state. + /// - `hat`: the index of the hat on the virtual joystick to update. + /// - `value`: the new value for the specified hat. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickVirtualAxis`] + /// - [`SDL_SetJoystickVirtualButton`] + /// - [`SDL_SetJoystickVirtualBall`] + /// - [`SDL_SetJoystickVirtualTouchpad`] + /// - [`SDL_SetJoystickVirtualSensorData`] + pub fn SDL_SetJoystickVirtualHat( + joystick: *mut SDL_Joystick, + hat: ::core::ffi::c_int, + value: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set touchpad finger state on an opened virtual joystick. + /// + /// Please note that values set here will not be applied until the next call to + /// [`SDL_UpdateJoysticks`], which can either be called directly, or can be called + /// indirectly through various other SDL APIs, including, but not limited to + /// the following: [`SDL_PollEvent`], [`SDL_PumpEvents`], [`SDL_WaitEventTimeout`], + /// [`SDL_WaitEvent`]. + /// + /// ## Parameters + /// - `joystick`: the virtual joystick on which to set state. + /// - `touchpad`: the index of the touchpad on the virtual joystick to + /// update. + /// - `finger`: the index of the finger on the touchpad to set. + /// - `down`: true if the finger is pressed, false if the finger is released. + /// - `x`: the x coordinate of the finger on the touchpad, normalized 0 to 1, + /// with the origin in the upper left. + /// - `y`: the y coordinate of the finger on the touchpad, normalized 0 to 1, + /// with the origin in the upper left. + /// - `pressure`: the pressure of the finger. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickVirtualAxis`] + /// - [`SDL_SetJoystickVirtualButton`] + /// - [`SDL_SetJoystickVirtualBall`] + /// - [`SDL_SetJoystickVirtualHat`] + /// - [`SDL_SetJoystickVirtualSensorData`] + pub fn SDL_SetJoystickVirtualTouchpad( + joystick: *mut SDL_Joystick, + touchpad: ::core::ffi::c_int, + finger: ::core::ffi::c_int, + down: ::core::primitive::bool, + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + pressure: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Send a sensor update for an opened virtual joystick. + /// + /// Please note that values set here will not be applied until the next call to + /// [`SDL_UpdateJoysticks`], which can either be called directly, or can be called + /// indirectly through various other SDL APIs, including, but not limited to + /// the following: [`SDL_PollEvent`], [`SDL_PumpEvents`], [`SDL_WaitEventTimeout`], + /// [`SDL_WaitEvent`]. + /// + /// ## Parameters + /// - `joystick`: the virtual joystick on which to set state. + /// - `type`: the type of the sensor on the virtual joystick to update. + /// - `sensor_timestamp`: a 64-bit timestamp in nanoseconds associated with + /// the sensor reading. + /// - `data`: the data associated with the sensor reading. + /// - `num_values`: the number of values pointed to by `data`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickVirtualAxis`] + /// - [`SDL_SetJoystickVirtualButton`] + /// - [`SDL_SetJoystickVirtualBall`] + /// - [`SDL_SetJoystickVirtualHat`] + /// - [`SDL_SetJoystickVirtualTouchpad`] + pub fn SDL_SendJoystickVirtualSensorData( + joystick: *mut SDL_Joystick, + r#type: SDL_SensorType, + sensor_timestamp: Uint64, + data: *const ::core::ffi::c_float, + num_values: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the properties associated with a joystick. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN`]\: true if this joystick has an + /// LED that has adjustable brightness + /// - [`SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN`]\: true if this joystick has an LED + /// that has adjustable color + /// - [`SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN`]\: true if this joystick has a + /// player LED + /// - [`SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN`]\: true if this joystick has + /// left/right rumble + /// - [`SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN`]\: true if this joystick has + /// simple trigger rumble + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickProperties(joystick: *mut SDL_Joystick) -> SDL_PropertiesID; +} + +pub const SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.joystick.cap.mono_led".as_ptr(); + +pub const SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.joystick.cap.rgb_led".as_ptr(); + +pub const SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.joystick.cap.player_led".as_ptr(); + +pub const SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.joystick.cap.rumble".as_ptr(); + +pub const SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.joystick.cap.trigger_rumble".as_ptr(); + +unsafe extern "C" { + /// Get the implementation dependent name of a joystick. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the name of the selected joystick. If no name can be found, this + /// function returns NULL; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickNameForID`] + pub fn SDL_GetJoystickName(joystick: *mut SDL_Joystick) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the implementation dependent path of a joystick. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the path of the selected joystick. If no path can be found, this + /// function returns NULL; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickPathForID`] + pub fn SDL_GetJoystickPath(joystick: *mut SDL_Joystick) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the player index of an opened joystick. + /// + /// For XInput controllers this returns the XInput user index. Many joysticks + /// will not be able to supply this information. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the player index, or -1 if it's not available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickPlayerIndex`] + pub fn SDL_GetJoystickPlayerIndex(joystick: *mut SDL_Joystick) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Set the player index of an opened joystick. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// - `player_index`: player index to assign to this joystick, or -1 to clear + /// the player index and turn off player LEDs. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickPlayerIndex`] + pub fn SDL_SetJoystickPlayerIndex( + joystick: *mut SDL_Joystick, + player_index: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the implementation-dependent GUID for the joystick. + /// + /// This function requires an open joystick. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the GUID of the given joystick. If called on an invalid index, + /// this function returns a zero GUID; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickGUIDForID`] + /// - [`SDL_GUIDToString`] + pub fn SDL_GetJoystickGUID(joystick: *mut SDL_Joystick) -> SDL_GUID; +} + +unsafe extern "C" { + /// Get the USB vendor ID of an opened joystick, if available. + /// + /// If the vendor ID isn't available this function returns 0. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the USB vendor ID of the selected joystick, or 0 if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickVendorForID`] + pub fn SDL_GetJoystickVendor(joystick: *mut SDL_Joystick) -> Uint16; +} + +unsafe extern "C" { + /// Get the USB product ID of an opened joystick, if available. + /// + /// If the product ID isn't available this function returns 0. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the USB product ID of the selected joystick, or 0 if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickProductForID`] + pub fn SDL_GetJoystickProduct(joystick: *mut SDL_Joystick) -> Uint16; +} + +unsafe extern "C" { + /// Get the product version of an opened joystick, if available. + /// + /// If the product version isn't available this function returns 0. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the product version of the selected joystick, or 0 if unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickProductVersionForID`] + pub fn SDL_GetJoystickProductVersion(joystick: *mut SDL_Joystick) -> Uint16; +} + +unsafe extern "C" { + /// Get the firmware version of an opened joystick, if available. + /// + /// If the firmware version isn't available this function returns 0. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the firmware version of the selected joystick, or 0 if + /// unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickFirmwareVersion(joystick: *mut SDL_Joystick) -> Uint16; +} + +unsafe extern "C" { + /// Get the serial number of an opened joystick, if available. + /// + /// Returns the serial number of the joystick, or NULL if it is not available. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the serial number of the selected joystick, or NULL if + /// unavailable. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickSerial(joystick: *mut SDL_Joystick) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the type of an opened joystick. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] obtained from [`SDL_OpenJoystick()`]. + /// + /// ## Return value + /// Returns the [`SDL_JoystickType`] of the selected joystick. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickTypeForID`] + pub fn SDL_GetJoystickType(joystick: *mut SDL_Joystick) -> SDL_JoystickType; +} + +unsafe extern "C" { + /// Get the device information encoded in a [`SDL_GUID`] structure. + /// + /// ## Parameters + /// - `guid`: the [`SDL_GUID`] you wish to get info about. + /// - `vendor`: a pointer filled in with the device VID, or 0 if not + /// available. + /// - `product`: a pointer filled in with the device PID, or 0 if not + /// available. + /// - `version`: a pointer filled in with the device version, or 0 if not + /// available. + /// - `crc16`: a pointer filled in with a CRC used to distinguish different + /// products with the same VID/PID, or 0 if not available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickGUIDForID`] + pub fn SDL_GetJoystickGUIDInfo( + guid: SDL_GUID, + vendor: *mut Uint16, + product: *mut Uint16, + version: *mut Uint16, + crc16: *mut Uint16, + ); +} + +unsafe extern "C" { + /// Get the status of a specified joystick. + /// + /// ## Parameters + /// - `joystick`: the joystick to query. + /// + /// ## Return value + /// Returns true if the joystick has been opened, false if it has not; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_JoystickConnected(joystick: *mut SDL_Joystick) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the instance ID of an opened joystick. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// + /// ## Return value + /// Returns the instance ID of the specified joystick on success or 0 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickID(joystick: *mut SDL_Joystick) -> SDL_JoystickID; +} + +unsafe extern "C" { + /// Get the number of general axis controls on a joystick. + /// + /// Often, the directional pad on a game controller will either look like 4 + /// separate buttons or a POV hat, and not axes, but all of this is up to the + /// device and platform. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// + /// ## Return value + /// Returns the number of axis controls/number of axes on success or -1 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickAxis`] + /// - [`SDL_GetNumJoystickBalls`] + /// - [`SDL_GetNumJoystickButtons`] + /// - [`SDL_GetNumJoystickHats`] + pub fn SDL_GetNumJoystickAxes(joystick: *mut SDL_Joystick) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of trackballs on a joystick. + /// + /// Joystick trackballs have only relative motion events associated with them + /// and their state cannot be polled. + /// + /// Most joysticks do not have trackballs. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// + /// ## Return value + /// Returns the number of trackballs on success or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickBall`] + /// - [`SDL_GetNumJoystickAxes`] + /// - [`SDL_GetNumJoystickButtons`] + /// - [`SDL_GetNumJoystickHats`] + pub fn SDL_GetNumJoystickBalls(joystick: *mut SDL_Joystick) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of POV hats on a joystick. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// + /// ## Return value + /// Returns the number of POV hats on success or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickHat`] + /// - [`SDL_GetNumJoystickAxes`] + /// - [`SDL_GetNumJoystickBalls`] + /// - [`SDL_GetNumJoystickButtons`] + pub fn SDL_GetNumJoystickHats(joystick: *mut SDL_Joystick) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the number of buttons on a joystick. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// + /// ## Return value + /// Returns the number of buttons on success or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetJoystickButton`] + /// - [`SDL_GetNumJoystickAxes`] + /// - [`SDL_GetNumJoystickBalls`] + /// - [`SDL_GetNumJoystickHats`] + pub fn SDL_GetNumJoystickButtons(joystick: *mut SDL_Joystick) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Set the state of joystick event processing. + /// + /// If joystick events are disabled, you must call [`SDL_UpdateJoysticks()`] + /// yourself and check the state of the joystick when you want joystick + /// information. + /// + /// ## Parameters + /// - `enabled`: whether to process joystick events or not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_JoystickEventsEnabled`] + /// - [`SDL_UpdateJoysticks`] + pub fn SDL_SetJoystickEventsEnabled(enabled: ::core::primitive::bool); +} + +unsafe extern "C" { + /// Query the state of joystick event processing. + /// + /// If joystick events are disabled, you must call [`SDL_UpdateJoysticks()`] + /// yourself and check the state of the joystick when you want joystick + /// information. + /// + /// ## Return value + /// Returns true if joystick events are being processed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetJoystickEventsEnabled`] + pub fn SDL_JoystickEventsEnabled() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update the current state of the open joysticks. + /// + /// This is called automatically by the event loop if any joystick events are + /// enabled. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UpdateJoysticks(); +} + +unsafe extern "C" { + /// Get the current state of an axis control on a joystick. + /// + /// SDL makes no promises about what part of the joystick any given axis refers + /// to. Your game should have some sort of configuration UI to let users + /// specify what each axis should be bound to. Alternately, SDL's higher-level + /// Game Controller API makes a great effort to apply order to this lower-level + /// interface, so you know that a specific axis is the "left thumb stick," etc. + /// + /// The value returned by [`SDL_GetJoystickAxis()`] is a signed integer (-32768 to + /// 32767) representing the current position of the axis. It may be necessary + /// to impose certain tolerances on these values to account for jitter. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// - `axis`: the axis to query; the axis indices start at index 0. + /// + /// ## Return value + /// Returns a 16-bit signed integer representing the current position of the + /// axis or 0 on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumJoystickAxes`] + pub fn SDL_GetJoystickAxis(joystick: *mut SDL_Joystick, axis: ::core::ffi::c_int) -> Sint16; +} + +unsafe extern "C" { + /// Get the initial state of an axis control on a joystick. + /// + /// The state is a value ranging from -32768 to 32767. + /// + /// The axis indices start at index 0. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// - `axis`: the axis to query; the axis indices start at index 0. + /// - `state`: upon return, the initial value is supplied here. + /// + /// ## Return value + /// Returns true if this axis has any initial value, or false if not. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickAxisInitialState( + joystick: *mut SDL_Joystick, + axis: ::core::ffi::c_int, + state: *mut Sint16, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the ball axis change since the last poll. + /// + /// Trackballs can only return relative motion since the last call to + /// [`SDL_GetJoystickBall()`], these motion deltas are placed into `dx` and `dy`. + /// + /// Most joysticks do not have trackballs. + /// + /// ## Parameters + /// - `joystick`: the [`SDL_Joystick`] to query. + /// - `ball`: the ball index to query; ball indices start at index 0. + /// - `dx`: stores the difference in the x axis position since the last poll. + /// - `dy`: stores the difference in the y axis position since the last poll. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumJoystickBalls`] + pub fn SDL_GetJoystickBall( + joystick: *mut SDL_Joystick, + ball: ::core::ffi::c_int, + dx: *mut ::core::ffi::c_int, + dy: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current state of a POV hat on a joystick. + /// + /// The returned value will be one of the `SDL_HAT_*` values. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// - `hat`: the hat index to get the state from; indices start at index 0. + /// + /// ## Return value + /// Returns the current hat position. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumJoystickHats`] + pub fn SDL_GetJoystickHat(joystick: *mut SDL_Joystick, hat: ::core::ffi::c_int) -> Uint8; +} + +pub const SDL_HAT_CENTERED: Uint8 = (0x00 as Uint8); + +pub const SDL_HAT_UP: Uint8 = (0x01 as Uint8); + +pub const SDL_HAT_RIGHT: Uint8 = (0x02 as Uint8); + +pub const SDL_HAT_DOWN: Uint8 = (0x04 as Uint8); + +pub const SDL_HAT_LEFT: Uint8 = (0x08 as Uint8); + +pub const SDL_HAT_RIGHTUP: Uint8 = (SDL_HAT_RIGHT | SDL_HAT_UP); + +pub const SDL_HAT_RIGHTDOWN: Uint8 = (SDL_HAT_RIGHT | SDL_HAT_DOWN); + +pub const SDL_HAT_LEFTUP: Uint8 = (SDL_HAT_LEFT | SDL_HAT_UP); + +pub const SDL_HAT_LEFTDOWN: Uint8 = (SDL_HAT_LEFT | SDL_HAT_DOWN); + +unsafe extern "C" { + /// Get the current state of a button on a joystick. + /// + /// ## Parameters + /// - `joystick`: an [`SDL_Joystick`] structure containing joystick information. + /// - `button`: the button index to get the state from; indices start at + /// index 0. + /// + /// ## Return value + /// Returns true if the button is pressed, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumJoystickButtons`] + pub fn SDL_GetJoystickButton( + joystick: *mut SDL_Joystick, + button: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Start a rumble effect. + /// + /// Each call to this function cancels any previous rumble effect, and calling + /// it with 0 intensity stops any rumbling. + /// + /// This function requires you to process SDL events or call + /// [`SDL_UpdateJoysticks()`] to update rumble state. + /// + /// ## Parameters + /// - `joystick`: the joystick to vibrate. + /// - `low_frequency_rumble`: the intensity of the low frequency (left) + /// rumble motor, from 0 to 0xFFFF. + /// - `high_frequency_rumble`: the intensity of the high frequency (right) + /// rumble motor, from 0 to 0xFFFF. + /// - `duration_ms`: the duration of the rumble effect, in milliseconds. + /// + /// ## Return value + /// Returns true, or false if rumble isn't supported on this joystick. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RumbleJoystick( + joystick: *mut SDL_Joystick, + low_frequency_rumble: Uint16, + high_frequency_rumble: Uint16, + duration_ms: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Start a rumble effect in the joystick's triggers. + /// + /// Each call to this function cancels any previous trigger rumble effect, and + /// calling it with 0 intensity stops any rumbling. + /// + /// Note that this is rumbling of the _triggers_ and not the game controller as + /// a whole. This is currently only supported on Xbox One controllers. If you + /// want the (more common) whole-controller rumble, use [`SDL_RumbleJoystick()`] + /// instead. + /// + /// This function requires you to process SDL events or call + /// [`SDL_UpdateJoysticks()`] to update rumble state. + /// + /// ## Parameters + /// - `joystick`: the joystick to vibrate. + /// - `left_rumble`: the intensity of the left trigger rumble motor, from 0 + /// to 0xFFFF. + /// - `right_rumble`: the intensity of the right trigger rumble motor, from 0 + /// to 0xFFFF. + /// - `duration_ms`: the duration of the rumble effect, in milliseconds. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RumbleJoystick`] + pub fn SDL_RumbleJoystickTriggers( + joystick: *mut SDL_Joystick, + left_rumble: Uint16, + right_rumble: Uint16, + duration_ms: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update a joystick's LED color. + /// + /// An example of a joystick LED is the light on the back of a PlayStation 4's + /// DualShock 4 controller. + /// + /// For joysticks with a single color LED, the maximum of the RGB values will + /// be used as the LED brightness. + /// + /// ## Parameters + /// - `joystick`: the joystick to update. + /// - `red`: the intensity of the red LED. + /// - `green`: the intensity of the green LED. + /// - `blue`: the intensity of the blue LED. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetJoystickLED( + joystick: *mut SDL_Joystick, + red: Uint8, + green: Uint8, + blue: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Send a joystick specific effect packet. + /// + /// ## Parameters + /// - `joystick`: the joystick to affect. + /// - `data`: the data to send to the joystick. + /// - `size`: the size of the data to send to the joystick. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SendJoystickEffect( + joystick: *mut SDL_Joystick, + data: *const ::core::ffi::c_void, + size: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Close a joystick previously opened with [`SDL_OpenJoystick()`]. + /// + /// ## Parameters + /// - `joystick`: the joystick device to close. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenJoystick`] + pub fn SDL_CloseJoystick(joystick: *mut SDL_Joystick); +} + +unsafe extern "C" { + /// Get the connection state of a joystick. + /// + /// ## Parameters + /// - `joystick`: the joystick to query. + /// + /// ## Return value + /// Returns the connection state on success or + /// [`SDL_JOYSTICK_CONNECTION_INVALID`] on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickConnectionState( + joystick: *mut SDL_Joystick, + ) -> SDL_JoystickConnectionState; +} + +unsafe extern "C" { + /// Get the battery state of a joystick. + /// + /// You should never take a battery status as absolute truth. Batteries + /// (especially failing batteries) are delicate hardware, and the values + /// reported here are best estimates based on what that hardware reports. It's + /// not uncommon for older batteries to lose stored power much faster than it + /// reports, or completely drain when reporting it has 20 percent left, etc. + /// + /// ## Parameters + /// - `joystick`: the joystick to query. + /// - `percent`: a pointer filled in with the percentage of battery life + /// left, between 0 and 100, or NULL to ignore. This will be + /// filled in with -1 we can't determine a value or there is no + /// battery. + /// + /// ## Return value + /// Returns the current battery state or [`SDL_POWERSTATE_ERROR`] on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetJoystickPowerInfo( + joystick: *mut SDL_Joystick, + percent: *mut ::core::ffi::c_int, + ) -> SDL_PowerState; +} + +/// The joystick structure used to identify an SDL joystick. +/// +/// This is opaque data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Joystick { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/keyboard.rs b/vendor/sdl3-sys/src/generated/keyboard.rs new file mode 100644 index 00000000..9c61455d --- /dev/null +++ b/vendor/sdl3-sys/src/generated/keyboard.rs @@ -0,0 +1,977 @@ +//! SDL keyboard management. +//! +//! Please refer to the Best Keyboard Practices document for details on how +//! best to accept keyboard input in various types of programs: +//! +//! + +use super::stdinc::*; + +use super::error::*; + +use super::keycode::*; + +use super::properties::*; + +use super::rect::*; + +use super::scancode::*; + +use super::video::*; + +/// This is a unique ID for a keyboard for the time it is connected to the +/// system, and is never reused for the lifetime of the application. +/// +/// If the keyboard is disconnected and reconnected, it will get a new ID. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_KeyboardID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_KeyboardID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_KeyboardID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_KeyboardID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_KeyboardID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_KeyboardID { + /// Initialize a `SDL_KeyboardID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_KeyboardID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_KeyboardID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::keyboard::METADATA_SDL_KeyboardID; +} + +unsafe extern "C" { + /// Return whether a keyboard is currently connected. + /// + /// ## Return value + /// Returns true if a keyboard is connected, false otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyboards`] + pub fn SDL_HasKeyboard() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a list of currently connected keyboards. + /// + /// Note that this will include any device or virtual driver that includes + /// keyboard functionality, including some mice, KVM switches, motherboard + /// power buttons, etc. You should wait for input from a device before you + /// consider it actively in use. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of keyboards returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of keyboards instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyboardNameForID`] + /// - [`SDL_HasKeyboard`] + pub fn SDL_GetKeyboards(count: *mut ::core::ffi::c_int) -> *mut SDL_KeyboardID; +} + +unsafe extern "C" { + /// Get the name of a keyboard. + /// + /// This function returns "" if the keyboard doesn't have a name. + /// + /// ## Parameters + /// - `instance_id`: the keyboard instance ID. + /// + /// ## Return value + /// Returns the name of the selected keyboard or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyboards`] + pub fn SDL_GetKeyboardNameForID(instance_id: SDL_KeyboardID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Query the window which currently has keyboard focus. + /// + /// ## Return value + /// Returns the window with keyboard focus. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetKeyboardFocus() -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Get a snapshot of the current state of the keyboard. + /// + /// The pointer returned is a pointer to an internal SDL array. It will be + /// valid for the whole lifetime of the application and should not be freed by + /// the caller. + /// + /// A array element with a value of true means that the key is pressed and a + /// value of false means that it is not. Indexes into this array are obtained + /// by using [`SDL_Scancode`] values. + /// + /// Use [`SDL_PumpEvents()`] to update the state array. + /// + /// This function gives you the current state after all events have been + /// processed, so if a key or button has been pressed and released before you + /// process events, then the pressed state will never show up in the + /// [`SDL_GetKeyboardState()`] calls. + /// + /// Note: This function doesn't take into account whether shift has been + /// pressed or not. + /// + /// ## Parameters + /// - `numkeys`: if non-NULL, receives the length of the returned array. + /// + /// ## Return value + /// Returns a pointer to an array of key states. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_PumpEvents`] + /// - [`SDL_ResetKeyboard`] + pub fn SDL_GetKeyboardState(numkeys: *mut ::core::ffi::c_int) + -> *const ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear the state of the keyboard. + /// + /// This function will generate key up events for all pressed keys. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyboardState`] + pub fn SDL_ResetKeyboard(); +} + +unsafe extern "C" { + /// Get the current key modifier state for the keyboard. + /// + /// ## Return value + /// Returns an OR'd combination of the modifier keys for the keyboard. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyboardState`] + /// - [`SDL_SetModState`] + pub fn SDL_GetModState() -> SDL_Keymod; +} + +unsafe extern "C" { + /// Set the current key modifier state for the keyboard. + /// + /// The inverse of [`SDL_GetModState()`], [`SDL_SetModState()`] allows you to impose + /// modifier key states on your application. Simply pass your desired modifier + /// states into `modstate`. This value may be a bitwise, OR'd combination of + /// [`SDL_Keymod`] values. + /// + /// This does not change the keyboard state, only the key modifier flags that + /// SDL reports. + /// + /// ## Parameters + /// - `modstate`: the desired [`SDL_Keymod`] for the keyboard. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetModState`] + pub fn SDL_SetModState(modstate: SDL_Keymod); +} + +unsafe extern "C" { + /// Get the key code corresponding to the given scancode according to the + /// current keyboard layout. + /// + /// If you want to get the keycode as it would be delivered in key events, + /// including options specified in [`SDL_HINT_KEYCODE_OPTIONS`], then you should + /// pass `key_event` as true. Otherwise this function simply translates the + /// scancode based on the given modifier state. + /// + /// ## Parameters + /// - `scancode`: the desired [`SDL_Scancode`] to query. + /// - `modstate`: the modifier state to use when translating the scancode to + /// a keycode. + /// - `key_event`: true if the keycode will be used in key events. + /// + /// ## Return value + /// Returns the [`SDL_Keycode`] that corresponds to the given [`SDL_Scancode`]. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyName`] + /// - [`SDL_GetScancodeFromKey`] + pub fn SDL_GetKeyFromScancode( + scancode: SDL_Scancode, + modstate: SDL_Keymod, + key_event: ::core::primitive::bool, + ) -> SDL_Keycode; +} + +unsafe extern "C" { + /// Get the scancode corresponding to the given key code according to the + /// current keyboard layout. + /// + /// Note that there may be multiple scancode+modifier states that can generate + /// this keycode, this will just return the first one found. + /// + /// ## Parameters + /// - `key`: the desired [`SDL_Keycode`] to query. + /// - `modstate`: a pointer to the modifier state that would be used when the + /// scancode generates this key, may be NULL. + /// + /// ## Return value + /// Returns the [`SDL_Scancode`] that corresponds to the given [`SDL_Keycode`]. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyFromScancode`] + /// - [`SDL_GetScancodeName`] + pub fn SDL_GetScancodeFromKey(key: SDL_Keycode, modstate: *mut SDL_Keymod) -> SDL_Scancode; +} + +unsafe extern "C" { + /// Set a human-readable name for a scancode. + /// + /// ## Parameters + /// - `scancode`: the desired [`SDL_Scancode`]. + /// - `name`: the name to use for the scancode, encoded as UTF-8. The string + /// is not copied, so the pointer given to this function must stay + /// valid while SDL is being used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetScancodeName`] + pub fn SDL_SetScancodeName( + scancode: SDL_Scancode, + name: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a human-readable name for a scancode. + /// + /// **Warning**: The returned name is by design not stable across platforms, + /// e.g. the name for [`SDL_SCANCODE_LGUI`] is "Left GUI" under Linux but "Left + /// Windows" under Microsoft Windows, and some scancodes like + /// [`SDL_SCANCODE_NONUSBACKSLASH`] don't have any name at all. There are even + /// scancodes that share names, e.g. [`SDL_SCANCODE_RETURN`] and + /// [`SDL_SCANCODE_RETURN2`] (both called "Return"). This function is therefore + /// unsuitable for creating a stable cross-platform two-way mapping between + /// strings and scancodes. + /// + /// ## Parameters + /// - `scancode`: the desired [`SDL_Scancode`] to query. + /// + /// ## Return value + /// Returns a pointer to the name for the scancode. If the scancode doesn't + /// have a name this function returns an empty string (""). + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetScancodeFromKey`] + /// - [`SDL_GetScancodeFromName`] + /// - [`SDL_SetScancodeName`] + pub fn SDL_GetScancodeName(scancode: SDL_Scancode) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get a scancode from a human-readable name. + /// + /// ## Parameters + /// - `name`: the human-readable scancode name. + /// + /// ## Return value + /// Returns the [`SDL_Scancode`], or [`SDL_SCANCODE_UNKNOWN`] if the name wasn't + /// recognized; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyFromName`] + /// - [`SDL_GetScancodeFromKey`] + /// - [`SDL_GetScancodeName`] + pub fn SDL_GetScancodeFromName(name: *const ::core::ffi::c_char) -> SDL_Scancode; +} + +unsafe extern "C" { + /// Get a human-readable name for a key. + /// + /// If the key doesn't have a name, this function returns an empty string (""). + /// + /// Letters will be presented in their uppercase form, if applicable. + /// + /// ## Parameters + /// - `key`: the desired [`SDL_Keycode`] to query. + /// + /// ## Return value + /// Returns a UTF-8 encoded string of the key name. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyFromName`] + /// - [`SDL_GetKeyFromScancode`] + /// - [`SDL_GetScancodeFromKey`] + pub fn SDL_GetKeyName(key: SDL_Keycode) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get a key code from a human-readable name. + /// + /// ## Parameters + /// - `name`: the human-readable key name. + /// + /// ## Return value + /// Returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetKeyFromScancode`] + /// - [`SDL_GetKeyName`] + /// - [`SDL_GetScancodeFromName`] + pub fn SDL_GetKeyFromName(name: *const ::core::ffi::c_char) -> SDL_Keycode; +} + +unsafe extern "C" { + /// Start accepting Unicode text input events in a window. + /// + /// This function will enable text input ([`SDL_EVENT_TEXT_INPUT`] and + /// [`SDL_EVENT_TEXT_EDITING`] events) in the specified window. Please use this + /// function paired with [`SDL_StopTextInput()`]. + /// + /// Text input events are not received by default. + /// + /// On some platforms using this function shows the screen keyboard and/or + /// activates an IME, which can prevent some key press events from being passed + /// through. + /// + /// ## Parameters + /// - `window`: the window to enable text input. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetTextInputArea`] + /// - [`SDL_StartTextInputWithProperties`] + /// - [`SDL_StopTextInput`] + /// - [`SDL_TextInputActive`] + pub fn SDL_StartTextInput(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +/// Text input type. +/// +/// These are the valid values for [`SDL_PROP_TEXTINPUT_TYPE_NUMBER`]. Not every +/// value is valid on every platform, but where a value isn't supported, a +/// reasonable fallback will be used. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_StartTextInputWithProperties`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`TEXT`](SDL_TextInputType::TEXT) | [`SDL_TEXTINPUT_TYPE_TEXT`] | The input is text | +/// | [`TEXT_NAME`](SDL_TextInputType::TEXT_NAME) | [`SDL_TEXTINPUT_TYPE_TEXT_NAME`] | The input is a person's name | +/// | [`TEXT_EMAIL`](SDL_TextInputType::TEXT_EMAIL) | [`SDL_TEXTINPUT_TYPE_TEXT_EMAIL`] | The input is an e-mail address | +/// | [`TEXT_USERNAME`](SDL_TextInputType::TEXT_USERNAME) | [`SDL_TEXTINPUT_TYPE_TEXT_USERNAME`] | The input is a username | +/// | [`TEXT_PASSWORD_HIDDEN`](SDL_TextInputType::TEXT_PASSWORD_HIDDEN) | [`SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN`] | The input is a secure password that is hidden | +/// | [`TEXT_PASSWORD_VISIBLE`](SDL_TextInputType::TEXT_PASSWORD_VISIBLE) | [`SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE`] | The input is a secure password that is visible | +/// | [`NUMBER`](SDL_TextInputType::NUMBER) | [`SDL_TEXTINPUT_TYPE_NUMBER`] | The input is a number | +/// | [`NUMBER_PASSWORD_HIDDEN`](SDL_TextInputType::NUMBER_PASSWORD_HIDDEN) | [`SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN`] | The input is a secure PIN that is hidden | +/// | [`NUMBER_PASSWORD_VISIBLE`](SDL_TextInputType::NUMBER_PASSWORD_VISIBLE) | [`SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE`] | The input is a secure PIN that is visible | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_TextInputType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_TextInputType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_TextInputType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_TextInputType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TextInputType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::TEXT => "SDL_TEXTINPUT_TYPE_TEXT", + Self::TEXT_NAME => "SDL_TEXTINPUT_TYPE_TEXT_NAME", + Self::TEXT_EMAIL => "SDL_TEXTINPUT_TYPE_TEXT_EMAIL", + Self::TEXT_USERNAME => "SDL_TEXTINPUT_TYPE_TEXT_USERNAME", + Self::TEXT_PASSWORD_HIDDEN => "SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN", + Self::TEXT_PASSWORD_VISIBLE => "SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE", + Self::NUMBER => "SDL_TEXTINPUT_TYPE_NUMBER", + Self::NUMBER_PASSWORD_HIDDEN => "SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN", + Self::NUMBER_PASSWORD_VISIBLE => "SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE", + + _ => return write!(f, "SDL_TextInputType({})", self.0), + }) + } +} + +impl SDL_TextInputType { + /// The input is text + pub const TEXT: Self = Self((0 as ::core::ffi::c_int)); + /// The input is a person's name + pub const TEXT_NAME: Self = Self((1 as ::core::ffi::c_int)); + /// The input is an e-mail address + pub const TEXT_EMAIL: Self = Self((2 as ::core::ffi::c_int)); + /// The input is a username + pub const TEXT_USERNAME: Self = Self((3 as ::core::ffi::c_int)); + /// The input is a secure password that is hidden + pub const TEXT_PASSWORD_HIDDEN: Self = Self((4 as ::core::ffi::c_int)); + /// The input is a secure password that is visible + pub const TEXT_PASSWORD_VISIBLE: Self = Self((5 as ::core::ffi::c_int)); + /// The input is a number + pub const NUMBER: Self = Self((6 as ::core::ffi::c_int)); + /// The input is a secure PIN that is hidden + pub const NUMBER_PASSWORD_HIDDEN: Self = Self((7 as ::core::ffi::c_int)); + /// The input is a secure PIN that is visible + pub const NUMBER_PASSWORD_VISIBLE: Self = Self((8 as ::core::ffi::c_int)); +} + +/// The input is text +pub const SDL_TEXTINPUT_TYPE_TEXT: SDL_TextInputType = SDL_TextInputType::TEXT; +/// The input is a person's name +pub const SDL_TEXTINPUT_TYPE_TEXT_NAME: SDL_TextInputType = SDL_TextInputType::TEXT_NAME; +/// The input is an e-mail address +pub const SDL_TEXTINPUT_TYPE_TEXT_EMAIL: SDL_TextInputType = SDL_TextInputType::TEXT_EMAIL; +/// The input is a username +pub const SDL_TEXTINPUT_TYPE_TEXT_USERNAME: SDL_TextInputType = SDL_TextInputType::TEXT_USERNAME; +/// The input is a secure password that is hidden +pub const SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: SDL_TextInputType = + SDL_TextInputType::TEXT_PASSWORD_HIDDEN; +/// The input is a secure password that is visible +pub const SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: SDL_TextInputType = + SDL_TextInputType::TEXT_PASSWORD_VISIBLE; +/// The input is a number +pub const SDL_TEXTINPUT_TYPE_NUMBER: SDL_TextInputType = SDL_TextInputType::NUMBER; +/// The input is a secure PIN that is hidden +pub const SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: SDL_TextInputType = + SDL_TextInputType::NUMBER_PASSWORD_HIDDEN; +/// The input is a secure PIN that is visible +pub const SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: SDL_TextInputType = + SDL_TextInputType::NUMBER_PASSWORD_VISIBLE; + +impl SDL_TextInputType { + /// Initialize a `SDL_TextInputType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_TextInputType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TextInputType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::keyboard::METADATA_SDL_TextInputType; +} + +/// Auto capitalization type. +/// +/// These are the valid values for [`SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER`]. +/// Not every value is valid on every platform, but where a value isn't +/// supported, a reasonable fallback will be used. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_StartTextInputWithProperties`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_Capitalization::NONE) | [`SDL_CAPITALIZE_NONE`] | No auto-capitalization will be done | +/// | [`SENTENCES`](SDL_Capitalization::SENTENCES) | [`SDL_CAPITALIZE_SENTENCES`] | The first letter of sentences will be capitalized | +/// | [`WORDS`](SDL_Capitalization::WORDS) | [`SDL_CAPITALIZE_WORDS`] | The first letter of words will be capitalized | +/// | [`LETTERS`](SDL_Capitalization::LETTERS) | [`SDL_CAPITALIZE_LETTERS`] | All letters will be capitalized | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_Capitalization(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_Capitalization { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_Capitalization) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_Capitalization) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Capitalization { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_CAPITALIZE_NONE", + Self::SENTENCES => "SDL_CAPITALIZE_SENTENCES", + Self::WORDS => "SDL_CAPITALIZE_WORDS", + Self::LETTERS => "SDL_CAPITALIZE_LETTERS", + + _ => return write!(f, "SDL_Capitalization({})", self.0), + }) + } +} + +impl SDL_Capitalization { + /// No auto-capitalization will be done + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + /// The first letter of sentences will be capitalized + pub const SENTENCES: Self = Self((1 as ::core::ffi::c_int)); + /// The first letter of words will be capitalized + pub const WORDS: Self = Self((2 as ::core::ffi::c_int)); + /// All letters will be capitalized + pub const LETTERS: Self = Self((3 as ::core::ffi::c_int)); +} + +/// No auto-capitalization will be done +pub const SDL_CAPITALIZE_NONE: SDL_Capitalization = SDL_Capitalization::NONE; +/// The first letter of sentences will be capitalized +pub const SDL_CAPITALIZE_SENTENCES: SDL_Capitalization = SDL_Capitalization::SENTENCES; +/// The first letter of words will be capitalized +pub const SDL_CAPITALIZE_WORDS: SDL_Capitalization = SDL_Capitalization::WORDS; +/// All letters will be capitalized +pub const SDL_CAPITALIZE_LETTERS: SDL_Capitalization = SDL_Capitalization::LETTERS; + +impl SDL_Capitalization { + /// Initialize a `SDL_Capitalization` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_Capitalization { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Capitalization { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::keyboard::METADATA_SDL_Capitalization; +} + +unsafe extern "C" { + /// Start accepting Unicode text input events in a window, with properties + /// describing the input. + /// + /// This function will enable text input ([`SDL_EVENT_TEXT_INPUT`] and + /// [`SDL_EVENT_TEXT_EDITING`] events) in the specified window. Please use this + /// function paired with [`SDL_StopTextInput()`]. + /// + /// Text input events are not received by default. + /// + /// On some platforms using this function shows the screen keyboard and/or + /// activates an IME, which can prevent some key press events from being passed + /// through. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_TEXTINPUT_TYPE_NUMBER`] - an [`SDL_TextInputType`] value that + /// describes text being input, defaults to [`SDL_TEXTINPUT_TYPE_TEXT`]. + /// - [`SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER`] - an [`SDL_Capitalization`] value + /// that describes how text should be capitalized, defaults to + /// [`SDL_CAPITALIZE_SENTENCES`] for normal text entry, [`SDL_CAPITALIZE_WORDS`] for + /// [`SDL_TEXTINPUT_TYPE_TEXT_NAME`], and [`SDL_CAPITALIZE_NONE`] for e-mail + /// addresses, usernames, and passwords. + /// - [`SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN`] - true to enable auto completion + /// and auto correction, defaults to true. + /// - [`SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN`] - true if multiple lines of text + /// are allowed. This defaults to true if [`SDL_HINT_RETURN_KEY_HIDES_IME`] is + /// "0" or is not set, and defaults to false if [`SDL_HINT_RETURN_KEY_HIDES_IME`] + /// is "1". + /// + /// On Android you can directly specify the input type: + /// + /// - [`SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER`] - the text input type to + /// use, overriding other properties. This is documented at + /// + /// + /// ## Parameters + /// - `window`: the window to enable text input. + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetTextInputArea`] + /// - [`SDL_StartTextInput`] + /// - [`SDL_StopTextInput`] + /// - [`SDL_TextInputActive`] + pub fn SDL_StartTextInputWithProperties( + window: *mut SDL_Window, + props: SDL_PropertiesID, + ) -> ::core::primitive::bool; +} + +pub const SDL_PROP_TEXTINPUT_TYPE_NUMBER: *const ::core::ffi::c_char = + c"SDL.textinput.type".as_ptr(); + +pub const SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER: *const ::core::ffi::c_char = + c"SDL.textinput.capitalization".as_ptr(); + +pub const SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.textinput.autocorrect".as_ptr(); + +pub const SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.textinput.multiline".as_ptr(); + +pub const SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER: *const ::core::ffi::c_char = + c"SDL.textinput.android.inputtype".as_ptr(); + +unsafe extern "C" { + /// Check whether or not Unicode text input events are enabled for a window. + /// + /// ## Parameters + /// - `window`: the window to check. + /// + /// ## Return value + /// Returns true if text input events are enabled else false. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StartTextInput`] + pub fn SDL_TextInputActive(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Stop receiving any text input events in a window. + /// + /// If [`SDL_StartTextInput()`] showed the screen keyboard, this function will hide + /// it. + /// + /// ## Parameters + /// - `window`: the window to disable text input. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StartTextInput`] + pub fn SDL_StopTextInput(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Dismiss the composition window/IME without disabling the subsystem. + /// + /// ## Parameters + /// - `window`: the window to affect. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StartTextInput`] + /// - [`SDL_StopTextInput`] + pub fn SDL_ClearComposition(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the area used to type Unicode text input. + /// + /// Native input methods may place a window with word suggestions near the + /// cursor, without covering the text being entered. + /// + /// ## Parameters + /// - `window`: the window for which to set the text input area. + /// - `rect`: the [`SDL_Rect`] representing the text input area, in window + /// coordinates, or NULL to clear it. + /// - `cursor`: the offset of the current cursor location relative to + /// `rect->x`, in window coordinates. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextInputArea`] + /// - [`SDL_StartTextInput`] + pub fn SDL_SetTextInputArea( + window: *mut SDL_Window, + rect: *const SDL_Rect, + cursor: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the area used to type Unicode text input. + /// + /// This returns the values previously set by [`SDL_SetTextInputArea()`]. + /// + /// ## Parameters + /// - `window`: the window for which to query the text input area. + /// - `rect`: a pointer to an [`SDL_Rect`] filled in with the text input area, + /// may be NULL. + /// - `cursor`: a pointer to the offset of the current cursor location + /// relative to `rect->x`, may be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetTextInputArea`] + pub fn SDL_GetTextInputArea( + window: *mut SDL_Window, + rect: *mut SDL_Rect, + cursor: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Check whether the platform has screen keyboard support. + /// + /// ## Return value + /// Returns true if the platform has some screen keyboard support or false if + /// not. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StartTextInput`] + /// - [`SDL_ScreenKeyboardShown`] + pub fn SDL_HasScreenKeyboardSupport() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Check whether the screen keyboard is shown for given window. + /// + /// ## Parameters + /// - `window`: the window for which screen keyboard should be queried. + /// + /// ## Return value + /// Returns true if screen keyboard is shown or false if not. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasScreenKeyboardSupport`] + pub fn SDL_ScreenKeyboardShown(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/keycode.rs b/vendor/sdl3-sys/src/generated/keycode.rs new file mode 100644 index 00000000..5df62256 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/keycode.rs @@ -0,0 +1,2025 @@ +//! Defines constants which identify keyboard keys and modifiers. +//! +//! Please refer to the Best Keyboard Practices document for details on what +//! this information means and how best to use it. +//! +//! + +use super::stdinc::*; + +use super::scancode::*; + +/// The SDL virtual key representation. +/// +/// Values of this type are used to represent keyboard keys using the current +/// layout of the keyboard. These values include Unicode values representing +/// the unmodified character that would be generated by pressing the key, or an +/// `SDLK_*` constant for those keys that do not generate characters. +/// +/// A special exception is the number keys at the top of the keyboard which map +/// by default to SDLK_0...SDLK_9 on AZERTY layouts. +/// +/// Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or +/// Unicode code point. +/// +/// Many common keycodes are listed below, but this list is not exhaustive. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HINT_KEYCODE_OPTIONS`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`EXTENDED_MASK`](SDL_Keycode::EXTENDED_MASK) | [`SDLK_EXTENDED_MASK`] | | +/// | [`SCANCODE_MASK`](SDL_Keycode::SCANCODE_MASK) | [`SDLK_SCANCODE_MASK`] | | +/// | [`UNKNOWN`](SDL_Keycode::UNKNOWN) | [`SDLK_UNKNOWN`] | 0 | +/// | [`RETURN`](SDL_Keycode::RETURN) | [`SDLK_RETURN`] | '\r' | +/// | [`ESCAPE`](SDL_Keycode::ESCAPE) | [`SDLK_ESCAPE`] | '\x1B' | +/// | [`BACKSPACE`](SDL_Keycode::BACKSPACE) | [`SDLK_BACKSPACE`] | '\b' | +/// | [`TAB`](SDL_Keycode::TAB) | [`SDLK_TAB`] | '\t' | +/// | [`SPACE`](SDL_Keycode::SPACE) | [`SDLK_SPACE`] | ' ' | +/// | [`EXCLAIM`](SDL_Keycode::EXCLAIM) | [`SDLK_EXCLAIM`] | '!' | +/// | [`DBLAPOSTROPHE`](SDL_Keycode::DBLAPOSTROPHE) | [`SDLK_DBLAPOSTROPHE`] | '"' | +/// | [`HASH`](SDL_Keycode::HASH) | [`SDLK_HASH`] | '#' | +/// | [`DOLLAR`](SDL_Keycode::DOLLAR) | [`SDLK_DOLLAR`] | '$' | +/// | [`PERCENT`](SDL_Keycode::PERCENT) | [`SDLK_PERCENT`] | '%' | +/// | [`AMPERSAND`](SDL_Keycode::AMPERSAND) | [`SDLK_AMPERSAND`] | '&' | +/// | [`APOSTROPHE`](SDL_Keycode::APOSTROPHE) | [`SDLK_APOSTROPHE`] | '\'' | +/// | [`LEFTPAREN`](SDL_Keycode::LEFTPAREN) | [`SDLK_LEFTPAREN`] | '(' | +/// | [`RIGHTPAREN`](SDL_Keycode::RIGHTPAREN) | [`SDLK_RIGHTPAREN`] | ')' | +/// | [`ASTERISK`](SDL_Keycode::ASTERISK) | [`SDLK_ASTERISK`] | '*' | +/// | [`PLUS`](SDL_Keycode::PLUS) | [`SDLK_PLUS`] | '+' | +/// | [`COMMA`](SDL_Keycode::COMMA) | [`SDLK_COMMA`] | ',' | +/// | [`MINUS`](SDL_Keycode::MINUS) | [`SDLK_MINUS`] | '-' | +/// | [`PERIOD`](SDL_Keycode::PERIOD) | [`SDLK_PERIOD`] | '.' | +/// | [`SLASH`](SDL_Keycode::SLASH) | [`SDLK_SLASH`] | '/' | +/// | [`_0`](SDL_Keycode::_0) | [`SDLK_0`] | '0' | +/// | [`_1`](SDL_Keycode::_1) | [`SDLK_1`] | '1' | +/// | [`_2`](SDL_Keycode::_2) | [`SDLK_2`] | '2' | +/// | [`_3`](SDL_Keycode::_3) | [`SDLK_3`] | '3' | +/// | [`_4`](SDL_Keycode::_4) | [`SDLK_4`] | '4' | +/// | [`_5`](SDL_Keycode::_5) | [`SDLK_5`] | '5' | +/// | [`_6`](SDL_Keycode::_6) | [`SDLK_6`] | '6' | +/// | [`_7`](SDL_Keycode::_7) | [`SDLK_7`] | '7' | +/// | [`_8`](SDL_Keycode::_8) | [`SDLK_8`] | '8' | +/// | [`_9`](SDL_Keycode::_9) | [`SDLK_9`] | '9' | +/// | [`COLON`](SDL_Keycode::COLON) | [`SDLK_COLON`] | ':' | +/// | [`SEMICOLON`](SDL_Keycode::SEMICOLON) | [`SDLK_SEMICOLON`] | ';' | +/// | [`LESS`](SDL_Keycode::LESS) | [`SDLK_LESS`] | '<' | +/// | [`EQUALS`](SDL_Keycode::EQUALS) | [`SDLK_EQUALS`] | '=' | +/// | [`GREATER`](SDL_Keycode::GREATER) | [`SDLK_GREATER`] | '>' | +/// | [`QUESTION`](SDL_Keycode::QUESTION) | [`SDLK_QUESTION`] | '?' | +/// | [`AT`](SDL_Keycode::AT) | [`SDLK_AT`] | '@' | +/// | [`LEFTBRACKET`](SDL_Keycode::LEFTBRACKET) | [`SDLK_LEFTBRACKET`] | '[' | +/// | [`BACKSLASH`](SDL_Keycode::BACKSLASH) | [`SDLK_BACKSLASH`] | '\\' | +/// | [`RIGHTBRACKET`](SDL_Keycode::RIGHTBRACKET) | [`SDLK_RIGHTBRACKET`] | ']' | +/// | [`CARET`](SDL_Keycode::CARET) | [`SDLK_CARET`] | '^' | +/// | [`UNDERSCORE`](SDL_Keycode::UNDERSCORE) | [`SDLK_UNDERSCORE`] | '_' | +/// | [`GRAVE`](SDL_Keycode::GRAVE) | [`SDLK_GRAVE`] | '`' | +/// | [`A`](SDL_Keycode::A) | [`SDLK_A`] | 'a' | +/// | [`B`](SDL_Keycode::B) | [`SDLK_B`] | 'b' | +/// | [`C`](SDL_Keycode::C) | [`SDLK_C`] | 'c' | +/// | [`D`](SDL_Keycode::D) | [`SDLK_D`] | 'd' | +/// | [`E`](SDL_Keycode::E) | [`SDLK_E`] | 'e' | +/// | [`F`](SDL_Keycode::F) | [`SDLK_F`] | 'f' | +/// | [`G`](SDL_Keycode::G) | [`SDLK_G`] | 'g' | +/// | [`H`](SDL_Keycode::H) | [`SDLK_H`] | 'h' | +/// | [`I`](SDL_Keycode::I) | [`SDLK_I`] | 'i' | +/// | [`J`](SDL_Keycode::J) | [`SDLK_J`] | 'j' | +/// | [`K`](SDL_Keycode::K) | [`SDLK_K`] | 'k' | +/// | [`L`](SDL_Keycode::L) | [`SDLK_L`] | 'l' | +/// | [`M`](SDL_Keycode::M) | [`SDLK_M`] | 'm' | +/// | [`N`](SDL_Keycode::N) | [`SDLK_N`] | 'n' | +/// | [`O`](SDL_Keycode::O) | [`SDLK_O`] | 'o' | +/// | [`P`](SDL_Keycode::P) | [`SDLK_P`] | 'p' | +/// | [`Q`](SDL_Keycode::Q) | [`SDLK_Q`] | 'q' | +/// | [`R`](SDL_Keycode::R) | [`SDLK_R`] | 'r' | +/// | [`S`](SDL_Keycode::S) | [`SDLK_S`] | 's' | +/// | [`T`](SDL_Keycode::T) | [`SDLK_T`] | 't' | +/// | [`U`](SDL_Keycode::U) | [`SDLK_U`] | 'u' | +/// | [`V`](SDL_Keycode::V) | [`SDLK_V`] | 'v' | +/// | [`W`](SDL_Keycode::W) | [`SDLK_W`] | 'w' | +/// | [`X`](SDL_Keycode::X) | [`SDLK_X`] | 'x' | +/// | [`Y`](SDL_Keycode::Y) | [`SDLK_Y`] | 'y' | +/// | [`Z`](SDL_Keycode::Z) | [`SDLK_Z`] | 'z' | +/// | [`LEFTBRACE`](SDL_Keycode::LEFTBRACE) | [`SDLK_LEFTBRACE`] | '{' | +/// | [`PIPE`](SDL_Keycode::PIPE) | [`SDLK_PIPE`] | '|' | +/// | [`RIGHTBRACE`](SDL_Keycode::RIGHTBRACE) | [`SDLK_RIGHTBRACE`] | '}' | +/// | [`TILDE`](SDL_Keycode::TILDE) | [`SDLK_TILDE`] | '~' | +/// | [`DELETE`](SDL_Keycode::DELETE) | [`SDLK_DELETE`] | '\x7F' | +/// | [`PLUSMINUS`](SDL_Keycode::PLUSMINUS) | [`SDLK_PLUSMINUS`] | '\xB1' | +/// | [`CAPSLOCK`](SDL_Keycode::CAPSLOCK) | [`SDLK_CAPSLOCK`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CAPSLOCK`]) | +/// | [`F1`](SDL_Keycode::F1) | [`SDLK_F1`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F1`]) | +/// | [`F2`](SDL_Keycode::F2) | [`SDLK_F2`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F2`]) | +/// | [`F3`](SDL_Keycode::F3) | [`SDLK_F3`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F3`]) | +/// | [`F4`](SDL_Keycode::F4) | [`SDLK_F4`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F4`]) | +/// | [`F5`](SDL_Keycode::F5) | [`SDLK_F5`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F5`]) | +/// | [`F6`](SDL_Keycode::F6) | [`SDLK_F6`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F6`]) | +/// | [`F7`](SDL_Keycode::F7) | [`SDLK_F7`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F7`]) | +/// | [`F8`](SDL_Keycode::F8) | [`SDLK_F8`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F8`]) | +/// | [`F9`](SDL_Keycode::F9) | [`SDLK_F9`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F9`]) | +/// | [`F10`](SDL_Keycode::F10) | [`SDLK_F10`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F10`]) | +/// | [`F11`](SDL_Keycode::F11) | [`SDLK_F11`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F11`]) | +/// | [`F12`](SDL_Keycode::F12) | [`SDLK_F12`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F12`]) | +/// | [`PRINTSCREEN`](SDL_Keycode::PRINTSCREEN) | [`SDLK_PRINTSCREEN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRINTSCREEN`]) | +/// | [`SCROLLLOCK`](SDL_Keycode::SCROLLLOCK) | [`SDLK_SCROLLLOCK`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SCROLLLOCK`]) | +/// | [`PAUSE`](SDL_Keycode::PAUSE) | [`SDLK_PAUSE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAUSE`]) | +/// | [`INSERT`](SDL_Keycode::INSERT) | [`SDLK_INSERT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_INSERT`]) | +/// | [`HOME`](SDL_Keycode::HOME) | [`SDLK_HOME`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HOME`]) | +/// | [`PAGEUP`](SDL_Keycode::PAGEUP) | [`SDLK_PAGEUP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEUP`]) | +/// | [`END`](SDL_Keycode::END) | [`SDLK_END`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_END`]) | +/// | [`PAGEDOWN`](SDL_Keycode::PAGEDOWN) | [`SDLK_PAGEDOWN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEDOWN`]) | +/// | [`RIGHT`](SDL_Keycode::RIGHT) | [`SDLK_RIGHT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RIGHT`]) | +/// | [`LEFT`](SDL_Keycode::LEFT) | [`SDLK_LEFT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LEFT`]) | +/// | [`DOWN`](SDL_Keycode::DOWN) | [`SDLK_DOWN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DOWN`]) | +/// | [`UP`](SDL_Keycode::UP) | [`SDLK_UP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UP`]) | +/// | [`NUMLOCKCLEAR`](SDL_Keycode::NUMLOCKCLEAR) | [`SDLK_NUMLOCKCLEAR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_NUMLOCKCLEAR`]) | +/// | [`KP_DIVIDE`](SDL_Keycode::KP_DIVIDE) | [`SDLK_KP_DIVIDE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DIVIDE`]) | +/// | [`KP_MULTIPLY`](SDL_Keycode::KP_MULTIPLY) | [`SDLK_KP_MULTIPLY`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MULTIPLY`]) | +/// | [`KP_MINUS`](SDL_Keycode::KP_MINUS) | [`SDLK_KP_MINUS`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MINUS`]) | +/// | [`KP_PLUS`](SDL_Keycode::KP_PLUS) | [`SDLK_KP_PLUS`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUS`]) | +/// | [`KP_ENTER`](SDL_Keycode::KP_ENTER) | [`SDLK_KP_ENTER`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_ENTER`]) | +/// | [`KP_1`](SDL_Keycode::KP_1) | [`SDLK_KP_1`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_1`]) | +/// | [`KP_2`](SDL_Keycode::KP_2) | [`SDLK_KP_2`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_2`]) | +/// | [`KP_3`](SDL_Keycode::KP_3) | [`SDLK_KP_3`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_3`]) | +/// | [`KP_4`](SDL_Keycode::KP_4) | [`SDLK_KP_4`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_4`]) | +/// | [`KP_5`](SDL_Keycode::KP_5) | [`SDLK_KP_5`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_5`]) | +/// | [`KP_6`](SDL_Keycode::KP_6) | [`SDLK_KP_6`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_6`]) | +/// | [`KP_7`](SDL_Keycode::KP_7) | [`SDLK_KP_7`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_7`]) | +/// | [`KP_8`](SDL_Keycode::KP_8) | [`SDLK_KP_8`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_8`]) | +/// | [`KP_9`](SDL_Keycode::KP_9) | [`SDLK_KP_9`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_9`]) | +/// | [`KP_0`](SDL_Keycode::KP_0) | [`SDLK_KP_0`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_0`]) | +/// | [`KP_PERIOD`](SDL_Keycode::KP_PERIOD) | [`SDLK_KP_PERIOD`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERIOD`]) | +/// | [`APPLICATION`](SDL_Keycode::APPLICATION) | [`SDLK_APPLICATION`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_APPLICATION`]) | +/// | [`POWER`](SDL_Keycode::POWER) | [`SDLK_POWER`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_POWER`]) | +/// | [`KP_EQUALS`](SDL_Keycode::KP_EQUALS) | [`SDLK_KP_EQUALS`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALS`]) | +/// | [`F13`](SDL_Keycode::F13) | [`SDLK_F13`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F13`]) | +/// | [`F14`](SDL_Keycode::F14) | [`SDLK_F14`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F14`]) | +/// | [`F15`](SDL_Keycode::F15) | [`SDLK_F15`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F15`]) | +/// | [`F16`](SDL_Keycode::F16) | [`SDLK_F16`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F16`]) | +/// | [`F17`](SDL_Keycode::F17) | [`SDLK_F17`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F17`]) | +/// | [`F18`](SDL_Keycode::F18) | [`SDLK_F18`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F18`]) | +/// | [`F19`](SDL_Keycode::F19) | [`SDLK_F19`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F19`]) | +/// | [`F20`](SDL_Keycode::F20) | [`SDLK_F20`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F20`]) | +/// | [`F21`](SDL_Keycode::F21) | [`SDLK_F21`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F21`]) | +/// | [`F22`](SDL_Keycode::F22) | [`SDLK_F22`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F22`]) | +/// | [`F23`](SDL_Keycode::F23) | [`SDLK_F23`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F23`]) | +/// | [`F24`](SDL_Keycode::F24) | [`SDLK_F24`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F24`]) | +/// | [`EXECUTE`](SDL_Keycode::EXECUTE) | [`SDLK_EXECUTE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXECUTE`]) | +/// | [`HELP`](SDL_Keycode::HELP) | [`SDLK_HELP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HELP`]) | +/// | [`MENU`](SDL_Keycode::MENU) | [`SDLK_MENU`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MENU`]) | +/// | [`SELECT`](SDL_Keycode::SELECT) | [`SDLK_SELECT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SELECT`]) | +/// | [`STOP`](SDL_Keycode::STOP) | [`SDLK_STOP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_STOP`]) | +/// | [`AGAIN`](SDL_Keycode::AGAIN) | [`SDLK_AGAIN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AGAIN`]) | +/// | [`UNDO`](SDL_Keycode::UNDO) | [`SDLK_UNDO`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UNDO`]) | +/// | [`CUT`](SDL_Keycode::CUT) | [`SDLK_CUT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CUT`]) | +/// | [`COPY`](SDL_Keycode::COPY) | [`SDLK_COPY`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_COPY`]) | +/// | [`PASTE`](SDL_Keycode::PASTE) | [`SDLK_PASTE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PASTE`]) | +/// | [`FIND`](SDL_Keycode::FIND) | [`SDLK_FIND`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_FIND`]) | +/// | [`MUTE`](SDL_Keycode::MUTE) | [`SDLK_MUTE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MUTE`]) | +/// | [`VOLUMEUP`](SDL_Keycode::VOLUMEUP) | [`SDLK_VOLUMEUP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEUP`]) | +/// | [`VOLUMEDOWN`](SDL_Keycode::VOLUMEDOWN) | [`SDLK_VOLUMEDOWN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEDOWN`]) | +/// | [`KP_COMMA`](SDL_Keycode::KP_COMMA) | [`SDLK_KP_COMMA`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COMMA`]) | +/// | [`KP_EQUALSAS400`](SDL_Keycode::KP_EQUALSAS400) | [`SDLK_KP_EQUALSAS400`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALSAS400`]) | +/// | [`ALTERASE`](SDL_Keycode::ALTERASE) | [`SDLK_ALTERASE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ALTERASE`]) | +/// | [`SYSREQ`](SDL_Keycode::SYSREQ) | [`SDLK_SYSREQ`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SYSREQ`]) | +/// | [`CANCEL`](SDL_Keycode::CANCEL) | [`SDLK_CANCEL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CANCEL`]) | +/// | [`CLEAR`](SDL_Keycode::CLEAR) | [`SDLK_CLEAR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEAR`]) | +/// | [`PRIOR`](SDL_Keycode::PRIOR) | [`SDLK_PRIOR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRIOR`]) | +/// | [`RETURN2`](SDL_Keycode::RETURN2) | [`SDLK_RETURN2`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RETURN2`]) | +/// | [`SEPARATOR`](SDL_Keycode::SEPARATOR) | [`SDLK_SEPARATOR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SEPARATOR`]) | +/// | [`OUT`](SDL_Keycode::OUT) | [`SDLK_OUT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OUT`]) | +/// | [`OPER`](SDL_Keycode::OPER) | [`SDLK_OPER`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OPER`]) | +/// | [`CLEARAGAIN`](SDL_Keycode::CLEARAGAIN) | [`SDLK_CLEARAGAIN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEARAGAIN`]) | +/// | [`CRSEL`](SDL_Keycode::CRSEL) | [`SDLK_CRSEL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CRSEL`]) | +/// | [`EXSEL`](SDL_Keycode::EXSEL) | [`SDLK_EXSEL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXSEL`]) | +/// | [`KP_00`](SDL_Keycode::KP_00) | [`SDLK_KP_00`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_00`]) | +/// | [`KP_000`](SDL_Keycode::KP_000) | [`SDLK_KP_000`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_000`]) | +/// | [`THOUSANDSSEPARATOR`](SDL_Keycode::THOUSANDSSEPARATOR) | [`SDLK_THOUSANDSSEPARATOR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_THOUSANDSSEPARATOR`]) | +/// | [`DECIMALSEPARATOR`](SDL_Keycode::DECIMALSEPARATOR) | [`SDLK_DECIMALSEPARATOR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DECIMALSEPARATOR`]) | +/// | [`CURRENCYUNIT`](SDL_Keycode::CURRENCYUNIT) | [`SDLK_CURRENCYUNIT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYUNIT`]) | +/// | [`CURRENCYSUBUNIT`](SDL_Keycode::CURRENCYSUBUNIT) | [`SDLK_CURRENCYSUBUNIT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYSUBUNIT`]) | +/// | [`KP_LEFTPAREN`](SDL_Keycode::KP_LEFTPAREN) | [`SDLK_KP_LEFTPAREN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTPAREN`]) | +/// | [`KP_RIGHTPAREN`](SDL_Keycode::KP_RIGHTPAREN) | [`SDLK_KP_RIGHTPAREN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTPAREN`]) | +/// | [`KP_LEFTBRACE`](SDL_Keycode::KP_LEFTBRACE) | [`SDLK_KP_LEFTBRACE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTBRACE`]) | +/// | [`KP_RIGHTBRACE`](SDL_Keycode::KP_RIGHTBRACE) | [`SDLK_KP_RIGHTBRACE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTBRACE`]) | +/// | [`KP_TAB`](SDL_Keycode::KP_TAB) | [`SDLK_KP_TAB`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_TAB`]) | +/// | [`KP_BACKSPACE`](SDL_Keycode::KP_BACKSPACE) | [`SDLK_KP_BACKSPACE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BACKSPACE`]) | +/// | [`KP_A`](SDL_Keycode::KP_A) | [`SDLK_KP_A`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_A`]) | +/// | [`KP_B`](SDL_Keycode::KP_B) | [`SDLK_KP_B`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_B`]) | +/// | [`KP_C`](SDL_Keycode::KP_C) | [`SDLK_KP_C`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_C`]) | +/// | [`KP_D`](SDL_Keycode::KP_D) | [`SDLK_KP_D`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_D`]) | +/// | [`KP_E`](SDL_Keycode::KP_E) | [`SDLK_KP_E`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_E`]) | +/// | [`KP_F`](SDL_Keycode::KP_F) | [`SDLK_KP_F`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_F`]) | +/// | [`KP_XOR`](SDL_Keycode::KP_XOR) | [`SDLK_KP_XOR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_XOR`]) | +/// | [`KP_POWER`](SDL_Keycode::KP_POWER) | [`SDLK_KP_POWER`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_POWER`]) | +/// | [`KP_PERCENT`](SDL_Keycode::KP_PERCENT) | [`SDLK_KP_PERCENT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERCENT`]) | +/// | [`KP_LESS`](SDL_Keycode::KP_LESS) | [`SDLK_KP_LESS`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LESS`]) | +/// | [`KP_GREATER`](SDL_Keycode::KP_GREATER) | [`SDLK_KP_GREATER`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_GREATER`]) | +/// | [`KP_AMPERSAND`](SDL_Keycode::KP_AMPERSAND) | [`SDLK_KP_AMPERSAND`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AMPERSAND`]) | +/// | [`KP_DBLAMPERSAND`](SDL_Keycode::KP_DBLAMPERSAND) | [`SDLK_KP_DBLAMPERSAND`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLAMPERSAND`]) | +/// | [`KP_VERTICALBAR`](SDL_Keycode::KP_VERTICALBAR) | [`SDLK_KP_VERTICALBAR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_VERTICALBAR`]) | +/// | [`KP_DBLVERTICALBAR`](SDL_Keycode::KP_DBLVERTICALBAR) | [`SDLK_KP_DBLVERTICALBAR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLVERTICALBAR`]) | +/// | [`KP_COLON`](SDL_Keycode::KP_COLON) | [`SDLK_KP_COLON`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COLON`]) | +/// | [`KP_HASH`](SDL_Keycode::KP_HASH) | [`SDLK_KP_HASH`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HASH`]) | +/// | [`KP_SPACE`](SDL_Keycode::KP_SPACE) | [`SDLK_KP_SPACE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_SPACE`]) | +/// | [`KP_AT`](SDL_Keycode::KP_AT) | [`SDLK_KP_AT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AT`]) | +/// | [`KP_EXCLAM`](SDL_Keycode::KP_EXCLAM) | [`SDLK_KP_EXCLAM`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EXCLAM`]) | +/// | [`KP_MEMSTORE`](SDL_Keycode::KP_MEMSTORE) | [`SDLK_KP_MEMSTORE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSTORE`]) | +/// | [`KP_MEMRECALL`](SDL_Keycode::KP_MEMRECALL) | [`SDLK_KP_MEMRECALL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMRECALL`]) | +/// | [`KP_MEMCLEAR`](SDL_Keycode::KP_MEMCLEAR) | [`SDLK_KP_MEMCLEAR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMCLEAR`]) | +/// | [`KP_MEMADD`](SDL_Keycode::KP_MEMADD) | [`SDLK_KP_MEMADD`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMADD`]) | +/// | [`KP_MEMSUBTRACT`](SDL_Keycode::KP_MEMSUBTRACT) | [`SDLK_KP_MEMSUBTRACT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSUBTRACT`]) | +/// | [`KP_MEMMULTIPLY`](SDL_Keycode::KP_MEMMULTIPLY) | [`SDLK_KP_MEMMULTIPLY`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMMULTIPLY`]) | +/// | [`KP_MEMDIVIDE`](SDL_Keycode::KP_MEMDIVIDE) | [`SDLK_KP_MEMDIVIDE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMDIVIDE`]) | +/// | [`KP_PLUSMINUS`](SDL_Keycode::KP_PLUSMINUS) | [`SDLK_KP_PLUSMINUS`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUSMINUS`]) | +/// | [`KP_CLEAR`](SDL_Keycode::KP_CLEAR) | [`SDLK_KP_CLEAR`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEAR`]) | +/// | [`KP_CLEARENTRY`](SDL_Keycode::KP_CLEARENTRY) | [`SDLK_KP_CLEARENTRY`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEARENTRY`]) | +/// | [`KP_BINARY`](SDL_Keycode::KP_BINARY) | [`SDLK_KP_BINARY`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BINARY`]) | +/// | [`KP_OCTAL`](SDL_Keycode::KP_OCTAL) | [`SDLK_KP_OCTAL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_OCTAL`]) | +/// | [`KP_DECIMAL`](SDL_Keycode::KP_DECIMAL) | [`SDLK_KP_DECIMAL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DECIMAL`]) | +/// | [`KP_HEXADECIMAL`](SDL_Keycode::KP_HEXADECIMAL) | [`SDLK_KP_HEXADECIMAL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HEXADECIMAL`]) | +/// | [`LCTRL`](SDL_Keycode::LCTRL) | [`SDLK_LCTRL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LCTRL`]) | +/// | [`LSHIFT`](SDL_Keycode::LSHIFT) | [`SDLK_LSHIFT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LSHIFT`]) | +/// | [`LALT`](SDL_Keycode::LALT) | [`SDLK_LALT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LALT`]) | +/// | [`LGUI`](SDL_Keycode::LGUI) | [`SDLK_LGUI`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LGUI`]) | +/// | [`RCTRL`](SDL_Keycode::RCTRL) | [`SDLK_RCTRL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RCTRL`]) | +/// | [`RSHIFT`](SDL_Keycode::RSHIFT) | [`SDLK_RSHIFT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RSHIFT`]) | +/// | [`RALT`](SDL_Keycode::RALT) | [`SDLK_RALT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RALT`]) | +/// | [`RGUI`](SDL_Keycode::RGUI) | [`SDLK_RGUI`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RGUI`]) | +/// | [`MODE`](SDL_Keycode::MODE) | [`SDLK_MODE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MODE`]) | +/// | [`SLEEP`](SDL_Keycode::SLEEP) | [`SDLK_SLEEP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SLEEP`]) | +/// | [`WAKE`](SDL_Keycode::WAKE) | [`SDLK_WAKE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_WAKE`]) | +/// | [`CHANNEL_INCREMENT`](SDL_Keycode::CHANNEL_INCREMENT) | [`SDLK_CHANNEL_INCREMENT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_INCREMENT`]) | +/// | [`CHANNEL_DECREMENT`](SDL_Keycode::CHANNEL_DECREMENT) | [`SDLK_CHANNEL_DECREMENT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_DECREMENT`]) | +/// | [`MEDIA_PLAY`](SDL_Keycode::MEDIA_PLAY) | [`SDLK_MEDIA_PLAY`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY`]) | +/// | [`MEDIA_PAUSE`](SDL_Keycode::MEDIA_PAUSE) | [`SDLK_MEDIA_PAUSE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PAUSE`]) | +/// | [`MEDIA_RECORD`](SDL_Keycode::MEDIA_RECORD) | [`SDLK_MEDIA_RECORD`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_RECORD`]) | +/// | [`MEDIA_FAST_FORWARD`](SDL_Keycode::MEDIA_FAST_FORWARD) | [`SDLK_MEDIA_FAST_FORWARD`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_FAST_FORWARD`]) | +/// | [`MEDIA_REWIND`](SDL_Keycode::MEDIA_REWIND) | [`SDLK_MEDIA_REWIND`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_REWIND`]) | +/// | [`MEDIA_NEXT_TRACK`](SDL_Keycode::MEDIA_NEXT_TRACK) | [`SDLK_MEDIA_NEXT_TRACK`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_NEXT_TRACK`]) | +/// | [`MEDIA_PREVIOUS_TRACK`](SDL_Keycode::MEDIA_PREVIOUS_TRACK) | [`SDLK_MEDIA_PREVIOUS_TRACK`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PREVIOUS_TRACK`]) | +/// | [`MEDIA_STOP`](SDL_Keycode::MEDIA_STOP) | [`SDLK_MEDIA_STOP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_STOP`]) | +/// | [`MEDIA_EJECT`](SDL_Keycode::MEDIA_EJECT) | [`SDLK_MEDIA_EJECT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_EJECT`]) | +/// | [`MEDIA_PLAY_PAUSE`](SDL_Keycode::MEDIA_PLAY_PAUSE) | [`SDLK_MEDIA_PLAY_PAUSE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY_PAUSE`]) | +/// | [`MEDIA_SELECT`](SDL_Keycode::MEDIA_SELECT) | [`SDLK_MEDIA_SELECT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_SELECT`]) | +/// | [`AC_NEW`](SDL_Keycode::AC_NEW) | [`SDLK_AC_NEW`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_NEW`]) | +/// | [`AC_OPEN`](SDL_Keycode::AC_OPEN) | [`SDLK_AC_OPEN`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_OPEN`]) | +/// | [`AC_CLOSE`](SDL_Keycode::AC_CLOSE) | [`SDLK_AC_CLOSE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_CLOSE`]) | +/// | [`AC_EXIT`](SDL_Keycode::AC_EXIT) | [`SDLK_AC_EXIT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_EXIT`]) | +/// | [`AC_SAVE`](SDL_Keycode::AC_SAVE) | [`SDLK_AC_SAVE`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SAVE`]) | +/// | [`AC_PRINT`](SDL_Keycode::AC_PRINT) | [`SDLK_AC_PRINT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PRINT`]) | +/// | [`AC_PROPERTIES`](SDL_Keycode::AC_PROPERTIES) | [`SDLK_AC_PROPERTIES`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PROPERTIES`]) | +/// | [`AC_SEARCH`](SDL_Keycode::AC_SEARCH) | [`SDLK_AC_SEARCH`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SEARCH`]) | +/// | [`AC_HOME`](SDL_Keycode::AC_HOME) | [`SDLK_AC_HOME`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_HOME`]) | +/// | [`AC_BACK`](SDL_Keycode::AC_BACK) | [`SDLK_AC_BACK`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BACK`]) | +/// | [`AC_FORWARD`](SDL_Keycode::AC_FORWARD) | [`SDLK_AC_FORWARD`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_FORWARD`]) | +/// | [`AC_STOP`](SDL_Keycode::AC_STOP) | [`SDLK_AC_STOP`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_STOP`]) | +/// | [`AC_REFRESH`](SDL_Keycode::AC_REFRESH) | [`SDLK_AC_REFRESH`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_REFRESH`]) | +/// | [`AC_BOOKMARKS`](SDL_Keycode::AC_BOOKMARKS) | [`SDLK_AC_BOOKMARKS`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BOOKMARKS`]) | +/// | [`SOFTLEFT`](SDL_Keycode::SOFTLEFT) | [`SDLK_SOFTLEFT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTLEFT`]) | +/// | [`SOFTRIGHT`](SDL_Keycode::SOFTRIGHT) | [`SDLK_SOFTRIGHT`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTRIGHT`]) | +/// | [`CALL`](SDL_Keycode::CALL) | [`SDLK_CALL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CALL`]) | +/// | [`ENDCALL`](SDL_Keycode::ENDCALL) | [`SDLK_ENDCALL`] | SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ENDCALL`]) | +/// | [`LEFT_TAB`](SDL_Keycode::LEFT_TAB) | [`SDLK_LEFT_TAB`] | Extended key Left Tab | +/// | [`LEVEL5_SHIFT`](SDL_Keycode::LEVEL5_SHIFT) | [`SDLK_LEVEL5_SHIFT`] | Extended key Level 5 Shift | +/// | [`MULTI_KEY_COMPOSE`](SDL_Keycode::MULTI_KEY_COMPOSE) | [`SDLK_MULTI_KEY_COMPOSE`] | Extended key Multi-key Compose | +/// | [`LMETA`](SDL_Keycode::LMETA) | [`SDLK_LMETA`] | Extended key Left Meta | +/// | [`RMETA`](SDL_Keycode::RMETA) | [`SDLK_RMETA`] | Extended key Right Meta | +/// | [`LHYPER`](SDL_Keycode::LHYPER) | [`SDLK_LHYPER`] | Extended key Left Hyper | +/// | [`RHYPER`](SDL_Keycode::RHYPER) | [`SDLK_RHYPER`] | Extended key Right Hyper | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_Keycode(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_Keycode { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_Keycode) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_Keycode) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_Keycode { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Keycode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::EXTENDED_MASK => "SDLK_EXTENDED_MASK", + Self::SCANCODE_MASK => "SDLK_SCANCODE_MASK", + Self::UNKNOWN => "SDLK_UNKNOWN", + Self::RETURN => "SDLK_RETURN", + Self::ESCAPE => "SDLK_ESCAPE", + Self::BACKSPACE => "SDLK_BACKSPACE", + Self::TAB => "SDLK_TAB", + Self::SPACE => "SDLK_SPACE", + Self::EXCLAIM => "SDLK_EXCLAIM", + Self::DBLAPOSTROPHE => "SDLK_DBLAPOSTROPHE", + Self::HASH => "SDLK_HASH", + Self::DOLLAR => "SDLK_DOLLAR", + Self::PERCENT => "SDLK_PERCENT", + Self::AMPERSAND => "SDLK_AMPERSAND", + Self::APOSTROPHE => "SDLK_APOSTROPHE", + Self::LEFTPAREN => "SDLK_LEFTPAREN", + Self::RIGHTPAREN => "SDLK_RIGHTPAREN", + Self::ASTERISK => "SDLK_ASTERISK", + Self::PLUS => "SDLK_PLUS", + Self::COMMA => "SDLK_COMMA", + Self::MINUS => "SDLK_MINUS", + Self::PERIOD => "SDLK_PERIOD", + Self::SLASH => "SDLK_SLASH", + Self::_0 => "SDLK_0", + Self::_1 => "SDLK_1", + Self::_2 => "SDLK_2", + Self::_3 => "SDLK_3", + Self::_4 => "SDLK_4", + Self::_5 => "SDLK_5", + Self::_6 => "SDLK_6", + Self::_7 => "SDLK_7", + Self::_8 => "SDLK_8", + Self::_9 => "SDLK_9", + Self::COLON => "SDLK_COLON", + Self::SEMICOLON => "SDLK_SEMICOLON", + Self::LESS => "SDLK_LESS", + Self::EQUALS => "SDLK_EQUALS", + Self::GREATER => "SDLK_GREATER", + Self::QUESTION => "SDLK_QUESTION", + Self::AT => "SDLK_AT", + Self::LEFTBRACKET => "SDLK_LEFTBRACKET", + Self::BACKSLASH => "SDLK_BACKSLASH", + Self::RIGHTBRACKET => "SDLK_RIGHTBRACKET", + Self::CARET => "SDLK_CARET", + Self::UNDERSCORE => "SDLK_UNDERSCORE", + Self::GRAVE => "SDLK_GRAVE", + Self::A => "SDLK_A", + Self::B => "SDLK_B", + Self::C => "SDLK_C", + Self::D => "SDLK_D", + Self::E => "SDLK_E", + Self::F => "SDLK_F", + Self::G => "SDLK_G", + Self::H => "SDLK_H", + Self::I => "SDLK_I", + Self::J => "SDLK_J", + Self::K => "SDLK_K", + Self::L => "SDLK_L", + Self::M => "SDLK_M", + Self::N => "SDLK_N", + Self::O => "SDLK_O", + Self::P => "SDLK_P", + Self::Q => "SDLK_Q", + Self::R => "SDLK_R", + Self::S => "SDLK_S", + Self::T => "SDLK_T", + Self::U => "SDLK_U", + Self::V => "SDLK_V", + Self::W => "SDLK_W", + Self::X => "SDLK_X", + Self::Y => "SDLK_Y", + Self::Z => "SDLK_Z", + Self::LEFTBRACE => "SDLK_LEFTBRACE", + Self::PIPE => "SDLK_PIPE", + Self::RIGHTBRACE => "SDLK_RIGHTBRACE", + Self::TILDE => "SDLK_TILDE", + Self::DELETE => "SDLK_DELETE", + Self::PLUSMINUS => "SDLK_PLUSMINUS", + Self::CAPSLOCK => "SDLK_CAPSLOCK", + Self::F1 => "SDLK_F1", + Self::F2 => "SDLK_F2", + Self::F3 => "SDLK_F3", + Self::F4 => "SDLK_F4", + Self::F5 => "SDLK_F5", + Self::F6 => "SDLK_F6", + Self::F7 => "SDLK_F7", + Self::F8 => "SDLK_F8", + Self::F9 => "SDLK_F9", + Self::F10 => "SDLK_F10", + Self::F11 => "SDLK_F11", + Self::F12 => "SDLK_F12", + Self::PRINTSCREEN => "SDLK_PRINTSCREEN", + Self::SCROLLLOCK => "SDLK_SCROLLLOCK", + Self::PAUSE => "SDLK_PAUSE", + Self::INSERT => "SDLK_INSERT", + Self::HOME => "SDLK_HOME", + Self::PAGEUP => "SDLK_PAGEUP", + Self::END => "SDLK_END", + Self::PAGEDOWN => "SDLK_PAGEDOWN", + Self::RIGHT => "SDLK_RIGHT", + Self::LEFT => "SDLK_LEFT", + Self::DOWN => "SDLK_DOWN", + Self::UP => "SDLK_UP", + Self::NUMLOCKCLEAR => "SDLK_NUMLOCKCLEAR", + Self::KP_DIVIDE => "SDLK_KP_DIVIDE", + Self::KP_MULTIPLY => "SDLK_KP_MULTIPLY", + Self::KP_MINUS => "SDLK_KP_MINUS", + Self::KP_PLUS => "SDLK_KP_PLUS", + Self::KP_ENTER => "SDLK_KP_ENTER", + Self::KP_1 => "SDLK_KP_1", + Self::KP_2 => "SDLK_KP_2", + Self::KP_3 => "SDLK_KP_3", + Self::KP_4 => "SDLK_KP_4", + Self::KP_5 => "SDLK_KP_5", + Self::KP_6 => "SDLK_KP_6", + Self::KP_7 => "SDLK_KP_7", + Self::KP_8 => "SDLK_KP_8", + Self::KP_9 => "SDLK_KP_9", + Self::KP_0 => "SDLK_KP_0", + Self::KP_PERIOD => "SDLK_KP_PERIOD", + Self::APPLICATION => "SDLK_APPLICATION", + Self::POWER => "SDLK_POWER", + Self::KP_EQUALS => "SDLK_KP_EQUALS", + Self::F13 => "SDLK_F13", + Self::F14 => "SDLK_F14", + Self::F15 => "SDLK_F15", + Self::F16 => "SDLK_F16", + Self::F17 => "SDLK_F17", + Self::F18 => "SDLK_F18", + Self::F19 => "SDLK_F19", + Self::F20 => "SDLK_F20", + Self::F21 => "SDLK_F21", + Self::F22 => "SDLK_F22", + Self::F23 => "SDLK_F23", + Self::F24 => "SDLK_F24", + Self::EXECUTE => "SDLK_EXECUTE", + Self::HELP => "SDLK_HELP", + Self::MENU => "SDLK_MENU", + Self::SELECT => "SDLK_SELECT", + Self::STOP => "SDLK_STOP", + Self::AGAIN => "SDLK_AGAIN", + Self::UNDO => "SDLK_UNDO", + Self::CUT => "SDLK_CUT", + Self::COPY => "SDLK_COPY", + Self::PASTE => "SDLK_PASTE", + Self::FIND => "SDLK_FIND", + Self::MUTE => "SDLK_MUTE", + Self::VOLUMEUP => "SDLK_VOLUMEUP", + Self::VOLUMEDOWN => "SDLK_VOLUMEDOWN", + Self::KP_COMMA => "SDLK_KP_COMMA", + Self::KP_EQUALSAS400 => "SDLK_KP_EQUALSAS400", + Self::ALTERASE => "SDLK_ALTERASE", + Self::SYSREQ => "SDLK_SYSREQ", + Self::CANCEL => "SDLK_CANCEL", + Self::CLEAR => "SDLK_CLEAR", + Self::PRIOR => "SDLK_PRIOR", + Self::RETURN2 => "SDLK_RETURN2", + Self::SEPARATOR => "SDLK_SEPARATOR", + Self::OUT => "SDLK_OUT", + Self::OPER => "SDLK_OPER", + Self::CLEARAGAIN => "SDLK_CLEARAGAIN", + Self::CRSEL => "SDLK_CRSEL", + Self::EXSEL => "SDLK_EXSEL", + Self::KP_00 => "SDLK_KP_00", + Self::KP_000 => "SDLK_KP_000", + Self::THOUSANDSSEPARATOR => "SDLK_THOUSANDSSEPARATOR", + Self::DECIMALSEPARATOR => "SDLK_DECIMALSEPARATOR", + Self::CURRENCYUNIT => "SDLK_CURRENCYUNIT", + Self::CURRENCYSUBUNIT => "SDLK_CURRENCYSUBUNIT", + Self::KP_LEFTPAREN => "SDLK_KP_LEFTPAREN", + Self::KP_RIGHTPAREN => "SDLK_KP_RIGHTPAREN", + Self::KP_LEFTBRACE => "SDLK_KP_LEFTBRACE", + Self::KP_RIGHTBRACE => "SDLK_KP_RIGHTBRACE", + Self::KP_TAB => "SDLK_KP_TAB", + Self::KP_BACKSPACE => "SDLK_KP_BACKSPACE", + Self::KP_A => "SDLK_KP_A", + Self::KP_B => "SDLK_KP_B", + Self::KP_C => "SDLK_KP_C", + Self::KP_D => "SDLK_KP_D", + Self::KP_E => "SDLK_KP_E", + Self::KP_F => "SDLK_KP_F", + Self::KP_XOR => "SDLK_KP_XOR", + Self::KP_POWER => "SDLK_KP_POWER", + Self::KP_PERCENT => "SDLK_KP_PERCENT", + Self::KP_LESS => "SDLK_KP_LESS", + Self::KP_GREATER => "SDLK_KP_GREATER", + Self::KP_AMPERSAND => "SDLK_KP_AMPERSAND", + Self::KP_DBLAMPERSAND => "SDLK_KP_DBLAMPERSAND", + Self::KP_VERTICALBAR => "SDLK_KP_VERTICALBAR", + Self::KP_DBLVERTICALBAR => "SDLK_KP_DBLVERTICALBAR", + Self::KP_COLON => "SDLK_KP_COLON", + Self::KP_HASH => "SDLK_KP_HASH", + Self::KP_SPACE => "SDLK_KP_SPACE", + Self::KP_AT => "SDLK_KP_AT", + Self::KP_EXCLAM => "SDLK_KP_EXCLAM", + Self::KP_MEMSTORE => "SDLK_KP_MEMSTORE", + Self::KP_MEMRECALL => "SDLK_KP_MEMRECALL", + Self::KP_MEMCLEAR => "SDLK_KP_MEMCLEAR", + Self::KP_MEMADD => "SDLK_KP_MEMADD", + Self::KP_MEMSUBTRACT => "SDLK_KP_MEMSUBTRACT", + Self::KP_MEMMULTIPLY => "SDLK_KP_MEMMULTIPLY", + Self::KP_MEMDIVIDE => "SDLK_KP_MEMDIVIDE", + Self::KP_PLUSMINUS => "SDLK_KP_PLUSMINUS", + Self::KP_CLEAR => "SDLK_KP_CLEAR", + Self::KP_CLEARENTRY => "SDLK_KP_CLEARENTRY", + Self::KP_BINARY => "SDLK_KP_BINARY", + Self::KP_OCTAL => "SDLK_KP_OCTAL", + Self::KP_DECIMAL => "SDLK_KP_DECIMAL", + Self::KP_HEXADECIMAL => "SDLK_KP_HEXADECIMAL", + Self::LCTRL => "SDLK_LCTRL", + Self::LSHIFT => "SDLK_LSHIFT", + Self::LALT => "SDLK_LALT", + Self::LGUI => "SDLK_LGUI", + Self::RCTRL => "SDLK_RCTRL", + Self::RSHIFT => "SDLK_RSHIFT", + Self::RALT => "SDLK_RALT", + Self::RGUI => "SDLK_RGUI", + Self::MODE => "SDLK_MODE", + Self::SLEEP => "SDLK_SLEEP", + Self::WAKE => "SDLK_WAKE", + Self::CHANNEL_INCREMENT => "SDLK_CHANNEL_INCREMENT", + Self::CHANNEL_DECREMENT => "SDLK_CHANNEL_DECREMENT", + Self::MEDIA_PLAY => "SDLK_MEDIA_PLAY", + Self::MEDIA_PAUSE => "SDLK_MEDIA_PAUSE", + Self::MEDIA_RECORD => "SDLK_MEDIA_RECORD", + Self::MEDIA_FAST_FORWARD => "SDLK_MEDIA_FAST_FORWARD", + Self::MEDIA_REWIND => "SDLK_MEDIA_REWIND", + Self::MEDIA_NEXT_TRACK => "SDLK_MEDIA_NEXT_TRACK", + Self::MEDIA_PREVIOUS_TRACK => "SDLK_MEDIA_PREVIOUS_TRACK", + Self::MEDIA_STOP => "SDLK_MEDIA_STOP", + Self::MEDIA_EJECT => "SDLK_MEDIA_EJECT", + Self::MEDIA_PLAY_PAUSE => "SDLK_MEDIA_PLAY_PAUSE", + Self::MEDIA_SELECT => "SDLK_MEDIA_SELECT", + Self::AC_NEW => "SDLK_AC_NEW", + Self::AC_OPEN => "SDLK_AC_OPEN", + Self::AC_CLOSE => "SDLK_AC_CLOSE", + Self::AC_EXIT => "SDLK_AC_EXIT", + Self::AC_SAVE => "SDLK_AC_SAVE", + Self::AC_PRINT => "SDLK_AC_PRINT", + Self::AC_PROPERTIES => "SDLK_AC_PROPERTIES", + Self::AC_SEARCH => "SDLK_AC_SEARCH", + Self::AC_HOME => "SDLK_AC_HOME", + Self::AC_BACK => "SDLK_AC_BACK", + Self::AC_FORWARD => "SDLK_AC_FORWARD", + Self::AC_STOP => "SDLK_AC_STOP", + Self::AC_REFRESH => "SDLK_AC_REFRESH", + Self::AC_BOOKMARKS => "SDLK_AC_BOOKMARKS", + Self::SOFTLEFT => "SDLK_SOFTLEFT", + Self::SOFTRIGHT => "SDLK_SOFTRIGHT", + Self::CALL => "SDLK_CALL", + Self::ENDCALL => "SDLK_ENDCALL", + Self::LEFT_TAB => "SDLK_LEFT_TAB", + Self::LEVEL5_SHIFT => "SDLK_LEVEL5_SHIFT", + Self::MULTI_KEY_COMPOSE => "SDLK_MULTI_KEY_COMPOSE", + Self::LMETA => "SDLK_LMETA", + Self::RMETA => "SDLK_RMETA", + Self::LHYPER => "SDLK_LHYPER", + Self::RHYPER => "SDLK_RHYPER", + + _ => return write!(f, "SDL_Keycode({})", self.0), + }) + } +} + +impl SDL_Keycode { + pub const EXTENDED_MASK: Self = Self((536870912_u32 as Uint32)); + pub const SCANCODE_MASK: Self = Self((1073741824_u32 as Uint32)); + /// 0 + pub const UNKNOWN: Self = Self((0x00000000 as Uint32)); + /// '\r' + pub const RETURN: Self = Self((0x0000000d as Uint32)); + /// '\x1B' + pub const ESCAPE: Self = Self((0x0000001b as Uint32)); + /// '\b' + pub const BACKSPACE: Self = Self((0x00000008 as Uint32)); + /// '\t' + pub const TAB: Self = Self((0x00000009 as Uint32)); + /// ' ' + pub const SPACE: Self = Self((0x00000020 as Uint32)); + /// '!' + pub const EXCLAIM: Self = Self((0x00000021 as Uint32)); + /// '"' + pub const DBLAPOSTROPHE: Self = Self((0x00000022 as Uint32)); + /// '#' + pub const HASH: Self = Self((0x00000023 as Uint32)); + /// '$' + pub const DOLLAR: Self = Self((0x00000024 as Uint32)); + /// '%' + pub const PERCENT: Self = Self((0x00000025 as Uint32)); + /// '&' + pub const AMPERSAND: Self = Self((0x00000026 as Uint32)); + /// '\'' + pub const APOSTROPHE: Self = Self((0x00000027 as Uint32)); + /// '(' + pub const LEFTPAREN: Self = Self((0x00000028 as Uint32)); + /// ')' + pub const RIGHTPAREN: Self = Self((0x00000029 as Uint32)); + /// '*' + pub const ASTERISK: Self = Self((0x0000002a as Uint32)); + /// '+' + pub const PLUS: Self = Self((0x0000002b as Uint32)); + /// ',' + pub const COMMA: Self = Self((0x0000002c as Uint32)); + /// '-' + pub const MINUS: Self = Self((0x0000002d as Uint32)); + /// '.' + pub const PERIOD: Self = Self((0x0000002e as Uint32)); + /// '/' + pub const SLASH: Self = Self((0x0000002f as Uint32)); + /// '0' + pub const _0: Self = Self((0x00000030 as Uint32)); + /// '1' + pub const _1: Self = Self((0x00000031 as Uint32)); + /// '2' + pub const _2: Self = Self((0x00000032 as Uint32)); + /// '3' + pub const _3: Self = Self((0x00000033 as Uint32)); + /// '4' + pub const _4: Self = Self((0x00000034 as Uint32)); + /// '5' + pub const _5: Self = Self((0x00000035 as Uint32)); + /// '6' + pub const _6: Self = Self((0x00000036 as Uint32)); + /// '7' + pub const _7: Self = Self((0x00000037 as Uint32)); + /// '8' + pub const _8: Self = Self((0x00000038 as Uint32)); + /// '9' + pub const _9: Self = Self((0x00000039 as Uint32)); + /// ':' + pub const COLON: Self = Self((0x0000003a as Uint32)); + /// ';' + pub const SEMICOLON: Self = Self((0x0000003b as Uint32)); + /// '<' + pub const LESS: Self = Self((0x0000003c as Uint32)); + /// '=' + pub const EQUALS: Self = Self((0x0000003d as Uint32)); + /// '>' + pub const GREATER: Self = Self((0x0000003e as Uint32)); + /// '?' + pub const QUESTION: Self = Self((0x0000003f as Uint32)); + /// '@' + pub const AT: Self = Self((0x00000040 as Uint32)); + /// '[' + pub const LEFTBRACKET: Self = Self((0x0000005b as Uint32)); + /// '\\' + pub const BACKSLASH: Self = Self((0x0000005c as Uint32)); + /// ']' + pub const RIGHTBRACKET: Self = Self((0x0000005d as Uint32)); + /// '^' + pub const CARET: Self = Self((0x0000005e as Uint32)); + /// '_' + pub const UNDERSCORE: Self = Self((0x0000005f as Uint32)); + /// '`' + pub const GRAVE: Self = Self((0x00000060 as Uint32)); + /// 'a' + pub const A: Self = Self((0x00000061 as Uint32)); + /// 'b' + pub const B: Self = Self((0x00000062 as Uint32)); + /// 'c' + pub const C: Self = Self((0x00000063 as Uint32)); + /// 'd' + pub const D: Self = Self((0x00000064 as Uint32)); + /// 'e' + pub const E: Self = Self((0x00000065 as Uint32)); + /// 'f' + pub const F: Self = Self((0x00000066 as Uint32)); + /// 'g' + pub const G: Self = Self((0x00000067 as Uint32)); + /// 'h' + pub const H: Self = Self((0x00000068 as Uint32)); + /// 'i' + pub const I: Self = Self((0x00000069 as Uint32)); + /// 'j' + pub const J: Self = Self((0x0000006a as Uint32)); + /// 'k' + pub const K: Self = Self((0x0000006b as Uint32)); + /// 'l' + pub const L: Self = Self((0x0000006c as Uint32)); + /// 'm' + pub const M: Self = Self((0x0000006d as Uint32)); + /// 'n' + pub const N: Self = Self((0x0000006e as Uint32)); + /// 'o' + pub const O: Self = Self((0x0000006f as Uint32)); + /// 'p' + pub const P: Self = Self((0x00000070 as Uint32)); + /// 'q' + pub const Q: Self = Self((0x00000071 as Uint32)); + /// 'r' + pub const R: Self = Self((0x00000072 as Uint32)); + /// 's' + pub const S: Self = Self((0x00000073 as Uint32)); + /// 't' + pub const T: Self = Self((0x00000074 as Uint32)); + /// 'u' + pub const U: Self = Self((0x00000075 as Uint32)); + /// 'v' + pub const V: Self = Self((0x00000076 as Uint32)); + /// 'w' + pub const W: Self = Self((0x00000077 as Uint32)); + /// 'x' + pub const X: Self = Self((0x00000078 as Uint32)); + /// 'y' + pub const Y: Self = Self((0x00000079 as Uint32)); + /// 'z' + pub const Z: Self = Self((0x0000007a as Uint32)); + /// '{' + pub const LEFTBRACE: Self = Self((0x0000007b as Uint32)); + /// '|' + pub const PIPE: Self = Self((0x0000007c as Uint32)); + /// '}' + pub const RIGHTBRACE: Self = Self((0x0000007d as Uint32)); + /// '~' + pub const TILDE: Self = Self((0x0000007e as Uint32)); + /// '\x7F' + pub const DELETE: Self = Self((0x0000007f as Uint32)); + /// '\xB1' + pub const PLUSMINUS: Self = Self((0x000000b1 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CAPSLOCK`]) + pub const CAPSLOCK: Self = Self((0x40000039 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F1`]) + pub const F1: Self = Self((0x4000003a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F2`]) + pub const F2: Self = Self((0x4000003b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F3`]) + pub const F3: Self = Self((0x4000003c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F4`]) + pub const F4: Self = Self((0x4000003d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F5`]) + pub const F5: Self = Self((0x4000003e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F6`]) + pub const F6: Self = Self((0x4000003f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F7`]) + pub const F7: Self = Self((0x40000040 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F8`]) + pub const F8: Self = Self((0x40000041 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F9`]) + pub const F9: Self = Self((0x40000042 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F10`]) + pub const F10: Self = Self((0x40000043 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F11`]) + pub const F11: Self = Self((0x40000044 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F12`]) + pub const F12: Self = Self((0x40000045 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRINTSCREEN`]) + pub const PRINTSCREEN: Self = Self((0x40000046 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SCROLLLOCK`]) + pub const SCROLLLOCK: Self = Self((0x40000047 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAUSE`]) + pub const PAUSE: Self = Self((0x40000048 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_INSERT`]) + pub const INSERT: Self = Self((0x40000049 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HOME`]) + pub const HOME: Self = Self((0x4000004a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEUP`]) + pub const PAGEUP: Self = Self((0x4000004b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_END`]) + pub const END: Self = Self((0x4000004d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEDOWN`]) + pub const PAGEDOWN: Self = Self((0x4000004e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RIGHT`]) + pub const RIGHT: Self = Self((0x4000004f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LEFT`]) + pub const LEFT: Self = Self((0x40000050 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DOWN`]) + pub const DOWN: Self = Self((0x40000051 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UP`]) + pub const UP: Self = Self((0x40000052 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_NUMLOCKCLEAR`]) + pub const NUMLOCKCLEAR: Self = Self((0x40000053 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DIVIDE`]) + pub const KP_DIVIDE: Self = Self((0x40000054 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MULTIPLY`]) + pub const KP_MULTIPLY: Self = Self((0x40000055 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MINUS`]) + pub const KP_MINUS: Self = Self((0x40000056 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUS`]) + pub const KP_PLUS: Self = Self((0x40000057 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_ENTER`]) + pub const KP_ENTER: Self = Self((0x40000058 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_1`]) + pub const KP_1: Self = Self((0x40000059 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_2`]) + pub const KP_2: Self = Self((0x4000005a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_3`]) + pub const KP_3: Self = Self((0x4000005b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_4`]) + pub const KP_4: Self = Self((0x4000005c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_5`]) + pub const KP_5: Self = Self((0x4000005d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_6`]) + pub const KP_6: Self = Self((0x4000005e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_7`]) + pub const KP_7: Self = Self((0x4000005f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_8`]) + pub const KP_8: Self = Self((0x40000060 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_9`]) + pub const KP_9: Self = Self((0x40000061 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_0`]) + pub const KP_0: Self = Self((0x40000062 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERIOD`]) + pub const KP_PERIOD: Self = Self((0x40000063 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_APPLICATION`]) + pub const APPLICATION: Self = Self((0x40000065 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_POWER`]) + pub const POWER: Self = Self((0x40000066 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALS`]) + pub const KP_EQUALS: Self = Self((0x40000067 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F13`]) + pub const F13: Self = Self((0x40000068 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F14`]) + pub const F14: Self = Self((0x40000069 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F15`]) + pub const F15: Self = Self((0x4000006a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F16`]) + pub const F16: Self = Self((0x4000006b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F17`]) + pub const F17: Self = Self((0x4000006c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F18`]) + pub const F18: Self = Self((0x4000006d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F19`]) + pub const F19: Self = Self((0x4000006e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F20`]) + pub const F20: Self = Self((0x4000006f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F21`]) + pub const F21: Self = Self((0x40000070 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F22`]) + pub const F22: Self = Self((0x40000071 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F23`]) + pub const F23: Self = Self((0x40000072 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F24`]) + pub const F24: Self = Self((0x40000073 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXECUTE`]) + pub const EXECUTE: Self = Self((0x40000074 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HELP`]) + pub const HELP: Self = Self((0x40000075 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MENU`]) + pub const MENU: Self = Self((0x40000076 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SELECT`]) + pub const SELECT: Self = Self((0x40000077 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_STOP`]) + pub const STOP: Self = Self((0x40000078 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AGAIN`]) + pub const AGAIN: Self = Self((0x40000079 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UNDO`]) + pub const UNDO: Self = Self((0x4000007a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CUT`]) + pub const CUT: Self = Self((0x4000007b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_COPY`]) + pub const COPY: Self = Self((0x4000007c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PASTE`]) + pub const PASTE: Self = Self((0x4000007d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_FIND`]) + pub const FIND: Self = Self((0x4000007e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MUTE`]) + pub const MUTE: Self = Self((0x4000007f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEUP`]) + pub const VOLUMEUP: Self = Self((0x40000080 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEDOWN`]) + pub const VOLUMEDOWN: Self = Self((0x40000081 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COMMA`]) + pub const KP_COMMA: Self = Self((0x40000085 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALSAS400`]) + pub const KP_EQUALSAS400: Self = Self((0x40000086 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ALTERASE`]) + pub const ALTERASE: Self = Self((0x40000099 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SYSREQ`]) + pub const SYSREQ: Self = Self((0x4000009a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CANCEL`]) + pub const CANCEL: Self = Self((0x4000009b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEAR`]) + pub const CLEAR: Self = Self((0x4000009c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRIOR`]) + pub const PRIOR: Self = Self((0x4000009d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RETURN2`]) + pub const RETURN2: Self = Self((0x4000009e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SEPARATOR`]) + pub const SEPARATOR: Self = Self((0x4000009f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OUT`]) + pub const OUT: Self = Self((0x400000a0 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OPER`]) + pub const OPER: Self = Self((0x400000a1 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEARAGAIN`]) + pub const CLEARAGAIN: Self = Self((0x400000a2 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CRSEL`]) + pub const CRSEL: Self = Self((0x400000a3 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXSEL`]) + pub const EXSEL: Self = Self((0x400000a4 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_00`]) + pub const KP_00: Self = Self((0x400000b0 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_000`]) + pub const KP_000: Self = Self((0x400000b1 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_THOUSANDSSEPARATOR`]) + pub const THOUSANDSSEPARATOR: Self = Self((0x400000b2 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DECIMALSEPARATOR`]) + pub const DECIMALSEPARATOR: Self = Self((0x400000b3 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYUNIT`]) + pub const CURRENCYUNIT: Self = Self((0x400000b4 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYSUBUNIT`]) + pub const CURRENCYSUBUNIT: Self = Self((0x400000b5 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTPAREN`]) + pub const KP_LEFTPAREN: Self = Self((0x400000b6 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTPAREN`]) + pub const KP_RIGHTPAREN: Self = Self((0x400000b7 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTBRACE`]) + pub const KP_LEFTBRACE: Self = Self((0x400000b8 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTBRACE`]) + pub const KP_RIGHTBRACE: Self = Self((0x400000b9 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_TAB`]) + pub const KP_TAB: Self = Self((0x400000ba as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BACKSPACE`]) + pub const KP_BACKSPACE: Self = Self((0x400000bb as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_A`]) + pub const KP_A: Self = Self((0x400000bc as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_B`]) + pub const KP_B: Self = Self((0x400000bd as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_C`]) + pub const KP_C: Self = Self((0x400000be as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_D`]) + pub const KP_D: Self = Self((0x400000bf as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_E`]) + pub const KP_E: Self = Self((0x400000c0 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_F`]) + pub const KP_F: Self = Self((0x400000c1 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_XOR`]) + pub const KP_XOR: Self = Self((0x400000c2 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_POWER`]) + pub const KP_POWER: Self = Self((0x400000c3 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERCENT`]) + pub const KP_PERCENT: Self = Self((0x400000c4 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LESS`]) + pub const KP_LESS: Self = Self((0x400000c5 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_GREATER`]) + pub const KP_GREATER: Self = Self((0x400000c6 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AMPERSAND`]) + pub const KP_AMPERSAND: Self = Self((0x400000c7 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLAMPERSAND`]) + pub const KP_DBLAMPERSAND: Self = Self((0x400000c8 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_VERTICALBAR`]) + pub const KP_VERTICALBAR: Self = Self((0x400000c9 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLVERTICALBAR`]) + pub const KP_DBLVERTICALBAR: Self = Self((0x400000ca as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COLON`]) + pub const KP_COLON: Self = Self((0x400000cb as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HASH`]) + pub const KP_HASH: Self = Self((0x400000cc as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_SPACE`]) + pub const KP_SPACE: Self = Self((0x400000cd as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AT`]) + pub const KP_AT: Self = Self((0x400000ce as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EXCLAM`]) + pub const KP_EXCLAM: Self = Self((0x400000cf as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSTORE`]) + pub const KP_MEMSTORE: Self = Self((0x400000d0 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMRECALL`]) + pub const KP_MEMRECALL: Self = Self((0x400000d1 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMCLEAR`]) + pub const KP_MEMCLEAR: Self = Self((0x400000d2 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMADD`]) + pub const KP_MEMADD: Self = Self((0x400000d3 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSUBTRACT`]) + pub const KP_MEMSUBTRACT: Self = Self((0x400000d4 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMMULTIPLY`]) + pub const KP_MEMMULTIPLY: Self = Self((0x400000d5 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMDIVIDE`]) + pub const KP_MEMDIVIDE: Self = Self((0x400000d6 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUSMINUS`]) + pub const KP_PLUSMINUS: Self = Self((0x400000d7 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEAR`]) + pub const KP_CLEAR: Self = Self((0x400000d8 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEARENTRY`]) + pub const KP_CLEARENTRY: Self = Self((0x400000d9 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BINARY`]) + pub const KP_BINARY: Self = Self((0x400000da as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_OCTAL`]) + pub const KP_OCTAL: Self = Self((0x400000db as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DECIMAL`]) + pub const KP_DECIMAL: Self = Self((0x400000dc as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HEXADECIMAL`]) + pub const KP_HEXADECIMAL: Self = Self((0x400000dd as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LCTRL`]) + pub const LCTRL: Self = Self((0x400000e0 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LSHIFT`]) + pub const LSHIFT: Self = Self((0x400000e1 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LALT`]) + pub const LALT: Self = Self((0x400000e2 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LGUI`]) + pub const LGUI: Self = Self((0x400000e3 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RCTRL`]) + pub const RCTRL: Self = Self((0x400000e4 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RSHIFT`]) + pub const RSHIFT: Self = Self((0x400000e5 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RALT`]) + pub const RALT: Self = Self((0x400000e6 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RGUI`]) + pub const RGUI: Self = Self((0x400000e7 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MODE`]) + pub const MODE: Self = Self((0x40000101 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SLEEP`]) + pub const SLEEP: Self = Self((0x40000102 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_WAKE`]) + pub const WAKE: Self = Self((0x40000103 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_INCREMENT`]) + pub const CHANNEL_INCREMENT: Self = Self((0x40000104 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_DECREMENT`]) + pub const CHANNEL_DECREMENT: Self = Self((0x40000105 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY`]) + pub const MEDIA_PLAY: Self = Self((0x40000106 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PAUSE`]) + pub const MEDIA_PAUSE: Self = Self((0x40000107 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_RECORD`]) + pub const MEDIA_RECORD: Self = Self((0x40000108 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_FAST_FORWARD`]) + pub const MEDIA_FAST_FORWARD: Self = Self((0x40000109 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_REWIND`]) + pub const MEDIA_REWIND: Self = Self((0x4000010a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_NEXT_TRACK`]) + pub const MEDIA_NEXT_TRACK: Self = Self((0x4000010b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PREVIOUS_TRACK`]) + pub const MEDIA_PREVIOUS_TRACK: Self = Self((0x4000010c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_STOP`]) + pub const MEDIA_STOP: Self = Self((0x4000010d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_EJECT`]) + pub const MEDIA_EJECT: Self = Self((0x4000010e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY_PAUSE`]) + pub const MEDIA_PLAY_PAUSE: Self = Self((0x4000010f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_SELECT`]) + pub const MEDIA_SELECT: Self = Self((0x40000110 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_NEW`]) + pub const AC_NEW: Self = Self((0x40000111 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_OPEN`]) + pub const AC_OPEN: Self = Self((0x40000112 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_CLOSE`]) + pub const AC_CLOSE: Self = Self((0x40000113 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_EXIT`]) + pub const AC_EXIT: Self = Self((0x40000114 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SAVE`]) + pub const AC_SAVE: Self = Self((0x40000115 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PRINT`]) + pub const AC_PRINT: Self = Self((0x40000116 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PROPERTIES`]) + pub const AC_PROPERTIES: Self = Self((0x40000117 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SEARCH`]) + pub const AC_SEARCH: Self = Self((0x40000118 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_HOME`]) + pub const AC_HOME: Self = Self((0x40000119 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BACK`]) + pub const AC_BACK: Self = Self((0x4000011a as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_FORWARD`]) + pub const AC_FORWARD: Self = Self((0x4000011b as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_STOP`]) + pub const AC_STOP: Self = Self((0x4000011c as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_REFRESH`]) + pub const AC_REFRESH: Self = Self((0x4000011d as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BOOKMARKS`]) + pub const AC_BOOKMARKS: Self = Self((0x4000011e as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTLEFT`]) + pub const SOFTLEFT: Self = Self((0x4000011f as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTRIGHT`]) + pub const SOFTRIGHT: Self = Self((0x40000120 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CALL`]) + pub const CALL: Self = Self((0x40000121 as Uint32)); + /// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ENDCALL`]) + pub const ENDCALL: Self = Self((0x40000122 as Uint32)); + /// Extended key Left Tab + pub const LEFT_TAB: Self = Self((0x20000001 as Uint32)); + /// Extended key Level 5 Shift + pub const LEVEL5_SHIFT: Self = Self((0x20000002 as Uint32)); + /// Extended key Multi-key Compose + pub const MULTI_KEY_COMPOSE: Self = Self((0x20000003 as Uint32)); + /// Extended key Left Meta + pub const LMETA: Self = Self((0x20000004 as Uint32)); + /// Extended key Right Meta + pub const RMETA: Self = Self((0x20000005 as Uint32)); + /// Extended key Left Hyper + pub const LHYPER: Self = Self((0x20000006 as Uint32)); + /// Extended key Right Hyper + pub const RHYPER: Self = Self((0x20000007 as Uint32)); +} + +pub const SDLK_EXTENDED_MASK: SDL_Keycode = SDL_Keycode::EXTENDED_MASK; +pub const SDLK_SCANCODE_MASK: SDL_Keycode = SDL_Keycode::SCANCODE_MASK; +/// 0 +pub const SDLK_UNKNOWN: SDL_Keycode = SDL_Keycode::UNKNOWN; +/// '\r' +pub const SDLK_RETURN: SDL_Keycode = SDL_Keycode::RETURN; +/// '\x1B' +pub const SDLK_ESCAPE: SDL_Keycode = SDL_Keycode::ESCAPE; +/// '\b' +pub const SDLK_BACKSPACE: SDL_Keycode = SDL_Keycode::BACKSPACE; +/// '\t' +pub const SDLK_TAB: SDL_Keycode = SDL_Keycode::TAB; +/// ' ' +pub const SDLK_SPACE: SDL_Keycode = SDL_Keycode::SPACE; +/// '!' +pub const SDLK_EXCLAIM: SDL_Keycode = SDL_Keycode::EXCLAIM; +/// '"' +pub const SDLK_DBLAPOSTROPHE: SDL_Keycode = SDL_Keycode::DBLAPOSTROPHE; +/// '#' +pub const SDLK_HASH: SDL_Keycode = SDL_Keycode::HASH; +/// '$' +pub const SDLK_DOLLAR: SDL_Keycode = SDL_Keycode::DOLLAR; +/// '%' +pub const SDLK_PERCENT: SDL_Keycode = SDL_Keycode::PERCENT; +/// '&' +pub const SDLK_AMPERSAND: SDL_Keycode = SDL_Keycode::AMPERSAND; +/// '\'' +pub const SDLK_APOSTROPHE: SDL_Keycode = SDL_Keycode::APOSTROPHE; +/// '(' +pub const SDLK_LEFTPAREN: SDL_Keycode = SDL_Keycode::LEFTPAREN; +/// ')' +pub const SDLK_RIGHTPAREN: SDL_Keycode = SDL_Keycode::RIGHTPAREN; +/// '*' +pub const SDLK_ASTERISK: SDL_Keycode = SDL_Keycode::ASTERISK; +/// '+' +pub const SDLK_PLUS: SDL_Keycode = SDL_Keycode::PLUS; +/// ',' +pub const SDLK_COMMA: SDL_Keycode = SDL_Keycode::COMMA; +/// '-' +pub const SDLK_MINUS: SDL_Keycode = SDL_Keycode::MINUS; +/// '.' +pub const SDLK_PERIOD: SDL_Keycode = SDL_Keycode::PERIOD; +/// '/' +pub const SDLK_SLASH: SDL_Keycode = SDL_Keycode::SLASH; +/// '0' +pub const SDLK_0: SDL_Keycode = SDL_Keycode::_0; +/// '1' +pub const SDLK_1: SDL_Keycode = SDL_Keycode::_1; +/// '2' +pub const SDLK_2: SDL_Keycode = SDL_Keycode::_2; +/// '3' +pub const SDLK_3: SDL_Keycode = SDL_Keycode::_3; +/// '4' +pub const SDLK_4: SDL_Keycode = SDL_Keycode::_4; +/// '5' +pub const SDLK_5: SDL_Keycode = SDL_Keycode::_5; +/// '6' +pub const SDLK_6: SDL_Keycode = SDL_Keycode::_6; +/// '7' +pub const SDLK_7: SDL_Keycode = SDL_Keycode::_7; +/// '8' +pub const SDLK_8: SDL_Keycode = SDL_Keycode::_8; +/// '9' +pub const SDLK_9: SDL_Keycode = SDL_Keycode::_9; +/// ':' +pub const SDLK_COLON: SDL_Keycode = SDL_Keycode::COLON; +/// ';' +pub const SDLK_SEMICOLON: SDL_Keycode = SDL_Keycode::SEMICOLON; +/// '<' +pub const SDLK_LESS: SDL_Keycode = SDL_Keycode::LESS; +/// '=' +pub const SDLK_EQUALS: SDL_Keycode = SDL_Keycode::EQUALS; +/// '>' +pub const SDLK_GREATER: SDL_Keycode = SDL_Keycode::GREATER; +/// '?' +pub const SDLK_QUESTION: SDL_Keycode = SDL_Keycode::QUESTION; +/// '@' +pub const SDLK_AT: SDL_Keycode = SDL_Keycode::AT; +/// '[' +pub const SDLK_LEFTBRACKET: SDL_Keycode = SDL_Keycode::LEFTBRACKET; +/// '\\' +pub const SDLK_BACKSLASH: SDL_Keycode = SDL_Keycode::BACKSLASH; +/// ']' +pub const SDLK_RIGHTBRACKET: SDL_Keycode = SDL_Keycode::RIGHTBRACKET; +/// '^' +pub const SDLK_CARET: SDL_Keycode = SDL_Keycode::CARET; +/// '_' +pub const SDLK_UNDERSCORE: SDL_Keycode = SDL_Keycode::UNDERSCORE; +/// '`' +pub const SDLK_GRAVE: SDL_Keycode = SDL_Keycode::GRAVE; +/// 'a' +pub const SDLK_A: SDL_Keycode = SDL_Keycode::A; +/// 'b' +pub const SDLK_B: SDL_Keycode = SDL_Keycode::B; +/// 'c' +pub const SDLK_C: SDL_Keycode = SDL_Keycode::C; +/// 'd' +pub const SDLK_D: SDL_Keycode = SDL_Keycode::D; +/// 'e' +pub const SDLK_E: SDL_Keycode = SDL_Keycode::E; +/// 'f' +pub const SDLK_F: SDL_Keycode = SDL_Keycode::F; +/// 'g' +pub const SDLK_G: SDL_Keycode = SDL_Keycode::G; +/// 'h' +pub const SDLK_H: SDL_Keycode = SDL_Keycode::H; +/// 'i' +pub const SDLK_I: SDL_Keycode = SDL_Keycode::I; +/// 'j' +pub const SDLK_J: SDL_Keycode = SDL_Keycode::J; +/// 'k' +pub const SDLK_K: SDL_Keycode = SDL_Keycode::K; +/// 'l' +pub const SDLK_L: SDL_Keycode = SDL_Keycode::L; +/// 'm' +pub const SDLK_M: SDL_Keycode = SDL_Keycode::M; +/// 'n' +pub const SDLK_N: SDL_Keycode = SDL_Keycode::N; +/// 'o' +pub const SDLK_O: SDL_Keycode = SDL_Keycode::O; +/// 'p' +pub const SDLK_P: SDL_Keycode = SDL_Keycode::P; +/// 'q' +pub const SDLK_Q: SDL_Keycode = SDL_Keycode::Q; +/// 'r' +pub const SDLK_R: SDL_Keycode = SDL_Keycode::R; +/// 's' +pub const SDLK_S: SDL_Keycode = SDL_Keycode::S; +/// 't' +pub const SDLK_T: SDL_Keycode = SDL_Keycode::T; +/// 'u' +pub const SDLK_U: SDL_Keycode = SDL_Keycode::U; +/// 'v' +pub const SDLK_V: SDL_Keycode = SDL_Keycode::V; +/// 'w' +pub const SDLK_W: SDL_Keycode = SDL_Keycode::W; +/// 'x' +pub const SDLK_X: SDL_Keycode = SDL_Keycode::X; +/// 'y' +pub const SDLK_Y: SDL_Keycode = SDL_Keycode::Y; +/// 'z' +pub const SDLK_Z: SDL_Keycode = SDL_Keycode::Z; +/// '{' +pub const SDLK_LEFTBRACE: SDL_Keycode = SDL_Keycode::LEFTBRACE; +/// '|' +pub const SDLK_PIPE: SDL_Keycode = SDL_Keycode::PIPE; +/// '}' +pub const SDLK_RIGHTBRACE: SDL_Keycode = SDL_Keycode::RIGHTBRACE; +/// '~' +pub const SDLK_TILDE: SDL_Keycode = SDL_Keycode::TILDE; +/// '\x7F' +pub const SDLK_DELETE: SDL_Keycode = SDL_Keycode::DELETE; +/// '\xB1' +pub const SDLK_PLUSMINUS: SDL_Keycode = SDL_Keycode::PLUSMINUS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CAPSLOCK`]) +pub const SDLK_CAPSLOCK: SDL_Keycode = SDL_Keycode::CAPSLOCK; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F1`]) +pub const SDLK_F1: SDL_Keycode = SDL_Keycode::F1; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F2`]) +pub const SDLK_F2: SDL_Keycode = SDL_Keycode::F2; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F3`]) +pub const SDLK_F3: SDL_Keycode = SDL_Keycode::F3; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F4`]) +pub const SDLK_F4: SDL_Keycode = SDL_Keycode::F4; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F5`]) +pub const SDLK_F5: SDL_Keycode = SDL_Keycode::F5; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F6`]) +pub const SDLK_F6: SDL_Keycode = SDL_Keycode::F6; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F7`]) +pub const SDLK_F7: SDL_Keycode = SDL_Keycode::F7; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F8`]) +pub const SDLK_F8: SDL_Keycode = SDL_Keycode::F8; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F9`]) +pub const SDLK_F9: SDL_Keycode = SDL_Keycode::F9; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F10`]) +pub const SDLK_F10: SDL_Keycode = SDL_Keycode::F10; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F11`]) +pub const SDLK_F11: SDL_Keycode = SDL_Keycode::F11; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F12`]) +pub const SDLK_F12: SDL_Keycode = SDL_Keycode::F12; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRINTSCREEN`]) +pub const SDLK_PRINTSCREEN: SDL_Keycode = SDL_Keycode::PRINTSCREEN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SCROLLLOCK`]) +pub const SDLK_SCROLLLOCK: SDL_Keycode = SDL_Keycode::SCROLLLOCK; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAUSE`]) +pub const SDLK_PAUSE: SDL_Keycode = SDL_Keycode::PAUSE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_INSERT`]) +pub const SDLK_INSERT: SDL_Keycode = SDL_Keycode::INSERT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HOME`]) +pub const SDLK_HOME: SDL_Keycode = SDL_Keycode::HOME; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEUP`]) +pub const SDLK_PAGEUP: SDL_Keycode = SDL_Keycode::PAGEUP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_END`]) +pub const SDLK_END: SDL_Keycode = SDL_Keycode::END; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEDOWN`]) +pub const SDLK_PAGEDOWN: SDL_Keycode = SDL_Keycode::PAGEDOWN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RIGHT`]) +pub const SDLK_RIGHT: SDL_Keycode = SDL_Keycode::RIGHT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LEFT`]) +pub const SDLK_LEFT: SDL_Keycode = SDL_Keycode::LEFT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DOWN`]) +pub const SDLK_DOWN: SDL_Keycode = SDL_Keycode::DOWN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UP`]) +pub const SDLK_UP: SDL_Keycode = SDL_Keycode::UP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_NUMLOCKCLEAR`]) +pub const SDLK_NUMLOCKCLEAR: SDL_Keycode = SDL_Keycode::NUMLOCKCLEAR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DIVIDE`]) +pub const SDLK_KP_DIVIDE: SDL_Keycode = SDL_Keycode::KP_DIVIDE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MULTIPLY`]) +pub const SDLK_KP_MULTIPLY: SDL_Keycode = SDL_Keycode::KP_MULTIPLY; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MINUS`]) +pub const SDLK_KP_MINUS: SDL_Keycode = SDL_Keycode::KP_MINUS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUS`]) +pub const SDLK_KP_PLUS: SDL_Keycode = SDL_Keycode::KP_PLUS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_ENTER`]) +pub const SDLK_KP_ENTER: SDL_Keycode = SDL_Keycode::KP_ENTER; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_1`]) +pub const SDLK_KP_1: SDL_Keycode = SDL_Keycode::KP_1; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_2`]) +pub const SDLK_KP_2: SDL_Keycode = SDL_Keycode::KP_2; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_3`]) +pub const SDLK_KP_3: SDL_Keycode = SDL_Keycode::KP_3; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_4`]) +pub const SDLK_KP_4: SDL_Keycode = SDL_Keycode::KP_4; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_5`]) +pub const SDLK_KP_5: SDL_Keycode = SDL_Keycode::KP_5; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_6`]) +pub const SDLK_KP_6: SDL_Keycode = SDL_Keycode::KP_6; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_7`]) +pub const SDLK_KP_7: SDL_Keycode = SDL_Keycode::KP_7; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_8`]) +pub const SDLK_KP_8: SDL_Keycode = SDL_Keycode::KP_8; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_9`]) +pub const SDLK_KP_9: SDL_Keycode = SDL_Keycode::KP_9; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_0`]) +pub const SDLK_KP_0: SDL_Keycode = SDL_Keycode::KP_0; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERIOD`]) +pub const SDLK_KP_PERIOD: SDL_Keycode = SDL_Keycode::KP_PERIOD; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_APPLICATION`]) +pub const SDLK_APPLICATION: SDL_Keycode = SDL_Keycode::APPLICATION; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_POWER`]) +pub const SDLK_POWER: SDL_Keycode = SDL_Keycode::POWER; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALS`]) +pub const SDLK_KP_EQUALS: SDL_Keycode = SDL_Keycode::KP_EQUALS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F13`]) +pub const SDLK_F13: SDL_Keycode = SDL_Keycode::F13; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F14`]) +pub const SDLK_F14: SDL_Keycode = SDL_Keycode::F14; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F15`]) +pub const SDLK_F15: SDL_Keycode = SDL_Keycode::F15; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F16`]) +pub const SDLK_F16: SDL_Keycode = SDL_Keycode::F16; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F17`]) +pub const SDLK_F17: SDL_Keycode = SDL_Keycode::F17; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F18`]) +pub const SDLK_F18: SDL_Keycode = SDL_Keycode::F18; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F19`]) +pub const SDLK_F19: SDL_Keycode = SDL_Keycode::F19; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F20`]) +pub const SDLK_F20: SDL_Keycode = SDL_Keycode::F20; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F21`]) +pub const SDLK_F21: SDL_Keycode = SDL_Keycode::F21; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F22`]) +pub const SDLK_F22: SDL_Keycode = SDL_Keycode::F22; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F23`]) +pub const SDLK_F23: SDL_Keycode = SDL_Keycode::F23; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F24`]) +pub const SDLK_F24: SDL_Keycode = SDL_Keycode::F24; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXECUTE`]) +pub const SDLK_EXECUTE: SDL_Keycode = SDL_Keycode::EXECUTE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HELP`]) +pub const SDLK_HELP: SDL_Keycode = SDL_Keycode::HELP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MENU`]) +pub const SDLK_MENU: SDL_Keycode = SDL_Keycode::MENU; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SELECT`]) +pub const SDLK_SELECT: SDL_Keycode = SDL_Keycode::SELECT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_STOP`]) +pub const SDLK_STOP: SDL_Keycode = SDL_Keycode::STOP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AGAIN`]) +pub const SDLK_AGAIN: SDL_Keycode = SDL_Keycode::AGAIN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UNDO`]) +pub const SDLK_UNDO: SDL_Keycode = SDL_Keycode::UNDO; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CUT`]) +pub const SDLK_CUT: SDL_Keycode = SDL_Keycode::CUT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_COPY`]) +pub const SDLK_COPY: SDL_Keycode = SDL_Keycode::COPY; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PASTE`]) +pub const SDLK_PASTE: SDL_Keycode = SDL_Keycode::PASTE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_FIND`]) +pub const SDLK_FIND: SDL_Keycode = SDL_Keycode::FIND; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MUTE`]) +pub const SDLK_MUTE: SDL_Keycode = SDL_Keycode::MUTE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEUP`]) +pub const SDLK_VOLUMEUP: SDL_Keycode = SDL_Keycode::VOLUMEUP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEDOWN`]) +pub const SDLK_VOLUMEDOWN: SDL_Keycode = SDL_Keycode::VOLUMEDOWN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COMMA`]) +pub const SDLK_KP_COMMA: SDL_Keycode = SDL_Keycode::KP_COMMA; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALSAS400`]) +pub const SDLK_KP_EQUALSAS400: SDL_Keycode = SDL_Keycode::KP_EQUALSAS400; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ALTERASE`]) +pub const SDLK_ALTERASE: SDL_Keycode = SDL_Keycode::ALTERASE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SYSREQ`]) +pub const SDLK_SYSREQ: SDL_Keycode = SDL_Keycode::SYSREQ; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CANCEL`]) +pub const SDLK_CANCEL: SDL_Keycode = SDL_Keycode::CANCEL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEAR`]) +pub const SDLK_CLEAR: SDL_Keycode = SDL_Keycode::CLEAR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRIOR`]) +pub const SDLK_PRIOR: SDL_Keycode = SDL_Keycode::PRIOR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RETURN2`]) +pub const SDLK_RETURN2: SDL_Keycode = SDL_Keycode::RETURN2; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SEPARATOR`]) +pub const SDLK_SEPARATOR: SDL_Keycode = SDL_Keycode::SEPARATOR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OUT`]) +pub const SDLK_OUT: SDL_Keycode = SDL_Keycode::OUT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OPER`]) +pub const SDLK_OPER: SDL_Keycode = SDL_Keycode::OPER; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEARAGAIN`]) +pub const SDLK_CLEARAGAIN: SDL_Keycode = SDL_Keycode::CLEARAGAIN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CRSEL`]) +pub const SDLK_CRSEL: SDL_Keycode = SDL_Keycode::CRSEL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXSEL`]) +pub const SDLK_EXSEL: SDL_Keycode = SDL_Keycode::EXSEL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_00`]) +pub const SDLK_KP_00: SDL_Keycode = SDL_Keycode::KP_00; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_000`]) +pub const SDLK_KP_000: SDL_Keycode = SDL_Keycode::KP_000; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_THOUSANDSSEPARATOR`]) +pub const SDLK_THOUSANDSSEPARATOR: SDL_Keycode = SDL_Keycode::THOUSANDSSEPARATOR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DECIMALSEPARATOR`]) +pub const SDLK_DECIMALSEPARATOR: SDL_Keycode = SDL_Keycode::DECIMALSEPARATOR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYUNIT`]) +pub const SDLK_CURRENCYUNIT: SDL_Keycode = SDL_Keycode::CURRENCYUNIT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYSUBUNIT`]) +pub const SDLK_CURRENCYSUBUNIT: SDL_Keycode = SDL_Keycode::CURRENCYSUBUNIT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTPAREN`]) +pub const SDLK_KP_LEFTPAREN: SDL_Keycode = SDL_Keycode::KP_LEFTPAREN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTPAREN`]) +pub const SDLK_KP_RIGHTPAREN: SDL_Keycode = SDL_Keycode::KP_RIGHTPAREN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTBRACE`]) +pub const SDLK_KP_LEFTBRACE: SDL_Keycode = SDL_Keycode::KP_LEFTBRACE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTBRACE`]) +pub const SDLK_KP_RIGHTBRACE: SDL_Keycode = SDL_Keycode::KP_RIGHTBRACE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_TAB`]) +pub const SDLK_KP_TAB: SDL_Keycode = SDL_Keycode::KP_TAB; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BACKSPACE`]) +pub const SDLK_KP_BACKSPACE: SDL_Keycode = SDL_Keycode::KP_BACKSPACE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_A`]) +pub const SDLK_KP_A: SDL_Keycode = SDL_Keycode::KP_A; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_B`]) +pub const SDLK_KP_B: SDL_Keycode = SDL_Keycode::KP_B; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_C`]) +pub const SDLK_KP_C: SDL_Keycode = SDL_Keycode::KP_C; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_D`]) +pub const SDLK_KP_D: SDL_Keycode = SDL_Keycode::KP_D; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_E`]) +pub const SDLK_KP_E: SDL_Keycode = SDL_Keycode::KP_E; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_F`]) +pub const SDLK_KP_F: SDL_Keycode = SDL_Keycode::KP_F; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_XOR`]) +pub const SDLK_KP_XOR: SDL_Keycode = SDL_Keycode::KP_XOR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_POWER`]) +pub const SDLK_KP_POWER: SDL_Keycode = SDL_Keycode::KP_POWER; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERCENT`]) +pub const SDLK_KP_PERCENT: SDL_Keycode = SDL_Keycode::KP_PERCENT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LESS`]) +pub const SDLK_KP_LESS: SDL_Keycode = SDL_Keycode::KP_LESS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_GREATER`]) +pub const SDLK_KP_GREATER: SDL_Keycode = SDL_Keycode::KP_GREATER; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AMPERSAND`]) +pub const SDLK_KP_AMPERSAND: SDL_Keycode = SDL_Keycode::KP_AMPERSAND; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLAMPERSAND`]) +pub const SDLK_KP_DBLAMPERSAND: SDL_Keycode = SDL_Keycode::KP_DBLAMPERSAND; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_VERTICALBAR`]) +pub const SDLK_KP_VERTICALBAR: SDL_Keycode = SDL_Keycode::KP_VERTICALBAR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLVERTICALBAR`]) +pub const SDLK_KP_DBLVERTICALBAR: SDL_Keycode = SDL_Keycode::KP_DBLVERTICALBAR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COLON`]) +pub const SDLK_KP_COLON: SDL_Keycode = SDL_Keycode::KP_COLON; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HASH`]) +pub const SDLK_KP_HASH: SDL_Keycode = SDL_Keycode::KP_HASH; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_SPACE`]) +pub const SDLK_KP_SPACE: SDL_Keycode = SDL_Keycode::KP_SPACE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AT`]) +pub const SDLK_KP_AT: SDL_Keycode = SDL_Keycode::KP_AT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EXCLAM`]) +pub const SDLK_KP_EXCLAM: SDL_Keycode = SDL_Keycode::KP_EXCLAM; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSTORE`]) +pub const SDLK_KP_MEMSTORE: SDL_Keycode = SDL_Keycode::KP_MEMSTORE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMRECALL`]) +pub const SDLK_KP_MEMRECALL: SDL_Keycode = SDL_Keycode::KP_MEMRECALL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMCLEAR`]) +pub const SDLK_KP_MEMCLEAR: SDL_Keycode = SDL_Keycode::KP_MEMCLEAR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMADD`]) +pub const SDLK_KP_MEMADD: SDL_Keycode = SDL_Keycode::KP_MEMADD; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSUBTRACT`]) +pub const SDLK_KP_MEMSUBTRACT: SDL_Keycode = SDL_Keycode::KP_MEMSUBTRACT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMMULTIPLY`]) +pub const SDLK_KP_MEMMULTIPLY: SDL_Keycode = SDL_Keycode::KP_MEMMULTIPLY; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMDIVIDE`]) +pub const SDLK_KP_MEMDIVIDE: SDL_Keycode = SDL_Keycode::KP_MEMDIVIDE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUSMINUS`]) +pub const SDLK_KP_PLUSMINUS: SDL_Keycode = SDL_Keycode::KP_PLUSMINUS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEAR`]) +pub const SDLK_KP_CLEAR: SDL_Keycode = SDL_Keycode::KP_CLEAR; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEARENTRY`]) +pub const SDLK_KP_CLEARENTRY: SDL_Keycode = SDL_Keycode::KP_CLEARENTRY; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BINARY`]) +pub const SDLK_KP_BINARY: SDL_Keycode = SDL_Keycode::KP_BINARY; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_OCTAL`]) +pub const SDLK_KP_OCTAL: SDL_Keycode = SDL_Keycode::KP_OCTAL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DECIMAL`]) +pub const SDLK_KP_DECIMAL: SDL_Keycode = SDL_Keycode::KP_DECIMAL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HEXADECIMAL`]) +pub const SDLK_KP_HEXADECIMAL: SDL_Keycode = SDL_Keycode::KP_HEXADECIMAL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LCTRL`]) +pub const SDLK_LCTRL: SDL_Keycode = SDL_Keycode::LCTRL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LSHIFT`]) +pub const SDLK_LSHIFT: SDL_Keycode = SDL_Keycode::LSHIFT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LALT`]) +pub const SDLK_LALT: SDL_Keycode = SDL_Keycode::LALT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LGUI`]) +pub const SDLK_LGUI: SDL_Keycode = SDL_Keycode::LGUI; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RCTRL`]) +pub const SDLK_RCTRL: SDL_Keycode = SDL_Keycode::RCTRL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RSHIFT`]) +pub const SDLK_RSHIFT: SDL_Keycode = SDL_Keycode::RSHIFT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RALT`]) +pub const SDLK_RALT: SDL_Keycode = SDL_Keycode::RALT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RGUI`]) +pub const SDLK_RGUI: SDL_Keycode = SDL_Keycode::RGUI; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MODE`]) +pub const SDLK_MODE: SDL_Keycode = SDL_Keycode::MODE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SLEEP`]) +pub const SDLK_SLEEP: SDL_Keycode = SDL_Keycode::SLEEP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_WAKE`]) +pub const SDLK_WAKE: SDL_Keycode = SDL_Keycode::WAKE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_INCREMENT`]) +pub const SDLK_CHANNEL_INCREMENT: SDL_Keycode = SDL_Keycode::CHANNEL_INCREMENT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_DECREMENT`]) +pub const SDLK_CHANNEL_DECREMENT: SDL_Keycode = SDL_Keycode::CHANNEL_DECREMENT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY`]) +pub const SDLK_MEDIA_PLAY: SDL_Keycode = SDL_Keycode::MEDIA_PLAY; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PAUSE`]) +pub const SDLK_MEDIA_PAUSE: SDL_Keycode = SDL_Keycode::MEDIA_PAUSE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_RECORD`]) +pub const SDLK_MEDIA_RECORD: SDL_Keycode = SDL_Keycode::MEDIA_RECORD; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_FAST_FORWARD`]) +pub const SDLK_MEDIA_FAST_FORWARD: SDL_Keycode = SDL_Keycode::MEDIA_FAST_FORWARD; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_REWIND`]) +pub const SDLK_MEDIA_REWIND: SDL_Keycode = SDL_Keycode::MEDIA_REWIND; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_NEXT_TRACK`]) +pub const SDLK_MEDIA_NEXT_TRACK: SDL_Keycode = SDL_Keycode::MEDIA_NEXT_TRACK; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PREVIOUS_TRACK`]) +pub const SDLK_MEDIA_PREVIOUS_TRACK: SDL_Keycode = SDL_Keycode::MEDIA_PREVIOUS_TRACK; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_STOP`]) +pub const SDLK_MEDIA_STOP: SDL_Keycode = SDL_Keycode::MEDIA_STOP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_EJECT`]) +pub const SDLK_MEDIA_EJECT: SDL_Keycode = SDL_Keycode::MEDIA_EJECT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY_PAUSE`]) +pub const SDLK_MEDIA_PLAY_PAUSE: SDL_Keycode = SDL_Keycode::MEDIA_PLAY_PAUSE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_SELECT`]) +pub const SDLK_MEDIA_SELECT: SDL_Keycode = SDL_Keycode::MEDIA_SELECT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_NEW`]) +pub const SDLK_AC_NEW: SDL_Keycode = SDL_Keycode::AC_NEW; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_OPEN`]) +pub const SDLK_AC_OPEN: SDL_Keycode = SDL_Keycode::AC_OPEN; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_CLOSE`]) +pub const SDLK_AC_CLOSE: SDL_Keycode = SDL_Keycode::AC_CLOSE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_EXIT`]) +pub const SDLK_AC_EXIT: SDL_Keycode = SDL_Keycode::AC_EXIT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SAVE`]) +pub const SDLK_AC_SAVE: SDL_Keycode = SDL_Keycode::AC_SAVE; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PRINT`]) +pub const SDLK_AC_PRINT: SDL_Keycode = SDL_Keycode::AC_PRINT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PROPERTIES`]) +pub const SDLK_AC_PROPERTIES: SDL_Keycode = SDL_Keycode::AC_PROPERTIES; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SEARCH`]) +pub const SDLK_AC_SEARCH: SDL_Keycode = SDL_Keycode::AC_SEARCH; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_HOME`]) +pub const SDLK_AC_HOME: SDL_Keycode = SDL_Keycode::AC_HOME; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BACK`]) +pub const SDLK_AC_BACK: SDL_Keycode = SDL_Keycode::AC_BACK; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_FORWARD`]) +pub const SDLK_AC_FORWARD: SDL_Keycode = SDL_Keycode::AC_FORWARD; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_STOP`]) +pub const SDLK_AC_STOP: SDL_Keycode = SDL_Keycode::AC_STOP; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_REFRESH`]) +pub const SDLK_AC_REFRESH: SDL_Keycode = SDL_Keycode::AC_REFRESH; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BOOKMARKS`]) +pub const SDLK_AC_BOOKMARKS: SDL_Keycode = SDL_Keycode::AC_BOOKMARKS; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTLEFT`]) +pub const SDLK_SOFTLEFT: SDL_Keycode = SDL_Keycode::SOFTLEFT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTRIGHT`]) +pub const SDLK_SOFTRIGHT: SDL_Keycode = SDL_Keycode::SOFTRIGHT; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CALL`]) +pub const SDLK_CALL: SDL_Keycode = SDL_Keycode::CALL; +/// SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ENDCALL`]) +pub const SDLK_ENDCALL: SDL_Keycode = SDL_Keycode::ENDCALL; +/// Extended key Left Tab +pub const SDLK_LEFT_TAB: SDL_Keycode = SDL_Keycode::LEFT_TAB; +/// Extended key Level 5 Shift +pub const SDLK_LEVEL5_SHIFT: SDL_Keycode = SDL_Keycode::LEVEL5_SHIFT; +/// Extended key Multi-key Compose +pub const SDLK_MULTI_KEY_COMPOSE: SDL_Keycode = SDL_Keycode::MULTI_KEY_COMPOSE; +/// Extended key Left Meta +pub const SDLK_LMETA: SDL_Keycode = SDL_Keycode::LMETA; +/// Extended key Right Meta +pub const SDLK_RMETA: SDL_Keycode = SDL_Keycode::RMETA; +/// Extended key Left Hyper +pub const SDLK_LHYPER: SDL_Keycode = SDL_Keycode::LHYPER; +/// Extended key Right Hyper +pub const SDLK_RHYPER: SDL_Keycode = SDL_Keycode::RHYPER; + +impl SDL_Keycode { + /// Initialize a `SDL_Keycode` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_Keycode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Keycode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::keycode::METADATA_SDL_Keycode; +} + +#[inline(always)] +pub const fn SDL_SCANCODE_TO_KEYCODE(X: SDL_Scancode) -> Uint32 { + ((X.0 as Uint32) | SDLK_SCANCODE_MASK.0) +} + +/// Valid key modifiers (possibly OR'd together). +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_Keymod::NONE) | [`SDL_KMOD_NONE`] | no modifier is applicable. | +/// | [`LSHIFT`](SDL_Keymod::LSHIFT) | [`SDL_KMOD_LSHIFT`] | the left Shift key is down. | +/// | [`RSHIFT`](SDL_Keymod::RSHIFT) | [`SDL_KMOD_RSHIFT`] | the right Shift key is down. | +/// | [`LEVEL5`](SDL_Keymod::LEVEL5) | [`SDL_KMOD_LEVEL5`] | the Level 5 Shift key is down. | +/// | [`LCTRL`](SDL_Keymod::LCTRL) | [`SDL_KMOD_LCTRL`] | the left Ctrl (Control) key is down. | +/// | [`RCTRL`](SDL_Keymod::RCTRL) | [`SDL_KMOD_RCTRL`] | the right Ctrl (Control) key is down. | +/// | [`LALT`](SDL_Keymod::LALT) | [`SDL_KMOD_LALT`] | the left Alt key is down. | +/// | [`RALT`](SDL_Keymod::RALT) | [`SDL_KMOD_RALT`] | the right Alt key is down. | +/// | [`LGUI`](SDL_Keymod::LGUI) | [`SDL_KMOD_LGUI`] | the left GUI key (often the Windows key) is down. | +/// | [`RGUI`](SDL_Keymod::RGUI) | [`SDL_KMOD_RGUI`] | the right GUI key (often the Windows key) is down. | +/// | [`NUM`](SDL_Keymod::NUM) | [`SDL_KMOD_NUM`] | the Num Lock key (may be located on an extended keypad) is down. | +/// | [`CAPS`](SDL_Keymod::CAPS) | [`SDL_KMOD_CAPS`] | the Caps Lock key is down. | +/// | [`MODE`](SDL_Keymod::MODE) | [`SDL_KMOD_MODE`] | the !AltGr key is down. | +/// | [`SCROLL`](SDL_Keymod::SCROLL) | [`SDL_KMOD_SCROLL`] | the Scroll Lock key is down. | +/// | [`CTRL`](SDL_Keymod::CTRL) | [`SDL_KMOD_CTRL`] | Any Ctrl key is down. | +/// | [`SHIFT`](SDL_Keymod::SHIFT) | [`SDL_KMOD_SHIFT`] | Any Shift key is down. | +/// | [`ALT`](SDL_Keymod::ALT) | [`SDL_KMOD_ALT`] | Any Alt key is down. | +/// | [`GUI`](SDL_Keymod::GUI) | [`SDL_KMOD_GUI`] | Any GUI key is down. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_Keymod(pub Uint16); + +impl ::core::cmp::PartialEq for SDL_Keymod { + #[inline(always)] + fn eq(&self, other: &Uint16) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint16 { + #[inline(always)] + fn eq(&self, other: &SDL_Keymod) -> bool { + self == &other.0 + } +} + +impl From for Uint16 { + #[inline(always)] + fn from(value: SDL_Keymod) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Keymod { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_Keymod(")?; + let all_bits = all_bits | Self::NONE.0; + if (Self::NONE != 0 || self.0 == 0) && *self & Self::NONE == Self::NONE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NONE")?; + } + let all_bits = all_bits | Self::LSHIFT.0; + if (Self::LSHIFT != 0 || self.0 == 0) && *self & Self::LSHIFT == Self::LSHIFT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LSHIFT")?; + } + let all_bits = all_bits | Self::RSHIFT.0; + if (Self::RSHIFT != 0 || self.0 == 0) && *self & Self::RSHIFT == Self::RSHIFT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RSHIFT")?; + } + let all_bits = all_bits | Self::LEVEL5.0; + if (Self::LEVEL5 != 0 || self.0 == 0) && *self & Self::LEVEL5 == Self::LEVEL5 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LEVEL5")?; + } + let all_bits = all_bits | Self::LCTRL.0; + if (Self::LCTRL != 0 || self.0 == 0) && *self & Self::LCTRL == Self::LCTRL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LCTRL")?; + } + let all_bits = all_bits | Self::RCTRL.0; + if (Self::RCTRL != 0 || self.0 == 0) && *self & Self::RCTRL == Self::RCTRL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RCTRL")?; + } + let all_bits = all_bits | Self::LALT.0; + if (Self::LALT != 0 || self.0 == 0) && *self & Self::LALT == Self::LALT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LALT")?; + } + let all_bits = all_bits | Self::RALT.0; + if (Self::RALT != 0 || self.0 == 0) && *self & Self::RALT == Self::RALT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RALT")?; + } + let all_bits = all_bits | Self::LGUI.0; + if (Self::LGUI != 0 || self.0 == 0) && *self & Self::LGUI == Self::LGUI { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LGUI")?; + } + let all_bits = all_bits | Self::RGUI.0; + if (Self::RGUI != 0 || self.0 == 0) && *self & Self::RGUI == Self::RGUI { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RGUI")?; + } + let all_bits = all_bits | Self::NUM.0; + if (Self::NUM != 0 || self.0 == 0) && *self & Self::NUM == Self::NUM { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NUM")?; + } + let all_bits = all_bits | Self::CAPS.0; + if (Self::CAPS != 0 || self.0 == 0) && *self & Self::CAPS == Self::CAPS { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CAPS")?; + } + let all_bits = all_bits | Self::MODE.0; + if (Self::MODE != 0 || self.0 == 0) && *self & Self::MODE == Self::MODE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MODE")?; + } + let all_bits = all_bits | Self::SCROLL.0; + if (Self::SCROLL != 0 || self.0 == 0) && *self & Self::SCROLL == Self::SCROLL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SCROLL")?; + } + let all_bits = all_bits | Self::CTRL.0; + if (Self::CTRL != 0 || self.0 == 0) && *self & Self::CTRL == Self::CTRL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CTRL")?; + } + let all_bits = all_bits | Self::SHIFT.0; + if (Self::SHIFT != 0 || self.0 == 0) && *self & Self::SHIFT == Self::SHIFT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SHIFT")?; + } + let all_bits = all_bits | Self::ALT.0; + if (Self::ALT != 0 || self.0 == 0) && *self & Self::ALT == Self::ALT { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ALT")?; + } + let all_bits = all_bits | Self::GUI.0; + if (Self::GUI != 0 || self.0 == 0) && *self & Self::GUI == Self::GUI { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "GUI")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_Keymod { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_Keymod { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_Keymod { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_Keymod { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_Keymod { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_Keymod { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_Keymod { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_Keymod { + /// no modifier is applicable. + pub const NONE: Self = Self((0x0000 as Uint16)); + /// the left Shift key is down. + pub const LSHIFT: Self = Self((0x0001 as Uint16)); + /// the right Shift key is down. + pub const RSHIFT: Self = Self((0x0002 as Uint16)); + /// the Level 5 Shift key is down. + pub const LEVEL5: Self = Self((0x0004 as Uint16)); + /// the left Ctrl (Control) key is down. + pub const LCTRL: Self = Self((0x0040 as Uint16)); + /// the right Ctrl (Control) key is down. + pub const RCTRL: Self = Self((0x0080 as Uint16)); + /// the left Alt key is down. + pub const LALT: Self = Self((0x0100 as Uint16)); + /// the right Alt key is down. + pub const RALT: Self = Self((0x0200 as Uint16)); + /// the left GUI key (often the Windows key) is down. + pub const LGUI: Self = Self((0x0400 as Uint16)); + /// the right GUI key (often the Windows key) is down. + pub const RGUI: Self = Self((0x0800 as Uint16)); + /// the Num Lock key (may be located on an extended keypad) is down. + pub const NUM: Self = Self((0x1000 as Uint16)); + /// the Caps Lock key is down. + pub const CAPS: Self = Self((0x2000 as Uint16)); + /// the !AltGr key is down. + pub const MODE: Self = Self((0x4000 as Uint16)); + /// the Scroll Lock key is down. + pub const SCROLL: Self = Self((0x8000 as Uint16)); + /// Any Ctrl key is down. + pub const CTRL: Self = Self((SDL_KMOD_LCTRL.0 | SDL_KMOD_RCTRL.0)); + /// Any Shift key is down. + pub const SHIFT: Self = Self((SDL_KMOD_LSHIFT.0 | SDL_KMOD_RSHIFT.0)); + /// Any Alt key is down. + pub const ALT: Self = Self((SDL_KMOD_LALT.0 | SDL_KMOD_RALT.0)); + /// Any GUI key is down. + pub const GUI: Self = Self((SDL_KMOD_LGUI.0 | SDL_KMOD_RGUI.0)); +} + +/// no modifier is applicable. +pub const SDL_KMOD_NONE: SDL_Keymod = SDL_Keymod::NONE; +/// the left Shift key is down. +pub const SDL_KMOD_LSHIFT: SDL_Keymod = SDL_Keymod::LSHIFT; +/// the right Shift key is down. +pub const SDL_KMOD_RSHIFT: SDL_Keymod = SDL_Keymod::RSHIFT; +/// the Level 5 Shift key is down. +pub const SDL_KMOD_LEVEL5: SDL_Keymod = SDL_Keymod::LEVEL5; +/// the left Ctrl (Control) key is down. +pub const SDL_KMOD_LCTRL: SDL_Keymod = SDL_Keymod::LCTRL; +/// the right Ctrl (Control) key is down. +pub const SDL_KMOD_RCTRL: SDL_Keymod = SDL_Keymod::RCTRL; +/// the left Alt key is down. +pub const SDL_KMOD_LALT: SDL_Keymod = SDL_Keymod::LALT; +/// the right Alt key is down. +pub const SDL_KMOD_RALT: SDL_Keymod = SDL_Keymod::RALT; +/// the left GUI key (often the Windows key) is down. +pub const SDL_KMOD_LGUI: SDL_Keymod = SDL_Keymod::LGUI; +/// the right GUI key (often the Windows key) is down. +pub const SDL_KMOD_RGUI: SDL_Keymod = SDL_Keymod::RGUI; +/// the Num Lock key (may be located on an extended keypad) is down. +pub const SDL_KMOD_NUM: SDL_Keymod = SDL_Keymod::NUM; +/// the Caps Lock key is down. +pub const SDL_KMOD_CAPS: SDL_Keymod = SDL_Keymod::CAPS; +/// the !AltGr key is down. +pub const SDL_KMOD_MODE: SDL_Keymod = SDL_Keymod::MODE; +/// the Scroll Lock key is down. +pub const SDL_KMOD_SCROLL: SDL_Keymod = SDL_Keymod::SCROLL; +/// Any Ctrl key is down. +pub const SDL_KMOD_CTRL: SDL_Keymod = SDL_Keymod::CTRL; +/// Any Shift key is down. +pub const SDL_KMOD_SHIFT: SDL_Keymod = SDL_Keymod::SHIFT; +/// Any Alt key is down. +pub const SDL_KMOD_ALT: SDL_Keymod = SDL_Keymod::ALT; +/// Any GUI key is down. +pub const SDL_KMOD_GUI: SDL_Keymod = SDL_Keymod::GUI; + +impl SDL_Keymod { + /// Initialize a `SDL_Keymod` from a raw value. + #[inline(always)] + pub const fn new(value: Uint16) -> Self { + Self(value) + } +} + +impl SDL_Keymod { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint16 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Keymod { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::keycode::METADATA_SDL_Keymod; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/loadso.rs b/vendor/sdl3-sys/src/generated/loadso.rs new file mode 100644 index 00000000..b30cf4d6 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/loadso.rs @@ -0,0 +1,127 @@ +//! System-dependent library loading routines. +//! +//! Shared objects are code that is programmatically loadable at runtime. +//! Windows calls these "DLLs", Linux calls them "shared libraries", etc. +//! +//! To use them, build such a library, then call [`SDL_LoadObject()`] on it. Once +//! loaded, you can use [`SDL_LoadFunction()`] on that object to find the address +//! of its exported symbols. When done with the object, call [`SDL_UnloadObject()`] +//! to dispose of it. +//! +//! Some things to keep in mind: +//! +//! - These functions only work on C function names. Other languages may have +//! name mangling and intrinsic language support that varies from compiler to +//! compiler. +//! - Make sure you declare your function pointers with the same calling +//! convention as the actual library function. Your code will crash +//! mysteriously if you do not do this. +//! - Avoid namespace collisions. If you load a symbol from the library, it is +//! not defined whether or not it goes into the global symbol namespace for +//! the application. If it does and it conflicts with symbols in your code or +//! other shared libraries, you will not get the results you expect. :) +//! - Once a library is unloaded, all pointers into it obtained through +//! [`SDL_LoadFunction()`] become invalid, even if the library is later reloaded. +//! Don't unload a library if you plan to use these pointers in the future. +//! Notably: beware of giving one of these pointers to atexit(), since it may +//! call that pointer after the library unloads. + +use super::stdinc::*; + +use super::error::*; + +unsafe extern "C" { + /// Dynamically load a shared object. + /// + /// ## Parameters + /// - `sofile`: a system-dependent name of the object file. + /// + /// ## Return value + /// Returns an opaque pointer to the object handle or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadFunction`] + /// - [`SDL_UnloadObject`] + pub fn SDL_LoadObject(sofile: *const ::core::ffi::c_char) -> *mut SDL_SharedObject; +} + +unsafe extern "C" { + /// Look up the address of the named function in a shared object. + /// + /// This function pointer is no longer valid after calling [`SDL_UnloadObject()`]. + /// + /// This function can only look up C function names. Other languages may have + /// name mangling and intrinsic language support that varies from compiler to + /// compiler. + /// + /// Make sure you declare your function pointers with the same calling + /// convention as the actual library function. Your code will crash + /// mysteriously if you do not do this. + /// + /// If the requested function doesn't exist, NULL is returned. + /// + /// ## Parameters + /// - `handle`: a valid shared object handle returned by [`SDL_LoadObject()`]. + /// - `name`: the name of the function to look up. + /// + /// ## Return value + /// Returns a pointer to the function or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadObject`] + pub fn SDL_LoadFunction( + handle: *mut SDL_SharedObject, + name: *const ::core::ffi::c_char, + ) -> SDL_FunctionPointer; +} + +unsafe extern "C" { + /// Unload a shared object from memory. + /// + /// Note that any pointers from this object looked up through + /// [`SDL_LoadFunction()`] will no longer be valid. + /// + /// ## Parameters + /// - `handle`: a valid shared object handle returned by [`SDL_LoadObject()`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadObject`] + pub fn SDL_UnloadObject(handle: *mut SDL_SharedObject); +} + +/// An opaque datatype that represents a loaded shared object. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_LoadObject`] +/// - [`SDL_LoadFunction`] +/// - [`SDL_UnloadObject`] +#[repr(C)] +pub struct SDL_SharedObject { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/locale.rs b/vendor/sdl3-sys/src/generated/locale.rs new file mode 100644 index 00000000..cceb1c20 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/locale.rs @@ -0,0 +1,94 @@ +//! SDL locale services. +//! +//! This provides a way to get a list of preferred locales (language plus +//! country) for the user. There is exactly one function: +//! [`SDL_GetPreferredLocales()`], which handles all the heavy lifting, and offers +//! documentation on all the strange ways humans might have configured their +//! language settings. + +use super::stdinc::*; + +use super::error::*; + +/// A struct to provide locale data. +/// +/// Locale data is split into a spoken language, like English, and an optional +/// country, like Canada. The language will be in ISO-639 format (so English +/// would be "en"), and the country, if not NULL, will be an ISO-3166 country +/// code (so Canada would be "CA"). +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetPreferredLocales`] +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Locale { + /// A language name, like "en" for English. + pub language: *const ::core::ffi::c_char, + /// A country, like "US" for America. Can be NULL. + pub country: *const ::core::ffi::c_char, +} + +impl ::core::default::Default for SDL_Locale { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Report the user's preferred locale. + /// + /// Returned language strings are in the format xx, where 'xx' is an ISO-639 + /// language specifier (such as "en" for English, "de" for German, etc). + /// Country strings are in the format YY, where "YY" is an ISO-3166 country + /// code (such as "US" for the United States, "CA" for Canada, etc). Country + /// might be NULL if there's no specific guidance on them (so you might get { + /// "en", "US" } for American English, but { "en", NULL } means "English + /// language, generically"). Language strings are never NULL, except to + /// terminate the array. + /// + /// Please note that not all of these strings are 2 characters; some are three + /// or more. + /// + /// The returned list of locales are in the order of the user's preference. For + /// example, a German citizen that is fluent in US English and knows enough + /// Japanese to navigate around Tokyo might have a list like: { "de", "en_US", + /// "jp", NULL }. Someone from England might prefer British English (where + /// "color" is spelled "colour", etc), but will settle for anything like it: { + /// "en_GB", "en", NULL }. + /// + /// This function returns NULL on error, including when the platform does not + /// supply this information at all. + /// + /// This might be a "slow" call that has to query the operating system. It's + /// best to ask for this once and save the results. However, this list can + /// change, usually because the user has changed a system preference outside of + /// your program; SDL will send an [`SDL_EVENT_LOCALE_CHANGED`] event in this case, + /// if possible, and you can call this function again to get an updated copy of + /// preferred locales. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of locales returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a NULL terminated array of locale pointers, or NULL on failure; + /// call [`SDL_GetError()`] for more information. This is a single + /// allocation that should be freed with [`SDL_free()`] when it is no + /// longer needed. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetPreferredLocales(count: *mut ::core::ffi::c_int) -> *mut *mut SDL_Locale; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/log.rs b/vendor/sdl3-sys/src/generated/log.rs new file mode 100644 index 00000000..1415fdda --- /dev/null +++ b/vendor/sdl3-sys/src/generated/log.rs @@ -0,0 +1,795 @@ +//! Simple log messages with priorities and categories. A message's +//! [`SDL_LogPriority`] signifies how important the message is. A message's +//! [`SDL_LogCategory`] signifies from what domain it belongs to. Every category +//! has a minimum priority specified: when a message belongs to that category, +//! it will only be sent out if it has that minimum priority or higher. +//! +//! SDL's own logs are sent below the default priority threshold, so they are +//! quiet by default. +//! +//! You can change the log verbosity programmatically using +//! [`SDL_SetLogPriority()`] or with SDL_SetHint([`SDL_HINT_LOGGING`], ...), or with +//! the "SDL_LOGGING" environment variable. This variable is a comma separated +//! set of category=level tokens that define the default logging levels for SDL +//! applications. +//! +//! The category can be a numeric category, one of "app", "error", "assert", +//! "system", "audio", "video", "render", "input", "test", or `*` for any +//! unspecified category. +//! +//! The level can be a numeric level, one of "trace", "verbose", "debug", +//! "info", "warn", "error", "critical", or "quiet" to disable that category. +//! +//! You can omit the category if you want to set the logging level for all +//! categories. +//! +//! If this hint isn't set, the default log levels are equivalent to: +//! +//! `app=info,assert=warn,test=verbose,*=error` +//! +//! Here's where the messages go on different platforms: +//! +//! - Windows: debug output stream +//! - Android: log output +//! - Others: standard error output (stderr) +//! +//! You don't need to have a newline (`\n`) on the end of messages, the +//! functions will do that for you. For consistent behavior cross-platform, you +//! shouldn't have any newlines in messages, such as to log multiple lines in +//! one call; unusual platform-specific behavior can be observed in such usage. +//! Do one log call per line instead, with no newlines in messages. +//! +//! Each log call is atomic, so you won't see log messages cut off one another +//! when logging from multiple threads. + +use super::stdinc::*; + +/// The predefined log categories +/// +/// By default the application and gpu categories are enabled at the INFO +/// level, the assert category is enabled at the WARN level, test is enabled at +/// the VERBOSE level and all other categories are enabled at the ERROR level. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`APPLICATION`](SDL_LogCategory::APPLICATION) | [`SDL_LOG_CATEGORY_APPLICATION`] | | +/// | [`ERROR`](SDL_LogCategory::ERROR) | [`SDL_LOG_CATEGORY_ERROR`] | | +/// | [`ASSERT`](SDL_LogCategory::ASSERT) | [`SDL_LOG_CATEGORY_ASSERT`] | | +/// | [`SYSTEM`](SDL_LogCategory::SYSTEM) | [`SDL_LOG_CATEGORY_SYSTEM`] | | +/// | [`AUDIO`](SDL_LogCategory::AUDIO) | [`SDL_LOG_CATEGORY_AUDIO`] | | +/// | [`VIDEO`](SDL_LogCategory::VIDEO) | [`SDL_LOG_CATEGORY_VIDEO`] | | +/// | [`RENDER`](SDL_LogCategory::RENDER) | [`SDL_LOG_CATEGORY_RENDER`] | | +/// | [`INPUT`](SDL_LogCategory::INPUT) | [`SDL_LOG_CATEGORY_INPUT`] | | +/// | [`TEST`](SDL_LogCategory::TEST) | [`SDL_LOG_CATEGORY_TEST`] | | +/// | [`GPU`](SDL_LogCategory::GPU) | [`SDL_LOG_CATEGORY_GPU`] | | +/// | [`RESERVED2`](SDL_LogCategory::RESERVED2) | [`SDL_LOG_CATEGORY_RESERVED2`] | | +/// | [`RESERVED3`](SDL_LogCategory::RESERVED3) | [`SDL_LOG_CATEGORY_RESERVED3`] | | +/// | [`RESERVED4`](SDL_LogCategory::RESERVED4) | [`SDL_LOG_CATEGORY_RESERVED4`] | | +/// | [`RESERVED5`](SDL_LogCategory::RESERVED5) | [`SDL_LOG_CATEGORY_RESERVED5`] | | +/// | [`RESERVED6`](SDL_LogCategory::RESERVED6) | [`SDL_LOG_CATEGORY_RESERVED6`] | | +/// | [`RESERVED7`](SDL_LogCategory::RESERVED7) | [`SDL_LOG_CATEGORY_RESERVED7`] | | +/// | [`RESERVED8`](SDL_LogCategory::RESERVED8) | [`SDL_LOG_CATEGORY_RESERVED8`] | | +/// | [`RESERVED9`](SDL_LogCategory::RESERVED9) | [`SDL_LOG_CATEGORY_RESERVED9`] | | +/// | [`RESERVED10`](SDL_LogCategory::RESERVED10) | [`SDL_LOG_CATEGORY_RESERVED10`] | | +/// | [`CUSTOM`](SDL_LogCategory::CUSTOM) | [`SDL_LOG_CATEGORY_CUSTOM`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_LogCategory(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_LogCategory { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_LogCategory) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_LogCategory) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_LogCategory { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::APPLICATION => "SDL_LOG_CATEGORY_APPLICATION", + Self::ERROR => "SDL_LOG_CATEGORY_ERROR", + Self::ASSERT => "SDL_LOG_CATEGORY_ASSERT", + Self::SYSTEM => "SDL_LOG_CATEGORY_SYSTEM", + Self::AUDIO => "SDL_LOG_CATEGORY_AUDIO", + Self::VIDEO => "SDL_LOG_CATEGORY_VIDEO", + Self::RENDER => "SDL_LOG_CATEGORY_RENDER", + Self::INPUT => "SDL_LOG_CATEGORY_INPUT", + Self::TEST => "SDL_LOG_CATEGORY_TEST", + Self::GPU => "SDL_LOG_CATEGORY_GPU", + Self::RESERVED2 => "SDL_LOG_CATEGORY_RESERVED2", + Self::RESERVED3 => "SDL_LOG_CATEGORY_RESERVED3", + Self::RESERVED4 => "SDL_LOG_CATEGORY_RESERVED4", + Self::RESERVED5 => "SDL_LOG_CATEGORY_RESERVED5", + Self::RESERVED6 => "SDL_LOG_CATEGORY_RESERVED6", + Self::RESERVED7 => "SDL_LOG_CATEGORY_RESERVED7", + Self::RESERVED8 => "SDL_LOG_CATEGORY_RESERVED8", + Self::RESERVED9 => "SDL_LOG_CATEGORY_RESERVED9", + Self::RESERVED10 => "SDL_LOG_CATEGORY_RESERVED10", + Self::CUSTOM => "SDL_LOG_CATEGORY_CUSTOM", + + _ => return write!(f, "SDL_LogCategory({})", self.0), + }) + } +} + +impl SDL_LogCategory { + pub const APPLICATION: Self = Self((0 as ::core::ffi::c_int)); + pub const ERROR: Self = Self((1 as ::core::ffi::c_int)); + pub const ASSERT: Self = Self((2 as ::core::ffi::c_int)); + pub const SYSTEM: Self = Self((3 as ::core::ffi::c_int)); + pub const AUDIO: Self = Self((4 as ::core::ffi::c_int)); + pub const VIDEO: Self = Self((5 as ::core::ffi::c_int)); + pub const RENDER: Self = Self((6 as ::core::ffi::c_int)); + pub const INPUT: Self = Self((7 as ::core::ffi::c_int)); + pub const TEST: Self = Self((8 as ::core::ffi::c_int)); + pub const GPU: Self = Self((9 as ::core::ffi::c_int)); + pub const RESERVED2: Self = Self((10 as ::core::ffi::c_int)); + pub const RESERVED3: Self = Self((11 as ::core::ffi::c_int)); + pub const RESERVED4: Self = Self((12 as ::core::ffi::c_int)); + pub const RESERVED5: Self = Self((13 as ::core::ffi::c_int)); + pub const RESERVED6: Self = Self((14 as ::core::ffi::c_int)); + pub const RESERVED7: Self = Self((15 as ::core::ffi::c_int)); + pub const RESERVED8: Self = Self((16 as ::core::ffi::c_int)); + pub const RESERVED9: Self = Self((17 as ::core::ffi::c_int)); + pub const RESERVED10: Self = Self((18 as ::core::ffi::c_int)); + pub const CUSTOM: Self = Self((19 as ::core::ffi::c_int)); +} + +pub const SDL_LOG_CATEGORY_APPLICATION: SDL_LogCategory = SDL_LogCategory::APPLICATION; +pub const SDL_LOG_CATEGORY_ERROR: SDL_LogCategory = SDL_LogCategory::ERROR; +pub const SDL_LOG_CATEGORY_ASSERT: SDL_LogCategory = SDL_LogCategory::ASSERT; +pub const SDL_LOG_CATEGORY_SYSTEM: SDL_LogCategory = SDL_LogCategory::SYSTEM; +pub const SDL_LOG_CATEGORY_AUDIO: SDL_LogCategory = SDL_LogCategory::AUDIO; +pub const SDL_LOG_CATEGORY_VIDEO: SDL_LogCategory = SDL_LogCategory::VIDEO; +pub const SDL_LOG_CATEGORY_RENDER: SDL_LogCategory = SDL_LogCategory::RENDER; +pub const SDL_LOG_CATEGORY_INPUT: SDL_LogCategory = SDL_LogCategory::INPUT; +pub const SDL_LOG_CATEGORY_TEST: SDL_LogCategory = SDL_LogCategory::TEST; +pub const SDL_LOG_CATEGORY_GPU: SDL_LogCategory = SDL_LogCategory::GPU; +pub const SDL_LOG_CATEGORY_RESERVED2: SDL_LogCategory = SDL_LogCategory::RESERVED2; +pub const SDL_LOG_CATEGORY_RESERVED3: SDL_LogCategory = SDL_LogCategory::RESERVED3; +pub const SDL_LOG_CATEGORY_RESERVED4: SDL_LogCategory = SDL_LogCategory::RESERVED4; +pub const SDL_LOG_CATEGORY_RESERVED5: SDL_LogCategory = SDL_LogCategory::RESERVED5; +pub const SDL_LOG_CATEGORY_RESERVED6: SDL_LogCategory = SDL_LogCategory::RESERVED6; +pub const SDL_LOG_CATEGORY_RESERVED7: SDL_LogCategory = SDL_LogCategory::RESERVED7; +pub const SDL_LOG_CATEGORY_RESERVED8: SDL_LogCategory = SDL_LogCategory::RESERVED8; +pub const SDL_LOG_CATEGORY_RESERVED9: SDL_LogCategory = SDL_LogCategory::RESERVED9; +pub const SDL_LOG_CATEGORY_RESERVED10: SDL_LogCategory = SDL_LogCategory::RESERVED10; +pub const SDL_LOG_CATEGORY_CUSTOM: SDL_LogCategory = SDL_LogCategory::CUSTOM; + +impl SDL_LogCategory { + /// Initialize a `SDL_LogCategory` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_LogCategory { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_LogCategory { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::log::METADATA_SDL_LogCategory; +} + +/// The predefined log priorities +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_LogPriority::INVALID) | [`SDL_LOG_PRIORITY_INVALID`] | | +/// | [`TRACE`](SDL_LogPriority::TRACE) | [`SDL_LOG_PRIORITY_TRACE`] | | +/// | [`VERBOSE`](SDL_LogPriority::VERBOSE) | [`SDL_LOG_PRIORITY_VERBOSE`] | | +/// | [`DEBUG`](SDL_LogPriority::DEBUG) | [`SDL_LOG_PRIORITY_DEBUG`] | | +/// | [`INFO`](SDL_LogPriority::INFO) | [`SDL_LOG_PRIORITY_INFO`] | | +/// | [`WARN`](SDL_LogPriority::WARN) | [`SDL_LOG_PRIORITY_WARN`] | | +/// | [`ERROR`](SDL_LogPriority::ERROR) | [`SDL_LOG_PRIORITY_ERROR`] | | +/// | [`CRITICAL`](SDL_LogPriority::CRITICAL) | [`SDL_LOG_PRIORITY_CRITICAL`] | | +/// | [`COUNT`](SDL_LogPriority::COUNT) | [`SDL_LOG_PRIORITY_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_LogPriority(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_LogPriority { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_LogPriority) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_LogPriority) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_LogPriority { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_LOG_PRIORITY_INVALID", + Self::TRACE => "SDL_LOG_PRIORITY_TRACE", + Self::VERBOSE => "SDL_LOG_PRIORITY_VERBOSE", + Self::DEBUG => "SDL_LOG_PRIORITY_DEBUG", + Self::INFO => "SDL_LOG_PRIORITY_INFO", + Self::WARN => "SDL_LOG_PRIORITY_WARN", + Self::ERROR => "SDL_LOG_PRIORITY_ERROR", + Self::CRITICAL => "SDL_LOG_PRIORITY_CRITICAL", + Self::COUNT => "SDL_LOG_PRIORITY_COUNT", + + _ => return write!(f, "SDL_LogPriority({})", self.0), + }) + } +} + +impl SDL_LogPriority { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + pub const TRACE: Self = Self((1 as ::core::ffi::c_int)); + pub const VERBOSE: Self = Self((2 as ::core::ffi::c_int)); + pub const DEBUG: Self = Self((3 as ::core::ffi::c_int)); + pub const INFO: Self = Self((4 as ::core::ffi::c_int)); + pub const WARN: Self = Self((5 as ::core::ffi::c_int)); + pub const ERROR: Self = Self((6 as ::core::ffi::c_int)); + pub const CRITICAL: Self = Self((7 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((8 as ::core::ffi::c_int)); +} + +pub const SDL_LOG_PRIORITY_INVALID: SDL_LogPriority = SDL_LogPriority::INVALID; +pub const SDL_LOG_PRIORITY_TRACE: SDL_LogPriority = SDL_LogPriority::TRACE; +pub const SDL_LOG_PRIORITY_VERBOSE: SDL_LogPriority = SDL_LogPriority::VERBOSE; +pub const SDL_LOG_PRIORITY_DEBUG: SDL_LogPriority = SDL_LogPriority::DEBUG; +pub const SDL_LOG_PRIORITY_INFO: SDL_LogPriority = SDL_LogPriority::INFO; +pub const SDL_LOG_PRIORITY_WARN: SDL_LogPriority = SDL_LogPriority::WARN; +pub const SDL_LOG_PRIORITY_ERROR: SDL_LogPriority = SDL_LogPriority::ERROR; +pub const SDL_LOG_PRIORITY_CRITICAL: SDL_LogPriority = SDL_LogPriority::CRITICAL; +pub const SDL_LOG_PRIORITY_COUNT: SDL_LogPriority = SDL_LogPriority::COUNT; + +impl SDL_LogPriority { + /// Initialize a `SDL_LogPriority` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_LogPriority { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_LogPriority { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::log::METADATA_SDL_LogPriority; +} + +unsafe extern "C" { + /// Set the priority of all log categories. + /// + /// ## Parameters + /// - `priority`: the [`SDL_LogPriority`] to assign. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ResetLogPriorities`] + /// - [`SDL_SetLogPriority`] + pub fn SDL_SetLogPriorities(priority: SDL_LogPriority); +} + +unsafe extern "C" { + /// Set the priority of a particular log category. + /// + /// ## Parameters + /// - `category`: the category to assign a priority to. + /// - `priority`: the [`SDL_LogPriority`] to assign. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetLogPriority`] + /// - [`SDL_ResetLogPriorities`] + /// - [`SDL_SetLogPriorities`] + pub fn SDL_SetLogPriority(category: ::core::ffi::c_int, priority: SDL_LogPriority); +} + +unsafe extern "C" { + /// Get the priority of a particular log category. + /// + /// ## Parameters + /// - `category`: the category to query. + /// + /// ## Return value + /// Returns the [`SDL_LogPriority`] for the requested category. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetLogPriority`] + pub fn SDL_GetLogPriority(category: ::core::ffi::c_int) -> SDL_LogPriority; +} + +unsafe extern "C" { + /// Reset all priorities to default. + /// + /// This is called by [`SDL_Quit()`]. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetLogPriorities`] + /// - [`SDL_SetLogPriority`] + pub fn SDL_ResetLogPriorities(); +} + +unsafe extern "C" { + /// Set the text prepended to log messages of a given priority. + /// + /// By default [`SDL_LOG_PRIORITY_INFO`] and below have no prefix, and + /// [`SDL_LOG_PRIORITY_WARN`] and higher have a prefix showing their priority, e.g. + /// "WARNING: ". + /// + /// This function makes a copy of its string argument, **prefix**, so it is not + /// necessary to keep the value of **prefix** alive after the call returns. + /// + /// ## Parameters + /// - `priority`: the [`SDL_LogPriority`] to modify. + /// - `prefix`: the prefix to use for that log priority, or NULL to use no + /// prefix. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetLogPriorities`] + /// - [`SDL_SetLogPriority`] + pub fn SDL_SetLogPriorityPrefix( + priority: SDL_LogPriority, + prefix: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_CATEGORY_APPLICATION`] and [`SDL_LOG_PRIORITY_INFO`]. + /// + /// ## Parameters + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the `fmt` string, if + /// any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_Log(fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_TRACE`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogTrace(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_VERBOSE`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogVerbose(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_DEBUG`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogDebug(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_INFO`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogInfo(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_WARN`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + pub fn SDL_LogWarn(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_ERROR`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogError(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with [`SDL_LOG_PRIORITY_CRITICAL`]. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogCritical(category: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...); +} + +unsafe extern "C" { + /// Log a message with the specified category and priority. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `priority`: the priority of the message. + /// - `fmt`: a printf() style message format string. + /// - `...`: additional parameters matching % tokens in the **fmt** string, + /// if any. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessageV`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogMessage( + category: ::core::ffi::c_int, + priority: SDL_LogPriority, + fmt: *const ::core::ffi::c_char, + ... + ); +} + +unsafe extern "C" { + /// Log a message with the specified category and priority. + /// + /// ## Parameters + /// - `category`: the category of the message. + /// - `priority`: the priority of the message. + /// - `fmt`: a printf() style message format string. + /// - `ap`: a variable argument list. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Log`] + /// - [`SDL_LogCritical`] + /// - [`SDL_LogDebug`] + /// - [`SDL_LogError`] + /// - [`SDL_LogInfo`] + /// - [`SDL_LogMessage`] + /// - [`SDL_LogTrace`] + /// - [`SDL_LogVerbose`] + /// - [`SDL_LogWarn`] + pub fn SDL_LogMessageV( + category: ::core::ffi::c_int, + priority: SDL_LogPriority, + fmt: *const ::core::ffi::c_char, + ap: crate::ffi::VaList, + ); +} + +/// The prototype for the log output callback function. +/// +/// This function is called by SDL when there is new text to be logged. A mutex +/// is held so that this function is never called by more than one thread at +/// once. +/// +/// ## Parameters +/// - `userdata`: what was passed as `userdata` to +/// [`SDL_SetLogOutputFunction()`]. +/// - `category`: the category of the message. +/// - `priority`: the priority of the message. +/// - `message`: the message being output. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_LogOutputFunction = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + category: ::core::ffi::c_int, + priority: SDL_LogPriority, + message: *const ::core::ffi::c_char, + ), +>; + +unsafe extern "C" { + /// Get the default log output function. + /// + /// ## Return value + /// Returns the default log output callback. It should be called with NULL for + /// the userdata argument. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetLogOutputFunction`] + /// - [`SDL_GetLogOutputFunction`] + pub fn SDL_GetDefaultLogOutputFunction() -> SDL_LogOutputFunction; +} + +unsafe extern "C" { + /// Get the current log output function. + /// + /// ## Parameters + /// - `callback`: an [`SDL_LogOutputFunction`] filled in with the current log + /// callback. + /// - `userdata`: a pointer filled in with the pointer that is passed to + /// `callback`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDefaultLogOutputFunction`] + /// - [`SDL_SetLogOutputFunction`] + pub fn SDL_GetLogOutputFunction( + callback: *mut SDL_LogOutputFunction, + userdata: *mut *mut ::core::ffi::c_void, + ); +} + +unsafe extern "C" { + /// Replace the default log output function with one of your own. + /// + /// ## Parameters + /// - `callback`: an [`SDL_LogOutputFunction`] to call instead of the default. + /// - `userdata`: a pointer that is passed to `callback`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDefaultLogOutputFunction`] + /// - [`SDL_GetLogOutputFunction`] + pub fn SDL_SetLogOutputFunction( + callback: SDL_LogOutputFunction, + userdata: *mut ::core::ffi::c_void, + ); +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/main.rs b/vendor/sdl3-sys/src/generated/main.rs new file mode 100644 index 00000000..a9bc7b4d --- /dev/null +++ b/vendor/sdl3-sys/src/generated/main.rs @@ -0,0 +1,525 @@ +//! Redefine main() if necessary so that it is called by SDL. +//! +//! In order to make this consistent on all platforms, the application's main() +//! should look like this: +//! +//! ```c +//! #include +//! #include +//! +//! int main(int argc, char *argv[]) +//! { +//! } +//! ``` +//! +//! SDL will take care of platform specific details on how it gets called. +//! +//! This is also where an app can be configured to use the main callbacks, via +//! the SDL_MAIN_USE_CALLBACKS macro. +//! +//! SDL_main.h is a "single-header library," which is to say that including +//! this header inserts code into your program, and you should only include it +//! once in most cases. SDL.h does not include this header automatically. +//! +//! For more information, see: +//! +//! + +use super::stdinc::*; + +use super::error::*; + +use super::events::*; + +apply_cfg!(#[cfg(doc)] => { + /// Inform SDL that the app is providing an entry point instead of SDL. + /// + /// SDL does not define this macro, but will check if it is defined when + /// including `SDL_main.h`. If defined, SDL will expect the app to provide the + /// proper entry point for the platform, and all the other magic details + /// needed, like manually calling [`SDL_SetMainReady`]. + /// + /// Please see [README-main-functions](README-main-functions), (or + /// docs/README-main-functions.md in the source tree) for a more detailed + /// explanation. + /// + /// ## Availability + /// This macro is used by the headers since SDL 3.2.0. + pub const SDL_MAIN_HANDLED: ::core::primitive::i32 = 1; + +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +use super::init::*; + +unsafe extern "C" { + /// App-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps. + /// + /// Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a + /// standard "main" function, you should not supply this. + /// + /// This function is called by SDL once, at startup. The function should + /// initialize whatever is necessary, possibly create windows and open audio + /// devices, etc. The `argc` and `argv` parameters work like they would with a + /// standard "main" function. + /// + /// This function should not go into an infinite mainloop; it should do any + /// one-time setup it requires and then return. + /// + /// The app may optionally assign a pointer to `*appstate`. This pointer will + /// be provided on every future call to the other entry points, to allow + /// application state to be preserved between functions without the app needing + /// to use a global variable. If this isn't set, the pointer will be NULL in + /// future entry points. + /// + /// If this function returns [`SDL_APP_CONTINUE`], the app will proceed to normal + /// operation, and will begin receiving repeated calls to [`SDL_AppIterate`] and + /// [`SDL_AppEvent`] for the life of the program. If this function returns + /// [`SDL_APP_FAILURE`], SDL will call [`SDL_AppQuit`] and terminate the process with + /// an exit code that reports an error to the platform. If it returns + /// [`SDL_APP_SUCCESS`], SDL calls [`SDL_AppQuit`] and terminates with an exit code + /// that reports success to the platform. + /// + /// This function is called by SDL on the main thread. + /// + /// ## Parameters + /// - `appstate`: a place where the app can optionally store a pointer for + /// future use. + /// - `argc`: the standard ANSI C main's argc; number of elements in `argv`. + /// - `argv`: the standard ANSI C main's argv; array of command line + /// arguments. + /// + /// ## Return value + /// Returns [`SDL_APP_FAILURE`] to terminate with an error, [`SDL_APP_SUCCESS`] to + /// terminate with success, [`SDL_APP_CONTINUE`] to continue. + /// + /// ## Thread safety + /// This function is called once by SDL, at startup, on a single + /// thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AppIterate`] + /// - [`SDL_AppEvent`] + /// - [`SDL_AppQuit`] + pub fn SDL_AppInit( + appstate: *mut *mut ::core::ffi::c_void, + argc: ::core::ffi::c_int, + argv: *mut *mut ::core::ffi::c_char, + ) -> SDL_AppResult; +} + +unsafe extern "C" { + /// App-implemented iteration entry point for SDL_MAIN_USE_CALLBACKS apps. + /// + /// Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a + /// standard "main" function, you should not supply this. + /// + /// This function is called repeatedly by SDL after [`SDL_AppInit`] returns + /// [`SDL_APP_CONTINUE`]. The function should operate as a single iteration the + /// program's primary loop; it should update whatever state it needs and draw a + /// new frame of video, usually. + /// + /// On some platforms, this function will be called at the refresh rate of the + /// display (which might change during the life of your app!). There are no + /// promises made about what frequency this function might run at. You should + /// use SDL's timer functions if you need to see how much time has passed since + /// the last iteration. + /// + /// There is no need to process the SDL event queue during this function; SDL + /// will send events as they arrive in [`SDL_AppEvent`], and in most cases the + /// event queue will be empty when this function runs anyhow. + /// + /// This function should not go into an infinite mainloop; it should do one + /// iteration of whatever the program does and return. + /// + /// The `appstate` parameter is an optional pointer provided by the app during + /// [`SDL_AppInit()`]. If the app never provided a pointer, this will be NULL. + /// + /// If this function returns [`SDL_APP_CONTINUE`], the app will continue normal + /// operation, receiving repeated calls to [`SDL_AppIterate`] and [`SDL_AppEvent`] for + /// the life of the program. If this function returns [`SDL_APP_FAILURE`], SDL will + /// call [`SDL_AppQuit`] and terminate the process with an exit code that reports + /// an error to the platform. If it returns [`SDL_APP_SUCCESS`], SDL calls + /// [`SDL_AppQuit`] and terminates with an exit code that reports success to the + /// platform. + /// + /// This function is called by SDL on the main thread. + /// + /// ## Parameters + /// - `appstate`: an optional pointer, provided by the app in [`SDL_AppInit`]. + /// + /// ## Return value + /// Returns [`SDL_APP_FAILURE`] to terminate with an error, [`SDL_APP_SUCCESS`] to + /// terminate with success, [`SDL_APP_CONTINUE`] to continue. + /// + /// ## Thread safety + /// This function may get called concurrently with [`SDL_AppEvent()`] + /// for events not pushed on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AppInit`] + /// - [`SDL_AppEvent`] + pub fn SDL_AppIterate(appstate: *mut ::core::ffi::c_void) -> SDL_AppResult; +} + +unsafe extern "C" { + /// App-implemented event entry point for SDL_MAIN_USE_CALLBACKS apps. + /// + /// Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a + /// standard "main" function, you should not supply this. + /// + /// This function is called as needed by SDL after [`SDL_AppInit`] returns + /// [`SDL_APP_CONTINUE`]. It is called once for each new event. + /// + /// There is (currently) no guarantee about what thread this will be called + /// from; whatever thread pushes an event onto SDL's queue will trigger this + /// function. SDL is responsible for pumping the event queue between each call + /// to [`SDL_AppIterate`], so in normal operation one should only get events in a + /// serial fashion, but be careful if you have a thread that explicitly calls + /// [`SDL_PushEvent`]. SDL itself will push events to the queue on the main thread. + /// + /// Events sent to this function are not owned by the app; if you need to save + /// the data, you should copy it. + /// + /// This function should not go into an infinite mainloop; it should handle the + /// provided event appropriately and return. + /// + /// The `appstate` parameter is an optional pointer provided by the app during + /// [`SDL_AppInit()`]. If the app never provided a pointer, this will be NULL. + /// + /// If this function returns [`SDL_APP_CONTINUE`], the app will continue normal + /// operation, receiving repeated calls to [`SDL_AppIterate`] and [`SDL_AppEvent`] for + /// the life of the program. If this function returns [`SDL_APP_FAILURE`], SDL will + /// call [`SDL_AppQuit`] and terminate the process with an exit code that reports + /// an error to the platform. If it returns [`SDL_APP_SUCCESS`], SDL calls + /// [`SDL_AppQuit`] and terminates with an exit code that reports success to the + /// platform. + /// + /// ## Parameters + /// - `appstate`: an optional pointer, provided by the app in [`SDL_AppInit`]. + /// - `event`: the new event for the app to examine. + /// + /// ## Return value + /// Returns [`SDL_APP_FAILURE`] to terminate with an error, [`SDL_APP_SUCCESS`] to + /// terminate with success, [`SDL_APP_CONTINUE`] to continue. + /// + /// ## Thread safety + /// This function may get called concurrently with + /// [`SDL_AppIterate()`] or [`SDL_AppQuit()`] for events not pushed from + /// the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AppInit`] + /// - [`SDL_AppIterate`] + pub fn SDL_AppEvent(appstate: *mut ::core::ffi::c_void, event: *mut SDL_Event) + -> SDL_AppResult; +} + +unsafe extern "C" { + /// App-implemented deinit entry point for SDL_MAIN_USE_CALLBACKS apps. + /// + /// Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a + /// standard "main" function, you should not supply this. + /// + /// This function is called once by SDL before terminating the program. + /// + /// This function will be called in all cases, even if [`SDL_AppInit`] requests + /// termination at startup. + /// + /// This function should not go into an infinite mainloop; it should + /// deinitialize any resources necessary, perform whatever shutdown activities, + /// and return. + /// + /// You do not need to call [`SDL_Quit()`] in this function, as SDL will call it + /// after this function returns and before the process terminates, but it is + /// safe to do so. + /// + /// The `appstate` parameter is an optional pointer provided by the app during + /// [`SDL_AppInit()`]. If the app never provided a pointer, this will be NULL. This + /// function call is the last time this pointer will be provided, so any + /// resources to it should be cleaned up here. + /// + /// This function is called by SDL on the main thread. + /// + /// ## Parameters + /// - `appstate`: an optional pointer, provided by the app in [`SDL_AppInit`]. + /// - `result`: the result code that terminated the app (success or failure). + /// + /// ## Thread safety + /// [`SDL_AppEvent()`] may get called concurrently with this function + /// if other threads that push events are still active. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AppInit`] + pub fn SDL_AppQuit(appstate: *mut ::core::ffi::c_void, result: SDL_AppResult); +} + +/// The prototype for the application's main() function +/// +/// ## Parameters +/// - `argc`: an ANSI-C style main function's argc. +/// - `argv`: an ANSI-C style main function's argv. +/// +/// ## Return value +/// Returns an ANSI-C main return code; generally 0 is considered successful +/// program completion, and small non-zero values are considered +/// errors. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_main_func = ::core::option::Option< + unsafe extern "C" fn( + argc: ::core::ffi::c_int, + argv: *mut *mut ::core::ffi::c_char, + ) -> ::core::ffi::c_int, +>; + +unsafe extern "C" { + /// An app-supplied function for program entry. + /// + /// Apps do not directly create this function; they should create a standard + /// ANSI-C `main` function instead. If SDL needs to insert some startup code + /// before `main` runs, or the platform doesn't actually _use_ a function + /// called "main", SDL will do some macro magic to redefine `main` to + /// [`SDL_main`] and provide its own `main`. + /// + /// Apps should include `SDL_main.h` in the same file as their `main` function, + /// and they should not use that symbol for anything else in that file, as it + /// might get redefined. + /// + /// This function is only provided by the app if it isn't using + /// SDL_MAIN_USE_CALLBACKS. + /// + /// Program startup is a surprisingly complex topic. Please see + /// [README-main-functions](README-main-functions), (or + /// docs/README-main-functions.md in the source tree) for a more detailed + /// explanation. + /// + /// ## Parameters + /// - `argc`: an ANSI-C style main function's argc. + /// - `argv`: an ANSI-C style main function's argv. + /// + /// ## Return value + /// Returns an ANSI-C main return code; generally 0 is considered successful + /// program completion, and small non-zero values are considered + /// errors. + /// + /// ## Thread safety + /// This is the program entry point. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_main( + argc: ::core::ffi::c_int, + argv: *mut *mut ::core::ffi::c_char, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Circumvent failure of [`SDL_Init()`] when not using [`SDL_main()`] as an entry + /// point. + /// + /// This function is defined in SDL_main.h, along with the preprocessor rule to + /// redefine main() as [`SDL_main()`]. Thus to ensure that your main() function + /// will not be changed it is necessary to define SDL_MAIN_HANDLED before + /// including SDL.h. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Init`] + pub fn SDL_SetMainReady(); +} + +unsafe extern "C" { + /// Initializes and launches an SDL application, by doing platform-specific + /// initialization before calling your mainFunction and cleanups after it + /// returns, if that is needed for a specific platform, otherwise it just calls + /// mainFunction. + /// + /// You can use this if you want to use your own main() implementation without + /// using [`SDL_main`] (like when using SDL_MAIN_HANDLED). When using this, you do + /// *not* need [`SDL_SetMainReady()`]. + /// + /// If `argv` is NULL, SDL will provide command line arguments, either by + /// querying the OS for them if possible, or supplying a filler array if not. + /// + /// ## Parameters + /// - `argc`: the argc parameter from the application's main() function, or 0 + /// if the platform's main-equivalent has no argc. + /// - `argv`: the argv parameter from the application's main() function, or + /// NULL if the platform's main-equivalent has no argv. + /// - `mainFunction`: your SDL app's C-style main(). NOT the function you're + /// calling this from! Its name doesn't matter; it doesn't + /// literally have to be `main`. + /// - `reserved`: should be NULL (reserved for future use, will probably be + /// platform-specific then). + /// + /// ## Return value + /// Returns the return value from mainFunction: 0 on success, otherwise + /// failure; [`SDL_GetError()`] might have more information on the + /// failure. + /// + /// ## Thread safety + /// Generally this is called once, near startup, from the + /// process's initial thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RunApp( + argc: ::core::ffi::c_int, + argv: *mut *mut ::core::ffi::c_char, + mainFunction: SDL_main_func, + reserved: *mut ::core::ffi::c_void, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// An entry point for SDL's use in SDL_MAIN_USE_CALLBACKS. + /// + /// Generally, you should not call this function directly. This only exists to + /// hand off work into SDL as soon as possible, where it has a lot more control + /// and functionality available, and make the inline code in SDL_main.h as + /// small as possible. + /// + /// Not all platforms use this, it's actual use is hidden in a magic + /// header-only library, and you should not call this directly unless you + /// _really_ know what you're doing. + /// + /// ## Parameters + /// - `argc`: standard Unix main argc. + /// - `argv`: standard Unix main argv. + /// - `appinit`: the application's [`SDL_AppInit`] function. + /// - `appiter`: the application's [`SDL_AppIterate`] function. + /// - `appevent`: the application's [`SDL_AppEvent`] function. + /// - `appquit`: the application's [`SDL_AppQuit`] function. + /// + /// ## Return value + /// Returns standard Unix main return value. + /// + /// ## Thread safety + /// It is not safe to call this anywhere except as the only + /// function call in [`SDL_main`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EnterAppMainCallbacks( + argc: ::core::ffi::c_int, + argv: *mut *mut ::core::ffi::c_char, + appinit: SDL_AppInit_func, + appiter: SDL_AppIterate_func, + appevent: SDL_AppEvent_func, + appquit: SDL_AppQuit_func, + ) -> ::core::ffi::c_int; +} + +apply_cfg!(#[cfg(any(doc, windows))] => { + unsafe extern "C" { + /// Register a win32 window class for SDL's use. + /// + /// This can be called to set the application window class at startup. It is + /// safe to call this multiple times, as long as every call is eventually + /// paired with a call to [`SDL_UnregisterApp`], but a second registration attempt + /// while a previous registration is still active will be ignored, other than + /// to increment a counter. + /// + /// Most applications do not need to, and should not, call this directly; SDL + /// will call it when initializing the video subsystem. + /// + /// If `name` is NULL, SDL currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` for + /// the style, regardless of what is specified here. + /// + /// ## Parameters + /// - `name`: the window class name, in UTF-8 encoding. If NULL, SDL + /// currently uses "SDL_app" but this isn't guaranteed. + /// - `style`: the value to use in WNDCLASSEX::style. + /// - `hInst`: the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL + /// will use `GetModuleHandle(NULL)` instead. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RegisterApp(name: *const ::core::ffi::c_char, style: Uint32, hInst: *mut ::core::ffi::c_void) -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Deregister the win32 window class from an [`SDL_RegisterApp`] call. + /// + /// This can be called to undo the effects of [`SDL_RegisterApp`]. + /// + /// Most applications do not need to, and should not, call this directly; SDL + /// will call it when deinitializing the video subsystem. + /// + /// It is safe to call this multiple times, as long as every call is eventually + /// paired with a prior call to [`SDL_RegisterApp`]. The window class will only be + /// deregistered when the registration counter in [`SDL_RegisterApp`] decrements to + /// zero through calls to this function. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UnregisterApp(); + } + +}); + +unsafe extern "C" { + /// Callback from the application to let the suspend continue. + /// + /// This should be called from an event watch in response to an + /// [`SDL_EVENT_DID_ENTER_BACKGROUND`] event. + /// + /// When using [`SDL_Render`], your event watch should be added _after_ creating + /// the [`SDL_Renderer`]; this allows the timing of the D3D12 command queue + /// suspension to execute in the correct order. + /// + /// When using SDL_GPU, this should be called after calling [`SDL_GDKSuspendGPU`]. + /// + /// If you're writing your own D3D12 renderer, this should be called after + /// calling `ID3D12CommandQueue::SuspendX`. + /// + /// This function is only needed for Xbox GDK support; all other platforms will + /// do nothing and set an "unsupported" error message. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddEventWatch`] + pub fn SDL_GDKSuspendComplete(); +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/messagebox.rs b/vendor/sdl3-sys/src/generated/messagebox.rs new file mode 100644 index 00000000..b17fe1f7 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/messagebox.rs @@ -0,0 +1,672 @@ +//! SDL offers a simple message box API, which is useful for simple alerts, +//! such as informing the user when something fatal happens at startup without +//! the need to build a UI for it (or informing the user _before_ your UI is +//! ready). +//! +//! These message boxes are native system dialogs where possible. +//! +//! There is both a customizable function ([`SDL_ShowMessageBox()`]) that offers +//! lots of options for what to display and reports on what choice the user +//! made, and also a much-simplified version ([`SDL_ShowSimpleMessageBox()`]), +//! merely takes a text message and title, and waits until the user presses a +//! single "OK" UI button. Often, this is all that is necessary. + +use super::stdinc::*; + +use super::error::*; + +use super::video::*; + +/// Message box flags. +/// +/// If supported will display warning icon, etc. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`ERROR`](SDL_MessageBoxFlags::ERROR) | [`SDL_MESSAGEBOX_ERROR`] | error dialog | +/// | [`WARNING`](SDL_MessageBoxFlags::WARNING) | [`SDL_MESSAGEBOX_WARNING`] | warning dialog | +/// | [`INFORMATION`](SDL_MessageBoxFlags::INFORMATION) | [`SDL_MESSAGEBOX_INFORMATION`] | informational dialog | +/// | [`BUTTONS_LEFT_TO_RIGHT`](SDL_MessageBoxFlags::BUTTONS_LEFT_TO_RIGHT) | [`SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT`] | buttons placed left to right | +/// | [`BUTTONS_RIGHT_TO_LEFT`](SDL_MessageBoxFlags::BUTTONS_RIGHT_TO_LEFT) | [`SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT`] | buttons placed right to left | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_MessageBoxFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_MessageBoxFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_MessageBoxFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_MessageBoxFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_MessageBoxFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_MessageBoxFlags(")?; + let all_bits = all_bits | Self::ERROR.0; + if (Self::ERROR != 0 || self.0 == 0) && *self & Self::ERROR == Self::ERROR { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ERROR")?; + } + let all_bits = all_bits | Self::WARNING.0; + if (Self::WARNING != 0 || self.0 == 0) && *self & Self::WARNING == Self::WARNING { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "WARNING")?; + } + let all_bits = all_bits | Self::INFORMATION.0; + if (Self::INFORMATION != 0 || self.0 == 0) && *self & Self::INFORMATION == Self::INFORMATION + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INFORMATION")?; + } + let all_bits = all_bits | Self::BUTTONS_LEFT_TO_RIGHT.0; + if (Self::BUTTONS_LEFT_TO_RIGHT != 0 || self.0 == 0) + && *self & Self::BUTTONS_LEFT_TO_RIGHT == Self::BUTTONS_LEFT_TO_RIGHT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTONS_LEFT_TO_RIGHT")?; + } + let all_bits = all_bits | Self::BUTTONS_RIGHT_TO_LEFT.0; + if (Self::BUTTONS_RIGHT_TO_LEFT != 0 || self.0 == 0) + && *self & Self::BUTTONS_RIGHT_TO_LEFT == Self::BUTTONS_RIGHT_TO_LEFT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTONS_RIGHT_TO_LEFT")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_MessageBoxFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_MessageBoxFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_MessageBoxFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_MessageBoxFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_MessageBoxFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_MessageBoxFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_MessageBoxFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_MessageBoxFlags { + /// error dialog + pub const ERROR: Self = Self((0x00000010 as Uint32)); + /// warning dialog + pub const WARNING: Self = Self((0x00000020 as Uint32)); + /// informational dialog + pub const INFORMATION: Self = Self((0x00000040 as Uint32)); + /// buttons placed left to right + pub const BUTTONS_LEFT_TO_RIGHT: Self = Self((0x00000080 as Uint32)); + /// buttons placed right to left + pub const BUTTONS_RIGHT_TO_LEFT: Self = Self((0x00000100 as Uint32)); +} + +/// error dialog +pub const SDL_MESSAGEBOX_ERROR: SDL_MessageBoxFlags = SDL_MessageBoxFlags::ERROR; +/// warning dialog +pub const SDL_MESSAGEBOX_WARNING: SDL_MessageBoxFlags = SDL_MessageBoxFlags::WARNING; +/// informational dialog +pub const SDL_MESSAGEBOX_INFORMATION: SDL_MessageBoxFlags = SDL_MessageBoxFlags::INFORMATION; +/// buttons placed left to right +pub const SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT: SDL_MessageBoxFlags = + SDL_MessageBoxFlags::BUTTONS_LEFT_TO_RIGHT; +/// buttons placed right to left +pub const SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT: SDL_MessageBoxFlags = + SDL_MessageBoxFlags::BUTTONS_RIGHT_TO_LEFT; + +impl SDL_MessageBoxFlags { + /// Initialize a `SDL_MessageBoxFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_MessageBoxFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::messagebox::METADATA_SDL_MessageBoxFlags; +} + +/// [`SDL_MessageBoxButtonData`] flags. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`RETURNKEY_DEFAULT`](SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT) | [`SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT`] | Marks the default button when return is hit | +/// | [`ESCAPEKEY_DEFAULT`](SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT) | [`SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT`] | Marks the default button when escape is hit | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_MessageBoxButtonFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_MessageBoxButtonFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_MessageBoxButtonFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_MessageBoxButtonFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_MessageBoxButtonFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_MessageBoxButtonFlags(")?; + let all_bits = all_bits | Self::RETURNKEY_DEFAULT.0; + if (Self::RETURNKEY_DEFAULT != 0 || self.0 == 0) + && *self & Self::RETURNKEY_DEFAULT == Self::RETURNKEY_DEFAULT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RETURNKEY_DEFAULT")?; + } + let all_bits = all_bits | Self::ESCAPEKEY_DEFAULT.0; + if (Self::ESCAPEKEY_DEFAULT != 0 || self.0 == 0) + && *self & Self::ESCAPEKEY_DEFAULT == Self::ESCAPEKEY_DEFAULT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ESCAPEKEY_DEFAULT")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_MessageBoxButtonFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_MessageBoxButtonFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_MessageBoxButtonFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_MessageBoxButtonFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_MessageBoxButtonFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_MessageBoxButtonFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_MessageBoxButtonFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_MessageBoxButtonFlags { + /// Marks the default button when return is hit + pub const RETURNKEY_DEFAULT: Self = Self((0x00000001 as Uint32)); + /// Marks the default button when escape is hit + pub const ESCAPEKEY_DEFAULT: Self = Self((0x00000002 as Uint32)); +} + +/// Marks the default button when return is hit +pub const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT: SDL_MessageBoxButtonFlags = + SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT; +/// Marks the default button when escape is hit +pub const SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT: SDL_MessageBoxButtonFlags = + SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT; + +impl SDL_MessageBoxButtonFlags { + /// Initialize a `SDL_MessageBoxButtonFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_MessageBoxButtonFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxButtonFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::messagebox::METADATA_SDL_MessageBoxButtonFlags; +} + +/// Individual button data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MessageBoxButtonData { + pub flags: SDL_MessageBoxButtonFlags, + /// User defined button id (value returned via [`SDL_ShowMessageBox`]) + pub buttonID: ::core::ffi::c_int, + /// The UTF-8 button text + pub text: *const ::core::ffi::c_char, +} + +impl ::core::default::Default for SDL_MessageBoxButtonData { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +/// RGB value used in a message box color scheme +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MessageBoxColor { + pub r: Uint8, + pub g: Uint8, + pub b: Uint8, +} + +/// An enumeration of indices inside the colors array of +/// [`SDL_MessageBoxColorScheme`]. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`BACKGROUND`](SDL_MessageBoxColorType::BACKGROUND) | [`SDL_MESSAGEBOX_COLOR_BACKGROUND`] | | +/// | [`TEXT`](SDL_MessageBoxColorType::TEXT) | [`SDL_MESSAGEBOX_COLOR_TEXT`] | | +/// | [`BUTTON_BORDER`](SDL_MessageBoxColorType::BUTTON_BORDER) | [`SDL_MESSAGEBOX_COLOR_BUTTON_BORDER`] | | +/// | [`BUTTON_BACKGROUND`](SDL_MessageBoxColorType::BUTTON_BACKGROUND) | [`SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND`] | | +/// | [`BUTTON_SELECTED`](SDL_MessageBoxColorType::BUTTON_SELECTED) | [`SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED`] | | +/// | [`COUNT`](SDL_MessageBoxColorType::COUNT) | [`SDL_MESSAGEBOX_COLOR_COUNT`] | Size of the colors array of [`SDL_MessageBoxColorScheme`]. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_MessageBoxColorType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_MessageBoxColorType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_MessageBoxColorType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_MessageBoxColorType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_MessageBoxColorType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::BACKGROUND => "SDL_MESSAGEBOX_COLOR_BACKGROUND", + Self::TEXT => "SDL_MESSAGEBOX_COLOR_TEXT", + Self::BUTTON_BORDER => "SDL_MESSAGEBOX_COLOR_BUTTON_BORDER", + Self::BUTTON_BACKGROUND => "SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND", + Self::BUTTON_SELECTED => "SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED", + Self::COUNT => "SDL_MESSAGEBOX_COLOR_COUNT", + + _ => return write!(f, "SDL_MessageBoxColorType({})", self.0), + }) + } +} + +impl SDL_MessageBoxColorType { + pub const BACKGROUND: Self = Self((0 as ::core::ffi::c_int)); + pub const TEXT: Self = Self((1 as ::core::ffi::c_int)); + pub const BUTTON_BORDER: Self = Self((2 as ::core::ffi::c_int)); + pub const BUTTON_BACKGROUND: Self = Self((3 as ::core::ffi::c_int)); + pub const BUTTON_SELECTED: Self = Self((4 as ::core::ffi::c_int)); + /// Size of the colors array of [`SDL_MessageBoxColorScheme`]. + pub const COUNT: Self = Self((5 as ::core::ffi::c_int)); +} + +pub const SDL_MESSAGEBOX_COLOR_BACKGROUND: SDL_MessageBoxColorType = + SDL_MessageBoxColorType::BACKGROUND; +pub const SDL_MESSAGEBOX_COLOR_TEXT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::TEXT; +pub const SDL_MESSAGEBOX_COLOR_BUTTON_BORDER: SDL_MessageBoxColorType = + SDL_MessageBoxColorType::BUTTON_BORDER; +pub const SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND: SDL_MessageBoxColorType = + SDL_MessageBoxColorType::BUTTON_BACKGROUND; +pub const SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED: SDL_MessageBoxColorType = + SDL_MessageBoxColorType::BUTTON_SELECTED; +/// Size of the colors array of [`SDL_MessageBoxColorScheme`]. +pub const SDL_MESSAGEBOX_COLOR_COUNT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::COUNT; + +impl SDL_MessageBoxColorType { + /// Initialize a `SDL_MessageBoxColorType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_MessageBoxColorType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxColorType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::messagebox::METADATA_SDL_MessageBoxColorType; +} + +/// A set of colors to use for message box dialogs +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MessageBoxColorScheme { + pub colors: [SDL_MessageBoxColor; SDL_MESSAGEBOX_COLOR_COUNT.0 as ::core::primitive::usize], +} + +/// MessageBox structure containing title, text, window, etc. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MessageBoxData { + pub flags: SDL_MessageBoxFlags, + /// Parent window, can be NULL + pub window: *mut SDL_Window, + /// UTF-8 title + pub title: *const ::core::ffi::c_char, + /// UTF-8 message text + pub message: *const ::core::ffi::c_char, + pub numbuttons: ::core::ffi::c_int, + pub buttons: *const SDL_MessageBoxButtonData, + /// [`SDL_MessageBoxColorScheme`], can be NULL to use system settings + pub colorScheme: *const SDL_MessageBoxColorScheme, +} + +impl ::core::default::Default for SDL_MessageBoxData { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Create a modal message box. + /// + /// If your needs aren't complex, it might be easier to use + /// [`SDL_ShowSimpleMessageBox`]. + /// + /// This function should be called on the thread that created the parent + /// window, or on the main thread if the messagebox has no parent. It will + /// block execution of that thread until the user clicks a button or closes the + /// messagebox. + /// + /// This function may be called at any time, even before [`SDL_Init()`]. This makes + /// it useful for reporting errors like a failure to create a renderer or + /// OpenGL context. + /// + /// On X11, SDL rolls its own dialog box with X11 primitives instead of a + /// formal toolkit like GTK+ or Qt. + /// + /// Note that if [`SDL_Init()`] would fail because there isn't any available video + /// target, this function is likely to fail for the same reasons. If this is a + /// concern, check the return value from this function and fall back to writing + /// to stderr if you can. + /// + /// ## Parameters + /// - `messageboxdata`: the [`SDL_MessageBoxData`] structure with title, text and + /// other options. + /// - `buttonid`: the pointer to which user id of hit button should be + /// copied. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ShowSimpleMessageBox`] + pub fn SDL_ShowMessageBox( + messageboxdata: *const SDL_MessageBoxData, + buttonid: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Display a simple modal message box. + /// + /// If your needs aren't complex, this function is preferred over + /// [`SDL_ShowMessageBox`]. + /// + /// `flags` may be any of the following: + /// + /// - [`SDL_MESSAGEBOX_ERROR`]\: error dialog + /// - [`SDL_MESSAGEBOX_WARNING`]\: warning dialog + /// - [`SDL_MESSAGEBOX_INFORMATION`]\: informational dialog + /// + /// This function should be called on the thread that created the parent + /// window, or on the main thread if the messagebox has no parent. It will + /// block execution of that thread until the user clicks a button or closes the + /// messagebox. + /// + /// This function may be called at any time, even before [`SDL_Init()`]. This makes + /// it useful for reporting errors like a failure to create a renderer or + /// OpenGL context. + /// + /// On X11, SDL rolls its own dialog box with X11 primitives instead of a + /// formal toolkit like GTK+ or Qt. + /// + /// Note that if [`SDL_Init()`] would fail because there isn't any available video + /// target, this function is likely to fail for the same reasons. If this is a + /// concern, check the return value from this function and fall back to writing + /// to stderr if you can. + /// + /// ## Parameters + /// - `flags`: an [`SDL_MessageBoxFlags`] value. + /// - `title`: UTF-8 title text. + /// - `message`: UTF-8 message text. + /// - `window`: the parent window, or NULL for no parent. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ShowMessageBox`] + pub fn SDL_ShowSimpleMessageBox( + flags: SDL_MessageBoxFlags, + title: *const ::core::ffi::c_char, + message: *const ::core::ffi::c_char, + window: *mut SDL_Window, + ) -> ::core::primitive::bool; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/metal.rs b/vendor/sdl3-sys/src/generated/metal.rs new file mode 100644 index 00000000..6a2f69e2 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/metal.rs @@ -0,0 +1,81 @@ +//! Functions to creating Metal layers and views on SDL windows. +//! +//! This provides some platform-specific glue for Apple platforms. Most macOS +//! and iOS apps can use SDL without these functions, but this API they can be +//! useful for specific OS-level integration tasks. + +use super::video::*; + +/// A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_MetalView = *mut ::core::ffi::c_void; + +unsafe extern "C" { + /// Create a CAMetalLayer-backed NSView/UIView and attach it to the specified + /// window. + /// + /// On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on + /// its own. It is up to user code to do that. + /// + /// The returned handle can be casted directly to a NSView or UIView. To access + /// the backing CAMetalLayer, call [`SDL_Metal_GetLayer()`]. + /// + /// ## Parameters + /// - `window`: the window. + /// + /// ## Return value + /// Returns handle NSView or UIView. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Metal_DestroyView`] + /// - [`SDL_Metal_GetLayer`] + pub fn SDL_Metal_CreateView(window: *mut SDL_Window) -> SDL_MetalView; +} + +unsafe extern "C" { + /// Destroy an existing [`SDL_MetalView`] object. + /// + /// This should be called before [`SDL_DestroyWindow`], if [`SDL_Metal_CreateView`] was + /// called after [`SDL_CreateWindow`]. + /// + /// ## Parameters + /// - `view`: the [`SDL_MetalView`] object. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Metal_CreateView`] + pub fn SDL_Metal_DestroyView(view: SDL_MetalView); +} + +unsafe extern "C" { + /// Get a pointer to the backing CAMetalLayer for the given view. + /// + /// ## Parameters + /// - `view`: the [`SDL_MetalView`] object. + /// + /// ## Return value + /// Returns a pointer. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_Metal_GetLayer(view: SDL_MetalView) -> *mut ::core::ffi::c_void; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/misc.rs b/vendor/sdl3-sys/src/generated/misc.rs new file mode 100644 index 00000000..a62699aa --- /dev/null +++ b/vendor/sdl3-sys/src/generated/misc.rs @@ -0,0 +1,46 @@ +//! SDL API functions that don't fit elsewhere. + +use super::stdinc::*; + +use super::error::*; + +unsafe extern "C" { + /// Open a URL/URI in the browser or other appropriate external application. + /// + /// Open a URL in a separate, system-provided application. How this works will + /// vary wildly depending on the platform. This will likely launch what makes + /// sense to handle a specific URL's protocol (a web browser for `http://`, + /// etc), but it might also be able to launch file managers for directories and + /// other things. + /// + /// What happens when you open a URL varies wildly as well: your game window + /// may lose focus (and may or may not lose focus if your game was fullscreen + /// or grabbing input at the time). On mobile devices, your app will likely + /// move to the background or your process might be paused. Any given platform + /// may or may not handle a given URL. + /// + /// If this is unimplemented (or simply unavailable) for a platform, this will + /// fail with an error. A successful result does not mean the URL loaded, just + /// that we launched _something_ to handle it (or at least believe we did). + /// + /// All this to say: this function can be useful, but you should definitely + /// test it on every platform you target. + /// + /// ## Parameters + /// - `url`: a valid URL/URI to open. Use `file:///full/path/to/file` for + /// local files, if supported. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OpenURL(url: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/mod.rs b/vendor/sdl3-sys/src/generated/mod.rs new file mode 100644 index 00000000..e5afae12 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/mod.rs @@ -0,0 +1,194 @@ +#![allow( + clippy::approx_constant, + clippy::doc_lazy_continuation, + clippy::double_parens, + clippy::eq_op, + clippy::identity_op, + clippy::missing_safety_doc, + clippy::needless_bool, + clippy::needless_return, + clippy::nonminimal_bool, + clippy::ptr_eq, + clippy::too_long_first_doc_paragraph, + clippy::unnecessary_cast, + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + unused_imports, + unused_parens, + unused_unsafe, + unused_variables +)] + +pub mod assert; +pub mod asyncio; +pub mod atomic; +pub mod audio; +pub mod bits; +pub mod blendmode; +pub mod camera; +pub mod clipboard; +pub mod cpuinfo; +pub mod dialog; +pub mod error; +pub mod events; +pub mod filesystem; +pub mod gamepad; +pub mod gpu; +pub mod guid; +pub mod haptic; +pub mod hidapi; +pub mod hints; +pub mod init; +pub mod iostream; +pub mod joystick; +pub mod keyboard; +pub mod keycode; +pub mod loadso; +pub mod locale; +pub mod log; +pub mod main; +pub mod messagebox; +pub mod metal; +pub mod misc; +pub mod mouse; +pub mod mutex; +pub mod pen; +pub mod pixels; +pub mod platform; +pub mod power; +pub mod process; +pub mod properties; +pub mod rect; +pub mod render; +pub mod revision; +pub mod scancode; +pub mod sensor; +pub mod stdinc; +pub mod storage; +pub mod surface; +pub mod system; +pub mod thread; +pub mod time; +pub mod timer; +pub mod touch; +pub mod tray; +pub mod version; +pub mod video; +pub mod vulkan; + +/// Reexports of everything from the other modules +pub mod everything { + #[doc(no_inline)] + pub use super::assert::*; + #[doc(no_inline)] + pub use super::asyncio::*; + #[doc(no_inline)] + pub use super::atomic::*; + #[doc(no_inline)] + pub use super::audio::*; + #[doc(no_inline)] + pub use super::bits::*; + #[doc(no_inline)] + pub use super::blendmode::*; + #[doc(no_inline)] + pub use super::camera::*; + #[doc(no_inline)] + pub use super::clipboard::*; + #[doc(no_inline)] + pub use super::cpuinfo::*; + #[doc(no_inline)] + pub use super::dialog::*; + #[doc(no_inline)] + pub use super::error::*; + #[doc(no_inline)] + pub use super::events::*; + #[doc(no_inline)] + pub use super::filesystem::*; + #[doc(no_inline)] + pub use super::gamepad::*; + #[doc(no_inline)] + pub use super::gpu::*; + #[doc(no_inline)] + pub use super::guid::*; + #[doc(no_inline)] + pub use super::haptic::*; + #[doc(no_inline)] + pub use super::hidapi::*; + #[doc(no_inline)] + pub use super::hints::*; + #[doc(no_inline)] + pub use super::init::*; + #[doc(no_inline)] + pub use super::iostream::*; + #[doc(no_inline)] + pub use super::joystick::*; + #[doc(no_inline)] + pub use super::keyboard::*; + #[doc(no_inline)] + pub use super::keycode::*; + #[doc(no_inline)] + pub use super::loadso::*; + #[doc(no_inline)] + pub use super::locale::*; + #[doc(no_inline)] + pub use super::log::*; + #[doc(no_inline)] + pub use super::main::*; + #[doc(no_inline)] + pub use super::messagebox::*; + #[doc(no_inline)] + pub use super::metal::*; + #[doc(no_inline)] + pub use super::misc::*; + #[doc(no_inline)] + pub use super::mouse::*; + #[doc(no_inline)] + pub use super::mutex::*; + #[doc(no_inline)] + pub use super::pen::*; + #[doc(no_inline)] + pub use super::pixels::*; + #[doc(no_inline)] + pub use super::platform::*; + #[doc(no_inline)] + pub use super::power::*; + #[doc(no_inline)] + pub use super::process::*; + #[doc(no_inline)] + pub use super::properties::*; + #[doc(no_inline)] + pub use super::rect::*; + #[doc(no_inline)] + pub use super::render::*; + #[doc(no_inline)] + pub use super::revision::*; + #[doc(no_inline)] + pub use super::scancode::*; + #[doc(no_inline)] + pub use super::sensor::*; + #[doc(no_inline)] + pub use super::stdinc::*; + #[doc(no_inline)] + pub use super::storage::*; + #[doc(no_inline)] + pub use super::surface::*; + #[doc(no_inline)] + pub use super::system::*; + #[doc(no_inline)] + pub use super::thread::*; + #[doc(no_inline)] + pub use super::time::*; + #[doc(no_inline)] + pub use super::timer::*; + #[doc(no_inline)] + pub use super::touch::*; + #[doc(no_inline)] + pub use super::tray::*; + #[doc(no_inline)] + pub use super::version::*; + #[doc(no_inline)] + pub use super::video::*; + #[doc(no_inline)] + pub use super::vulkan::*; +} diff --git a/vendor/sdl3-sys/src/generated/mouse.rs b/vendor/sdl3-sys/src/generated/mouse.rs new file mode 100644 index 00000000..77574a67 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/mouse.rs @@ -0,0 +1,1418 @@ +//! Any GUI application has to deal with the mouse, and SDL provides functions +//! to manage mouse input and the displayed cursor. +//! +//! Most interactions with the mouse will come through the event subsystem. +//! Moving a mouse generates an [`SDL_EVENT_MOUSE_MOTION`] event, pushing a button +//! generates [`SDL_EVENT_MOUSE_BUTTON_DOWN`], etc, but one can also query the +//! current state of the mouse at any time with [`SDL_GetMouseState()`]. +//! +//! For certain games, it's useful to disassociate the mouse cursor from mouse +//! input. An FPS, for example, would not want the player's motion to stop as +//! the mouse hits the edge of the window. For these scenarios, use +//! [`SDL_SetWindowRelativeMouseMode()`], which hides the cursor, grabs mouse input +//! to the window, and reads mouse input no matter how far it moves. +//! +//! Games that want the system to track the mouse but want to draw their own +//! cursor can use [`SDL_HideCursor()`] and [`SDL_ShowCursor()`]. It might be more +//! efficient to let the system manage the cursor, if possible, using +//! [`SDL_SetCursor()`] with a custom image made through [`SDL_CreateColorCursor()`], +//! or perhaps just a specific system cursor from [`SDL_CreateSystemCursor()`]. +//! +//! SDL can, on many platforms, differentiate between multiple connected mice, +//! allowing for interesting input scenarios and multiplayer games. They can be +//! enumerated with [`SDL_GetMice()`], and SDL will send [`SDL_EVENT_MOUSE_ADDED`] and +//! [`SDL_EVENT_MOUSE_REMOVED`] events as they are connected and unplugged. +//! +//! Since many apps only care about basic mouse input, SDL offers a virtual +//! mouse device for touch and pen input, which often can make a desktop +//! application work on a touchscreen phone without any code changes. Apps that +//! care about touch/pen separately from mouse input should filter out events +//! with a `which` field of SDL_TOUCH_MOUSEID/SDL_PEN_MOUSEID. + +use super::stdinc::*; + +use super::error::*; + +use super::surface::*; + +use super::video::*; + +/// This is a unique ID for a mouse for the time it is connected to the system, +/// and is never reused for the lifetime of the application. +/// +/// If the mouse is disconnected and reconnected, it will get a new ID. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_MouseID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_MouseID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_MouseID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_MouseID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_MouseID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_MouseID { + /// Initialize a `SDL_MouseID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_MouseID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MouseID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::mouse::METADATA_SDL_MouseID; +} + +/// Cursor types for [`SDL_CreateSystemCursor()`]. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DEFAULT`](SDL_SystemCursor::DEFAULT) | [`SDL_SYSTEM_CURSOR_DEFAULT`] | Default cursor. Usually an arrow. | +/// | [`TEXT`](SDL_SystemCursor::TEXT) | [`SDL_SYSTEM_CURSOR_TEXT`] | Text selection. Usually an I-beam. | +/// | [`WAIT`](SDL_SystemCursor::WAIT) | [`SDL_SYSTEM_CURSOR_WAIT`] | Wait. Usually an hourglass or watch or spinning ball. | +/// | [`CROSSHAIR`](SDL_SystemCursor::CROSSHAIR) | [`SDL_SYSTEM_CURSOR_CROSSHAIR`] | Crosshair. | +/// | [`PROGRESS`](SDL_SystemCursor::PROGRESS) | [`SDL_SYSTEM_CURSOR_PROGRESS`] | Program is busy but still interactive. Usually it's WAIT with an arrow. | +/// | [`NWSE_RESIZE`](SDL_SystemCursor::NWSE_RESIZE) | [`SDL_SYSTEM_CURSOR_NWSE_RESIZE`] | Double arrow pointing northwest and southeast. | +/// | [`NESW_RESIZE`](SDL_SystemCursor::NESW_RESIZE) | [`SDL_SYSTEM_CURSOR_NESW_RESIZE`] | Double arrow pointing northeast and southwest. | +/// | [`EW_RESIZE`](SDL_SystemCursor::EW_RESIZE) | [`SDL_SYSTEM_CURSOR_EW_RESIZE`] | Double arrow pointing west and east. | +/// | [`NS_RESIZE`](SDL_SystemCursor::NS_RESIZE) | [`SDL_SYSTEM_CURSOR_NS_RESIZE`] | Double arrow pointing north and south. | +/// | [`MOVE`](SDL_SystemCursor::MOVE) | [`SDL_SYSTEM_CURSOR_MOVE`] | Four pointed arrow pointing north, south, east, and west. | +/// | [`NOT_ALLOWED`](SDL_SystemCursor::NOT_ALLOWED) | [`SDL_SYSTEM_CURSOR_NOT_ALLOWED`] | Not permitted. Usually a slashed circle or crossbones. | +/// | [`POINTER`](SDL_SystemCursor::POINTER) | [`SDL_SYSTEM_CURSOR_POINTER`] | Pointer that indicates a link. Usually a pointing hand. | +/// | [`NW_RESIZE`](SDL_SystemCursor::NW_RESIZE) | [`SDL_SYSTEM_CURSOR_NW_RESIZE`] | Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE. | +/// | [`N_RESIZE`](SDL_SystemCursor::N_RESIZE) | [`SDL_SYSTEM_CURSOR_N_RESIZE`] | Window resize top. May be NS_RESIZE. | +/// | [`NE_RESIZE`](SDL_SystemCursor::NE_RESIZE) | [`SDL_SYSTEM_CURSOR_NE_RESIZE`] | Window resize top-right. May be NESW_RESIZE. | +/// | [`E_RESIZE`](SDL_SystemCursor::E_RESIZE) | [`SDL_SYSTEM_CURSOR_E_RESIZE`] | Window resize right. May be EW_RESIZE. | +/// | [`SE_RESIZE`](SDL_SystemCursor::SE_RESIZE) | [`SDL_SYSTEM_CURSOR_SE_RESIZE`] | Window resize bottom-right. May be NWSE_RESIZE. | +/// | [`S_RESIZE`](SDL_SystemCursor::S_RESIZE) | [`SDL_SYSTEM_CURSOR_S_RESIZE`] | Window resize bottom. May be NS_RESIZE. | +/// | [`SW_RESIZE`](SDL_SystemCursor::SW_RESIZE) | [`SDL_SYSTEM_CURSOR_SW_RESIZE`] | Window resize bottom-left. May be NESW_RESIZE. | +/// | [`W_RESIZE`](SDL_SystemCursor::W_RESIZE) | [`SDL_SYSTEM_CURSOR_W_RESIZE`] | Window resize left. May be EW_RESIZE. | +/// | [`COUNT`](SDL_SystemCursor::COUNT) | [`SDL_SYSTEM_CURSOR_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_SystemCursor(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_SystemCursor { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_SystemCursor) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_SystemCursor) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_SystemCursor { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::DEFAULT => "SDL_SYSTEM_CURSOR_DEFAULT", + Self::TEXT => "SDL_SYSTEM_CURSOR_TEXT", + Self::WAIT => "SDL_SYSTEM_CURSOR_WAIT", + Self::CROSSHAIR => "SDL_SYSTEM_CURSOR_CROSSHAIR", + Self::PROGRESS => "SDL_SYSTEM_CURSOR_PROGRESS", + Self::NWSE_RESIZE => "SDL_SYSTEM_CURSOR_NWSE_RESIZE", + Self::NESW_RESIZE => "SDL_SYSTEM_CURSOR_NESW_RESIZE", + Self::EW_RESIZE => "SDL_SYSTEM_CURSOR_EW_RESIZE", + Self::NS_RESIZE => "SDL_SYSTEM_CURSOR_NS_RESIZE", + Self::MOVE => "SDL_SYSTEM_CURSOR_MOVE", + Self::NOT_ALLOWED => "SDL_SYSTEM_CURSOR_NOT_ALLOWED", + Self::POINTER => "SDL_SYSTEM_CURSOR_POINTER", + Self::NW_RESIZE => "SDL_SYSTEM_CURSOR_NW_RESIZE", + Self::N_RESIZE => "SDL_SYSTEM_CURSOR_N_RESIZE", + Self::NE_RESIZE => "SDL_SYSTEM_CURSOR_NE_RESIZE", + Self::E_RESIZE => "SDL_SYSTEM_CURSOR_E_RESIZE", + Self::SE_RESIZE => "SDL_SYSTEM_CURSOR_SE_RESIZE", + Self::S_RESIZE => "SDL_SYSTEM_CURSOR_S_RESIZE", + Self::SW_RESIZE => "SDL_SYSTEM_CURSOR_SW_RESIZE", + Self::W_RESIZE => "SDL_SYSTEM_CURSOR_W_RESIZE", + Self::COUNT => "SDL_SYSTEM_CURSOR_COUNT", + + _ => return write!(f, "SDL_SystemCursor({})", self.0), + }) + } +} + +impl SDL_SystemCursor { + /// Default cursor. Usually an arrow. + pub const DEFAULT: Self = Self((0 as ::core::ffi::c_int)); + /// Text selection. Usually an I-beam. + pub const TEXT: Self = Self((1 as ::core::ffi::c_int)); + /// Wait. Usually an hourglass or watch or spinning ball. + pub const WAIT: Self = Self((2 as ::core::ffi::c_int)); + /// Crosshair. + pub const CROSSHAIR: Self = Self((3 as ::core::ffi::c_int)); + /// Program is busy but still interactive. Usually it's WAIT with an arrow. + pub const PROGRESS: Self = Self((4 as ::core::ffi::c_int)); + /// Double arrow pointing northwest and southeast. + pub const NWSE_RESIZE: Self = Self((5 as ::core::ffi::c_int)); + /// Double arrow pointing northeast and southwest. + pub const NESW_RESIZE: Self = Self((6 as ::core::ffi::c_int)); + /// Double arrow pointing west and east. + pub const EW_RESIZE: Self = Self((7 as ::core::ffi::c_int)); + /// Double arrow pointing north and south. + pub const NS_RESIZE: Self = Self((8 as ::core::ffi::c_int)); + /// Four pointed arrow pointing north, south, east, and west. + pub const MOVE: Self = Self((9 as ::core::ffi::c_int)); + /// Not permitted. Usually a slashed circle or crossbones. + pub const NOT_ALLOWED: Self = Self((10 as ::core::ffi::c_int)); + /// Pointer that indicates a link. Usually a pointing hand. + pub const POINTER: Self = Self((11 as ::core::ffi::c_int)); + /// Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE. + pub const NW_RESIZE: Self = Self((12 as ::core::ffi::c_int)); + /// Window resize top. May be NS_RESIZE. + pub const N_RESIZE: Self = Self((13 as ::core::ffi::c_int)); + /// Window resize top-right. May be NESW_RESIZE. + pub const NE_RESIZE: Self = Self((14 as ::core::ffi::c_int)); + /// Window resize right. May be EW_RESIZE. + pub const E_RESIZE: Self = Self((15 as ::core::ffi::c_int)); + /// Window resize bottom-right. May be NWSE_RESIZE. + pub const SE_RESIZE: Self = Self((16 as ::core::ffi::c_int)); + /// Window resize bottom. May be NS_RESIZE. + pub const S_RESIZE: Self = Self((17 as ::core::ffi::c_int)); + /// Window resize bottom-left. May be NESW_RESIZE. + pub const SW_RESIZE: Self = Self((18 as ::core::ffi::c_int)); + /// Window resize left. May be EW_RESIZE. + pub const W_RESIZE: Self = Self((19 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((20 as ::core::ffi::c_int)); +} + +/// Default cursor. Usually an arrow. +pub const SDL_SYSTEM_CURSOR_DEFAULT: SDL_SystemCursor = SDL_SystemCursor::DEFAULT; +/// Text selection. Usually an I-beam. +pub const SDL_SYSTEM_CURSOR_TEXT: SDL_SystemCursor = SDL_SystemCursor::TEXT; +/// Wait. Usually an hourglass or watch or spinning ball. +pub const SDL_SYSTEM_CURSOR_WAIT: SDL_SystemCursor = SDL_SystemCursor::WAIT; +/// Crosshair. +pub const SDL_SYSTEM_CURSOR_CROSSHAIR: SDL_SystemCursor = SDL_SystemCursor::CROSSHAIR; +/// Program is busy but still interactive. Usually it's WAIT with an arrow. +pub const SDL_SYSTEM_CURSOR_PROGRESS: SDL_SystemCursor = SDL_SystemCursor::PROGRESS; +/// Double arrow pointing northwest and southeast. +pub const SDL_SYSTEM_CURSOR_NWSE_RESIZE: SDL_SystemCursor = SDL_SystemCursor::NWSE_RESIZE; +/// Double arrow pointing northeast and southwest. +pub const SDL_SYSTEM_CURSOR_NESW_RESIZE: SDL_SystemCursor = SDL_SystemCursor::NESW_RESIZE; +/// Double arrow pointing west and east. +pub const SDL_SYSTEM_CURSOR_EW_RESIZE: SDL_SystemCursor = SDL_SystemCursor::EW_RESIZE; +/// Double arrow pointing north and south. +pub const SDL_SYSTEM_CURSOR_NS_RESIZE: SDL_SystemCursor = SDL_SystemCursor::NS_RESIZE; +/// Four pointed arrow pointing north, south, east, and west. +pub const SDL_SYSTEM_CURSOR_MOVE: SDL_SystemCursor = SDL_SystemCursor::MOVE; +/// Not permitted. Usually a slashed circle or crossbones. +pub const SDL_SYSTEM_CURSOR_NOT_ALLOWED: SDL_SystemCursor = SDL_SystemCursor::NOT_ALLOWED; +/// Pointer that indicates a link. Usually a pointing hand. +pub const SDL_SYSTEM_CURSOR_POINTER: SDL_SystemCursor = SDL_SystemCursor::POINTER; +/// Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE. +pub const SDL_SYSTEM_CURSOR_NW_RESIZE: SDL_SystemCursor = SDL_SystemCursor::NW_RESIZE; +/// Window resize top. May be NS_RESIZE. +pub const SDL_SYSTEM_CURSOR_N_RESIZE: SDL_SystemCursor = SDL_SystemCursor::N_RESIZE; +/// Window resize top-right. May be NESW_RESIZE. +pub const SDL_SYSTEM_CURSOR_NE_RESIZE: SDL_SystemCursor = SDL_SystemCursor::NE_RESIZE; +/// Window resize right. May be EW_RESIZE. +pub const SDL_SYSTEM_CURSOR_E_RESIZE: SDL_SystemCursor = SDL_SystemCursor::E_RESIZE; +/// Window resize bottom-right. May be NWSE_RESIZE. +pub const SDL_SYSTEM_CURSOR_SE_RESIZE: SDL_SystemCursor = SDL_SystemCursor::SE_RESIZE; +/// Window resize bottom. May be NS_RESIZE. +pub const SDL_SYSTEM_CURSOR_S_RESIZE: SDL_SystemCursor = SDL_SystemCursor::S_RESIZE; +/// Window resize bottom-left. May be NESW_RESIZE. +pub const SDL_SYSTEM_CURSOR_SW_RESIZE: SDL_SystemCursor = SDL_SystemCursor::SW_RESIZE; +/// Window resize left. May be EW_RESIZE. +pub const SDL_SYSTEM_CURSOR_W_RESIZE: SDL_SystemCursor = SDL_SystemCursor::W_RESIZE; +pub const SDL_SYSTEM_CURSOR_COUNT: SDL_SystemCursor = SDL_SystemCursor::COUNT; + +impl SDL_SystemCursor { + /// Initialize a `SDL_SystemCursor` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_SystemCursor { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_SystemCursor { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::mouse::METADATA_SDL_SystemCursor; +} + +/// Scroll direction types for the Scroll event +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NORMAL`](SDL_MouseWheelDirection::NORMAL) | [`SDL_MOUSEWHEEL_NORMAL`] | The scroll direction is normal | +/// | [`FLIPPED`](SDL_MouseWheelDirection::FLIPPED) | [`SDL_MOUSEWHEEL_FLIPPED`] | The scroll direction is flipped / natural | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_MouseWheelDirection(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_MouseWheelDirection { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_MouseWheelDirection) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_MouseWheelDirection) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_MouseWheelDirection { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NORMAL => "SDL_MOUSEWHEEL_NORMAL", + Self::FLIPPED => "SDL_MOUSEWHEEL_FLIPPED", + + _ => return write!(f, "SDL_MouseWheelDirection({})", self.0), + }) + } +} + +impl SDL_MouseWheelDirection { + /// The scroll direction is normal + pub const NORMAL: Self = Self((0 as ::core::ffi::c_int)); + /// The scroll direction is flipped / natural + pub const FLIPPED: Self = Self((1 as ::core::ffi::c_int)); +} + +/// The scroll direction is normal +pub const SDL_MOUSEWHEEL_NORMAL: SDL_MouseWheelDirection = SDL_MouseWheelDirection::NORMAL; +/// The scroll direction is flipped / natural +pub const SDL_MOUSEWHEEL_FLIPPED: SDL_MouseWheelDirection = SDL_MouseWheelDirection::FLIPPED; + +impl SDL_MouseWheelDirection { + /// Initialize a `SDL_MouseWheelDirection` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_MouseWheelDirection { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MouseWheelDirection { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::mouse::METADATA_SDL_MouseWheelDirection; +} + +/// Animated cursor frame info. +/// +/// ## Availability +/// This struct is available since SDL 3.4.0. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_CursorFrameInfo { + /// The surface data for this frame + pub surface: *mut SDL_Surface, + /// The frame duration in milliseconds (a duration of 0 is infinite) + pub duration: Uint32, +} + +impl ::core::default::Default for SDL_CursorFrameInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +pub const SDL_BUTTON_LEFT: ::core::primitive::i32 = 1; + +pub const SDL_BUTTON_MIDDLE: ::core::primitive::i32 = 2; + +pub const SDL_BUTTON_RIGHT: ::core::primitive::i32 = 3; + +pub const SDL_BUTTON_X1: ::core::primitive::i32 = 4; + +pub const SDL_BUTTON_X2: ::core::primitive::i32 = 5; + +#[inline(always)] +pub const fn SDL_BUTTON_MASK(X: ::core::primitive::i32) -> SDL_MouseButtonFlags { + SDL_MouseButtonFlags(((1_u32 << (X - 1_i32)) as Uint32)) +} + +/// A callback used to transform mouse motion delta from raw values. +/// +/// This is called during SDL's handling of platform mouse events to scale the +/// values of the resulting motion delta. +/// +/// ## Parameters +/// - `userdata`: what was passed as `userdata` to +/// [`SDL_SetRelativeMouseTransform()`]. +/// - `timestamp`: the associated time at which this mouse motion event was +/// received. +/// - `window`: the associated window to which this mouse motion event was +/// addressed. +/// - `mouseID`: the associated mouse from which this mouse motion event was +/// emitted. +/// - `x`: pointer to a variable that will be treated as the resulting x-axis +/// motion. +/// - `y`: pointer to a variable that will be treated as the resulting y-axis +/// motion. +/// +/// ## Thread safety +/// This callback is called by SDL's internal mouse input +/// processing procedure, which may be a thread separate from the +/// main event loop that is run at realtime priority. Stalling +/// this thread with too much work in the callback can therefore +/// potentially freeze the entire system. Care should be taken +/// with proper synchronization practices when adding other side +/// effects beyond mutation of the x and y values. +/// +/// ## Availability +/// This datatype is available since SDL 3.4.0. +/// +/// ## See also +/// - [`SDL_SetRelativeMouseTransform`] +pub type SDL_MouseMotionTransformCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + timestamp: Uint64, + window: *mut SDL_Window, + mouseID: SDL_MouseID, + x: *mut ::core::ffi::c_float, + y: *mut ::core::ffi::c_float, + ), +>; + +unsafe extern "C" { + /// Return whether a mouse is currently connected. + /// + /// ## Return value + /// Returns true if a mouse is connected, false otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMice`] + pub fn SDL_HasMouse() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a list of currently connected mice. + /// + /// Note that this will include any device or virtual driver that includes + /// mouse functionality, including some game controllers, KVM switches, etc. + /// You should wait for input from a device before you consider it actively in + /// use. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of mice returned, may be + /// NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of mouse instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMouseNameForID`] + /// - [`SDL_HasMouse`] + pub fn SDL_GetMice(count: *mut ::core::ffi::c_int) -> *mut SDL_MouseID; +} + +unsafe extern "C" { + /// Get the name of a mouse. + /// + /// This function returns "" if the mouse doesn't have a name. + /// + /// ## Parameters + /// - `instance_id`: the mouse instance ID. + /// + /// ## Return value + /// Returns the name of the selected mouse, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMice`] + pub fn SDL_GetMouseNameForID(instance_id: SDL_MouseID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the window which currently has mouse focus. + /// + /// ## Return value + /// Returns the window with mouse focus. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetMouseFocus() -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Query SDL's cache for the synchronous mouse button state and the + /// window-relative SDL-cursor position. + /// + /// This function returns the cached synchronous state as SDL understands it + /// from the last pump of the event queue. + /// + /// To query the platform for immediate asynchronous state, use + /// [`SDL_GetGlobalMouseState`]. + /// + /// Passing non-NULL pointers to `x` or `y` will write the destination with + /// respective x or y coordinates relative to the focused window. + /// + /// In Relative Mode, the SDL-cursor's position usually contradicts the + /// platform-cursor's position as manually calculated from + /// [`SDL_GetGlobalMouseState()`] and [`SDL_GetWindowPosition`]. + /// + /// ## Parameters + /// - `x`: a pointer to receive the SDL-cursor's x-position from the focused + /// window's top left corner, can be NULL if unused. + /// - `y`: a pointer to receive the SDL-cursor's y-position from the focused + /// window's top left corner, can be NULL if unused. + /// + /// ## Return value + /// Returns a 32-bit bitmask of the button state that can be bitwise-compared + /// against the SDL_BUTTON_MASK(X) macro. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGlobalMouseState`] + /// - [`SDL_GetRelativeMouseState`] + pub fn SDL_GetMouseState( + x: *mut ::core::ffi::c_float, + y: *mut ::core::ffi::c_float, + ) -> SDL_MouseButtonFlags; +} + +unsafe extern "C" { + /// Query the platform for the asynchronous mouse button state and the + /// desktop-relative platform-cursor position. + /// + /// This function immediately queries the platform for the most recent + /// asynchronous state, more costly than retrieving SDL's cached state in + /// [`SDL_GetMouseState()`]. + /// + /// Passing non-NULL pointers to `x` or `y` will write the destination with + /// respective x or y coordinates relative to the desktop. + /// + /// In Relative Mode, the platform-cursor's position usually contradicts the + /// SDL-cursor's position as manually calculated from [`SDL_GetMouseState()`] and + /// [`SDL_GetWindowPosition`]. + /// + /// This function can be useful if you need to track the mouse outside of a + /// specific window and [`SDL_CaptureMouse()`] doesn't fit your needs. For example, + /// it could be useful if you need to track the mouse while dragging a window, + /// where coordinates relative to a window might not be in sync at all times. + /// + /// ## Parameters + /// - `x`: a pointer to receive the platform-cursor's x-position from the + /// desktop's top left corner, can be NULL if unused. + /// - `y`: a pointer to receive the platform-cursor's y-position from the + /// desktop's top left corner, can be NULL if unused. + /// + /// ## Return value + /// Returns a 32-bit bitmask of the button state that can be bitwise-compared + /// against the SDL_BUTTON_MASK(X) macro. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CaptureMouse`] + /// - [`SDL_GetMouseState`] + /// - [`SDL_GetGlobalMouseState`] + pub fn SDL_GetGlobalMouseState( + x: *mut ::core::ffi::c_float, + y: *mut ::core::ffi::c_float, + ) -> SDL_MouseButtonFlags; +} + +unsafe extern "C" { + /// Query SDL's cache for the synchronous mouse button state and accumulated + /// mouse delta since last call. + /// + /// This function returns the cached synchronous state as SDL understands it + /// from the last pump of the event queue. + /// + /// To query the platform for immediate asynchronous state, use + /// [`SDL_GetGlobalMouseState`]. + /// + /// Passing non-NULL pointers to `x` or `y` will write the destination with + /// respective x or y deltas accumulated since the last call to this function + /// (or since event initialization). + /// + /// This function is useful for reducing overhead by processing relative mouse + /// inputs in one go per-frame instead of individually per-event, at the + /// expense of losing the order between events within the frame (e.g. quickly + /// pressing and releasing a button within the same frame). + /// + /// ## Parameters + /// - `x`: a pointer to receive the x mouse delta accumulated since last + /// call, can be NULL if unused. + /// - `y`: a pointer to receive the y mouse delta accumulated since last + /// call, can be NULL if unused. + /// + /// ## Return value + /// Returns a 32-bit bitmask of the button state that can be bitwise-compared + /// against the SDL_BUTTON_MASK(X) macro. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMouseState`] + /// - [`SDL_GetGlobalMouseState`] + pub fn SDL_GetRelativeMouseState( + x: *mut ::core::ffi::c_float, + y: *mut ::core::ffi::c_float, + ) -> SDL_MouseButtonFlags; +} + +unsafe extern "C" { + /// Move the mouse cursor to the given position within the window. + /// + /// This function generates a mouse motion event if relative mode is not + /// enabled. If relative mode is enabled, you can force mouse events for the + /// warp by setting the [`SDL_HINT_MOUSE_RELATIVE_WARP_MOTION`] hint. + /// + /// Note that this function will appear to succeed, but not actually move the + /// mouse when used over Microsoft Remote Desktop. + /// + /// ## Parameters + /// - `window`: the window to move the mouse into, or NULL for the current + /// mouse focus. + /// - `x`: the x coordinate within the window. + /// - `y`: the y coordinate within the window. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WarpMouseGlobal`] + pub fn SDL_WarpMouseInWindow( + window: *mut SDL_Window, + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + ); +} + +unsafe extern "C" { + /// Move the mouse to the given position in global screen space. + /// + /// This function generates a mouse motion event. + /// + /// A failure of this function usually means that it is unsupported by a + /// platform. + /// + /// Note that this function will appear to succeed, but not actually move the + /// mouse when used over Microsoft Remote Desktop. + /// + /// ## Parameters + /// - `x`: the x coordinate. + /// - `y`: the y coordinate. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WarpMouseInWindow`] + pub fn SDL_WarpMouseGlobal( + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a user-defined function by which to transform relative mouse inputs. + /// + /// This overrides the relative system scale and relative speed scale hints. + /// Should be called prior to enabling relative mouse mode, fails otherwise. + /// + /// ## Parameters + /// - `callback`: a callback used to transform relative mouse motion, or NULL + /// for default behavior. + /// - `userdata`: a pointer that will be passed to `callback`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_SetRelativeMouseTransform( + callback: SDL_MouseMotionTransformCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set relative mouse mode for a window. + /// + /// While the window has focus and relative mouse mode is enabled, the cursor + /// is hidden, the mouse position is constrained to the window, and SDL will + /// report continuous relative mouse motion even if the mouse is at the edge of + /// the window. + /// + /// If you'd like to keep the mouse position fixed while in relative mode you + /// can use [`SDL_SetWindowMouseRect()`]. If you'd like the cursor to be at a + /// specific location when relative mode ends, you should use + /// [`SDL_WarpMouseInWindow()`] before disabling relative mode. + /// + /// This function will flush any pending mouse motion for this window. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `enabled`: true to enable relative mode, false to disable. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowRelativeMouseMode`] + pub fn SDL_SetWindowRelativeMouseMode( + window: *mut SDL_Window, + enabled: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Query whether relative mouse mode is enabled for a window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns true if relative mode is enabled for a window or false otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowRelativeMouseMode`] + pub fn SDL_GetWindowRelativeMouseMode(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Capture the mouse and to track input outside an SDL window. + /// + /// Capturing enables your app to obtain mouse events globally, instead of just + /// within your window. Not all video targets support this function. When + /// capturing is enabled, the current window will get all mouse events, but + /// unlike relative mode, no change is made to the cursor and it is not + /// restrained to your window. + /// + /// This function may also deny mouse input to other windows--both those in + /// your application and others on the system--so you should use this function + /// sparingly, and in small bursts. For example, you might want to track the + /// mouse while the user is dragging something, until the user releases a mouse + /// button. It is not recommended that you capture the mouse for long periods + /// of time, such as the entire time your app is running. For that, you should + /// probably use [`SDL_SetWindowRelativeMouseMode()`] or [`SDL_SetWindowMouseGrab()`], + /// depending on your goals. + /// + /// While captured, mouse events still report coordinates relative to the + /// current (foreground) window, but those coordinates may be outside the + /// bounds of the window (including negative values). Capturing is only allowed + /// for the foreground window. If the window loses focus while capturing, the + /// capture will be disabled automatically. + /// + /// While capturing is enabled, the current window will have the + /// [`SDL_WINDOW_MOUSE_CAPTURE`] flag set. + /// + /// Please note that SDL will attempt to "auto capture" the mouse while the + /// user is pressing a button; this is to try and make mouse behavior more + /// consistent between platforms, and deal with the common case of a user + /// dragging the mouse outside of the window. This means that if you are + /// calling [`SDL_CaptureMouse()`] only to deal with this situation, you do not + /// have to (although it is safe to do so). If this causes problems for your + /// app, you can disable auto capture by setting the + /// [`SDL_HINT_MOUSE_AUTO_CAPTURE`] hint to zero. + /// + /// ## Parameters + /// - `enabled`: true to enable capturing, false to disable. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetGlobalMouseState`] + pub fn SDL_CaptureMouse(enabled: ::core::primitive::bool) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create a cursor using the specified bitmap data and mask (in MSB format). + /// + /// `mask` has to be in MSB (Most Significant Bit) format. + /// + /// The cursor width (`w`) must be a multiple of 8 bits. + /// + /// The cursor is created in black and white according to the following: + /// + /// - data=0, mask=1: white + /// - data=1, mask=1: black + /// - data=0, mask=0: transparent + /// - data=1, mask=0: inverted color if possible, black if not. + /// + /// Cursors created with this function must be freed with [`SDL_DestroyCursor()`]. + /// + /// If you want to have a color cursor, or create your cursor from an + /// [`SDL_Surface`], you should use [`SDL_CreateColorCursor()`]. Alternately, you can + /// hide the cursor and draw your own as part of your game's rendering, but it + /// will be bound to the framerate. + /// + /// Also, [`SDL_CreateSystemCursor()`] is available, which provides several + /// readily-available system cursors to pick from. + /// + /// ## Parameters + /// - `data`: the color value for each pixel of the cursor. + /// - `mask`: the mask value for each pixel of the cursor. + /// - `w`: the width of the cursor. + /// - `h`: the height of the cursor. + /// - `hot_x`: the x-axis offset from the left of the cursor image to the + /// mouse x position, in the range of 0 to `w` - 1. + /// - `hot_y`: the y-axis offset from the top of the cursor image to the + /// mouse y position, in the range of 0 to `h` - 1. + /// + /// ## Return value + /// Returns a new cursor with the specified parameters on success or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateAnimatedCursor`] + /// - [`SDL_CreateColorCursor`] + /// - [`SDL_CreateSystemCursor`] + /// - [`SDL_DestroyCursor`] + /// - [`SDL_SetCursor`] + pub fn SDL_CreateCursor( + data: *const Uint8, + mask: *const Uint8, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + hot_x: ::core::ffi::c_int, + hot_y: ::core::ffi::c_int, + ) -> *mut SDL_Cursor; +} + +unsafe extern "C" { + /// Create a color cursor. + /// + /// If this function is passed a surface with alternate representations added + /// with [`SDL_AddSurfaceAlternateImage()`], the surface will be interpreted as the + /// content to be used for 100% display scale, and the alternate + /// representations will be used for high DPI situations if + /// [`SDL_HINT_MOUSE_DPI_SCALE_CURSORS`] is enabled. For example, if the original + /// surface is 32x32, then on a 2x macOS display or 200% display scale on + /// Windows, a 64x64 version of the image will be used, if available. If a + /// matching version of the image isn't available, the closest larger size + /// image will be downscaled to the appropriate size and be used instead, if + /// available. Otherwise, the closest smaller image will be upscaled and be + /// used instead. + /// + /// ## Parameters + /// - `surface`: an [`SDL_Surface`] structure representing the cursor image. + /// - `hot_x`: the x position of the cursor hot spot. + /// - `hot_y`: the y position of the cursor hot spot. + /// + /// ## Return value + /// Returns the new cursor on success or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddSurfaceAlternateImage`] + /// - [`SDL_CreateAnimatedCursor`] + /// - [`SDL_CreateCursor`] + /// - [`SDL_CreateSystemCursor`] + /// - [`SDL_DestroyCursor`] + /// - [`SDL_SetCursor`] + pub fn SDL_CreateColorCursor( + surface: *mut SDL_Surface, + hot_x: ::core::ffi::c_int, + hot_y: ::core::ffi::c_int, + ) -> *mut SDL_Cursor; +} + +unsafe extern "C" { + /// Create an animated color cursor. + /// + /// Animated cursors are composed of a sequential array of frames, specified as + /// surfaces and durations in an array of [`SDL_CursorFrameInfo`] structs. The hot + /// spot coordinates are universal to all frames, and all frames must have the + /// same dimensions. + /// + /// Frame durations are specified in milliseconds. A duration of 0 implies an + /// infinite frame time, and the animation will stop on that frame. To create a + /// one-shot animation, set the duration of the last frame in the sequence to + /// 0. + /// + /// If this function is passed surfaces with alternate representations added + /// with [`SDL_AddSurfaceAlternateImage()`], the surfaces will be interpreted as + /// the content to be used for 100% display scale, and the alternate + /// representations will be used for high DPI situations. For example, if the + /// original surfaces are 32x32, then on a 2x macOS display or 200% display + /// scale on Windows, a 64x64 version of the image will be used, if available. + /// If a matching version of the image isn't available, the closest larger size + /// image will be downscaled to the appropriate size and be used instead, if + /// available. Otherwise, the closest smaller image will be upscaled and be + /// used instead. + /// + /// If the underlying platform does not support animated cursors, this function + /// will fall back to creating a static color cursor using the first frame in + /// the sequence. + /// + /// ## Parameters + /// - `frames`: an array of cursor images composing the animation. + /// - `frame_count`: the number of frames in the sequence. + /// - `hot_x`: the x position of the cursor hot spot. + /// - `hot_y`: the y position of the cursor hot spot. + /// + /// ## Return value + /// Returns the new cursor on success or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_AddSurfaceAlternateImage`] + /// - [`SDL_CreateCursor`] + /// - [`SDL_CreateColorCursor`] + /// - [`SDL_CreateSystemCursor`] + /// - [`SDL_DestroyCursor`] + /// - [`SDL_SetCursor`] + pub fn SDL_CreateAnimatedCursor( + frames: *mut SDL_CursorFrameInfo, + frame_count: ::core::ffi::c_int, + hot_x: ::core::ffi::c_int, + hot_y: ::core::ffi::c_int, + ) -> *mut SDL_Cursor; +} + +unsafe extern "C" { + /// Create a system cursor. + /// + /// ## Parameters + /// - `id`: an [`SDL_SystemCursor`] enum value. + /// + /// ## Return value + /// Returns a cursor on success or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyCursor`] + pub fn SDL_CreateSystemCursor(id: SDL_SystemCursor) -> *mut SDL_Cursor; +} + +unsafe extern "C" { + /// Set the active cursor. + /// + /// This function sets the currently active cursor to the specified one. If the + /// cursor is currently visible, the change will be immediately represented on + /// the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if + /// this is desired for any reason. + /// + /// ## Parameters + /// - `cursor`: a cursor to make active. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCursor`] + pub fn SDL_SetCursor(cursor: *mut SDL_Cursor) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the active cursor. + /// + /// This function returns a pointer to the current cursor which is owned by the + /// library. It is not necessary to free the cursor with [`SDL_DestroyCursor()`]. + /// + /// ## Return value + /// Returns the active cursor or NULL if there is no mouse. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetCursor`] + pub fn SDL_GetCursor() -> *mut SDL_Cursor; +} + +unsafe extern "C" { + /// Get the default cursor. + /// + /// You do not have to call [`SDL_DestroyCursor()`] on the return value, but it is + /// safe to do so. + /// + /// ## Return value + /// Returns the default cursor on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetDefaultCursor() -> *mut SDL_Cursor; +} + +unsafe extern "C" { + /// Free a previously-created cursor. + /// + /// Use this function to free cursor resources created with [`SDL_CreateCursor()`], + /// [`SDL_CreateColorCursor()`] or [`SDL_CreateSystemCursor()`]. + /// + /// ## Parameters + /// - `cursor`: the cursor to free. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateAnimatedCursor`] + /// - [`SDL_CreateColorCursor`] + /// - [`SDL_CreateCursor`] + /// - [`SDL_CreateSystemCursor`] + pub fn SDL_DestroyCursor(cursor: *mut SDL_Cursor); +} + +unsafe extern "C" { + /// Show the cursor. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CursorVisible`] + /// - [`SDL_HideCursor`] + pub fn SDL_ShowCursor() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Hide the cursor. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CursorVisible`] + /// - [`SDL_ShowCursor`] + pub fn SDL_HideCursor() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether the cursor is currently being shown. + /// + /// ## Return value + /// Returns `true` if the cursor is being shown, or `false` if the cursor is + /// hidden. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HideCursor`] + /// - [`SDL_ShowCursor`] + pub fn SDL_CursorVisible() -> ::core::primitive::bool; +} + +/// The structure used to identify an SDL cursor. +/// +/// This is opaque data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Cursor { + _opaque: [::core::primitive::u8; 0], +} + +/// A bitmask of pressed mouse buttons, as reported by [`SDL_GetMouseState`], etc. +/// +/// - Button 1: Left mouse button +/// - Button 2: Middle mouse button +/// - Button 3: Right mouse button +/// - Button 4: Side mouse button 1 +/// - Button 5: Side mouse button 2 +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetMouseState`] +/// - [`SDL_GetGlobalMouseState`] +/// - [`SDL_GetRelativeMouseState`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`LMASK`](SDL_MouseButtonFlags::LMASK) | [`SDL_BUTTON_LMASK`] | | +/// | [`MMASK`](SDL_MouseButtonFlags::MMASK) | [`SDL_BUTTON_MMASK`] | | +/// | [`RMASK`](SDL_MouseButtonFlags::RMASK) | [`SDL_BUTTON_RMASK`] | | +/// | [`X1MASK`](SDL_MouseButtonFlags::X1MASK) | [`SDL_BUTTON_X1MASK`] | | +/// | [`X2MASK`](SDL_MouseButtonFlags::X2MASK) | [`SDL_BUTTON_X2MASK`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_MouseButtonFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_MouseButtonFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_MouseButtonFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_MouseButtonFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_MouseButtonFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_MouseButtonFlags(")?; + let all_bits = all_bits | Self::LMASK.0; + if (Self::LMASK != 0 || self.0 == 0) && *self & Self::LMASK == Self::LMASK { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LMASK")?; + } + let all_bits = all_bits | Self::MMASK.0; + if (Self::MMASK != 0 || self.0 == 0) && *self & Self::MMASK == Self::MMASK { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MMASK")?; + } + let all_bits = all_bits | Self::RMASK.0; + if (Self::RMASK != 0 || self.0 == 0) && *self & Self::RMASK == Self::RMASK { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RMASK")?; + } + let all_bits = all_bits | Self::X1MASK.0; + if (Self::X1MASK != 0 || self.0 == 0) && *self & Self::X1MASK == Self::X1MASK { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "X1MASK")?; + } + let all_bits = all_bits | Self::X2MASK.0; + if (Self::X2MASK != 0 || self.0 == 0) && *self & Self::X2MASK == Self::X2MASK { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "X2MASK")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_MouseButtonFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_MouseButtonFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_MouseButtonFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_MouseButtonFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_MouseButtonFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_MouseButtonFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_MouseButtonFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_MouseButtonFlags { + pub const LMASK: Self = SDL_BUTTON_MASK(SDL_BUTTON_LEFT); + pub const MMASK: Self = SDL_BUTTON_MASK(SDL_BUTTON_MIDDLE); + pub const RMASK: Self = SDL_BUTTON_MASK(SDL_BUTTON_RIGHT); + pub const X1MASK: Self = SDL_BUTTON_MASK(SDL_BUTTON_X1); + pub const X2MASK: Self = SDL_BUTTON_MASK(SDL_BUTTON_X2); +} + +pub const SDL_BUTTON_LMASK: SDL_MouseButtonFlags = SDL_MouseButtonFlags::LMASK; +pub const SDL_BUTTON_MMASK: SDL_MouseButtonFlags = SDL_MouseButtonFlags::MMASK; +pub const SDL_BUTTON_RMASK: SDL_MouseButtonFlags = SDL_MouseButtonFlags::RMASK; +pub const SDL_BUTTON_X1MASK: SDL_MouseButtonFlags = SDL_MouseButtonFlags::X1MASK; +pub const SDL_BUTTON_X2MASK: SDL_MouseButtonFlags = SDL_MouseButtonFlags::X2MASK; + +impl SDL_MouseButtonFlags { + /// Initialize a `SDL_MouseButtonFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_MouseButtonFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MouseButtonFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::mouse::METADATA_SDL_MouseButtonFlags; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/mutex.rs b/vendor/sdl3-sys/src/generated/mutex.rs new file mode 100644 index 00000000..2d415e2f --- /dev/null +++ b/vendor/sdl3-sys/src/generated/mutex.rs @@ -0,0 +1,1050 @@ +//! SDL offers several thread synchronization primitives. This document can't +//! cover the complicated topic of thread safety, but reading up on what each +//! of these primitives are, why they are useful, and how to correctly use them +//! is vital to writing correct and safe multithreaded programs. +//! +//! - Mutexes: [`SDL_CreateMutex()`] +//! - Read/Write locks: [`SDL_CreateRWLock()`] +//! - Semaphores: [`SDL_CreateSemaphore()`] +//! - Condition variables: [`SDL_CreateCondition()`] +//! +//! SDL also offers a datatype, [`SDL_InitState`], which can be used to make sure +//! only one thread initializes/deinitializes some resource that several +//! threads might try to use for the first time simultaneously. + +use super::stdinc::*; + +use super::atomic::*; + +use super::error::*; + +use super::thread::*; + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +unsafe extern "C" { + /// Create a new mutex. + /// + /// All newly-created mutexes begin in the _unlocked_ state. + /// + /// Calls to [`SDL_LockMutex()`] will not return while the mutex is locked by + /// another thread. See [`SDL_TryLockMutex()`] to attempt to lock without blocking. + /// + /// SDL mutexes are reentrant. + /// + /// ## Return value + /// Returns the initialized and unlocked mutex or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyMutex`] + /// - [`SDL_LockMutex`] + /// - [`SDL_TryLockMutex`] + /// - [`SDL_UnlockMutex`] + pub fn SDL_CreateMutex() -> *mut SDL_Mutex; +} + +unsafe extern "C" { + /// Lock the mutex. + /// + /// This will block until the mutex is available, which is to say it is in the + /// unlocked state and the OS has chosen the caller as the next thread to lock + /// it. Of all threads waiting to lock the mutex, only one may do so at a time. + /// + /// It is legal for the owning thread to lock an already-locked mutex. It must + /// unlock it the same number of times before it is actually made available for + /// other threads in the system (this is known as a "recursive mutex"). + /// + /// This function does not fail; if mutex is NULL, it will return immediately + /// having locked nothing. If the mutex is valid, this function will always + /// block until it can lock the mutex, and return with it locked. + /// + /// ## Parameters + /// - `mutex`: the mutex to lock. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_TryLockMutex`] + /// - [`SDL_UnlockMutex`] + pub fn SDL_LockMutex(mutex: *mut SDL_Mutex); +} + +unsafe extern "C" { + /// Try to lock a mutex without blocking. + /// + /// This works just like [`SDL_LockMutex()`], but if the mutex is not available, + /// this function returns false immediately. + /// + /// This technique is useful if you need exclusive access to a resource but + /// don't want to wait for it, and will return to it to try again later. + /// + /// This function returns true if passed a NULL mutex. + /// + /// ## Parameters + /// - `mutex`: the mutex to try to lock. + /// + /// ## Return value + /// Returns true on success, false if the mutex would block. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockMutex`] + /// - [`SDL_UnlockMutex`] + pub fn SDL_TryLockMutex(mutex: *mut SDL_Mutex) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unlock the mutex. + /// + /// It is legal for the owning thread to lock an already-locked mutex. It must + /// unlock it the same number of times before it is actually made available for + /// other threads in the system (this is known as a "recursive mutex"). + /// + /// It is illegal to unlock a mutex that has not been locked by the current + /// thread, and doing so results in undefined behavior. + /// + /// ## Parameters + /// - `mutex`: the mutex to unlock. + /// + /// ## Thread safety + /// This call must be paired with a previous locking call on the + /// same thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockMutex`] + /// - [`SDL_TryLockMutex`] + pub fn SDL_UnlockMutex(mutex: *mut SDL_Mutex); +} + +unsafe extern "C" { + /// Destroy a mutex created with [`SDL_CreateMutex()`]. + /// + /// This function must be called on any mutex that is no longer needed. Failure + /// to destroy a mutex will result in a system memory or resource leak. While + /// it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt + /// to destroy a locked mutex, and may result in undefined behavior depending + /// on the platform. + /// + /// ## Parameters + /// - `mutex`: the mutex to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateMutex`] + pub fn SDL_DestroyMutex(mutex: *mut SDL_Mutex); +} + +unsafe extern "C" { + /// Create a new read/write lock. + /// + /// A read/write lock is useful for situations where you have multiple threads + /// trying to access a resource that is rarely updated. All threads requesting + /// a read-only lock will be allowed to run in parallel; if a thread requests a + /// write lock, it will be provided exclusive access. This makes it safe for + /// multiple threads to use a resource at the same time if they promise not to + /// change it, and when it has to be changed, the rwlock will serve as a + /// gateway to make sure those changes can be made safely. + /// + /// In the right situation, a rwlock can be more efficient than a mutex, which + /// only lets a single thread proceed at a time, even if it won't be modifying + /// the data. + /// + /// All newly-created read/write locks begin in the _unlocked_ state. + /// + /// Calls to [`SDL_LockRWLockForReading()`] and [`SDL_LockRWLockForWriting`] will not + /// return while the rwlock is locked _for writing_ by another thread. See + /// [`SDL_TryLockRWLockForReading()`] and [`SDL_TryLockRWLockForWriting()`] to attempt + /// to lock without blocking. + /// + /// SDL read/write locks are only recursive for read-only locks! They are not + /// guaranteed to be fair, or provide access in a FIFO manner! They are not + /// guaranteed to favor writers. You may not lock a rwlock for both read-only + /// and write access at the same time from the same thread (so you can't + /// promote your read-only lock to a write lock without unlocking first). + /// + /// ## Return value + /// Returns the initialized and unlocked read/write lock or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyRWLock`] + /// - [`SDL_LockRWLockForReading`] + /// - [`SDL_LockRWLockForWriting`] + /// - [`SDL_TryLockRWLockForReading`] + /// - [`SDL_TryLockRWLockForWriting`] + /// - [`SDL_UnlockRWLock`] + pub fn SDL_CreateRWLock() -> *mut SDL_RWLock; +} + +unsafe extern "C" { + /// Lock the read/write lock for _read only_ operations. + /// + /// This will block until the rwlock is available, which is to say it is not + /// locked for writing by any other thread. Of all threads waiting to lock the + /// rwlock, all may do so at the same time as long as they are requesting + /// read-only access; if a thread wants to lock for writing, only one may do so + /// at a time, and no other threads, read-only or not, may hold the lock at the + /// same time. + /// + /// It is legal for the owning thread to lock an already-locked rwlock for + /// reading. It must unlock it the same number of times before it is actually + /// made available for other threads in the system (this is known as a + /// "recursive rwlock"). + /// + /// Note that locking for writing is not recursive (this is only available to + /// read-only locks). + /// + /// It is illegal to request a read-only lock from a thread that already holds + /// the write lock. Doing so results in undefined behavior. Unlock the write + /// lock before requesting a read-only lock. (But, of course, if you have the + /// write lock, you don't need further locks to read in any case.) + /// + /// This function does not fail; if rwlock is NULL, it will return immediately + /// having locked nothing. If the rwlock is valid, this function will always + /// block until it can lock the mutex, and return with it locked. + /// + /// ## Parameters + /// - `rwlock`: the read/write lock to lock. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockRWLockForWriting`] + /// - [`SDL_TryLockRWLockForReading`] + /// - [`SDL_UnlockRWLock`] + pub fn SDL_LockRWLockForReading(rwlock: *mut SDL_RWLock); +} + +unsafe extern "C" { + /// Lock the read/write lock for _write_ operations. + /// + /// This will block until the rwlock is available, which is to say it is not + /// locked for reading or writing by any other thread. Only one thread may hold + /// the lock when it requests write access; all other threads, whether they + /// also want to write or only want read-only access, must wait until the + /// writer thread has released the lock. + /// + /// It is illegal for the owning thread to lock an already-locked rwlock for + /// writing (read-only may be locked recursively, writing can not). Doing so + /// results in undefined behavior. + /// + /// It is illegal to request a write lock from a thread that already holds a + /// read-only lock. Doing so results in undefined behavior. Unlock the + /// read-only lock before requesting a write lock. + /// + /// This function does not fail; if rwlock is NULL, it will return immediately + /// having locked nothing. If the rwlock is valid, this function will always + /// block until it can lock the mutex, and return with it locked. + /// + /// ## Parameters + /// - `rwlock`: the read/write lock to lock. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockRWLockForReading`] + /// - [`SDL_TryLockRWLockForWriting`] + /// - [`SDL_UnlockRWLock`] + pub fn SDL_LockRWLockForWriting(rwlock: *mut SDL_RWLock); +} + +unsafe extern "C" { + /// Try to lock a read/write lock _for reading_ without blocking. + /// + /// This works just like [`SDL_LockRWLockForReading()`], but if the rwlock is not + /// available, then this function returns false immediately. + /// + /// This technique is useful if you need access to a resource but don't want to + /// wait for it, and will return to it to try again later. + /// + /// Trying to lock for read-only access can succeed if other threads are + /// holding read-only locks, as this won't prevent access. + /// + /// This function returns true if passed a NULL rwlock. + /// + /// ## Parameters + /// - `rwlock`: the rwlock to try to lock. + /// + /// ## Return value + /// Returns true on success, false if the lock would block. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockRWLockForReading`] + /// - [`SDL_TryLockRWLockForWriting`] + /// - [`SDL_UnlockRWLock`] + pub fn SDL_TryLockRWLockForReading(rwlock: *mut SDL_RWLock) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Try to lock a read/write lock _for writing_ without blocking. + /// + /// This works just like [`SDL_LockRWLockForWriting()`], but if the rwlock is not + /// available, then this function returns false immediately. + /// + /// This technique is useful if you need exclusive access to a resource but + /// don't want to wait for it, and will return to it to try again later. + /// + /// It is illegal for the owning thread to lock an already-locked rwlock for + /// writing (read-only may be locked recursively, writing can not). Doing so + /// results in undefined behavior. + /// + /// It is illegal to request a write lock from a thread that already holds a + /// read-only lock. Doing so results in undefined behavior. Unlock the + /// read-only lock before requesting a write lock. + /// + /// This function returns true if passed a NULL rwlock. + /// + /// ## Parameters + /// - `rwlock`: the rwlock to try to lock. + /// + /// ## Return value + /// Returns true on success, false if the lock would block. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockRWLockForWriting`] + /// - [`SDL_TryLockRWLockForReading`] + /// - [`SDL_UnlockRWLock`] + pub fn SDL_TryLockRWLockForWriting(rwlock: *mut SDL_RWLock) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unlock the read/write lock. + /// + /// Use this function to unlock the rwlock, whether it was locked for read-only + /// or write operations. + /// + /// It is legal for the owning thread to lock an already-locked read-only lock. + /// It must unlock it the same number of times before it is actually made + /// available for other threads in the system (this is known as a "recursive + /// rwlock"). + /// + /// It is illegal to unlock a rwlock that has not been locked by the current + /// thread, and doing so results in undefined behavior. + /// + /// ## Parameters + /// - `rwlock`: the rwlock to unlock. + /// + /// ## Thread safety + /// This call must be paired with a previous locking call on the + /// same thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockRWLockForReading`] + /// - [`SDL_LockRWLockForWriting`] + /// - [`SDL_TryLockRWLockForReading`] + /// - [`SDL_TryLockRWLockForWriting`] + pub fn SDL_UnlockRWLock(rwlock: *mut SDL_RWLock); +} + +unsafe extern "C" { + /// Destroy a read/write lock created with [`SDL_CreateRWLock()`]. + /// + /// This function must be called on any read/write lock that is no longer + /// needed. Failure to destroy a rwlock will result in a system memory or + /// resource leak. While it is safe to destroy a rwlock that is _unlocked_, it + /// is not safe to attempt to destroy a locked rwlock, and may result in + /// undefined behavior depending on the platform. + /// + /// ## Parameters + /// - `rwlock`: the rwlock to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRWLock`] + pub fn SDL_DestroyRWLock(rwlock: *mut SDL_RWLock); +} + +unsafe extern "C" { + /// Create a semaphore. + /// + /// This function creates a new semaphore and initializes it with the value + /// `initial_value`. Each wait operation on the semaphore will atomically + /// decrement the semaphore value and potentially block if the semaphore value + /// is 0. Each post operation will atomically increment the semaphore value and + /// wake waiting threads and allow them to retry the wait operation. + /// + /// ## Parameters + /// - `initial_value`: the starting value of the semaphore. + /// + /// ## Return value + /// Returns a new semaphore or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroySemaphore`] + /// - [`SDL_SignalSemaphore`] + /// - [`SDL_TryWaitSemaphore`] + /// - [`SDL_GetSemaphoreValue`] + /// - [`SDL_WaitSemaphore`] + /// - [`SDL_WaitSemaphoreTimeout`] + pub fn SDL_CreateSemaphore(initial_value: Uint32) -> *mut SDL_Semaphore; +} + +unsafe extern "C" { + /// Destroy a semaphore. + /// + /// It is not safe to destroy a semaphore if there are threads currently + /// waiting on it. + /// + /// ## Parameters + /// - `sem`: the semaphore to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateSemaphore`] + pub fn SDL_DestroySemaphore(sem: *mut SDL_Semaphore); +} + +unsafe extern "C" { + /// Wait until a semaphore has a positive value and then decrements it. + /// + /// This function suspends the calling thread until the semaphore pointed to by + /// `sem` has a positive value, and then atomically decrement the semaphore + /// value. + /// + /// This function is the equivalent of calling [`SDL_WaitSemaphoreTimeout()`] with + /// a time length of -1. + /// + /// ## Parameters + /// - `sem`: the semaphore wait on. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SignalSemaphore`] + /// - [`SDL_TryWaitSemaphore`] + /// - [`SDL_WaitSemaphoreTimeout`] + pub fn SDL_WaitSemaphore(sem: *mut SDL_Semaphore); +} + +unsafe extern "C" { + /// See if a semaphore has a positive value and decrement it if it does. + /// + /// This function checks to see if the semaphore pointed to by `sem` has a + /// positive value and atomically decrements the semaphore value if it does. If + /// the semaphore doesn't have a positive value, the function immediately + /// returns false. + /// + /// ## Parameters + /// - `sem`: the semaphore to wait on. + /// + /// ## Return value + /// Returns true if the wait succeeds, false if the wait would block. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SignalSemaphore`] + /// - [`SDL_WaitSemaphore`] + /// - [`SDL_WaitSemaphoreTimeout`] + pub fn SDL_TryWaitSemaphore(sem: *mut SDL_Semaphore) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Wait until a semaphore has a positive value and then decrements it. + /// + /// This function suspends the calling thread until either the semaphore + /// pointed to by `sem` has a positive value or the specified time has elapsed. + /// If the call is successful it will atomically decrement the semaphore value. + /// + /// ## Parameters + /// - `sem`: the semaphore to wait on. + /// - `timeoutMS`: the length of the timeout, in milliseconds, or -1 to wait + /// indefinitely. + /// + /// ## Return value + /// Returns true if the wait succeeds or false if the wait times out. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SignalSemaphore`] + /// - [`SDL_TryWaitSemaphore`] + /// - [`SDL_WaitSemaphore`] + pub fn SDL_WaitSemaphoreTimeout( + sem: *mut SDL_Semaphore, + timeoutMS: Sint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Atomically increment a semaphore's value and wake waiting threads. + /// + /// ## Parameters + /// - `sem`: the semaphore to increment. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_TryWaitSemaphore`] + /// - [`SDL_WaitSemaphore`] + /// - [`SDL_WaitSemaphoreTimeout`] + pub fn SDL_SignalSemaphore(sem: *mut SDL_Semaphore); +} + +unsafe extern "C" { + /// Get the current value of a semaphore. + /// + /// ## Parameters + /// - `sem`: the semaphore to query. + /// + /// ## Return value + /// Returns the current value of the semaphore. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSemaphoreValue(sem: *mut SDL_Semaphore) -> Uint32; +} + +unsafe extern "C" { + /// Create a condition variable. + /// + /// ## Return value + /// Returns a new condition variable or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BroadcastCondition`] + /// - [`SDL_SignalCondition`] + /// - [`SDL_WaitCondition`] + /// - [`SDL_WaitConditionTimeout`] + /// - [`SDL_DestroyCondition`] + pub fn SDL_CreateCondition() -> *mut SDL_Condition; +} + +unsafe extern "C" { + /// Destroy a condition variable. + /// + /// ## Parameters + /// - `cond`: the condition variable to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateCondition`] + pub fn SDL_DestroyCondition(cond: *mut SDL_Condition); +} + +unsafe extern "C" { + /// Restart one of the threads that are waiting on the condition variable. + /// + /// ## Parameters + /// - `cond`: the condition variable to signal. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BroadcastCondition`] + /// - [`SDL_WaitCondition`] + /// - [`SDL_WaitConditionTimeout`] + pub fn SDL_SignalCondition(cond: *mut SDL_Condition); +} + +unsafe extern "C" { + /// Restart all threads that are waiting on the condition variable. + /// + /// ## Parameters + /// - `cond`: the condition variable to signal. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SignalCondition`] + /// - [`SDL_WaitCondition`] + /// - [`SDL_WaitConditionTimeout`] + pub fn SDL_BroadcastCondition(cond: *mut SDL_Condition); +} + +unsafe extern "C" { + /// Wait until a condition variable is signaled. + /// + /// This function unlocks the specified `mutex` and waits for another thread to + /// call [`SDL_SignalCondition()`] or [`SDL_BroadcastCondition()`] on the condition + /// variable `cond`. Once the condition variable is signaled, the mutex is + /// re-locked and the function returns. + /// + /// The mutex must be locked before calling this function. Locking the mutex + /// recursively (more than once) is not supported and leads to undefined + /// behavior. + /// + /// This function is the equivalent of calling [`SDL_WaitConditionTimeout()`] with + /// a time length of -1. + /// + /// ## Parameters + /// - `cond`: the condition variable to wait on. + /// - `mutex`: the mutex used to coordinate thread access. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BroadcastCondition`] + /// - [`SDL_SignalCondition`] + /// - [`SDL_WaitConditionTimeout`] + pub fn SDL_WaitCondition(cond: *mut SDL_Condition, mutex: *mut SDL_Mutex); +} + +unsafe extern "C" { + /// Wait until a condition variable is signaled or a certain time has passed. + /// + /// This function unlocks the specified `mutex` and waits for another thread to + /// call [`SDL_SignalCondition()`] or [`SDL_BroadcastCondition()`] on the condition + /// variable `cond`, or for the specified time to elapse. Once the condition + /// variable is signaled or the time elapsed, the mutex is re-locked and the + /// function returns. + /// + /// The mutex must be locked before calling this function. Locking the mutex + /// recursively (more than once) is not supported and leads to undefined + /// behavior. + /// + /// ## Parameters + /// - `cond`: the condition variable to wait on. + /// - `mutex`: the mutex used to coordinate thread access. + /// - `timeoutMS`: the maximum time to wait, in milliseconds, or -1 to wait + /// indefinitely. + /// + /// ## Return value + /// Returns true if the condition variable is signaled, false if the condition + /// is not signaled in the allotted time. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BroadcastCondition`] + /// - [`SDL_SignalCondition`] + /// - [`SDL_WaitCondition`] + pub fn SDL_WaitConditionTimeout( + cond: *mut SDL_Condition, + mutex: *mut SDL_Mutex, + timeoutMS: Sint32, + ) -> ::core::primitive::bool; +} + +/// The current status of an [`SDL_InitState`] structure. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNINITIALIZED`](SDL_InitStatus::UNINITIALIZED) | [`SDL_INIT_STATUS_UNINITIALIZED`] | | +/// | [`INITIALIZING`](SDL_InitStatus::INITIALIZING) | [`SDL_INIT_STATUS_INITIALIZING`] | | +/// | [`INITIALIZED`](SDL_InitStatus::INITIALIZED) | [`SDL_INIT_STATUS_INITIALIZED`] | | +/// | [`UNINITIALIZING`](SDL_InitStatus::UNINITIALIZING) | [`SDL_INIT_STATUS_UNINITIALIZING`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_InitStatus(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_InitStatus { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_InitStatus) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_InitStatus) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_InitStatus { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNINITIALIZED => "SDL_INIT_STATUS_UNINITIALIZED", + Self::INITIALIZING => "SDL_INIT_STATUS_INITIALIZING", + Self::INITIALIZED => "SDL_INIT_STATUS_INITIALIZED", + Self::UNINITIALIZING => "SDL_INIT_STATUS_UNINITIALIZING", + + _ => return write!(f, "SDL_InitStatus({})", self.0), + }) + } +} + +impl SDL_InitStatus { + pub const UNINITIALIZED: Self = Self((0 as ::core::ffi::c_int)); + pub const INITIALIZING: Self = Self((1 as ::core::ffi::c_int)); + pub const INITIALIZED: Self = Self((2 as ::core::ffi::c_int)); + pub const UNINITIALIZING: Self = Self((3 as ::core::ffi::c_int)); +} + +pub const SDL_INIT_STATUS_UNINITIALIZED: SDL_InitStatus = SDL_InitStatus::UNINITIALIZED; +pub const SDL_INIT_STATUS_INITIALIZING: SDL_InitStatus = SDL_InitStatus::INITIALIZING; +pub const SDL_INIT_STATUS_INITIALIZED: SDL_InitStatus = SDL_InitStatus::INITIALIZED; +pub const SDL_INIT_STATUS_UNINITIALIZING: SDL_InitStatus = SDL_InitStatus::UNINITIALIZING; + +impl SDL_InitStatus { + /// Initialize a `SDL_InitStatus` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_InitStatus { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_InitStatus { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::mutex::METADATA_SDL_InitStatus; +} + +/// A structure used for thread-safe initialization and shutdown. +/// +/// Here is an example of using this: +/// +/// ```c +/// static SDL_InitState init; +/// +/// bool InitSystem(void) +/// { +/// if (!SDL_ShouldInit(&init)) { +/// // The system is initialized +/// return true; +/// } +/// +/// // At this point, you should not leave this function without calling SDL_SetInitialized() +/// +/// bool initialized = DoInitTasks(); +/// SDL_SetInitialized(&init, initialized); +/// return initialized; +/// } +/// +/// bool UseSubsystem(void) +/// { +/// if (SDL_ShouldInit(&init)) { +/// // Error, the subsystem isn't initialized +/// SDL_SetInitialized(&init, false); +/// return false; +/// } +/// +/// // Do work using the initialized subsystem +/// +/// return true; +/// } +/// +/// void QuitSystem(void) +/// { +/// if (!SDL_ShouldQuit(&init)) { +/// // The system is not initialized +/// return; +/// } +/// +/// // At this point, you should not leave this function without calling SDL_SetInitialized() +/// +/// DoQuitTasks(); +/// SDL_SetInitialized(&init, false); +/// } +/// ``` +/// +/// Note that this doesn't protect any resources created during initialization, +/// or guarantee that nobody is using those resources during cleanup. You +/// should use other mechanisms to protect those, if that's a concern for your +/// code. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_InitState { + pub status: SDL_AtomicInt, + pub thread: SDL_ThreadID, + pub reserved: *mut ::core::ffi::c_void, +} + +impl ::core::default::Default for SDL_InitState { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Return whether initialization should be done. + /// + /// This function checks the passed in state and if initialization should be + /// done, sets the status to [`SDL_INIT_STATUS_INITIALIZING`] and returns true. + /// If another thread is already modifying this state, it will wait until + /// that's done before returning. + /// + /// If this function returns true, the calling code must call + /// [`SDL_SetInitialized()`] to complete the initialization. + /// + /// ## Parameters + /// - `state`: the initialization state to check. + /// + /// ## Return value + /// Returns true if initialization needs to be done, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetInitialized`] + /// - [`SDL_ShouldQuit`] + pub fn SDL_ShouldInit(state: *mut SDL_InitState) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether cleanup should be done. + /// + /// This function checks the passed in state and if cleanup should be done, + /// sets the status to [`SDL_INIT_STATUS_UNINITIALIZING`] and returns true. + /// + /// If this function returns true, the calling code must call + /// [`SDL_SetInitialized()`] to complete the cleanup. + /// + /// ## Parameters + /// - `state`: the initialization state to check. + /// + /// ## Return value + /// Returns true if cleanup needs to be done, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetInitialized`] + /// - [`SDL_ShouldInit`] + pub fn SDL_ShouldQuit(state: *mut SDL_InitState) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Finish an initialization state transition. + /// + /// This function sets the status of the passed in state to + /// [`SDL_INIT_STATUS_INITIALIZED`] or [`SDL_INIT_STATUS_UNINITIALIZED`] and allows + /// any threads waiting for the status to proceed. + /// + /// ## Parameters + /// - `state`: the initialization state to check. + /// - `initialized`: the new initialization state. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ShouldInit`] + /// - [`SDL_ShouldQuit`] + pub fn SDL_SetInitialized(state: *mut SDL_InitState, initialized: ::core::primitive::bool); +} + +/// A means to block multiple threads until a condition is satisfied. +/// +/// Condition variables, paired with an [`SDL_Mutex`], let an app halt multiple +/// threads until a condition has occurred, at which time the app can release +/// one or all waiting threads. +/// +/// Wikipedia has a thorough explanation of the concept: +/// +/// +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Condition { + _opaque: [::core::primitive::u8; 0], +} + +/// A means to serialize access to a resource between threads. +/// +/// Mutexes (short for "mutual exclusion") are a synchronization primitive that +/// allows exactly one thread to proceed at a time. +/// +/// Wikipedia has a thorough explanation of the concept: +/// +/// +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Mutex { + _opaque: [::core::primitive::u8; 0], +} + +/// A mutex that allows read-only threads to run in parallel. +/// +/// A rwlock is roughly the same concept as [`SDL_Mutex`], but allows threads that +/// request read-only access to all hold the lock at the same time. If a thread +/// requests write access, it will block until all read-only threads have +/// released the lock, and no one else can hold the thread (for reading or +/// writing) at the same time as the writing thread. +/// +/// This can be more efficient in cases where several threads need to access +/// data frequently, but changes to that data are rare. +/// +/// There are other rules that apply to rwlocks that don't apply to mutexes, +/// about how threads are scheduled and when they can be recursively locked. +/// These are documented in the other rwlock functions. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_RWLock { + _opaque: [::core::primitive::u8; 0], +} + +/// A means to manage access to a resource, by count, between threads. +/// +/// Semaphores (specifically, "counting semaphores"), let X number of threads +/// request access at the same time, each thread granted access decrementing a +/// counter. When the counter reaches zero, future requests block until a prior +/// thread releases their request, incrementing the counter again. +/// +/// Wikipedia has a thorough explanation of the concept: +/// +/// +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Semaphore { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/pen.rs b/vendor/sdl3-sys/src/generated/pen.rs new file mode 100644 index 00000000..437b5bf9 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/pen.rs @@ -0,0 +1,623 @@ +//! SDL pen event handling. +//! +//! SDL provides an API for pressure-sensitive pen (stylus and/or eraser) +//! handling, e.g., for input and drawing tablets or suitably equipped mobile / +//! tablet devices. +//! +//! To get started with pens, simply handle pen events: +//! +//! - [`SDL_EVENT_PEN_PROXIMITY_IN`], [`SDL_EVENT_PEN_PROXIMITY_OUT`] +//! ([`SDL_PenProximityEvent`]) +//! - [`SDL_EVENT_PEN_DOWN`], [`SDL_EVENT_PEN_UP`] ([`SDL_PenTouchEvent`]) +//! - [`SDL_EVENT_PEN_MOTION`] ([`SDL_PenMotionEvent`]) +//! - [`SDL_EVENT_PEN_BUTTON_DOWN`], [`SDL_EVENT_PEN_BUTTON_UP`] ([`SDL_PenButtonEvent`]) +//! - [`SDL_EVENT_PEN_AXIS`] ([`SDL_PenAxisEvent`]) +//! +//! Pens may provide more than simple touch input; they might have other axes, +//! such as pressure, tilt, rotation, etc. +//! +//! When a pen starts providing input, SDL will assign it a unique [`SDL_PenID`], +//! which will remain for the life of the process, as long as the pen stays +//! connected. A pen leaving proximity (being taken far enough away from the +//! digitizer tablet that it no longer reponds) and then coming back should +//! fire proximity events, but the [`SDL_PenID`] should remain consistent. +//! Unplugging the digitizer and reconnecting may cause future input to have a +//! new [`SDL_PenID`], as SDL may not know that this is the same hardware. +//! +//! Please note that various platforms vary wildly in how (and how well) they +//! support pen input. If your pen supports some piece of functionality but SDL +//! doesn't seem to, it might actually be the operating system's fault. For +//! example, some platforms can manage multiple devices at the same time, but +//! others will make any connected pens look like a single logical device, much +//! how all USB mice connected to a computer will move the same system cursor. +//! Other platforms might not support pen buttons, or the distance axis, etc. +//! Very few platforms can even report _what_ functionality the pen supports in +//! the first place, so best practices is to either build UI to let the user +//! configure their pens, or be prepared to handle new functionality for a pen +//! the first time an event is reported. + +use super::stdinc::*; + +use super::mouse::*; + +use super::touch::*; + +/// SDL pen instance IDs. +/// +/// Zero is used to signify an invalid/null device. +/// +/// These show up in pen events when SDL sees input from them. They remain +/// consistent as long as SDL can recognize a tool to be the same pen; but if a +/// pen's digitizer table is physically detached from the computer, it might +/// get a new ID when reconnected, as SDL won't know it's the same device. +/// +/// These IDs are only stable within a single run of a program; the next time a +/// program is run, the pen's ID will likely be different, even if the hardware +/// hasn't been disconnected, etc. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PenID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_PenID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_PenID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_PenID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_PenID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_PenID { + /// Initialize a `SDL_PenID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_PenID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PenID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pen::METADATA_SDL_PenID; +} + +/// The [`SDL_MouseID`] for mouse events simulated with pen input. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_PEN_MOUSEID: SDL_MouseID = SDL_MouseID((-2_i32 as Uint32)); + +/// The [`SDL_TouchID`] for touch events simulated with pen input. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_PEN_TOUCHID: SDL_TouchID = SDL_TouchID((-2_i32 as Uint64)); + +/// Pen input flags, as reported by various pen events' `pen_state` field. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DOWN`](SDL_PenInputFlags::DOWN) | [`SDL_PEN_INPUT_DOWN`] | pen is pressed down | +/// | [`BUTTON_1`](SDL_PenInputFlags::BUTTON_1) | [`SDL_PEN_INPUT_BUTTON_1`] | button 1 is pressed | +/// | [`BUTTON_2`](SDL_PenInputFlags::BUTTON_2) | [`SDL_PEN_INPUT_BUTTON_2`] | button 2 is pressed | +/// | [`BUTTON_3`](SDL_PenInputFlags::BUTTON_3) | [`SDL_PEN_INPUT_BUTTON_3`] | button 3 is pressed | +/// | [`BUTTON_4`](SDL_PenInputFlags::BUTTON_4) | [`SDL_PEN_INPUT_BUTTON_4`] | button 4 is pressed | +/// | [`BUTTON_5`](SDL_PenInputFlags::BUTTON_5) | [`SDL_PEN_INPUT_BUTTON_5`] | button 5 is pressed | +/// | [`ERASER_TIP`](SDL_PenInputFlags::ERASER_TIP) | [`SDL_PEN_INPUT_ERASER_TIP`] | eraser tip is used | +/// | [`IN_PROXIMITY`](SDL_PenInputFlags::IN_PROXIMITY) | [`SDL_PEN_INPUT_IN_PROXIMITY`] | pen is in proximity (since SDL 3.4.0) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_PenInputFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_PenInputFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_PenInputFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_PenInputFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PenInputFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_PenInputFlags(")?; + let all_bits = all_bits | Self::DOWN.0; + if (Self::DOWN != 0 || self.0 == 0) && *self & Self::DOWN == Self::DOWN { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DOWN")?; + } + let all_bits = all_bits | Self::BUTTON_1.0; + if (Self::BUTTON_1 != 0 || self.0 == 0) && *self & Self::BUTTON_1 == Self::BUTTON_1 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTON_1")?; + } + let all_bits = all_bits | Self::BUTTON_2.0; + if (Self::BUTTON_2 != 0 || self.0 == 0) && *self & Self::BUTTON_2 == Self::BUTTON_2 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTON_2")?; + } + let all_bits = all_bits | Self::BUTTON_3.0; + if (Self::BUTTON_3 != 0 || self.0 == 0) && *self & Self::BUTTON_3 == Self::BUTTON_3 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTON_3")?; + } + let all_bits = all_bits | Self::BUTTON_4.0; + if (Self::BUTTON_4 != 0 || self.0 == 0) && *self & Self::BUTTON_4 == Self::BUTTON_4 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTON_4")?; + } + let all_bits = all_bits | Self::BUTTON_5.0; + if (Self::BUTTON_5 != 0 || self.0 == 0) && *self & Self::BUTTON_5 == Self::BUTTON_5 { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTON_5")?; + } + let all_bits = all_bits | Self::ERASER_TIP.0; + if (Self::ERASER_TIP != 0 || self.0 == 0) && *self & Self::ERASER_TIP == Self::ERASER_TIP { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ERASER_TIP")?; + } + let all_bits = all_bits | Self::IN_PROXIMITY.0; + if (Self::IN_PROXIMITY != 0 || self.0 == 0) + && *self & Self::IN_PROXIMITY == Self::IN_PROXIMITY + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "IN_PROXIMITY")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_PenInputFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_PenInputFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_PenInputFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_PenInputFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_PenInputFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_PenInputFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_PenInputFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_PenInputFlags { + /// pen is pressed down + pub const DOWN: Self = Self((1_u32 as Uint32)); + /// button 1 is pressed + pub const BUTTON_1: Self = Self((2_u32 as Uint32)); + /// button 2 is pressed + pub const BUTTON_2: Self = Self((4_u32 as Uint32)); + /// button 3 is pressed + pub const BUTTON_3: Self = Self((8_u32 as Uint32)); + /// button 4 is pressed + pub const BUTTON_4: Self = Self((16_u32 as Uint32)); + /// button 5 is pressed + pub const BUTTON_5: Self = Self((32_u32 as Uint32)); + /// eraser tip is used + pub const ERASER_TIP: Self = Self((1073741824_u32 as Uint32)); + /// pen is in proximity (since SDL 3.4.0) + pub const IN_PROXIMITY: Self = Self((2147483648_u32 as Uint32)); +} + +/// pen is pressed down +pub const SDL_PEN_INPUT_DOWN: SDL_PenInputFlags = SDL_PenInputFlags::DOWN; +/// button 1 is pressed +pub const SDL_PEN_INPUT_BUTTON_1: SDL_PenInputFlags = SDL_PenInputFlags::BUTTON_1; +/// button 2 is pressed +pub const SDL_PEN_INPUT_BUTTON_2: SDL_PenInputFlags = SDL_PenInputFlags::BUTTON_2; +/// button 3 is pressed +pub const SDL_PEN_INPUT_BUTTON_3: SDL_PenInputFlags = SDL_PenInputFlags::BUTTON_3; +/// button 4 is pressed +pub const SDL_PEN_INPUT_BUTTON_4: SDL_PenInputFlags = SDL_PenInputFlags::BUTTON_4; +/// button 5 is pressed +pub const SDL_PEN_INPUT_BUTTON_5: SDL_PenInputFlags = SDL_PenInputFlags::BUTTON_5; +/// eraser tip is used +pub const SDL_PEN_INPUT_ERASER_TIP: SDL_PenInputFlags = SDL_PenInputFlags::ERASER_TIP; +/// pen is in proximity (since SDL 3.4.0) +pub const SDL_PEN_INPUT_IN_PROXIMITY: SDL_PenInputFlags = SDL_PenInputFlags::IN_PROXIMITY; + +impl SDL_PenInputFlags { + /// Initialize a `SDL_PenInputFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_PenInputFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PenInputFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pen::METADATA_SDL_PenInputFlags; +} + +/// Pen axis indices. +/// +/// These are the valid values for the `axis` field in [`SDL_PenAxisEvent`]. All +/// axes are either normalised to 0..1 or report a (positive or negative) angle +/// in degrees, with 0.0 representing the centre. Not all pens/backends support +/// all axes: unsupported axes are always zero. +/// +/// To convert angles for tilt and rotation into vector representation, use +/// [`SDL_sinf`] on the XTILT, YTILT, or ROTATION component, for example: +/// +/// `SDL_sinf(xtilt * SDL_PI_F / 180.0)`. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`PRESSURE`](SDL_PenAxis::PRESSURE) | [`SDL_PEN_AXIS_PRESSURE`] | Pen pressure. Unidirectional: 0 to 1.0 | +/// | [`XTILT`](SDL_PenAxis::XTILT) | [`SDL_PEN_AXIS_XTILT`] | Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right). | +/// | [`YTILT`](SDL_PenAxis::YTILT) | [`SDL_PEN_AXIS_YTILT`] | Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down). | +/// | [`DISTANCE`](SDL_PenAxis::DISTANCE) | [`SDL_PEN_AXIS_DISTANCE`] | Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 | +/// | [`ROTATION`](SDL_PenAxis::ROTATION) | [`SDL_PEN_AXIS_ROTATION`] | Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). | +/// | [`SLIDER`](SDL_PenAxis::SLIDER) | [`SDL_PEN_AXIS_SLIDER`] | Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 | +/// | [`TANGENTIAL_PRESSURE`](SDL_PenAxis::TANGENTIAL_PRESSURE) | [`SDL_PEN_AXIS_TANGENTIAL_PRESSURE`] | Pressure from squeezing the pen ("barrel pressure"). | +/// | [`COUNT`](SDL_PenAxis::COUNT) | [`SDL_PEN_AXIS_COUNT`] | Total known pen axis types in this version of SDL. This number may grow in future releases! | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PenAxis(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PenAxis { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PenAxis) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PenAxis) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PenAxis { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::PRESSURE => "SDL_PEN_AXIS_PRESSURE", + Self::XTILT => "SDL_PEN_AXIS_XTILT", + Self::YTILT => "SDL_PEN_AXIS_YTILT", + Self::DISTANCE => "SDL_PEN_AXIS_DISTANCE", + Self::ROTATION => "SDL_PEN_AXIS_ROTATION", + Self::SLIDER => "SDL_PEN_AXIS_SLIDER", + Self::TANGENTIAL_PRESSURE => "SDL_PEN_AXIS_TANGENTIAL_PRESSURE", + Self::COUNT => "SDL_PEN_AXIS_COUNT", + + _ => return write!(f, "SDL_PenAxis({})", self.0), + }) + } +} + +impl SDL_PenAxis { + /// Pen pressure. Unidirectional: 0 to 1.0 + pub const PRESSURE: Self = Self((0 as ::core::ffi::c_int)); + /// Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right). + pub const XTILT: Self = Self((1 as ::core::ffi::c_int)); + /// Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down). + pub const YTILT: Self = Self((2 as ::core::ffi::c_int)); + /// Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 + pub const DISTANCE: Self = Self((3 as ::core::ffi::c_int)); + /// Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). + pub const ROTATION: Self = Self((4 as ::core::ffi::c_int)); + /// Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 + pub const SLIDER: Self = Self((5 as ::core::ffi::c_int)); + /// Pressure from squeezing the pen ("barrel pressure"). + pub const TANGENTIAL_PRESSURE: Self = Self((6 as ::core::ffi::c_int)); + /// Total known pen axis types in this version of SDL. This number may grow in future releases! + pub const COUNT: Self = Self((7 as ::core::ffi::c_int)); +} + +/// Pen pressure. Unidirectional: 0 to 1.0 +pub const SDL_PEN_AXIS_PRESSURE: SDL_PenAxis = SDL_PenAxis::PRESSURE; +/// Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right). +pub const SDL_PEN_AXIS_XTILT: SDL_PenAxis = SDL_PenAxis::XTILT; +/// Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down). +pub const SDL_PEN_AXIS_YTILT: SDL_PenAxis = SDL_PenAxis::YTILT; +/// Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 +pub const SDL_PEN_AXIS_DISTANCE: SDL_PenAxis = SDL_PenAxis::DISTANCE; +/// Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). +pub const SDL_PEN_AXIS_ROTATION: SDL_PenAxis = SDL_PenAxis::ROTATION; +/// Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 +pub const SDL_PEN_AXIS_SLIDER: SDL_PenAxis = SDL_PenAxis::SLIDER; +/// Pressure from squeezing the pen ("barrel pressure"). +pub const SDL_PEN_AXIS_TANGENTIAL_PRESSURE: SDL_PenAxis = SDL_PenAxis::TANGENTIAL_PRESSURE; +/// Total known pen axis types in this version of SDL. This number may grow in future releases! +pub const SDL_PEN_AXIS_COUNT: SDL_PenAxis = SDL_PenAxis::COUNT; + +impl SDL_PenAxis { + /// Initialize a `SDL_PenAxis` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PenAxis { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PenAxis { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pen::METADATA_SDL_PenAxis; +} + +/// An enum that describes the type of a pen device. +/// +/// A "direct" device is a pen that touches a graphic display (like an Apple +/// Pencil on an iPad's screen). "Indirect" devices touch an external tablet +/// surface that is connected to the machine but is not a display (like a +/// lower-end Wacom tablet connected over USB). +/// +/// Apps may use this information to decide if they should draw a cursor; if +/// the pen is touching the screen directly, a cursor doesn't make sense and +/// can be in the way, but becomes necessary for indirect devices to know where +/// on the display they are interacting. +/// +/// ## Availability +/// This enum is available since SDL 3.4.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_PenDeviceType::INVALID) | [`SDL_PEN_DEVICE_TYPE_INVALID`] | Not a valid pen device. | +/// | [`UNKNOWN`](SDL_PenDeviceType::UNKNOWN) | [`SDL_PEN_DEVICE_TYPE_UNKNOWN`] | Don't know specifics of this pen. | +/// | [`DIRECT`](SDL_PenDeviceType::DIRECT) | [`SDL_PEN_DEVICE_TYPE_DIRECT`] | Pen touches display. | +/// | [`INDIRECT`](SDL_PenDeviceType::INDIRECT) | [`SDL_PEN_DEVICE_TYPE_INDIRECT`] | Pen touches something that isn't the display. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PenDeviceType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PenDeviceType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PenDeviceType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PenDeviceType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PenDeviceType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_PEN_DEVICE_TYPE_INVALID", + Self::UNKNOWN => "SDL_PEN_DEVICE_TYPE_UNKNOWN", + Self::DIRECT => "SDL_PEN_DEVICE_TYPE_DIRECT", + Self::INDIRECT => "SDL_PEN_DEVICE_TYPE_INDIRECT", + + _ => return write!(f, "SDL_PenDeviceType({})", self.0), + }) + } +} + +impl SDL_PenDeviceType { + /// Not a valid pen device. + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// Don't know specifics of this pen. + pub const UNKNOWN: Self = Self((0_i32 as ::core::ffi::c_int)); + /// Pen touches display. + pub const DIRECT: Self = Self((1_i32 as ::core::ffi::c_int)); + /// Pen touches something that isn't the display. + pub const INDIRECT: Self = Self((2_i32 as ::core::ffi::c_int)); +} + +/// Not a valid pen device. +pub const SDL_PEN_DEVICE_TYPE_INVALID: SDL_PenDeviceType = SDL_PenDeviceType::INVALID; +/// Don't know specifics of this pen. +pub const SDL_PEN_DEVICE_TYPE_UNKNOWN: SDL_PenDeviceType = SDL_PenDeviceType::UNKNOWN; +/// Pen touches display. +pub const SDL_PEN_DEVICE_TYPE_DIRECT: SDL_PenDeviceType = SDL_PenDeviceType::DIRECT; +/// Pen touches something that isn't the display. +pub const SDL_PEN_DEVICE_TYPE_INDIRECT: SDL_PenDeviceType = SDL_PenDeviceType::INDIRECT; + +impl SDL_PenDeviceType { + /// Initialize a `SDL_PenDeviceType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PenDeviceType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PenDeviceType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pen::METADATA_SDL_PenDeviceType; +} + +unsafe extern "C" { + /// Get the device type of the given pen. + /// + /// Many platforms do not supply this information, so an app must always be + /// prepared to get an [`SDL_PEN_DEVICE_TYPE_UNKNOWN`] result. + /// + /// ## Parameters + /// - `instance_id`: the pen instance ID. + /// + /// ## Return value + /// Returns the device type of the given pen, or [`SDL_PEN_DEVICE_TYPE_INVALID`] + /// on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetPenDeviceType(instance_id: SDL_PenID) -> SDL_PenDeviceType; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/pixels.rs b/vendor/sdl3-sys/src/generated/pixels.rs new file mode 100644 index 00000000..189e56a3 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/pixels.rs @@ -0,0 +1,3132 @@ +//! SDL offers facilities for pixel management. +//! +//! Largely these facilities deal with pixel _format_: what does this set of +//! bits represent? +//! +//! If you mostly want to think of a pixel as some combination of red, green, +//! blue, and maybe alpha intensities, this is all pretty straightforward, and +//! in many cases, is enough information to build a perfectly fine game. +//! +//! However, the actual definition of a pixel is more complex than that: +//! +//! Pixels are a representation of a color in a particular color space. +//! +//! The first characteristic of a color space is the color type. SDL +//! understands two different color types, RGB and YCbCr, or in SDL also +//! referred to as YUV. +//! +//! RGB colors consist of red, green, and blue channels of color that are added +//! together to represent the colors we see on the screen. +//! +//! +//! +//! YCbCr colors represent colors as a Y luma brightness component and red and +//! blue chroma color offsets. This color representation takes advantage of the +//! fact that the human eye is more sensitive to brightness than the color in +//! an image. The Cb and Cr components are often compressed and have lower +//! resolution than the luma component. +//! +//! +//! +//! When the color information in YCbCr is compressed, the Y pixels are left at +//! full resolution and each Cr and Cb pixel represents an average of the color +//! information in a block of Y pixels. The chroma location determines where in +//! that block of pixels the color information is coming from. +//! +//! The color range defines how much of the pixel to use when converting a +//! pixel into a color on the display. When the full color range is used, the +//! entire numeric range of the pixel bits is significant. When narrow color +//! range is used, for historical reasons, the pixel uses only a portion of the +//! numeric range to represent colors. +//! +//! The color primaries and white point are a definition of the colors in the +//! color space relative to the standard XYZ color space. +//! +//! +//! +//! The transfer characteristic, or opto-electrical transfer function (OETF), +//! is the way a color is converted from mathematically linear space into a +//! non-linear output signals. +//! +//! +//! +//! The matrix coefficients are used to convert between YCbCr and RGB colors. + +use super::stdinc::*; + +use super::error::*; + +/// A fully opaque 8-bit alpha value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ALPHA_TRANSPARENT`] +pub const SDL_ALPHA_OPAQUE: Uint8 = (255 as Uint8); + +/// A fully opaque floating point alpha value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ALPHA_TRANSPARENT_FLOAT`] +pub const SDL_ALPHA_OPAQUE_FLOAT: ::core::ffi::c_float = 1.0_f32; + +/// A fully transparent 8-bit alpha value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ALPHA_OPAQUE`] +pub const SDL_ALPHA_TRANSPARENT: Uint8 = (0 as Uint8); + +/// A fully transparent floating point alpha value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ALPHA_OPAQUE_FLOAT`] +pub const SDL_ALPHA_TRANSPARENT_FLOAT: ::core::ffi::c_float = 0.0_f32; + +/// Pixel type. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_PixelType::UNKNOWN) | [`SDL_PIXELTYPE_UNKNOWN`] | | +/// | [`INDEX1`](SDL_PixelType::INDEX1) | [`SDL_PIXELTYPE_INDEX1`] | | +/// | [`INDEX4`](SDL_PixelType::INDEX4) | [`SDL_PIXELTYPE_INDEX4`] | | +/// | [`INDEX8`](SDL_PixelType::INDEX8) | [`SDL_PIXELTYPE_INDEX8`] | | +/// | [`PACKED8`](SDL_PixelType::PACKED8) | [`SDL_PIXELTYPE_PACKED8`] | | +/// | [`PACKED16`](SDL_PixelType::PACKED16) | [`SDL_PIXELTYPE_PACKED16`] | | +/// | [`PACKED32`](SDL_PixelType::PACKED32) | [`SDL_PIXELTYPE_PACKED32`] | | +/// | [`ARRAYU8`](SDL_PixelType::ARRAYU8) | [`SDL_PIXELTYPE_ARRAYU8`] | | +/// | [`ARRAYU16`](SDL_PixelType::ARRAYU16) | [`SDL_PIXELTYPE_ARRAYU16`] | | +/// | [`ARRAYU32`](SDL_PixelType::ARRAYU32) | [`SDL_PIXELTYPE_ARRAYU32`] | | +/// | [`ARRAYF16`](SDL_PixelType::ARRAYF16) | [`SDL_PIXELTYPE_ARRAYF16`] | | +/// | [`ARRAYF32`](SDL_PixelType::ARRAYF32) | [`SDL_PIXELTYPE_ARRAYF32`] | | +/// | [`INDEX2`](SDL_PixelType::INDEX2) | [`SDL_PIXELTYPE_INDEX2`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PixelType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PixelType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PixelType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PixelType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PixelType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_PIXELTYPE_UNKNOWN", + Self::INDEX1 => "SDL_PIXELTYPE_INDEX1", + Self::INDEX4 => "SDL_PIXELTYPE_INDEX4", + Self::INDEX8 => "SDL_PIXELTYPE_INDEX8", + Self::PACKED8 => "SDL_PIXELTYPE_PACKED8", + Self::PACKED16 => "SDL_PIXELTYPE_PACKED16", + Self::PACKED32 => "SDL_PIXELTYPE_PACKED32", + Self::ARRAYU8 => "SDL_PIXELTYPE_ARRAYU8", + Self::ARRAYU16 => "SDL_PIXELTYPE_ARRAYU16", + Self::ARRAYU32 => "SDL_PIXELTYPE_ARRAYU32", + Self::ARRAYF16 => "SDL_PIXELTYPE_ARRAYF16", + Self::ARRAYF32 => "SDL_PIXELTYPE_ARRAYF32", + Self::INDEX2 => "SDL_PIXELTYPE_INDEX2", + + _ => return write!(f, "SDL_PixelType({})", self.0), + }) + } +} + +impl SDL_PixelType { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const INDEX1: Self = Self((1 as ::core::ffi::c_int)); + pub const INDEX4: Self = Self((2 as ::core::ffi::c_int)); + pub const INDEX8: Self = Self((3 as ::core::ffi::c_int)); + pub const PACKED8: Self = Self((4 as ::core::ffi::c_int)); + pub const PACKED16: Self = Self((5 as ::core::ffi::c_int)); + pub const PACKED32: Self = Self((6 as ::core::ffi::c_int)); + pub const ARRAYU8: Self = Self((7 as ::core::ffi::c_int)); + pub const ARRAYU16: Self = Self((8 as ::core::ffi::c_int)); + pub const ARRAYU32: Self = Self((9 as ::core::ffi::c_int)); + pub const ARRAYF16: Self = Self((10 as ::core::ffi::c_int)); + pub const ARRAYF32: Self = Self((11 as ::core::ffi::c_int)); + pub const INDEX2: Self = Self((12 as ::core::ffi::c_int)); +} + +pub const SDL_PIXELTYPE_UNKNOWN: SDL_PixelType = SDL_PixelType::UNKNOWN; +pub const SDL_PIXELTYPE_INDEX1: SDL_PixelType = SDL_PixelType::INDEX1; +pub const SDL_PIXELTYPE_INDEX4: SDL_PixelType = SDL_PixelType::INDEX4; +pub const SDL_PIXELTYPE_INDEX8: SDL_PixelType = SDL_PixelType::INDEX8; +pub const SDL_PIXELTYPE_PACKED8: SDL_PixelType = SDL_PixelType::PACKED8; +pub const SDL_PIXELTYPE_PACKED16: SDL_PixelType = SDL_PixelType::PACKED16; +pub const SDL_PIXELTYPE_PACKED32: SDL_PixelType = SDL_PixelType::PACKED32; +pub const SDL_PIXELTYPE_ARRAYU8: SDL_PixelType = SDL_PixelType::ARRAYU8; +pub const SDL_PIXELTYPE_ARRAYU16: SDL_PixelType = SDL_PixelType::ARRAYU16; +pub const SDL_PIXELTYPE_ARRAYU32: SDL_PixelType = SDL_PixelType::ARRAYU32; +pub const SDL_PIXELTYPE_ARRAYF16: SDL_PixelType = SDL_PixelType::ARRAYF16; +pub const SDL_PIXELTYPE_ARRAYF32: SDL_PixelType = SDL_PixelType::ARRAYF32; +pub const SDL_PIXELTYPE_INDEX2: SDL_PixelType = SDL_PixelType::INDEX2; + +impl SDL_PixelType { + /// Initialize a `SDL_PixelType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PixelType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PixelType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_PixelType; +} + +/// Bitmap pixel order, high bit -> low bit. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_BitmapOrder::NONE) | [`SDL_BITMAPORDER_NONE`] | | +/// | [`_4321`](SDL_BitmapOrder::_4321) | [`SDL_BITMAPORDER_4321`] | | +/// | [`_1234`](SDL_BitmapOrder::_1234) | [`SDL_BITMAPORDER_1234`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_BitmapOrder(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_BitmapOrder { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_BitmapOrder) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_BitmapOrder) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_BitmapOrder { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_BITMAPORDER_NONE", + Self::_4321 => "SDL_BITMAPORDER_4321", + Self::_1234 => "SDL_BITMAPORDER_1234", + + _ => return write!(f, "SDL_BitmapOrder({})", self.0), + }) + } +} + +impl SDL_BitmapOrder { + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + pub const _4321: Self = Self((1 as ::core::ffi::c_int)); + pub const _1234: Self = Self((2 as ::core::ffi::c_int)); +} + +pub const SDL_BITMAPORDER_NONE: SDL_BitmapOrder = SDL_BitmapOrder::NONE; +pub const SDL_BITMAPORDER_4321: SDL_BitmapOrder = SDL_BitmapOrder::_4321; +pub const SDL_BITMAPORDER_1234: SDL_BitmapOrder = SDL_BitmapOrder::_1234; + +impl SDL_BitmapOrder { + /// Initialize a `SDL_BitmapOrder` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_BitmapOrder { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_BitmapOrder { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_BitmapOrder; +} + +/// Packed component order, high bit -> low bit. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_PackedOrder::NONE) | [`SDL_PACKEDORDER_NONE`] | | +/// | [`XRGB`](SDL_PackedOrder::XRGB) | [`SDL_PACKEDORDER_XRGB`] | | +/// | [`RGBX`](SDL_PackedOrder::RGBX) | [`SDL_PACKEDORDER_RGBX`] | | +/// | [`ARGB`](SDL_PackedOrder::ARGB) | [`SDL_PACKEDORDER_ARGB`] | | +/// | [`RGBA`](SDL_PackedOrder::RGBA) | [`SDL_PACKEDORDER_RGBA`] | | +/// | [`XBGR`](SDL_PackedOrder::XBGR) | [`SDL_PACKEDORDER_XBGR`] | | +/// | [`BGRX`](SDL_PackedOrder::BGRX) | [`SDL_PACKEDORDER_BGRX`] | | +/// | [`ABGR`](SDL_PackedOrder::ABGR) | [`SDL_PACKEDORDER_ABGR`] | | +/// | [`BGRA`](SDL_PackedOrder::BGRA) | [`SDL_PACKEDORDER_BGRA`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PackedOrder(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PackedOrder { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PackedOrder) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PackedOrder) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PackedOrder { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_PACKEDORDER_NONE", + Self::XRGB => "SDL_PACKEDORDER_XRGB", + Self::RGBX => "SDL_PACKEDORDER_RGBX", + Self::ARGB => "SDL_PACKEDORDER_ARGB", + Self::RGBA => "SDL_PACKEDORDER_RGBA", + Self::XBGR => "SDL_PACKEDORDER_XBGR", + Self::BGRX => "SDL_PACKEDORDER_BGRX", + Self::ABGR => "SDL_PACKEDORDER_ABGR", + Self::BGRA => "SDL_PACKEDORDER_BGRA", + + _ => return write!(f, "SDL_PackedOrder({})", self.0), + }) + } +} + +impl SDL_PackedOrder { + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + pub const XRGB: Self = Self((1 as ::core::ffi::c_int)); + pub const RGBX: Self = Self((2 as ::core::ffi::c_int)); + pub const ARGB: Self = Self((3 as ::core::ffi::c_int)); + pub const RGBA: Self = Self((4 as ::core::ffi::c_int)); + pub const XBGR: Self = Self((5 as ::core::ffi::c_int)); + pub const BGRX: Self = Self((6 as ::core::ffi::c_int)); + pub const ABGR: Self = Self((7 as ::core::ffi::c_int)); + pub const BGRA: Self = Self((8 as ::core::ffi::c_int)); +} + +pub const SDL_PACKEDORDER_NONE: SDL_PackedOrder = SDL_PackedOrder::NONE; +pub const SDL_PACKEDORDER_XRGB: SDL_PackedOrder = SDL_PackedOrder::XRGB; +pub const SDL_PACKEDORDER_RGBX: SDL_PackedOrder = SDL_PackedOrder::RGBX; +pub const SDL_PACKEDORDER_ARGB: SDL_PackedOrder = SDL_PackedOrder::ARGB; +pub const SDL_PACKEDORDER_RGBA: SDL_PackedOrder = SDL_PackedOrder::RGBA; +pub const SDL_PACKEDORDER_XBGR: SDL_PackedOrder = SDL_PackedOrder::XBGR; +pub const SDL_PACKEDORDER_BGRX: SDL_PackedOrder = SDL_PackedOrder::BGRX; +pub const SDL_PACKEDORDER_ABGR: SDL_PackedOrder = SDL_PackedOrder::ABGR; +pub const SDL_PACKEDORDER_BGRA: SDL_PackedOrder = SDL_PackedOrder::BGRA; + +impl SDL_PackedOrder { + /// Initialize a `SDL_PackedOrder` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PackedOrder { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PackedOrder { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_PackedOrder; +} + +/// Array component order, low byte -> high byte. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_ArrayOrder::NONE) | [`SDL_ARRAYORDER_NONE`] | | +/// | [`RGB`](SDL_ArrayOrder::RGB) | [`SDL_ARRAYORDER_RGB`] | | +/// | [`RGBA`](SDL_ArrayOrder::RGBA) | [`SDL_ARRAYORDER_RGBA`] | | +/// | [`ARGB`](SDL_ArrayOrder::ARGB) | [`SDL_ARRAYORDER_ARGB`] | | +/// | [`BGR`](SDL_ArrayOrder::BGR) | [`SDL_ARRAYORDER_BGR`] | | +/// | [`BGRA`](SDL_ArrayOrder::BGRA) | [`SDL_ARRAYORDER_BGRA`] | | +/// | [`ABGR`](SDL_ArrayOrder::ABGR) | [`SDL_ARRAYORDER_ABGR`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ArrayOrder(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ArrayOrder { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_ArrayOrder) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_ArrayOrder) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ArrayOrder { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_ARRAYORDER_NONE", + Self::RGB => "SDL_ARRAYORDER_RGB", + Self::RGBA => "SDL_ARRAYORDER_RGBA", + Self::ARGB => "SDL_ARRAYORDER_ARGB", + Self::BGR => "SDL_ARRAYORDER_BGR", + Self::BGRA => "SDL_ARRAYORDER_BGRA", + Self::ABGR => "SDL_ARRAYORDER_ABGR", + + _ => return write!(f, "SDL_ArrayOrder({})", self.0), + }) + } +} + +impl SDL_ArrayOrder { + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + pub const RGB: Self = Self((1 as ::core::ffi::c_int)); + pub const RGBA: Self = Self((2 as ::core::ffi::c_int)); + pub const ARGB: Self = Self((3 as ::core::ffi::c_int)); + pub const BGR: Self = Self((4 as ::core::ffi::c_int)); + pub const BGRA: Self = Self((5 as ::core::ffi::c_int)); + pub const ABGR: Self = Self((6 as ::core::ffi::c_int)); +} + +pub const SDL_ARRAYORDER_NONE: SDL_ArrayOrder = SDL_ArrayOrder::NONE; +pub const SDL_ARRAYORDER_RGB: SDL_ArrayOrder = SDL_ArrayOrder::RGB; +pub const SDL_ARRAYORDER_RGBA: SDL_ArrayOrder = SDL_ArrayOrder::RGBA; +pub const SDL_ARRAYORDER_ARGB: SDL_ArrayOrder = SDL_ArrayOrder::ARGB; +pub const SDL_ARRAYORDER_BGR: SDL_ArrayOrder = SDL_ArrayOrder::BGR; +pub const SDL_ARRAYORDER_BGRA: SDL_ArrayOrder = SDL_ArrayOrder::BGRA; +pub const SDL_ARRAYORDER_ABGR: SDL_ArrayOrder = SDL_ArrayOrder::ABGR; + +impl SDL_ArrayOrder { + /// Initialize a `SDL_ArrayOrder` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_ArrayOrder { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ArrayOrder { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_ArrayOrder; +} + +/// Packed component layout. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_PackedLayout::NONE) | [`SDL_PACKEDLAYOUT_NONE`] | | +/// | [`_332`](SDL_PackedLayout::_332) | [`SDL_PACKEDLAYOUT_332`] | | +/// | [`_4444`](SDL_PackedLayout::_4444) | [`SDL_PACKEDLAYOUT_4444`] | | +/// | [`_1555`](SDL_PackedLayout::_1555) | [`SDL_PACKEDLAYOUT_1555`] | | +/// | [`_5551`](SDL_PackedLayout::_5551) | [`SDL_PACKEDLAYOUT_5551`] | | +/// | [`_565`](SDL_PackedLayout::_565) | [`SDL_PACKEDLAYOUT_565`] | | +/// | [`_8888`](SDL_PackedLayout::_8888) | [`SDL_PACKEDLAYOUT_8888`] | | +/// | [`_2101010`](SDL_PackedLayout::_2101010) | [`SDL_PACKEDLAYOUT_2101010`] | | +/// | [`_1010102`](SDL_PackedLayout::_1010102) | [`SDL_PACKEDLAYOUT_1010102`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PackedLayout(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PackedLayout { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PackedLayout) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PackedLayout) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PackedLayout { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_PACKEDLAYOUT_NONE", + Self::_332 => "SDL_PACKEDLAYOUT_332", + Self::_4444 => "SDL_PACKEDLAYOUT_4444", + Self::_1555 => "SDL_PACKEDLAYOUT_1555", + Self::_5551 => "SDL_PACKEDLAYOUT_5551", + Self::_565 => "SDL_PACKEDLAYOUT_565", + Self::_8888 => "SDL_PACKEDLAYOUT_8888", + Self::_2101010 => "SDL_PACKEDLAYOUT_2101010", + Self::_1010102 => "SDL_PACKEDLAYOUT_1010102", + + _ => return write!(f, "SDL_PackedLayout({})", self.0), + }) + } +} + +impl SDL_PackedLayout { + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + pub const _332: Self = Self((1 as ::core::ffi::c_int)); + pub const _4444: Self = Self((2 as ::core::ffi::c_int)); + pub const _1555: Self = Self((3 as ::core::ffi::c_int)); + pub const _5551: Self = Self((4 as ::core::ffi::c_int)); + pub const _565: Self = Self((5 as ::core::ffi::c_int)); + pub const _8888: Self = Self((6 as ::core::ffi::c_int)); + pub const _2101010: Self = Self((7 as ::core::ffi::c_int)); + pub const _1010102: Self = Self((8 as ::core::ffi::c_int)); +} + +pub const SDL_PACKEDLAYOUT_NONE: SDL_PackedLayout = SDL_PackedLayout::NONE; +pub const SDL_PACKEDLAYOUT_332: SDL_PackedLayout = SDL_PackedLayout::_332; +pub const SDL_PACKEDLAYOUT_4444: SDL_PackedLayout = SDL_PackedLayout::_4444; +pub const SDL_PACKEDLAYOUT_1555: SDL_PackedLayout = SDL_PackedLayout::_1555; +pub const SDL_PACKEDLAYOUT_5551: SDL_PackedLayout = SDL_PackedLayout::_5551; +pub const SDL_PACKEDLAYOUT_565: SDL_PackedLayout = SDL_PackedLayout::_565; +pub const SDL_PACKEDLAYOUT_8888: SDL_PackedLayout = SDL_PackedLayout::_8888; +pub const SDL_PACKEDLAYOUT_2101010: SDL_PackedLayout = SDL_PackedLayout::_2101010; +pub const SDL_PACKEDLAYOUT_1010102: SDL_PackedLayout = SDL_PackedLayout::_1010102; + +impl SDL_PackedLayout { + /// Initialize a `SDL_PackedLayout` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PackedLayout { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PackedLayout { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_PackedLayout; +} + +/// A macro for defining custom FourCC pixel formats. +/// +/// For example, defining [`SDL_PIXELFORMAT_YV12`] looks like this: +/// +/// ```c +/// SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2') +/// ``` +/// +/// ## Parameters +/// - `A`: the first character of the FourCC code. +/// - `B`: the second character of the FourCC code. +/// - `C`: the third character of the FourCC code. +/// - `D`: the fourth character of the FourCC code. +/// +/// ## Return value +/// Returns a format value in the style of [`SDL_PixelFormat`]. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_DEFINE_PIXELFOURCC(A: Uint8, B: Uint8, C: Uint8, D: Uint8) -> Uint32 { + SDL_FOURCC(A, B, C, D) +} + +/// Pixel format. +/// +/// SDL's pixel formats have the following naming convention: +/// +/// - Names with a list of components and a single bit count, such as RGB24 and +/// ABGR32, define a platform-independent encoding into bytes in the order +/// specified. For example, in RGB24 data, each pixel is encoded in 3 bytes +/// (red, green, blue) in that order, and in ABGR32 data, each pixel is +/// encoded in 4 bytes (alpha, blue, green, red) in that order. Use these +/// names if the property of a format that is important to you is the order +/// of the bytes in memory or on disk. +/// - Names with a bit count per component, such as ARGB8888 and XRGB1555, are +/// "packed" into an appropriately-sized integer in the platform's native +/// endianness. For example, ARGB8888 is a sequence of 32-bit integers; in +/// each integer, the most significant bits are alpha, and the least +/// significant bits are blue. On a little-endian CPU such as x86, the least +/// significant bits of each integer are arranged first in memory, but on a +/// big-endian CPU such as s390x, the most significant bits are arranged +/// first. Use these names if the property of a format that is important to +/// you is the meaning of each bit position within a native-endianness +/// integer. +/// - In indexed formats such as INDEX4LSB, each pixel is represented by +/// encoding an index into the palette into the indicated number of bits, +/// with multiple pixels packed into each byte if appropriate. In LSB +/// formats, the first (leftmost) pixel is stored in the least-significant +/// bits of the byte; in MSB formats, it's stored in the most-significant +/// bits. INDEX8 does not need LSB/MSB variants, because each pixel exactly +/// fills one byte. +/// +/// The 32-bit byte-array encodings such as RGBA32 are aliases for the +/// appropriate 8888 encoding for the current platform. For example, RGBA32 is +/// an alias for ABGR8888 on little-endian CPUs like x86, or an alias for +/// RGBA8888 on big-endian CPUs. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_PixelFormat::UNKNOWN) | [`SDL_PIXELFORMAT_UNKNOWN`] | | +/// | [`INDEX1LSB`](SDL_PixelFormat::INDEX1LSB) | [`SDL_PIXELFORMAT_INDEX1LSB`] | | +/// | [`INDEX1MSB`](SDL_PixelFormat::INDEX1MSB) | [`SDL_PIXELFORMAT_INDEX1MSB`] | | +/// | [`INDEX2LSB`](SDL_PixelFormat::INDEX2LSB) | [`SDL_PIXELFORMAT_INDEX2LSB`] | | +/// | [`INDEX2MSB`](SDL_PixelFormat::INDEX2MSB) | [`SDL_PIXELFORMAT_INDEX2MSB`] | | +/// | [`INDEX4LSB`](SDL_PixelFormat::INDEX4LSB) | [`SDL_PIXELFORMAT_INDEX4LSB`] | | +/// | [`INDEX4MSB`](SDL_PixelFormat::INDEX4MSB) | [`SDL_PIXELFORMAT_INDEX4MSB`] | | +/// | [`INDEX8`](SDL_PixelFormat::INDEX8) | [`SDL_PIXELFORMAT_INDEX8`] | | +/// | [`RGB332`](SDL_PixelFormat::RGB332) | [`SDL_PIXELFORMAT_RGB332`] | | +/// | [`XRGB4444`](SDL_PixelFormat::XRGB4444) | [`SDL_PIXELFORMAT_XRGB4444`] | | +/// | [`XBGR4444`](SDL_PixelFormat::XBGR4444) | [`SDL_PIXELFORMAT_XBGR4444`] | | +/// | [`XRGB1555`](SDL_PixelFormat::XRGB1555) | [`SDL_PIXELFORMAT_XRGB1555`] | | +/// | [`XBGR1555`](SDL_PixelFormat::XBGR1555) | [`SDL_PIXELFORMAT_XBGR1555`] | | +/// | [`ARGB4444`](SDL_PixelFormat::ARGB4444) | [`SDL_PIXELFORMAT_ARGB4444`] | | +/// | [`RGBA4444`](SDL_PixelFormat::RGBA4444) | [`SDL_PIXELFORMAT_RGBA4444`] | | +/// | [`ABGR4444`](SDL_PixelFormat::ABGR4444) | [`SDL_PIXELFORMAT_ABGR4444`] | | +/// | [`BGRA4444`](SDL_PixelFormat::BGRA4444) | [`SDL_PIXELFORMAT_BGRA4444`] | | +/// | [`ARGB1555`](SDL_PixelFormat::ARGB1555) | [`SDL_PIXELFORMAT_ARGB1555`] | | +/// | [`RGBA5551`](SDL_PixelFormat::RGBA5551) | [`SDL_PIXELFORMAT_RGBA5551`] | | +/// | [`ABGR1555`](SDL_PixelFormat::ABGR1555) | [`SDL_PIXELFORMAT_ABGR1555`] | | +/// | [`BGRA5551`](SDL_PixelFormat::BGRA5551) | [`SDL_PIXELFORMAT_BGRA5551`] | | +/// | [`RGB565`](SDL_PixelFormat::RGB565) | [`SDL_PIXELFORMAT_RGB565`] | | +/// | [`BGR565`](SDL_PixelFormat::BGR565) | [`SDL_PIXELFORMAT_BGR565`] | | +/// | [`RGB24`](SDL_PixelFormat::RGB24) | [`SDL_PIXELFORMAT_RGB24`] | | +/// | [`BGR24`](SDL_PixelFormat::BGR24) | [`SDL_PIXELFORMAT_BGR24`] | | +/// | [`XRGB8888`](SDL_PixelFormat::XRGB8888) | [`SDL_PIXELFORMAT_XRGB8888`] | | +/// | [`RGBX8888`](SDL_PixelFormat::RGBX8888) | [`SDL_PIXELFORMAT_RGBX8888`] | | +/// | [`XBGR8888`](SDL_PixelFormat::XBGR8888) | [`SDL_PIXELFORMAT_XBGR8888`] | | +/// | [`BGRX8888`](SDL_PixelFormat::BGRX8888) | [`SDL_PIXELFORMAT_BGRX8888`] | | +/// | [`ARGB8888`](SDL_PixelFormat::ARGB8888) | [`SDL_PIXELFORMAT_ARGB8888`] | | +/// | [`RGBA8888`](SDL_PixelFormat::RGBA8888) | [`SDL_PIXELFORMAT_RGBA8888`] | | +/// | [`ABGR8888`](SDL_PixelFormat::ABGR8888) | [`SDL_PIXELFORMAT_ABGR8888`] | | +/// | [`BGRA8888`](SDL_PixelFormat::BGRA8888) | [`SDL_PIXELFORMAT_BGRA8888`] | | +/// | [`XRGB2101010`](SDL_PixelFormat::XRGB2101010) | [`SDL_PIXELFORMAT_XRGB2101010`] | | +/// | [`XBGR2101010`](SDL_PixelFormat::XBGR2101010) | [`SDL_PIXELFORMAT_XBGR2101010`] | | +/// | [`ARGB2101010`](SDL_PixelFormat::ARGB2101010) | [`SDL_PIXELFORMAT_ARGB2101010`] | | +/// | [`ABGR2101010`](SDL_PixelFormat::ABGR2101010) | [`SDL_PIXELFORMAT_ABGR2101010`] | | +/// | [`RGB48`](SDL_PixelFormat::RGB48) | [`SDL_PIXELFORMAT_RGB48`] | | +/// | [`BGR48`](SDL_PixelFormat::BGR48) | [`SDL_PIXELFORMAT_BGR48`] | | +/// | [`RGBA64`](SDL_PixelFormat::RGBA64) | [`SDL_PIXELFORMAT_RGBA64`] | | +/// | [`ARGB64`](SDL_PixelFormat::ARGB64) | [`SDL_PIXELFORMAT_ARGB64`] | | +/// | [`BGRA64`](SDL_PixelFormat::BGRA64) | [`SDL_PIXELFORMAT_BGRA64`] | | +/// | [`ABGR64`](SDL_PixelFormat::ABGR64) | [`SDL_PIXELFORMAT_ABGR64`] | | +/// | [`RGB48_FLOAT`](SDL_PixelFormat::RGB48_FLOAT) | [`SDL_PIXELFORMAT_RGB48_FLOAT`] | | +/// | [`BGR48_FLOAT`](SDL_PixelFormat::BGR48_FLOAT) | [`SDL_PIXELFORMAT_BGR48_FLOAT`] | | +/// | [`RGBA64_FLOAT`](SDL_PixelFormat::RGBA64_FLOAT) | [`SDL_PIXELFORMAT_RGBA64_FLOAT`] | | +/// | [`ARGB64_FLOAT`](SDL_PixelFormat::ARGB64_FLOAT) | [`SDL_PIXELFORMAT_ARGB64_FLOAT`] | | +/// | [`BGRA64_FLOAT`](SDL_PixelFormat::BGRA64_FLOAT) | [`SDL_PIXELFORMAT_BGRA64_FLOAT`] | | +/// | [`ABGR64_FLOAT`](SDL_PixelFormat::ABGR64_FLOAT) | [`SDL_PIXELFORMAT_ABGR64_FLOAT`] | | +/// | [`RGB96_FLOAT`](SDL_PixelFormat::RGB96_FLOAT) | [`SDL_PIXELFORMAT_RGB96_FLOAT`] | | +/// | [`BGR96_FLOAT`](SDL_PixelFormat::BGR96_FLOAT) | [`SDL_PIXELFORMAT_BGR96_FLOAT`] | | +/// | [`RGBA128_FLOAT`](SDL_PixelFormat::RGBA128_FLOAT) | [`SDL_PIXELFORMAT_RGBA128_FLOAT`] | | +/// | [`ARGB128_FLOAT`](SDL_PixelFormat::ARGB128_FLOAT) | [`SDL_PIXELFORMAT_ARGB128_FLOAT`] | | +/// | [`BGRA128_FLOAT`](SDL_PixelFormat::BGRA128_FLOAT) | [`SDL_PIXELFORMAT_BGRA128_FLOAT`] | | +/// | [`ABGR128_FLOAT`](SDL_PixelFormat::ABGR128_FLOAT) | [`SDL_PIXELFORMAT_ABGR128_FLOAT`] | | +/// | [`YV12`](SDL_PixelFormat::YV12) | [`SDL_PIXELFORMAT_YV12`] | Planar mode: Y + V + U (3 planes) | +/// | [`IYUV`](SDL_PixelFormat::IYUV) | [`SDL_PIXELFORMAT_IYUV`] | Planar mode: Y + U + V (3 planes) | +/// | [`YUY2`](SDL_PixelFormat::YUY2) | [`SDL_PIXELFORMAT_YUY2`] | Packed mode: Y0+U0+Y1+V0 (1 plane) | +/// | [`UYVY`](SDL_PixelFormat::UYVY) | [`SDL_PIXELFORMAT_UYVY`] | Packed mode: U0+Y0+V0+Y1 (1 plane) | +/// | [`YVYU`](SDL_PixelFormat::YVYU) | [`SDL_PIXELFORMAT_YVYU`] | Packed mode: Y0+V0+Y1+U0 (1 plane) | +/// | [`NV12`](SDL_PixelFormat::NV12) | [`SDL_PIXELFORMAT_NV12`] | Planar mode: Y + U/V interleaved (2 planes) | +/// | [`NV21`](SDL_PixelFormat::NV21) | [`SDL_PIXELFORMAT_NV21`] | Planar mode: Y + V/U interleaved (2 planes) | +/// | [`P010`](SDL_PixelFormat::P010) | [`SDL_PIXELFORMAT_P010`] | Planar mode: Y + U/V interleaved (2 planes) | +/// | [`EXTERNAL_OES`](SDL_PixelFormat::EXTERNAL_OES) | [`SDL_PIXELFORMAT_EXTERNAL_OES`] | Android video texture format | +/// | [`MJPG`](SDL_PixelFormat::MJPG) | [`SDL_PIXELFORMAT_MJPG`] | Motion JPEG | +/// | [`RGBA32`](SDL_PixelFormat::RGBA32) | [`SDL_PIXELFORMAT_RGBA32`] | (target dependent) | +/// | [`ARGB32`](SDL_PixelFormat::ARGB32) | [`SDL_PIXELFORMAT_ARGB32`] | (target dependent) | +/// | [`BGRA32`](SDL_PixelFormat::BGRA32) | [`SDL_PIXELFORMAT_BGRA32`] | (target dependent) | +/// | [`ABGR32`](SDL_PixelFormat::ABGR32) | [`SDL_PIXELFORMAT_ABGR32`] | (target dependent) | +/// | [`RGBX32`](SDL_PixelFormat::RGBX32) | [`SDL_PIXELFORMAT_RGBX32`] | (target dependent) | +/// | [`XRGB32`](SDL_PixelFormat::XRGB32) | [`SDL_PIXELFORMAT_XRGB32`] | (target dependent) | +/// | [`BGRX32`](SDL_PixelFormat::BGRX32) | [`SDL_PIXELFORMAT_BGRX32`] | (target dependent) | +/// | [`XBGR32`](SDL_PixelFormat::XBGR32) | [`SDL_PIXELFORMAT_XBGR32`] | (target dependent) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PixelFormat(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PixelFormat { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PixelFormat) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PixelFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PixelFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_PIXELFORMAT_UNKNOWN", + Self::INDEX1LSB => "SDL_PIXELFORMAT_INDEX1LSB", + Self::INDEX1MSB => "SDL_PIXELFORMAT_INDEX1MSB", + Self::INDEX2LSB => "SDL_PIXELFORMAT_INDEX2LSB", + Self::INDEX2MSB => "SDL_PIXELFORMAT_INDEX2MSB", + Self::INDEX4LSB => "SDL_PIXELFORMAT_INDEX4LSB", + Self::INDEX4MSB => "SDL_PIXELFORMAT_INDEX4MSB", + Self::INDEX8 => "SDL_PIXELFORMAT_INDEX8", + Self::RGB332 => "SDL_PIXELFORMAT_RGB332", + Self::XRGB4444 => "SDL_PIXELFORMAT_XRGB4444", + Self::XBGR4444 => "SDL_PIXELFORMAT_XBGR4444", + Self::XRGB1555 => "SDL_PIXELFORMAT_XRGB1555", + Self::XBGR1555 => "SDL_PIXELFORMAT_XBGR1555", + Self::ARGB4444 => "SDL_PIXELFORMAT_ARGB4444", + Self::RGBA4444 => "SDL_PIXELFORMAT_RGBA4444", + Self::ABGR4444 => "SDL_PIXELFORMAT_ABGR4444", + Self::BGRA4444 => "SDL_PIXELFORMAT_BGRA4444", + Self::ARGB1555 => "SDL_PIXELFORMAT_ARGB1555", + Self::RGBA5551 => "SDL_PIXELFORMAT_RGBA5551", + Self::ABGR1555 => "SDL_PIXELFORMAT_ABGR1555", + Self::BGRA5551 => "SDL_PIXELFORMAT_BGRA5551", + Self::RGB565 => "SDL_PIXELFORMAT_RGB565", + Self::BGR565 => "SDL_PIXELFORMAT_BGR565", + Self::RGB24 => "SDL_PIXELFORMAT_RGB24", + Self::BGR24 => "SDL_PIXELFORMAT_BGR24", + Self::XRGB8888 => "SDL_PIXELFORMAT_XRGB8888", + Self::RGBX8888 => "SDL_PIXELFORMAT_RGBX8888", + Self::XBGR8888 => "SDL_PIXELFORMAT_XBGR8888", + Self::BGRX8888 => "SDL_PIXELFORMAT_BGRX8888", + Self::ARGB8888 => "SDL_PIXELFORMAT_ARGB8888", + Self::RGBA8888 => "SDL_PIXELFORMAT_RGBA8888", + Self::ABGR8888 => "SDL_PIXELFORMAT_ABGR8888", + Self::BGRA8888 => "SDL_PIXELFORMAT_BGRA8888", + Self::XRGB2101010 => "SDL_PIXELFORMAT_XRGB2101010", + Self::XBGR2101010 => "SDL_PIXELFORMAT_XBGR2101010", + Self::ARGB2101010 => "SDL_PIXELFORMAT_ARGB2101010", + Self::ABGR2101010 => "SDL_PIXELFORMAT_ABGR2101010", + Self::RGB48 => "SDL_PIXELFORMAT_RGB48", + Self::BGR48 => "SDL_PIXELFORMAT_BGR48", + Self::RGBA64 => "SDL_PIXELFORMAT_RGBA64", + Self::ARGB64 => "SDL_PIXELFORMAT_ARGB64", + Self::BGRA64 => "SDL_PIXELFORMAT_BGRA64", + Self::ABGR64 => "SDL_PIXELFORMAT_ABGR64", + Self::RGB48_FLOAT => "SDL_PIXELFORMAT_RGB48_FLOAT", + Self::BGR48_FLOAT => "SDL_PIXELFORMAT_BGR48_FLOAT", + Self::RGBA64_FLOAT => "SDL_PIXELFORMAT_RGBA64_FLOAT", + Self::ARGB64_FLOAT => "SDL_PIXELFORMAT_ARGB64_FLOAT", + Self::BGRA64_FLOAT => "SDL_PIXELFORMAT_BGRA64_FLOAT", + Self::ABGR64_FLOAT => "SDL_PIXELFORMAT_ABGR64_FLOAT", + Self::RGB96_FLOAT => "SDL_PIXELFORMAT_RGB96_FLOAT", + Self::BGR96_FLOAT => "SDL_PIXELFORMAT_BGR96_FLOAT", + Self::RGBA128_FLOAT => "SDL_PIXELFORMAT_RGBA128_FLOAT", + Self::ARGB128_FLOAT => "SDL_PIXELFORMAT_ARGB128_FLOAT", + Self::BGRA128_FLOAT => "SDL_PIXELFORMAT_BGRA128_FLOAT", + Self::ABGR128_FLOAT => "SDL_PIXELFORMAT_ABGR128_FLOAT", + Self::YV12 => "SDL_PIXELFORMAT_YV12", + Self::IYUV => "SDL_PIXELFORMAT_IYUV", + Self::YUY2 => "SDL_PIXELFORMAT_YUY2", + Self::UYVY => "SDL_PIXELFORMAT_UYVY", + Self::YVYU => "SDL_PIXELFORMAT_YVYU", + Self::NV12 => "SDL_PIXELFORMAT_NV12", + Self::NV21 => "SDL_PIXELFORMAT_NV21", + Self::P010 => "SDL_PIXELFORMAT_P010", + Self::EXTERNAL_OES => "SDL_PIXELFORMAT_EXTERNAL_OES", + Self::MJPG => "SDL_PIXELFORMAT_MJPG", + Self::RGBA32 => "SDL_PIXELFORMAT_RGBA32", + Self::ARGB32 => "SDL_PIXELFORMAT_ARGB32", + Self::BGRA32 => "SDL_PIXELFORMAT_BGRA32", + Self::ABGR32 => "SDL_PIXELFORMAT_ABGR32", + Self::RGBX32 => "SDL_PIXELFORMAT_RGBX32", + Self::XRGB32 => "SDL_PIXELFORMAT_XRGB32", + Self::BGRX32 => "SDL_PIXELFORMAT_BGRX32", + Self::XBGR32 => "SDL_PIXELFORMAT_XBGR32", + Self::RGBA32 => "SDL_PIXELFORMAT_RGBA32", + Self::ARGB32 => "SDL_PIXELFORMAT_ARGB32", + Self::BGRA32 => "SDL_PIXELFORMAT_BGRA32", + Self::ABGR32 => "SDL_PIXELFORMAT_ABGR32", + Self::RGBX32 => "SDL_PIXELFORMAT_RGBX32", + Self::XRGB32 => "SDL_PIXELFORMAT_XRGB32", + Self::BGRX32 => "SDL_PIXELFORMAT_BGRX32", + Self::XBGR32 => "SDL_PIXELFORMAT_XBGR32", + + _ => return write!(f, "SDL_PixelFormat({})", self.0), + }) + } +} + +impl SDL_PixelFormat { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const INDEX1LSB: Self = Self((0x11100100 as ::core::ffi::c_int)); + pub const INDEX1MSB: Self = Self((0x11200100 as ::core::ffi::c_int)); + pub const INDEX2LSB: Self = Self((0x1c100200 as ::core::ffi::c_int)); + pub const INDEX2MSB: Self = Self((0x1c200200 as ::core::ffi::c_int)); + pub const INDEX4LSB: Self = Self((0x12100400 as ::core::ffi::c_int)); + pub const INDEX4MSB: Self = Self((0x12200400 as ::core::ffi::c_int)); + pub const INDEX8: Self = Self((0x13000801 as ::core::ffi::c_int)); + pub const RGB332: Self = Self((0x14110801 as ::core::ffi::c_int)); + pub const XRGB4444: Self = Self((0x15120c02 as ::core::ffi::c_int)); + pub const XBGR4444: Self = Self((0x15520c02 as ::core::ffi::c_int)); + pub const XRGB1555: Self = Self((0x15130f02 as ::core::ffi::c_int)); + pub const XBGR1555: Self = Self((0x15530f02 as ::core::ffi::c_int)); + pub const ARGB4444: Self = Self((0x15321002 as ::core::ffi::c_int)); + pub const RGBA4444: Self = Self((0x15421002 as ::core::ffi::c_int)); + pub const ABGR4444: Self = Self((0x15721002 as ::core::ffi::c_int)); + pub const BGRA4444: Self = Self((0x15821002 as ::core::ffi::c_int)); + pub const ARGB1555: Self = Self((0x15331002 as ::core::ffi::c_int)); + pub const RGBA5551: Self = Self((0x15441002 as ::core::ffi::c_int)); + pub const ABGR1555: Self = Self((0x15731002 as ::core::ffi::c_int)); + pub const BGRA5551: Self = Self((0x15841002 as ::core::ffi::c_int)); + pub const RGB565: Self = Self((0x15151002 as ::core::ffi::c_int)); + pub const BGR565: Self = Self((0x15551002 as ::core::ffi::c_int)); + pub const RGB24: Self = Self((0x17101803 as ::core::ffi::c_int)); + pub const BGR24: Self = Self((0x17401803 as ::core::ffi::c_int)); + pub const XRGB8888: Self = Self((0x16161804 as ::core::ffi::c_int)); + pub const RGBX8888: Self = Self((0x16261804 as ::core::ffi::c_int)); + pub const XBGR8888: Self = Self((0x16561804 as ::core::ffi::c_int)); + pub const BGRX8888: Self = Self((0x16661804 as ::core::ffi::c_int)); + pub const ARGB8888: Self = Self((0x16362004 as ::core::ffi::c_int)); + pub const RGBA8888: Self = Self((0x16462004 as ::core::ffi::c_int)); + pub const ABGR8888: Self = Self((0x16762004 as ::core::ffi::c_int)); + pub const BGRA8888: Self = Self((0x16862004 as ::core::ffi::c_int)); + pub const XRGB2101010: Self = Self((0x16172004 as ::core::ffi::c_int)); + pub const XBGR2101010: Self = Self((0x16572004 as ::core::ffi::c_int)); + pub const ARGB2101010: Self = Self((0x16372004 as ::core::ffi::c_int)); + pub const ABGR2101010: Self = Self((0x16772004 as ::core::ffi::c_int)); + pub const RGB48: Self = Self((0x18103006 as ::core::ffi::c_int)); + pub const BGR48: Self = Self((0x18403006 as ::core::ffi::c_int)); + pub const RGBA64: Self = Self((0x18204008 as ::core::ffi::c_int)); + pub const ARGB64: Self = Self((0x18304008 as ::core::ffi::c_int)); + pub const BGRA64: Self = Self((0x18504008 as ::core::ffi::c_int)); + pub const ABGR64: Self = Self((0x18604008 as ::core::ffi::c_int)); + pub const RGB48_FLOAT: Self = Self((0x1a103006 as ::core::ffi::c_int)); + pub const BGR48_FLOAT: Self = Self((0x1a403006 as ::core::ffi::c_int)); + pub const RGBA64_FLOAT: Self = Self((0x1a204008 as ::core::ffi::c_int)); + pub const ARGB64_FLOAT: Self = Self((0x1a304008 as ::core::ffi::c_int)); + pub const BGRA64_FLOAT: Self = Self((0x1a504008 as ::core::ffi::c_int)); + pub const ABGR64_FLOAT: Self = Self((0x1a604008 as ::core::ffi::c_int)); + pub const RGB96_FLOAT: Self = Self((0x1b10600c as ::core::ffi::c_int)); + pub const BGR96_FLOAT: Self = Self((0x1b40600c as ::core::ffi::c_int)); + pub const RGBA128_FLOAT: Self = Self((0x1b208010 as ::core::ffi::c_int)); + pub const ARGB128_FLOAT: Self = Self((0x1b308010 as ::core::ffi::c_int)); + pub const BGRA128_FLOAT: Self = Self((0x1b508010 as ::core::ffi::c_int)); + pub const ABGR128_FLOAT: Self = Self((0x1b608010 as ::core::ffi::c_int)); + /// Planar mode: Y + V + U (3 planes) + pub const YV12: Self = Self((0x32315659 as ::core::ffi::c_int)); + /// Planar mode: Y + U + V (3 planes) + pub const IYUV: Self = Self((0x56555949 as ::core::ffi::c_int)); + /// Packed mode: Y0+U0+Y1+V0 (1 plane) + pub const YUY2: Self = Self((0x32595559 as ::core::ffi::c_int)); + /// Packed mode: U0+Y0+V0+Y1 (1 plane) + pub const UYVY: Self = Self((0x59565955 as ::core::ffi::c_int)); + /// Packed mode: Y0+V0+Y1+U0 (1 plane) + pub const YVYU: Self = Self((0x55595659 as ::core::ffi::c_int)); + /// Planar mode: Y + U/V interleaved (2 planes) + pub const NV12: Self = Self((0x3231564e as ::core::ffi::c_int)); + /// Planar mode: Y + V/U interleaved (2 planes) + pub const NV21: Self = Self((0x3132564e as ::core::ffi::c_int)); + /// Planar mode: Y + U/V interleaved (2 planes) + pub const P010: Self = Self((0x30313050 as ::core::ffi::c_int)); + /// Android video texture format + pub const EXTERNAL_OES: Self = Self((0x2053454f as ::core::ffi::c_int)); + /// Motion JPEG + pub const MJPG: Self = Self((0x47504a4d as ::core::ffi::c_int)); + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const RGBA32: Self = SDL_PIXELFORMAT_RGBA8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const ARGB32: Self = SDL_PIXELFORMAT_ARGB8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const BGRA32: Self = SDL_PIXELFORMAT_BGRA8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const ABGR32: Self = SDL_PIXELFORMAT_ABGR8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const RGBX32: Self = SDL_PIXELFORMAT_RGBX8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const XRGB32: Self = SDL_PIXELFORMAT_XRGB8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const BGRX32: Self = SDL_PIXELFORMAT_BGRX8888; + #[cfg(target_endian = "big")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const XBGR32: Self = SDL_PIXELFORMAT_XBGR8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const RGBA32: Self = SDL_PIXELFORMAT_ABGR8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const ARGB32: Self = SDL_PIXELFORMAT_BGRA8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const BGRA32: Self = SDL_PIXELFORMAT_ARGB8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const ABGR32: Self = SDL_PIXELFORMAT_RGBA8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const RGBX32: Self = SDL_PIXELFORMAT_XBGR8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const XRGB32: Self = SDL_PIXELFORMAT_BGRX8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const BGRX32: Self = SDL_PIXELFORMAT_XRGB8888; + #[cfg(not(target_endian = "big"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub const XBGR32: Self = SDL_PIXELFORMAT_RGBX8888; +} + +pub const SDL_PIXELFORMAT_UNKNOWN: SDL_PixelFormat = SDL_PixelFormat::UNKNOWN; +pub const SDL_PIXELFORMAT_INDEX1LSB: SDL_PixelFormat = SDL_PixelFormat::INDEX1LSB; +pub const SDL_PIXELFORMAT_INDEX1MSB: SDL_PixelFormat = SDL_PixelFormat::INDEX1MSB; +pub const SDL_PIXELFORMAT_INDEX2LSB: SDL_PixelFormat = SDL_PixelFormat::INDEX2LSB; +pub const SDL_PIXELFORMAT_INDEX2MSB: SDL_PixelFormat = SDL_PixelFormat::INDEX2MSB; +pub const SDL_PIXELFORMAT_INDEX4LSB: SDL_PixelFormat = SDL_PixelFormat::INDEX4LSB; +pub const SDL_PIXELFORMAT_INDEX4MSB: SDL_PixelFormat = SDL_PixelFormat::INDEX4MSB; +pub const SDL_PIXELFORMAT_INDEX8: SDL_PixelFormat = SDL_PixelFormat::INDEX8; +pub const SDL_PIXELFORMAT_RGB332: SDL_PixelFormat = SDL_PixelFormat::RGB332; +pub const SDL_PIXELFORMAT_XRGB4444: SDL_PixelFormat = SDL_PixelFormat::XRGB4444; +pub const SDL_PIXELFORMAT_XBGR4444: SDL_PixelFormat = SDL_PixelFormat::XBGR4444; +pub const SDL_PIXELFORMAT_XRGB1555: SDL_PixelFormat = SDL_PixelFormat::XRGB1555; +pub const SDL_PIXELFORMAT_XBGR1555: SDL_PixelFormat = SDL_PixelFormat::XBGR1555; +pub const SDL_PIXELFORMAT_ARGB4444: SDL_PixelFormat = SDL_PixelFormat::ARGB4444; +pub const SDL_PIXELFORMAT_RGBA4444: SDL_PixelFormat = SDL_PixelFormat::RGBA4444; +pub const SDL_PIXELFORMAT_ABGR4444: SDL_PixelFormat = SDL_PixelFormat::ABGR4444; +pub const SDL_PIXELFORMAT_BGRA4444: SDL_PixelFormat = SDL_PixelFormat::BGRA4444; +pub const SDL_PIXELFORMAT_ARGB1555: SDL_PixelFormat = SDL_PixelFormat::ARGB1555; +pub const SDL_PIXELFORMAT_RGBA5551: SDL_PixelFormat = SDL_PixelFormat::RGBA5551; +pub const SDL_PIXELFORMAT_ABGR1555: SDL_PixelFormat = SDL_PixelFormat::ABGR1555; +pub const SDL_PIXELFORMAT_BGRA5551: SDL_PixelFormat = SDL_PixelFormat::BGRA5551; +pub const SDL_PIXELFORMAT_RGB565: SDL_PixelFormat = SDL_PixelFormat::RGB565; +pub const SDL_PIXELFORMAT_BGR565: SDL_PixelFormat = SDL_PixelFormat::BGR565; +pub const SDL_PIXELFORMAT_RGB24: SDL_PixelFormat = SDL_PixelFormat::RGB24; +pub const SDL_PIXELFORMAT_BGR24: SDL_PixelFormat = SDL_PixelFormat::BGR24; +pub const SDL_PIXELFORMAT_XRGB8888: SDL_PixelFormat = SDL_PixelFormat::XRGB8888; +pub const SDL_PIXELFORMAT_RGBX8888: SDL_PixelFormat = SDL_PixelFormat::RGBX8888; +pub const SDL_PIXELFORMAT_XBGR8888: SDL_PixelFormat = SDL_PixelFormat::XBGR8888; +pub const SDL_PIXELFORMAT_BGRX8888: SDL_PixelFormat = SDL_PixelFormat::BGRX8888; +pub const SDL_PIXELFORMAT_ARGB8888: SDL_PixelFormat = SDL_PixelFormat::ARGB8888; +pub const SDL_PIXELFORMAT_RGBA8888: SDL_PixelFormat = SDL_PixelFormat::RGBA8888; +pub const SDL_PIXELFORMAT_ABGR8888: SDL_PixelFormat = SDL_PixelFormat::ABGR8888; +pub const SDL_PIXELFORMAT_BGRA8888: SDL_PixelFormat = SDL_PixelFormat::BGRA8888; +pub const SDL_PIXELFORMAT_XRGB2101010: SDL_PixelFormat = SDL_PixelFormat::XRGB2101010; +pub const SDL_PIXELFORMAT_XBGR2101010: SDL_PixelFormat = SDL_PixelFormat::XBGR2101010; +pub const SDL_PIXELFORMAT_ARGB2101010: SDL_PixelFormat = SDL_PixelFormat::ARGB2101010; +pub const SDL_PIXELFORMAT_ABGR2101010: SDL_PixelFormat = SDL_PixelFormat::ABGR2101010; +pub const SDL_PIXELFORMAT_RGB48: SDL_PixelFormat = SDL_PixelFormat::RGB48; +pub const SDL_PIXELFORMAT_BGR48: SDL_PixelFormat = SDL_PixelFormat::BGR48; +pub const SDL_PIXELFORMAT_RGBA64: SDL_PixelFormat = SDL_PixelFormat::RGBA64; +pub const SDL_PIXELFORMAT_ARGB64: SDL_PixelFormat = SDL_PixelFormat::ARGB64; +pub const SDL_PIXELFORMAT_BGRA64: SDL_PixelFormat = SDL_PixelFormat::BGRA64; +pub const SDL_PIXELFORMAT_ABGR64: SDL_PixelFormat = SDL_PixelFormat::ABGR64; +pub const SDL_PIXELFORMAT_RGB48_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGB48_FLOAT; +pub const SDL_PIXELFORMAT_BGR48_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGR48_FLOAT; +pub const SDL_PIXELFORMAT_RGBA64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGBA64_FLOAT; +pub const SDL_PIXELFORMAT_ARGB64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ARGB64_FLOAT; +pub const SDL_PIXELFORMAT_BGRA64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGRA64_FLOAT; +pub const SDL_PIXELFORMAT_ABGR64_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ABGR64_FLOAT; +pub const SDL_PIXELFORMAT_RGB96_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGB96_FLOAT; +pub const SDL_PIXELFORMAT_BGR96_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGR96_FLOAT; +pub const SDL_PIXELFORMAT_RGBA128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::RGBA128_FLOAT; +pub const SDL_PIXELFORMAT_ARGB128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ARGB128_FLOAT; +pub const SDL_PIXELFORMAT_BGRA128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::BGRA128_FLOAT; +pub const SDL_PIXELFORMAT_ABGR128_FLOAT: SDL_PixelFormat = SDL_PixelFormat::ABGR128_FLOAT; +/// Planar mode: Y + V + U (3 planes) +pub const SDL_PIXELFORMAT_YV12: SDL_PixelFormat = SDL_PixelFormat::YV12; +/// Planar mode: Y + U + V (3 planes) +pub const SDL_PIXELFORMAT_IYUV: SDL_PixelFormat = SDL_PixelFormat::IYUV; +/// Packed mode: Y0+U0+Y1+V0 (1 plane) +pub const SDL_PIXELFORMAT_YUY2: SDL_PixelFormat = SDL_PixelFormat::YUY2; +/// Packed mode: U0+Y0+V0+Y1 (1 plane) +pub const SDL_PIXELFORMAT_UYVY: SDL_PixelFormat = SDL_PixelFormat::UYVY; +/// Packed mode: Y0+V0+Y1+U0 (1 plane) +pub const SDL_PIXELFORMAT_YVYU: SDL_PixelFormat = SDL_PixelFormat::YVYU; +/// Planar mode: Y + U/V interleaved (2 planes) +pub const SDL_PIXELFORMAT_NV12: SDL_PixelFormat = SDL_PixelFormat::NV12; +/// Planar mode: Y + V/U interleaved (2 planes) +pub const SDL_PIXELFORMAT_NV21: SDL_PixelFormat = SDL_PixelFormat::NV21; +/// Planar mode: Y + U/V interleaved (2 planes) +pub const SDL_PIXELFORMAT_P010: SDL_PixelFormat = SDL_PixelFormat::P010; +/// Android video texture format +pub const SDL_PIXELFORMAT_EXTERNAL_OES: SDL_PixelFormat = SDL_PixelFormat::EXTERNAL_OES; +/// Motion JPEG +pub const SDL_PIXELFORMAT_MJPG: SDL_PixelFormat = SDL_PixelFormat::MJPG; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_RGBA32: SDL_PixelFormat = SDL_PixelFormat::RGBA32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_ARGB32: SDL_PixelFormat = SDL_PixelFormat::ARGB32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_BGRA32: SDL_PixelFormat = SDL_PixelFormat::BGRA32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_ABGR32: SDL_PixelFormat = SDL_PixelFormat::ABGR32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_RGBX32: SDL_PixelFormat = SDL_PixelFormat::RGBX32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_XRGB32: SDL_PixelFormat = SDL_PixelFormat::XRGB32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_BGRX32: SDL_PixelFormat = SDL_PixelFormat::BGRX32; +#[cfg(target_endian = "big")] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_XBGR32: SDL_PixelFormat = SDL_PixelFormat::XBGR32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_RGBA32: SDL_PixelFormat = SDL_PixelFormat::RGBA32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_ARGB32: SDL_PixelFormat = SDL_PixelFormat::ARGB32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_BGRA32: SDL_PixelFormat = SDL_PixelFormat::BGRA32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_ABGR32: SDL_PixelFormat = SDL_PixelFormat::ABGR32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_RGBX32: SDL_PixelFormat = SDL_PixelFormat::RGBX32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_XRGB32: SDL_PixelFormat = SDL_PixelFormat::XRGB32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_BGRX32: SDL_PixelFormat = SDL_PixelFormat::BGRX32; +#[cfg(not(target_endian = "big"))] +#[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] +pub const SDL_PIXELFORMAT_XBGR32: SDL_PixelFormat = SDL_PixelFormat::XBGR32; + +impl SDL_PixelFormat { + /// Initialize a `SDL_PixelFormat` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PixelFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PixelFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_PixelFormat; +} + +/// A macro for defining custom non-FourCC pixel formats. +/// +/// For example, defining [`SDL_PIXELFORMAT_RGBA8888`] looks like this: +/// +/// ```c +/// SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4) +/// ``` +/// +/// ## Parameters +/// - `type`: the type of the new format, probably a [`SDL_PixelType`] value. +/// - `order`: the order of the new format, probably a [`SDL_BitmapOrder`], +/// [`SDL_PackedOrder`], or [`SDL_ArrayOrder`] value. +/// - `layout`: the layout of the new format, probably an [`SDL_PackedLayout`] +/// value or zero. +/// - `bits`: the number of bits per pixel of the new format. +/// - `bytes`: the number of bytes per pixel of the new format. +/// +/// ## Return value +/// Returns a format value in the style of [`SDL_PixelFormat`]. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_DEFINE_PIXELFORMAT( + r#type: SDL_PixelType, + order: ::core::ffi::c_int, + layout: SDL_PackedLayout, + bits: ::core::primitive::u8, + bytes: ::core::primitive::u8, +) -> SDL_PixelFormat { + SDL_PixelFormat( + ((((((268435456_i32 | (r#type.0 << 24)) | (order << 20)) | (layout.0 << 16)) + | ((bits as ::core::ffi::c_int) << 8)) + | ((bytes as ::core::ffi::c_int) << 0)) as ::core::ffi::c_int), + ) +} + +/// A macro to retrieve the flags of an [`SDL_PixelFormat`]. +/// +/// This macro is generally not needed directly by an app, which should use +/// specific tests, like [`SDL_ISPIXELFORMAT_FOURCC`], instead. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns the flags of `format`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_PIXELFLAG(format: SDL_PixelFormat) -> ::core::ffi::c_int { + ((format.0 >> 28) & 15_i32) +} + +/// A macro to retrieve the type of an [`SDL_PixelFormat`]. +/// +/// This is usually a value from the [`SDL_PixelType`] enumeration. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns the type of `format`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_PIXELTYPE(format: SDL_PixelFormat) -> SDL_PixelType { + SDL_PixelType(((format.0 >> 24) & 15_i32)) +} + +/// A macro to retrieve the order of an [`SDL_PixelFormat`]. +/// +/// This is usually a value from the [`SDL_BitmapOrder`], [`SDL_PackedOrder`], or +/// [`SDL_ArrayOrder`] enumerations, depending on the format type. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns the order of `format`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_PIXELORDER(format: SDL_PixelFormat) -> ::core::ffi::c_int { + ((format.0 >> 20) & 15_i32) +} + +/// A macro to retrieve the layout of an [`SDL_PixelFormat`]. +/// +/// This is usually a value from the [`SDL_PackedLayout`] enumeration, or zero if a +/// layout doesn't make sense for the format type. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns the layout of `format`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_PIXELLAYOUT(format: SDL_PixelFormat) -> SDL_PackedLayout { + SDL_PackedLayout(((format.0 >> 16) & 15_i32)) +} + +/// A macro to determine if an [`SDL_PixelFormat`] is a "FourCC" format. +/// +/// This covers custom and other unusual formats. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format has alpha, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_FOURCC(format: SDL_PixelFormat) -> ::core::primitive::bool { + ((format.0 != 0) && (SDL_PIXELFLAG(format) != 1_i32)) +} + +/// A macro to determine an SDL_PixelFormat's bits per pixel. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// FourCC formats will report zero here, as it rarely makes sense to measure +/// them per-pixel. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns the bits-per-pixel of `format`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BYTESPERPIXEL`] +#[inline(always)] +pub const fn SDL_BITSPERPIXEL(format: SDL_PixelFormat) -> ::core::primitive::u8 { + (if SDL_ISPIXELFORMAT_FOURCC(format) { + 0_i32 + } else { + ((format.0 >> 8) & 255_i32) + } as ::core::primitive::u8) +} + +/// A macro to determine if an [`SDL_PixelFormat`] is an indexed format. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format is indexed, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_INDEXED(format: SDL_PixelFormat) -> ::core::primitive::bool { + (!(SDL_ISPIXELFORMAT_FOURCC(format)) + && ((((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX1.0) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX2.0)) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX4.0)) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_INDEX8.0))) +} + +/// A macro to determine if an [`SDL_PixelFormat`] is a packed format. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format is packed, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_PACKED(format: SDL_PixelFormat) -> ::core::primitive::bool { + (!(SDL_ISPIXELFORMAT_FOURCC(format)) + && (((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED8.0) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED16.0)) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED32.0))) +} + +/// A macro to determine if an [`SDL_PixelFormat`] is an array format. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format is an array, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_ARRAY(format: SDL_PixelFormat) -> ::core::primitive::bool { + (!(SDL_ISPIXELFORMAT_FOURCC(format)) + && (((((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYU8.0) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYU16.0)) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYU32.0)) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF16.0)) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF32.0))) +} + +/// A macro to determine if an [`SDL_PixelFormat`] is a floating point format. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format is a floating point, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_FLOAT(format: SDL_PixelFormat) -> ::core::primitive::bool { + (!(SDL_ISPIXELFORMAT_FOURCC(format)) + && ((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF16.0) + || (SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_ARRAYF32.0))) +} + +/// A macro to determine if an [`SDL_PixelFormat`] has an alpha channel. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format has alpha, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_ALPHA(format: SDL_PixelFormat) -> ::core::primitive::bool { + ((SDL_ISPIXELFORMAT_PACKED(format) + && ((((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB.0) + || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA.0)) + || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR.0)) + || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA.0))) + || (SDL_ISPIXELFORMAT_ARRAY(format) + && ((((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB.0) + || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA.0)) + || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR.0)) + || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA.0)))) +} + +/// A macro to determine if an [`SDL_PixelFormat`] is a 10-bit format. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns true if the format is 10-bit, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISPIXELFORMAT_10BIT(format: SDL_PixelFormat) -> ::core::primitive::bool { + (!(SDL_ISPIXELFORMAT_FOURCC(format)) + && ((SDL_PIXELTYPE(format).0 == SDL_PIXELTYPE_PACKED32.0) + && (SDL_PIXELLAYOUT(format).0 == SDL_PACKEDLAYOUT_2101010.0))) +} + +/// A macro to determine an SDL_PixelFormat's bytes per pixel. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// FourCC formats do their best here, but many of them don't have a meaningful +/// measurement of bytes per pixel. +/// +/// ## Parameters +/// - `format`: an [`SDL_PixelFormat`] to check. +/// +/// ## Return value +/// Returns the bytes-per-pixel of `format`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_BITSPERPIXEL`] +#[inline(always)] +pub const fn SDL_BYTESPERPIXEL(format: SDL_PixelFormat) -> ::core::primitive::u8 { + (if SDL_ISPIXELFORMAT_FOURCC(format) { + if ((((format.0 == SDL_PIXELFORMAT_YUY2.0) || (format.0 == SDL_PIXELFORMAT_UYVY.0)) + || (format.0 == SDL_PIXELFORMAT_YVYU.0)) + || (format.0 == SDL_PIXELFORMAT_P010.0)) + { + 2 + } else { + 1 + } + } else { + ((format.0 >> 0) & 255_i32) + } as ::core::primitive::u8) +} + +/// Colorspace color type. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_ColorType::UNKNOWN) | [`SDL_COLOR_TYPE_UNKNOWN`] | | +/// | [`RGB`](SDL_ColorType::RGB) | [`SDL_COLOR_TYPE_RGB`] | | +/// | [`YCBCR`](SDL_ColorType::YCBCR) | [`SDL_COLOR_TYPE_YCBCR`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ColorType(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ColorType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_ColorType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_ColorType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ColorType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_COLOR_TYPE_UNKNOWN", + Self::RGB => "SDL_COLOR_TYPE_RGB", + Self::YCBCR => "SDL_COLOR_TYPE_YCBCR", + + _ => return write!(f, "SDL_ColorType({})", self.0), + }) + } +} + +impl SDL_ColorType { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint)); + pub const RGB: Self = Self((1 as ::core::ffi::c_uint)); + pub const YCBCR: Self = Self((2 as ::core::ffi::c_uint)); +} + +pub const SDL_COLOR_TYPE_UNKNOWN: SDL_ColorType = SDL_ColorType::UNKNOWN; +pub const SDL_COLOR_TYPE_RGB: SDL_ColorType = SDL_ColorType::RGB; +pub const SDL_COLOR_TYPE_YCBCR: SDL_ColorType = SDL_ColorType::YCBCR; + +impl SDL_ColorType { + /// Initialize a `SDL_ColorType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_ColorType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ColorType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_ColorType; +} + +/// Colorspace color range, as described by +/// +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_ColorRange::UNKNOWN) | [`SDL_COLOR_RANGE_UNKNOWN`] | | +/// | [`LIMITED`](SDL_ColorRange::LIMITED) | [`SDL_COLOR_RANGE_LIMITED`] | Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma | +/// | [`FULL`](SDL_ColorRange::FULL) | [`SDL_COLOR_RANGE_FULL`] | Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ColorRange(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ColorRange { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_ColorRange) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_ColorRange) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ColorRange { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_COLOR_RANGE_UNKNOWN", + Self::LIMITED => "SDL_COLOR_RANGE_LIMITED", + Self::FULL => "SDL_COLOR_RANGE_FULL", + + _ => return write!(f, "SDL_ColorRange({})", self.0), + }) + } +} + +impl SDL_ColorRange { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint)); + /// Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma + pub const LIMITED: Self = Self((1 as ::core::ffi::c_uint)); + /// Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma + pub const FULL: Self = Self((2 as ::core::ffi::c_uint)); +} + +pub const SDL_COLOR_RANGE_UNKNOWN: SDL_ColorRange = SDL_ColorRange::UNKNOWN; +/// Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma +pub const SDL_COLOR_RANGE_LIMITED: SDL_ColorRange = SDL_ColorRange::LIMITED; +/// Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma +pub const SDL_COLOR_RANGE_FULL: SDL_ColorRange = SDL_ColorRange::FULL; + +impl SDL_ColorRange { + /// Initialize a `SDL_ColorRange` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_ColorRange { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ColorRange { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_ColorRange; +} + +/// Colorspace color primaries, as described by +/// +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_ColorPrimaries::UNKNOWN) | [`SDL_COLOR_PRIMARIES_UNKNOWN`] | | +/// | [`BT709`](SDL_ColorPrimaries::BT709) | [`SDL_COLOR_PRIMARIES_BT709`] | ITU-R BT.709-6 | +/// | [`UNSPECIFIED`](SDL_ColorPrimaries::UNSPECIFIED) | [`SDL_COLOR_PRIMARIES_UNSPECIFIED`] | | +/// | [`BT470M`](SDL_ColorPrimaries::BT470M) | [`SDL_COLOR_PRIMARIES_BT470M`] | ITU-R BT.470-6 System M | +/// | [`BT470BG`](SDL_ColorPrimaries::BT470BG) | [`SDL_COLOR_PRIMARIES_BT470BG`] | ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 | +/// | [`BT601`](SDL_ColorPrimaries::BT601) | [`SDL_COLOR_PRIMARIES_BT601`] | ITU-R BT.601-7 525, SMPTE 170M | +/// | [`SMPTE240`](SDL_ColorPrimaries::SMPTE240) | [`SDL_COLOR_PRIMARIES_SMPTE240`] | SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`] | +/// | [`GENERIC_FILM`](SDL_ColorPrimaries::GENERIC_FILM) | [`SDL_COLOR_PRIMARIES_GENERIC_FILM`] | Generic film (color filters using Illuminant C) | +/// | [`BT2020`](SDL_ColorPrimaries::BT2020) | [`SDL_COLOR_PRIMARIES_BT2020`] | ITU-R BT.2020-2 / ITU-R BT.2100-0 | +/// | [`XYZ`](SDL_ColorPrimaries::XYZ) | [`SDL_COLOR_PRIMARIES_XYZ`] | SMPTE ST 428-1 | +/// | [`SMPTE431`](SDL_ColorPrimaries::SMPTE431) | [`SDL_COLOR_PRIMARIES_SMPTE431`] | SMPTE RP 431-2 | +/// | [`SMPTE432`](SDL_ColorPrimaries::SMPTE432) | [`SDL_COLOR_PRIMARIES_SMPTE432`] | SMPTE EG 432-1 / DCI P3 | +/// | [`EBU3213`](SDL_ColorPrimaries::EBU3213) | [`SDL_COLOR_PRIMARIES_EBU3213`] | EBU Tech. 3213-E | +/// | [`CUSTOM`](SDL_ColorPrimaries::CUSTOM) | [`SDL_COLOR_PRIMARIES_CUSTOM`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ColorPrimaries(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ColorPrimaries { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_ColorPrimaries) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_ColorPrimaries) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ColorPrimaries { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_COLOR_PRIMARIES_UNKNOWN", + Self::BT709 => "SDL_COLOR_PRIMARIES_BT709", + Self::UNSPECIFIED => "SDL_COLOR_PRIMARIES_UNSPECIFIED", + Self::BT470M => "SDL_COLOR_PRIMARIES_BT470M", + Self::BT470BG => "SDL_COLOR_PRIMARIES_BT470BG", + Self::BT601 => "SDL_COLOR_PRIMARIES_BT601", + Self::SMPTE240 => "SDL_COLOR_PRIMARIES_SMPTE240", + Self::GENERIC_FILM => "SDL_COLOR_PRIMARIES_GENERIC_FILM", + Self::BT2020 => "SDL_COLOR_PRIMARIES_BT2020", + Self::XYZ => "SDL_COLOR_PRIMARIES_XYZ", + Self::SMPTE431 => "SDL_COLOR_PRIMARIES_SMPTE431", + Self::SMPTE432 => "SDL_COLOR_PRIMARIES_SMPTE432", + Self::EBU3213 => "SDL_COLOR_PRIMARIES_EBU3213", + Self::CUSTOM => "SDL_COLOR_PRIMARIES_CUSTOM", + + _ => return write!(f, "SDL_ColorPrimaries({})", self.0), + }) + } +} + +impl SDL_ColorPrimaries { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint)); + /// ITU-R BT.709-6 + pub const BT709: Self = Self((1 as ::core::ffi::c_uint)); + pub const UNSPECIFIED: Self = Self((2 as ::core::ffi::c_uint)); + /// ITU-R BT.470-6 System M + pub const BT470M: Self = Self((4 as ::core::ffi::c_uint)); + /// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 + pub const BT470BG: Self = Self((5 as ::core::ffi::c_uint)); + /// ITU-R BT.601-7 525, SMPTE 170M + pub const BT601: Self = Self((6 as ::core::ffi::c_uint)); + /// SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`] + pub const SMPTE240: Self = Self((7 as ::core::ffi::c_uint)); + /// Generic film (color filters using Illuminant C) + pub const GENERIC_FILM: Self = Self((8 as ::core::ffi::c_uint)); + /// ITU-R BT.2020-2 / ITU-R BT.2100-0 + pub const BT2020: Self = Self((9 as ::core::ffi::c_uint)); + /// SMPTE ST 428-1 + pub const XYZ: Self = Self((10 as ::core::ffi::c_uint)); + /// SMPTE RP 431-2 + pub const SMPTE431: Self = Self((11 as ::core::ffi::c_uint)); + /// SMPTE EG 432-1 / DCI P3 + pub const SMPTE432: Self = Self((12 as ::core::ffi::c_uint)); + /// EBU Tech. 3213-E + pub const EBU3213: Self = Self((22 as ::core::ffi::c_uint)); + pub const CUSTOM: Self = Self((31 as ::core::ffi::c_uint)); +} + +pub const SDL_COLOR_PRIMARIES_UNKNOWN: SDL_ColorPrimaries = SDL_ColorPrimaries::UNKNOWN; +/// ITU-R BT.709-6 +pub const SDL_COLOR_PRIMARIES_BT709: SDL_ColorPrimaries = SDL_ColorPrimaries::BT709; +pub const SDL_COLOR_PRIMARIES_UNSPECIFIED: SDL_ColorPrimaries = SDL_ColorPrimaries::UNSPECIFIED; +/// ITU-R BT.470-6 System M +pub const SDL_COLOR_PRIMARIES_BT470M: SDL_ColorPrimaries = SDL_ColorPrimaries::BT470M; +/// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 +pub const SDL_COLOR_PRIMARIES_BT470BG: SDL_ColorPrimaries = SDL_ColorPrimaries::BT470BG; +/// ITU-R BT.601-7 525, SMPTE 170M +pub const SDL_COLOR_PRIMARIES_BT601: SDL_ColorPrimaries = SDL_ColorPrimaries::BT601; +/// SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`] +pub const SDL_COLOR_PRIMARIES_SMPTE240: SDL_ColorPrimaries = SDL_ColorPrimaries::SMPTE240; +/// Generic film (color filters using Illuminant C) +pub const SDL_COLOR_PRIMARIES_GENERIC_FILM: SDL_ColorPrimaries = SDL_ColorPrimaries::GENERIC_FILM; +/// ITU-R BT.2020-2 / ITU-R BT.2100-0 +pub const SDL_COLOR_PRIMARIES_BT2020: SDL_ColorPrimaries = SDL_ColorPrimaries::BT2020; +/// SMPTE ST 428-1 +pub const SDL_COLOR_PRIMARIES_XYZ: SDL_ColorPrimaries = SDL_ColorPrimaries::XYZ; +/// SMPTE RP 431-2 +pub const SDL_COLOR_PRIMARIES_SMPTE431: SDL_ColorPrimaries = SDL_ColorPrimaries::SMPTE431; +/// SMPTE EG 432-1 / DCI P3 +pub const SDL_COLOR_PRIMARIES_SMPTE432: SDL_ColorPrimaries = SDL_ColorPrimaries::SMPTE432; +/// EBU Tech. 3213-E +pub const SDL_COLOR_PRIMARIES_EBU3213: SDL_ColorPrimaries = SDL_ColorPrimaries::EBU3213; +pub const SDL_COLOR_PRIMARIES_CUSTOM: SDL_ColorPrimaries = SDL_ColorPrimaries::CUSTOM; + +impl SDL_ColorPrimaries { + /// Initialize a `SDL_ColorPrimaries` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_ColorPrimaries { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ColorPrimaries { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_ColorPrimaries; +} + +/// Colorspace transfer characteristics. +/// +/// These are as described by +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_TransferCharacteristics::UNKNOWN) | [`SDL_TRANSFER_CHARACTERISTICS_UNKNOWN`] | | +/// | [`BT709`](SDL_TransferCharacteristics::BT709) | [`SDL_TRANSFER_CHARACTERISTICS_BT709`] | Rec. ITU-R BT.709-6 / ITU-R BT1361 | +/// | [`UNSPECIFIED`](SDL_TransferCharacteristics::UNSPECIFIED) | [`SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED`] | | +/// | [`GAMMA22`](SDL_TransferCharacteristics::GAMMA22) | [`SDL_TRANSFER_CHARACTERISTICS_GAMMA22`] | ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM | +/// | [`GAMMA28`](SDL_TransferCharacteristics::GAMMA28) | [`SDL_TRANSFER_CHARACTERISTICS_GAMMA28`] | ITU-R BT.470-6 System B, G | +/// | [`BT601`](SDL_TransferCharacteristics::BT601) | [`SDL_TRANSFER_CHARACTERISTICS_BT601`] | SMPTE ST 170M / ITU-R BT.601-7 525 or 625 | +/// | [`SMPTE240`](SDL_TransferCharacteristics::SMPTE240) | [`SDL_TRANSFER_CHARACTERISTICS_SMPTE240`] | SMPTE ST 240M | +/// | [`LINEAR`](SDL_TransferCharacteristics::LINEAR) | [`SDL_TRANSFER_CHARACTERISTICS_LINEAR`] | | +/// | [`LOG100`](SDL_TransferCharacteristics::LOG100) | [`SDL_TRANSFER_CHARACTERISTICS_LOG100`] | | +/// | [`LOG100_SQRT10`](SDL_TransferCharacteristics::LOG100_SQRT10) | [`SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10`] | | +/// | [`IEC61966`](SDL_TransferCharacteristics::IEC61966) | [`SDL_TRANSFER_CHARACTERISTICS_IEC61966`] | IEC 61966-2-4 | +/// | [`BT1361`](SDL_TransferCharacteristics::BT1361) | [`SDL_TRANSFER_CHARACTERISTICS_BT1361`] | ITU-R BT1361 Extended Colour Gamut | +/// | [`SRGB`](SDL_TransferCharacteristics::SRGB) | [`SDL_TRANSFER_CHARACTERISTICS_SRGB`] | IEC 61966-2-1 (sRGB or sYCC) | +/// | [`BT2020_10BIT`](SDL_TransferCharacteristics::BT2020_10BIT) | [`SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT`] | ITU-R BT2020 for 10-bit system | +/// | [`BT2020_12BIT`](SDL_TransferCharacteristics::BT2020_12BIT) | [`SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT`] | ITU-R BT2020 for 12-bit system | +/// | [`PQ`](SDL_TransferCharacteristics::PQ) | [`SDL_TRANSFER_CHARACTERISTICS_PQ`] | SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems | +/// | [`SMPTE428`](SDL_TransferCharacteristics::SMPTE428) | [`SDL_TRANSFER_CHARACTERISTICS_SMPTE428`] | SMPTE ST 428-1 | +/// | [`HLG`](SDL_TransferCharacteristics::HLG) | [`SDL_TRANSFER_CHARACTERISTICS_HLG`] | ARIB STD-B67, known as "hybrid log-gamma" (HLG) | +/// | [`CUSTOM`](SDL_TransferCharacteristics::CUSTOM) | [`SDL_TRANSFER_CHARACTERISTICS_CUSTOM`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_TransferCharacteristics(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_TransferCharacteristics { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_TransferCharacteristics) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_TransferCharacteristics) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TransferCharacteristics { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_TRANSFER_CHARACTERISTICS_UNKNOWN", + Self::BT709 => "SDL_TRANSFER_CHARACTERISTICS_BT709", + Self::UNSPECIFIED => "SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED", + Self::GAMMA22 => "SDL_TRANSFER_CHARACTERISTICS_GAMMA22", + Self::GAMMA28 => "SDL_TRANSFER_CHARACTERISTICS_GAMMA28", + Self::BT601 => "SDL_TRANSFER_CHARACTERISTICS_BT601", + Self::SMPTE240 => "SDL_TRANSFER_CHARACTERISTICS_SMPTE240", + Self::LINEAR => "SDL_TRANSFER_CHARACTERISTICS_LINEAR", + Self::LOG100 => "SDL_TRANSFER_CHARACTERISTICS_LOG100", + Self::LOG100_SQRT10 => "SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10", + Self::IEC61966 => "SDL_TRANSFER_CHARACTERISTICS_IEC61966", + Self::BT1361 => "SDL_TRANSFER_CHARACTERISTICS_BT1361", + Self::SRGB => "SDL_TRANSFER_CHARACTERISTICS_SRGB", + Self::BT2020_10BIT => "SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT", + Self::BT2020_12BIT => "SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT", + Self::PQ => "SDL_TRANSFER_CHARACTERISTICS_PQ", + Self::SMPTE428 => "SDL_TRANSFER_CHARACTERISTICS_SMPTE428", + Self::HLG => "SDL_TRANSFER_CHARACTERISTICS_HLG", + Self::CUSTOM => "SDL_TRANSFER_CHARACTERISTICS_CUSTOM", + + _ => return write!(f, "SDL_TransferCharacteristics({})", self.0), + }) + } +} + +impl SDL_TransferCharacteristics { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_uint)); + /// Rec. ITU-R BT.709-6 / ITU-R BT1361 + pub const BT709: Self = Self((1 as ::core::ffi::c_uint)); + pub const UNSPECIFIED: Self = Self((2 as ::core::ffi::c_uint)); + /// ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM + pub const GAMMA22: Self = Self((4 as ::core::ffi::c_uint)); + /// ITU-R BT.470-6 System B, G + pub const GAMMA28: Self = Self((5 as ::core::ffi::c_uint)); + /// SMPTE ST 170M / ITU-R BT.601-7 525 or 625 + pub const BT601: Self = Self((6 as ::core::ffi::c_uint)); + /// SMPTE ST 240M + pub const SMPTE240: Self = Self((7 as ::core::ffi::c_uint)); + pub const LINEAR: Self = Self((8 as ::core::ffi::c_uint)); + pub const LOG100: Self = Self((9 as ::core::ffi::c_uint)); + pub const LOG100_SQRT10: Self = Self((10 as ::core::ffi::c_uint)); + /// IEC 61966-2-4 + pub const IEC61966: Self = Self((11 as ::core::ffi::c_uint)); + /// ITU-R BT1361 Extended Colour Gamut + pub const BT1361: Self = Self((12 as ::core::ffi::c_uint)); + /// IEC 61966-2-1 (sRGB or sYCC) + pub const SRGB: Self = Self((13 as ::core::ffi::c_uint)); + /// ITU-R BT2020 for 10-bit system + pub const BT2020_10BIT: Self = Self((14 as ::core::ffi::c_uint)); + /// ITU-R BT2020 for 12-bit system + pub const BT2020_12BIT: Self = Self((15 as ::core::ffi::c_uint)); + /// SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems + pub const PQ: Self = Self((16 as ::core::ffi::c_uint)); + /// SMPTE ST 428-1 + pub const SMPTE428: Self = Self((17 as ::core::ffi::c_uint)); + /// ARIB STD-B67, known as "hybrid log-gamma" (HLG) + pub const HLG: Self = Self((18 as ::core::ffi::c_uint)); + pub const CUSTOM: Self = Self((31 as ::core::ffi::c_uint)); +} + +pub const SDL_TRANSFER_CHARACTERISTICS_UNKNOWN: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::UNKNOWN; +/// Rec. ITU-R BT.709-6 / ITU-R BT1361 +pub const SDL_TRANSFER_CHARACTERISTICS_BT709: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::BT709; +pub const SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::UNSPECIFIED; +/// ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM +pub const SDL_TRANSFER_CHARACTERISTICS_GAMMA22: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::GAMMA22; +/// ITU-R BT.470-6 System B, G +pub const SDL_TRANSFER_CHARACTERISTICS_GAMMA28: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::GAMMA28; +/// SMPTE ST 170M / ITU-R BT.601-7 525 or 625 +pub const SDL_TRANSFER_CHARACTERISTICS_BT601: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::BT601; +/// SMPTE ST 240M +pub const SDL_TRANSFER_CHARACTERISTICS_SMPTE240: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::SMPTE240; +pub const SDL_TRANSFER_CHARACTERISTICS_LINEAR: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::LINEAR; +pub const SDL_TRANSFER_CHARACTERISTICS_LOG100: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::LOG100; +pub const SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::LOG100_SQRT10; +/// IEC 61966-2-4 +pub const SDL_TRANSFER_CHARACTERISTICS_IEC61966: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::IEC61966; +/// ITU-R BT1361 Extended Colour Gamut +pub const SDL_TRANSFER_CHARACTERISTICS_BT1361: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::BT1361; +/// IEC 61966-2-1 (sRGB or sYCC) +pub const SDL_TRANSFER_CHARACTERISTICS_SRGB: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::SRGB; +/// ITU-R BT2020 for 10-bit system +pub const SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::BT2020_10BIT; +/// ITU-R BT2020 for 12-bit system +pub const SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::BT2020_12BIT; +/// SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems +pub const SDL_TRANSFER_CHARACTERISTICS_PQ: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::PQ; +/// SMPTE ST 428-1 +pub const SDL_TRANSFER_CHARACTERISTICS_SMPTE428: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::SMPTE428; +/// ARIB STD-B67, known as "hybrid log-gamma" (HLG) +pub const SDL_TRANSFER_CHARACTERISTICS_HLG: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::HLG; +pub const SDL_TRANSFER_CHARACTERISTICS_CUSTOM: SDL_TransferCharacteristics = + SDL_TransferCharacteristics::CUSTOM; + +impl SDL_TransferCharacteristics { + /// Initialize a `SDL_TransferCharacteristics` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_TransferCharacteristics { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TransferCharacteristics { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_TransferCharacteristics; +} + +/// Colorspace matrix coefficients. +/// +/// These are as described by +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`IDENTITY`](SDL_MatrixCoefficients::IDENTITY) | [`SDL_MATRIX_COEFFICIENTS_IDENTITY`] | | +/// | [`BT709`](SDL_MatrixCoefficients::BT709) | [`SDL_MATRIX_COEFFICIENTS_BT709`] | ITU-R BT.709-6 | +/// | [`UNSPECIFIED`](SDL_MatrixCoefficients::UNSPECIFIED) | [`SDL_MATRIX_COEFFICIENTS_UNSPECIFIED`] | | +/// | [`FCC`](SDL_MatrixCoefficients::FCC) | [`SDL_MATRIX_COEFFICIENTS_FCC`] | US FCC Title 47 | +/// | [`BT470BG`](SDL_MatrixCoefficients::BT470BG) | [`SDL_MATRIX_COEFFICIENTS_BT470BG`] | ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`] | +/// | [`BT601`](SDL_MatrixCoefficients::BT601) | [`SDL_MATRIX_COEFFICIENTS_BT601`] | ITU-R BT.601-7 525 | +/// | [`SMPTE240`](SDL_MatrixCoefficients::SMPTE240) | [`SDL_MATRIX_COEFFICIENTS_SMPTE240`] | SMPTE 240M | +/// | [`YCGCO`](SDL_MatrixCoefficients::YCGCO) | [`SDL_MATRIX_COEFFICIENTS_YCGCO`] | | +/// | [`BT2020_NCL`](SDL_MatrixCoefficients::BT2020_NCL) | [`SDL_MATRIX_COEFFICIENTS_BT2020_NCL`] | ITU-R BT.2020-2 non-constant luminance | +/// | [`BT2020_CL`](SDL_MatrixCoefficients::BT2020_CL) | [`SDL_MATRIX_COEFFICIENTS_BT2020_CL`] | ITU-R BT.2020-2 constant luminance | +/// | [`SMPTE2085`](SDL_MatrixCoefficients::SMPTE2085) | [`SDL_MATRIX_COEFFICIENTS_SMPTE2085`] | SMPTE ST 2085 | +/// | [`CHROMA_DERIVED_NCL`](SDL_MatrixCoefficients::CHROMA_DERIVED_NCL) | [`SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL`] | | +/// | [`CHROMA_DERIVED_CL`](SDL_MatrixCoefficients::CHROMA_DERIVED_CL) | [`SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL`] | | +/// | [`ICTCP`](SDL_MatrixCoefficients::ICTCP) | [`SDL_MATRIX_COEFFICIENTS_ICTCP`] | ITU-R BT.2100-0 ICTCP | +/// | [`CUSTOM`](SDL_MatrixCoefficients::CUSTOM) | [`SDL_MATRIX_COEFFICIENTS_CUSTOM`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_MatrixCoefficients(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_MatrixCoefficients { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_MatrixCoefficients) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_MatrixCoefficients) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_MatrixCoefficients { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::IDENTITY => "SDL_MATRIX_COEFFICIENTS_IDENTITY", + Self::BT709 => "SDL_MATRIX_COEFFICIENTS_BT709", + Self::UNSPECIFIED => "SDL_MATRIX_COEFFICIENTS_UNSPECIFIED", + Self::FCC => "SDL_MATRIX_COEFFICIENTS_FCC", + Self::BT470BG => "SDL_MATRIX_COEFFICIENTS_BT470BG", + Self::BT601 => "SDL_MATRIX_COEFFICIENTS_BT601", + Self::SMPTE240 => "SDL_MATRIX_COEFFICIENTS_SMPTE240", + Self::YCGCO => "SDL_MATRIX_COEFFICIENTS_YCGCO", + Self::BT2020_NCL => "SDL_MATRIX_COEFFICIENTS_BT2020_NCL", + Self::BT2020_CL => "SDL_MATRIX_COEFFICIENTS_BT2020_CL", + Self::SMPTE2085 => "SDL_MATRIX_COEFFICIENTS_SMPTE2085", + Self::CHROMA_DERIVED_NCL => "SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL", + Self::CHROMA_DERIVED_CL => "SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL", + Self::ICTCP => "SDL_MATRIX_COEFFICIENTS_ICTCP", + Self::CUSTOM => "SDL_MATRIX_COEFFICIENTS_CUSTOM", + + _ => return write!(f, "SDL_MatrixCoefficients({})", self.0), + }) + } +} + +impl SDL_MatrixCoefficients { + pub const IDENTITY: Self = Self((0 as ::core::ffi::c_uint)); + /// ITU-R BT.709-6 + pub const BT709: Self = Self((1 as ::core::ffi::c_uint)); + pub const UNSPECIFIED: Self = Self((2 as ::core::ffi::c_uint)); + /// US FCC Title 47 + pub const FCC: Self = Self((4 as ::core::ffi::c_uint)); + /// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`] + pub const BT470BG: Self = Self((5 as ::core::ffi::c_uint)); + /// ITU-R BT.601-7 525 + pub const BT601: Self = Self((6 as ::core::ffi::c_uint)); + /// SMPTE 240M + pub const SMPTE240: Self = Self((7 as ::core::ffi::c_uint)); + pub const YCGCO: Self = Self((8 as ::core::ffi::c_uint)); + /// ITU-R BT.2020-2 non-constant luminance + pub const BT2020_NCL: Self = Self((9 as ::core::ffi::c_uint)); + /// ITU-R BT.2020-2 constant luminance + pub const BT2020_CL: Self = Self((10 as ::core::ffi::c_uint)); + /// SMPTE ST 2085 + pub const SMPTE2085: Self = Self((11 as ::core::ffi::c_uint)); + pub const CHROMA_DERIVED_NCL: Self = Self((12 as ::core::ffi::c_uint)); + pub const CHROMA_DERIVED_CL: Self = Self((13 as ::core::ffi::c_uint)); + /// ITU-R BT.2100-0 ICTCP + pub const ICTCP: Self = Self((14 as ::core::ffi::c_uint)); + pub const CUSTOM: Self = Self((31 as ::core::ffi::c_uint)); +} + +pub const SDL_MATRIX_COEFFICIENTS_IDENTITY: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::IDENTITY; +/// ITU-R BT.709-6 +pub const SDL_MATRIX_COEFFICIENTS_BT709: SDL_MatrixCoefficients = SDL_MatrixCoefficients::BT709; +pub const SDL_MATRIX_COEFFICIENTS_UNSPECIFIED: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::UNSPECIFIED; +/// US FCC Title 47 +pub const SDL_MATRIX_COEFFICIENTS_FCC: SDL_MatrixCoefficients = SDL_MatrixCoefficients::FCC; +/// ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`] +pub const SDL_MATRIX_COEFFICIENTS_BT470BG: SDL_MatrixCoefficients = SDL_MatrixCoefficients::BT470BG; +/// ITU-R BT.601-7 525 +pub const SDL_MATRIX_COEFFICIENTS_BT601: SDL_MatrixCoefficients = SDL_MatrixCoefficients::BT601; +/// SMPTE 240M +pub const SDL_MATRIX_COEFFICIENTS_SMPTE240: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::SMPTE240; +pub const SDL_MATRIX_COEFFICIENTS_YCGCO: SDL_MatrixCoefficients = SDL_MatrixCoefficients::YCGCO; +/// ITU-R BT.2020-2 non-constant luminance +pub const SDL_MATRIX_COEFFICIENTS_BT2020_NCL: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::BT2020_NCL; +/// ITU-R BT.2020-2 constant luminance +pub const SDL_MATRIX_COEFFICIENTS_BT2020_CL: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::BT2020_CL; +/// SMPTE ST 2085 +pub const SDL_MATRIX_COEFFICIENTS_SMPTE2085: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::SMPTE2085; +pub const SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::CHROMA_DERIVED_NCL; +pub const SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL: SDL_MatrixCoefficients = + SDL_MatrixCoefficients::CHROMA_DERIVED_CL; +/// ITU-R BT.2100-0 ICTCP +pub const SDL_MATRIX_COEFFICIENTS_ICTCP: SDL_MatrixCoefficients = SDL_MatrixCoefficients::ICTCP; +pub const SDL_MATRIX_COEFFICIENTS_CUSTOM: SDL_MatrixCoefficients = SDL_MatrixCoefficients::CUSTOM; + +impl SDL_MatrixCoefficients { + /// Initialize a `SDL_MatrixCoefficients` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_MatrixCoefficients { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_MatrixCoefficients { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_MatrixCoefficients; +} + +/// Colorspace chroma sample location. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_ChromaLocation::NONE) | [`SDL_CHROMA_LOCATION_NONE`] | RGB, no chroma sampling | +/// | [`LEFT`](SDL_ChromaLocation::LEFT) | [`SDL_CHROMA_LOCATION_LEFT`] | In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically. | +/// | [`CENTER`](SDL_ChromaLocation::CENTER) | [`SDL_CHROMA_LOCATION_CENTER`] | In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel. | +/// | [`TOPLEFT`](SDL_ChromaLocation::TOPLEFT) | [`SDL_CHROMA_LOCATION_TOPLEFT`] | In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located"). | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ChromaLocation(pub ::core::ffi::c_uint); + +impl ::core::cmp::PartialEq<::core::ffi::c_uint> for SDL_ChromaLocation { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_uint) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_uint { + #[inline(always)] + fn eq(&self, other: &SDL_ChromaLocation) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_uint { + #[inline(always)] + fn from(value: SDL_ChromaLocation) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ChromaLocation { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_CHROMA_LOCATION_NONE", + Self::LEFT => "SDL_CHROMA_LOCATION_LEFT", + Self::CENTER => "SDL_CHROMA_LOCATION_CENTER", + Self::TOPLEFT => "SDL_CHROMA_LOCATION_TOPLEFT", + + _ => return write!(f, "SDL_ChromaLocation({})", self.0), + }) + } +} + +impl SDL_ChromaLocation { + /// RGB, no chroma sampling + pub const NONE: Self = Self((0 as ::core::ffi::c_uint)); + /// In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically. + pub const LEFT: Self = Self((1 as ::core::ffi::c_uint)); + /// In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel. + pub const CENTER: Self = Self((2 as ::core::ffi::c_uint)); + /// In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located"). + pub const TOPLEFT: Self = Self((3 as ::core::ffi::c_uint)); +} + +/// RGB, no chroma sampling +pub const SDL_CHROMA_LOCATION_NONE: SDL_ChromaLocation = SDL_ChromaLocation::NONE; +/// In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically. +pub const SDL_CHROMA_LOCATION_LEFT: SDL_ChromaLocation = SDL_ChromaLocation::LEFT; +/// In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel. +pub const SDL_CHROMA_LOCATION_CENTER: SDL_ChromaLocation = SDL_ChromaLocation::CENTER; +/// In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located"). +pub const SDL_CHROMA_LOCATION_TOPLEFT: SDL_ChromaLocation = SDL_ChromaLocation::TOPLEFT; + +impl SDL_ChromaLocation { + /// Initialize a `SDL_ChromaLocation` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_uint) -> Self { + Self(value) + } +} + +impl SDL_ChromaLocation { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_uint { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ChromaLocation { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_ChromaLocation; +} + +/// Colorspace definitions. +/// +/// Since similar colorspaces may vary in their details (matrix, transfer +/// function, etc.), this is not an exhaustive list, but rather a +/// representative sample of the kinds of colorspaces supported in SDL. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_ColorPrimaries`] +/// - [`SDL_ColorRange`] +/// - [`SDL_ColorType`] +/// - [`SDL_MatrixCoefficients`] +/// - [`SDL_TransferCharacteristics`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_Colorspace::UNKNOWN) | [`SDL_COLORSPACE_UNKNOWN`] | | +/// | [`SRGB`](SDL_Colorspace::SRGB) | [`SDL_COLORSPACE_SRGB`] | Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 | +/// | [`SRGB_LINEAR`](SDL_Colorspace::SRGB_LINEAR) | [`SDL_COLORSPACE_SRGB_LINEAR`] | Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 | +/// | [`HDR10`](SDL_Colorspace::HDR10) | [`SDL_COLORSPACE_HDR10`] | Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 | +/// | [`JPEG`](SDL_Colorspace::JPEG) | [`SDL_COLORSPACE_JPEG`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 | +/// | [`BT601_LIMITED`](SDL_Colorspace::BT601_LIMITED) | [`SDL_COLORSPACE_BT601_LIMITED`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 | +/// | [`BT601_FULL`](SDL_Colorspace::BT601_FULL) | [`SDL_COLORSPACE_BT601_FULL`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 | +/// | [`BT709_LIMITED`](SDL_Colorspace::BT709_LIMITED) | [`SDL_COLORSPACE_BT709_LIMITED`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 | +/// | [`BT709_FULL`](SDL_Colorspace::BT709_FULL) | [`SDL_COLORSPACE_BT709_FULL`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 | +/// | [`BT2020_LIMITED`](SDL_Colorspace::BT2020_LIMITED) | [`SDL_COLORSPACE_BT2020_LIMITED`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 | +/// | [`BT2020_FULL`](SDL_Colorspace::BT2020_FULL) | [`SDL_COLORSPACE_BT2020_FULL`] | Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 | +/// | [`RGB_DEFAULT`](SDL_Colorspace::RGB_DEFAULT) | [`SDL_COLORSPACE_RGB_DEFAULT`] | The default colorspace for RGB surfaces if no colorspace is specified | +/// | [`YUV_DEFAULT`](SDL_Colorspace::YUV_DEFAULT) | [`SDL_COLORSPACE_YUV_DEFAULT`] | The default colorspace for YUV surfaces if no colorspace is specified | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_Colorspace(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_Colorspace { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_Colorspace) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_Colorspace) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Colorspace { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_COLORSPACE_UNKNOWN", + Self::SRGB => "SDL_COLORSPACE_SRGB", + Self::SRGB_LINEAR => "SDL_COLORSPACE_SRGB_LINEAR", + Self::HDR10 => "SDL_COLORSPACE_HDR10", + Self::JPEG => "SDL_COLORSPACE_JPEG", + Self::BT601_LIMITED => "SDL_COLORSPACE_BT601_LIMITED", + Self::BT601_FULL => "SDL_COLORSPACE_BT601_FULL", + Self::BT709_LIMITED => "SDL_COLORSPACE_BT709_LIMITED", + Self::BT709_FULL => "SDL_COLORSPACE_BT709_FULL", + Self::BT2020_LIMITED => "SDL_COLORSPACE_BT2020_LIMITED", + Self::BT2020_FULL => "SDL_COLORSPACE_BT2020_FULL", + Self::RGB_DEFAULT => "SDL_COLORSPACE_RGB_DEFAULT", + Self::YUV_DEFAULT => "SDL_COLORSPACE_YUV_DEFAULT", + + _ => return write!(f, "SDL_Colorspace({})", self.0), + }) + } +} + +impl SDL_Colorspace { + pub const UNKNOWN: Self = Self((0 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 + pub const SRGB: Self = Self((0x120005a0 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 + pub const SRGB_LINEAR: Self = Self((0x12000500 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 + pub const HDR10: Self = Self((0x12002600 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 + pub const JPEG: Self = Self((0x220004c6 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 + pub const BT601_LIMITED: Self = Self((0x211018c6 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 + pub const BT601_FULL: Self = Self((0x221018c6 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 + pub const BT709_LIMITED: Self = Self((0x21100421 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 + pub const BT709_FULL: Self = Self((0x22100421 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 + pub const BT2020_LIMITED: Self = Self((0x21102609 as Uint32)); + /// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 + pub const BT2020_FULL: Self = Self((0x22102609 as Uint32)); + /// The default colorspace for RGB surfaces if no colorspace is specified + pub const RGB_DEFAULT: Self = SDL_COLORSPACE_SRGB; + /// The default colorspace for YUV surfaces if no colorspace is specified + pub const YUV_DEFAULT: Self = SDL_COLORSPACE_BT601_LIMITED; +} + +pub const SDL_COLORSPACE_UNKNOWN: SDL_Colorspace = SDL_Colorspace::UNKNOWN; +/// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 +pub const SDL_COLORSPACE_SRGB: SDL_Colorspace = SDL_Colorspace::SRGB; +/// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 +pub const SDL_COLORSPACE_SRGB_LINEAR: SDL_Colorspace = SDL_Colorspace::SRGB_LINEAR; +/// Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 +pub const SDL_COLORSPACE_HDR10: SDL_Colorspace = SDL_Colorspace::HDR10; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 +pub const SDL_COLORSPACE_JPEG: SDL_Colorspace = SDL_Colorspace::JPEG; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 +pub const SDL_COLORSPACE_BT601_LIMITED: SDL_Colorspace = SDL_Colorspace::BT601_LIMITED; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 +pub const SDL_COLORSPACE_BT601_FULL: SDL_Colorspace = SDL_Colorspace::BT601_FULL; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 +pub const SDL_COLORSPACE_BT709_LIMITED: SDL_Colorspace = SDL_Colorspace::BT709_LIMITED; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 +pub const SDL_COLORSPACE_BT709_FULL: SDL_Colorspace = SDL_Colorspace::BT709_FULL; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 +pub const SDL_COLORSPACE_BT2020_LIMITED: SDL_Colorspace = SDL_Colorspace::BT2020_LIMITED; +/// Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 +pub const SDL_COLORSPACE_BT2020_FULL: SDL_Colorspace = SDL_Colorspace::BT2020_FULL; +/// The default colorspace for RGB surfaces if no colorspace is specified +pub const SDL_COLORSPACE_RGB_DEFAULT: SDL_Colorspace = SDL_Colorspace::RGB_DEFAULT; +/// The default colorspace for YUV surfaces if no colorspace is specified +pub const SDL_COLORSPACE_YUV_DEFAULT: SDL_Colorspace = SDL_Colorspace::YUV_DEFAULT; + +impl SDL_Colorspace { + /// Initialize a `SDL_Colorspace` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_Colorspace { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Colorspace { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::pixels::METADATA_SDL_Colorspace; +} + +/// A macro for defining custom [`SDL_Colorspace`] formats. +/// +/// For example, defining [`SDL_COLORSPACE_SRGB`] looks like this: +/// +/// ```c +/// SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_RGB, +/// SDL_COLOR_RANGE_FULL, +/// SDL_COLOR_PRIMARIES_BT709, +/// SDL_TRANSFER_CHARACTERISTICS_SRGB, +/// SDL_MATRIX_COEFFICIENTS_IDENTITY, +/// SDL_CHROMA_LOCATION_NONE) +/// ``` +/// +/// ## Parameters +/// - `type`: the type of the new format, probably an [`SDL_ColorType`] value. +/// - `range`: the range of the new format, probably a [`SDL_ColorRange`] value. +/// - `primaries`: the primaries of the new format, probably an +/// [`SDL_ColorPrimaries`] value. +/// - `transfer`: the transfer characteristics of the new format, probably an +/// [`SDL_TransferCharacteristics`] value. +/// - `matrix`: the matrix coefficients of the new format, probably an +/// [`SDL_MatrixCoefficients`] value. +/// - `chroma`: the chroma sample location of the new format, probably an +/// [`SDL_ChromaLocation`] value. +/// +/// ## Return value +/// Returns a format value in the style of [`SDL_Colorspace`]. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_DEFINE_COLORSPACE( + r#type: SDL_ColorType, + range: SDL_ColorRange, + primaries: SDL_ColorPrimaries, + transfer: SDL_TransferCharacteristics, + matrix: SDL_MatrixCoefficients, + chroma: SDL_ChromaLocation, +) -> SDL_Colorspace { + SDL_Colorspace( + (((((((r#type.0 as Uint32) << 28) | ((range.0 as Uint32) << 24)) + | ((chroma.0 as Uint32) << 20)) + | ((primaries.0 as Uint32) << 10)) + | ((transfer.0 as Uint32) << 5)) + | ((matrix.0 as Uint32) << 0)), + ) +} + +/// A macro to retrieve the type of an [`SDL_Colorspace`]. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns the [`SDL_ColorType`] for `cspace`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_COLORSPACETYPE(cspace: SDL_Colorspace) -> SDL_ColorType { + SDL_ColorType((((cspace.0 >> 28) & 15_u32) as ::core::ffi::c_uint)) +} + +/// A macro to retrieve the range of an [`SDL_Colorspace`]. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns the [`SDL_ColorRange`] of `cspace`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_COLORSPACERANGE(cspace: SDL_Colorspace) -> SDL_ColorRange { + SDL_ColorRange((((cspace.0 >> 24) & 15_u32) as ::core::ffi::c_uint)) +} + +/// A macro to retrieve the chroma sample location of an [`SDL_Colorspace`]. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns the [`SDL_ChromaLocation`] of `cspace`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_COLORSPACECHROMA(cspace: SDL_Colorspace) -> SDL_ChromaLocation { + SDL_ChromaLocation((((cspace.0 >> 20) & 15_u32) as ::core::ffi::c_uint)) +} + +/// A macro to retrieve the primaries of an [`SDL_Colorspace`]. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns the [`SDL_ColorPrimaries`] of `cspace`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_COLORSPACEPRIMARIES(cspace: SDL_Colorspace) -> SDL_ColorPrimaries { + SDL_ColorPrimaries((((cspace.0 >> 10) & 31_u32) as ::core::ffi::c_uint)) +} + +/// A macro to retrieve the transfer characteristics of an [`SDL_Colorspace`]. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns the [`SDL_TransferCharacteristics`] of `cspace`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_COLORSPACETRANSFER(cspace: SDL_Colorspace) -> SDL_TransferCharacteristics { + SDL_TransferCharacteristics((((cspace.0 >> 5) & 31_u32) as ::core::ffi::c_uint)) +} + +/// A macro to retrieve the matrix coefficients of an [`SDL_Colorspace`]. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns the [`SDL_MatrixCoefficients`] of `cspace`. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_COLORSPACEMATRIX(cspace: SDL_Colorspace) -> SDL_MatrixCoefficients { + SDL_MatrixCoefficients(((cspace.0 & 31_u32) as ::core::ffi::c_uint)) +} + +/// A macro to determine if an [`SDL_Colorspace`] has a limited range. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns true if limited range, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISCOLORSPACE_LIMITED_RANGE(cspace: SDL_Colorspace) -> ::core::primitive::bool { + (SDL_COLORSPACERANGE(cspace).0 != SDL_COLOR_RANGE_FULL.0) +} + +/// A macro to determine if an [`SDL_Colorspace`] has a full range. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns true if full range, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISCOLORSPACE_FULL_RANGE(cspace: SDL_Colorspace) -> ::core::primitive::bool { + (SDL_COLORSPACERANGE(cspace).0 == SDL_COLOR_RANGE_FULL.0) +} + +/// A macro to determine if an [`SDL_Colorspace`] uses BT601 (or BT470BG) matrix +/// coefficients. +/// +/// Note that this macro double-evaluates its parameter, so do not use +/// expressions with side-effects here. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns true if BT601 or BT470BG, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISCOLORSPACE_MATRIX_BT601(cspace: SDL_Colorspace) -> ::core::primitive::bool { + ((SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT601.0) + || (SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT470BG.0)) +} + +/// A macro to determine if an [`SDL_Colorspace`] uses BT709 matrix coefficients. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns true if BT709, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISCOLORSPACE_MATRIX_BT709(cspace: SDL_Colorspace) -> ::core::primitive::bool { + (SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT709.0) +} + +/// A macro to determine if an [`SDL_Colorspace`] uses BT2020_NCL matrix +/// coefficients. +/// +/// ## Parameters +/// - `cspace`: an [`SDL_Colorspace`] to check. +/// +/// ## Return value +/// Returns true if BT2020_NCL, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(cspace: SDL_Colorspace) -> ::core::primitive::bool { + (SDL_COLORSPACEMATRIX(cspace).0 == SDL_MATRIX_COEFFICIENTS_BT2020_NCL.0) +} + +/// A structure that represents a color as RGBA components. +/// +/// The bits of this structure can be directly reinterpreted as an +/// integer-packed color which uses the [`SDL_PIXELFORMAT_RGBA32`] format +/// ([`SDL_PIXELFORMAT_ABGR8888`] on little-endian systems and +/// [`SDL_PIXELFORMAT_RGBA8888`] on big-endian systems). +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Color { + pub r: Uint8, + pub g: Uint8, + pub b: Uint8, + pub a: Uint8, +} + +/// The bits of this structure can be directly reinterpreted as a float-packed +/// color which uses the [`SDL_PIXELFORMAT_RGBA128_FLOAT`] format +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_FColor { + pub r: ::core::ffi::c_float, + pub g: ::core::ffi::c_float, + pub b: ::core::ffi::c_float, + pub a: ::core::ffi::c_float, +} + +/// A set of indexed colors representing a palette. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetPaletteColors`] +/// +/// ## Notes for `sdl3-sys` +/// This struct can't be created manually. Use the corresponding SDL functions. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Palette { + /// number of elements in `colors`. + pub ncolors: ::core::ffi::c_int, + /// an array of colors, `ncolors` long. + pub colors: *mut SDL_Color, + /// internal use only, do not touch. + pub version: Uint32, + /// internal use only, do not touch. + pub refcount: ::core::ffi::c_int, + #[doc(hidden)] + __non_exhaustive: ::sdl3_sys::NonExhaustive, +} + +/// Details about the format of a pixel. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## Notes for `sdl3-sys` +/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PixelFormatDetails { + pub format: SDL_PixelFormat, + pub bits_per_pixel: Uint8, + pub bytes_per_pixel: Uint8, + #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")] + pub padding: [Uint8; 2], + pub Rmask: Uint32, + pub Gmask: Uint32, + pub Bmask: Uint32, + pub Amask: Uint32, + pub Rbits: Uint8, + pub Gbits: Uint8, + pub Bbits: Uint8, + pub Abits: Uint8, + pub Rshift: Uint8, + pub Gshift: Uint8, + pub Bshift: Uint8, + pub Ashift: Uint8, +} + +unsafe extern "C" { + /// Get the human readable name of a pixel format. + /// + /// ## Parameters + /// - `format`: the pixel format to query. + /// + /// ## Return value + /// Returns the human readable name of the specified pixel format or + /// "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_GetPixelFormatName(format: SDL_PixelFormat) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert one of the enumerated pixel formats to a bpp value and RGBA masks. + /// + /// ## Parameters + /// - `format`: one of the [`SDL_PixelFormat`] values. + /// - `bpp`: a bits per pixel value; usually 15, 16, or 32. + /// - `Rmask`: a pointer filled in with the red mask for the format. + /// - `Gmask`: a pointer filled in with the green mask for the format. + /// - `Bmask`: a pointer filled in with the blue mask for the format. + /// - `Amask`: a pointer filled in with the alpha mask for the format. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPixelFormatForMasks`] + pub fn SDL_GetMasksForPixelFormat( + format: SDL_PixelFormat, + bpp: *mut ::core::ffi::c_int, + Rmask: *mut Uint32, + Gmask: *mut Uint32, + Bmask: *mut Uint32, + Amask: *mut Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Convert a bpp value and RGBA masks to an enumerated pixel format. + /// + /// This will return [`SDL_PIXELFORMAT_UNKNOWN`] if the conversion wasn't + /// possible. + /// + /// ## Parameters + /// - `bpp`: a bits per pixel value; usually 15, 16, or 32. + /// - `Rmask`: the red mask for the format. + /// - `Gmask`: the green mask for the format. + /// - `Bmask`: the blue mask for the format. + /// - `Amask`: the alpha mask for the format. + /// + /// ## Return value + /// Returns the [`SDL_PixelFormat`] value corresponding to the format masks, or + /// [`SDL_PIXELFORMAT_UNKNOWN`] if there isn't a match. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMasksForPixelFormat`] + pub safe fn SDL_GetPixelFormatForMasks( + bpp: ::core::ffi::c_int, + Rmask: Uint32, + Gmask: Uint32, + Bmask: Uint32, + Amask: Uint32, + ) -> SDL_PixelFormat; +} + +unsafe extern "C" { + /// Create an [`SDL_PixelFormatDetails`] structure corresponding to a pixel format. + /// + /// Returned structure may come from a shared global cache (i.e. not newly + /// allocated), and hence should not be modified, especially the palette. Weird + /// errors such as `Blit combination not supported` may occur. + /// + /// ## Parameters + /// - `format`: one of the [`SDL_PixelFormat`] values. + /// + /// ## Return value + /// Returns a pointer to a [`SDL_PixelFormatDetails`] structure or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetPixelFormatDetails(format: SDL_PixelFormat) -> *const SDL_PixelFormatDetails; +} + +unsafe extern "C" { + /// Create a palette structure with the specified number of color entries. + /// + /// The palette entries are initialized to white. + /// + /// ## Parameters + /// - `ncolors`: represents the number of color entries in the color palette. + /// + /// ## Return value + /// Returns a new [`SDL_Palette`] structure on success or NULL on failure (e.g. if + /// there wasn't enough memory); call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyPalette`] + /// - [`SDL_SetPaletteColors`] + /// - [`SDL_SetSurfacePalette`] + pub fn SDL_CreatePalette(ncolors: ::core::ffi::c_int) -> *mut SDL_Palette; +} + +unsafe extern "C" { + /// Set a range of colors in a palette. + /// + /// ## Parameters + /// - `palette`: the [`SDL_Palette`] structure to modify. + /// - `colors`: an array of [`SDL_Color`] structures to copy into the palette. + /// - `firstcolor`: the index of the first palette entry to modify. + /// - `ncolors`: the number of entries to modify. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the palette is not modified or destroyed in another thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetPaletteColors( + palette: *mut SDL_Palette, + colors: *const SDL_Color, + firstcolor: ::core::ffi::c_int, + ncolors: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Free a palette created with [`SDL_CreatePalette()`]. + /// + /// ## Parameters + /// - `palette`: the [`SDL_Palette`] structure to be freed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the palette is not modified or destroyed in another thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreatePalette`] + pub fn SDL_DestroyPalette(palette: *mut SDL_Palette); +} + +unsafe extern "C" { + /// Map an RGB triple to an opaque pixel value for a given pixel format. + /// + /// This function maps the RGB color value to the specified pixel format and + /// returns the pixel value best approximating the given RGB color value for + /// the given pixel format. + /// + /// If the format has a palette (8-bit) the index of the closest matching color + /// in the palette will be returned. + /// + /// If the specified pixel format has an alpha component it will be returned as + /// all 1 bits (fully opaque). + /// + /// If the pixel format bpp (color depth) is less than 32-bpp then the unused + /// upper bits of the return value can safely be ignored (e.g., with a 16-bpp + /// format the return value can be assigned to a Uint16, and similarly a Uint8 + /// for an 8-bpp format). + /// + /// ## Parameters + /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel + /// format. + /// - `palette`: an optional palette for indexed formats, may be NULL. + /// - `r`: the red component of the pixel in the range 0-255. + /// - `g`: the green component of the pixel in the range 0-255. + /// - `b`: the blue component of the pixel in the range 0-255. + /// + /// ## Return value + /// Returns a pixel value. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the palette is not modified. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPixelFormatDetails`] + /// - [`SDL_GetRGB`] + /// - [`SDL_MapRGBA`] + /// - [`SDL_MapSurfaceRGB`] + pub fn SDL_MapRGB( + format: *const SDL_PixelFormatDetails, + palette: *const SDL_Palette, + r: Uint8, + g: Uint8, + b: Uint8, + ) -> Uint32; +} + +unsafe extern "C" { + /// Map an RGBA quadruple to a pixel value for a given pixel format. + /// + /// This function maps the RGBA color value to the specified pixel format and + /// returns the pixel value best approximating the given RGBA color value for + /// the given pixel format. + /// + /// If the specified pixel format has no alpha component the alpha value will + /// be ignored (as it will be in formats with a palette). + /// + /// If the format has a palette (8-bit) the index of the closest matching color + /// in the palette will be returned. + /// + /// If the pixel format bpp (color depth) is less than 32-bpp then the unused + /// upper bits of the return value can safely be ignored (e.g., with a 16-bpp + /// format the return value can be assigned to a Uint16, and similarly a Uint8 + /// for an 8-bpp format). + /// + /// ## Parameters + /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel + /// format. + /// - `palette`: an optional palette for indexed formats, may be NULL. + /// - `r`: the red component of the pixel in the range 0-255. + /// - `g`: the green component of the pixel in the range 0-255. + /// - `b`: the blue component of the pixel in the range 0-255. + /// - `a`: the alpha component of the pixel in the range 0-255. + /// + /// ## Return value + /// Returns a pixel value. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the palette is not modified. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPixelFormatDetails`] + /// - [`SDL_GetRGBA`] + /// - [`SDL_MapRGB`] + /// - [`SDL_MapSurfaceRGBA`] + pub fn SDL_MapRGBA( + format: *const SDL_PixelFormatDetails, + palette: *const SDL_Palette, + r: Uint8, + g: Uint8, + b: Uint8, + a: Uint8, + ) -> Uint32; +} + +unsafe extern "C" { + /// Get RGB values from a pixel in the specified format. + /// + /// This function uses the entire 8-bit \[0..255\] range when converting color + /// components from pixel formats with less than 8-bits per RGB component + /// (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, + /// 0xff, 0xff\] not \[0xf8, 0xfc, 0xf8\]). + /// + /// ## Parameters + /// - `pixelvalue`: a pixel value. + /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel + /// format. + /// - `palette`: an optional palette for indexed formats, may be NULL. + /// - `r`: a pointer filled in with the red component, may be NULL. + /// - `g`: a pointer filled in with the green component, may be NULL. + /// - `b`: a pointer filled in with the blue component, may be NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the palette is not modified. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPixelFormatDetails`] + /// - [`SDL_GetRGBA`] + /// - [`SDL_MapRGB`] + /// - [`SDL_MapRGBA`] + pub fn SDL_GetRGB( + pixelvalue: Uint32, + format: *const SDL_PixelFormatDetails, + palette: *const SDL_Palette, + r: *mut Uint8, + g: *mut Uint8, + b: *mut Uint8, + ); +} + +unsafe extern "C" { + /// Get RGBA values from a pixel in the specified format. + /// + /// This function uses the entire 8-bit \[0..255\] range when converting color + /// components from pixel formats with less than 8-bits per RGB component + /// (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, + /// 0xff, 0xff\] not \[0xf8, 0xfc, 0xf8\]). + /// + /// If the surface has no alpha component, the alpha will be returned as 0xff + /// (100% opaque). + /// + /// ## Parameters + /// - `pixelvalue`: a pixel value. + /// - `format`: a pointer to [`SDL_PixelFormatDetails`] describing the pixel + /// format. + /// - `palette`: an optional palette for indexed formats, may be NULL. + /// - `r`: a pointer filled in with the red component, may be NULL. + /// - `g`: a pointer filled in with the green component, may be NULL. + /// - `b`: a pointer filled in with the blue component, may be NULL. + /// - `a`: a pointer filled in with the alpha component, may be NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the palette is not modified. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPixelFormatDetails`] + /// - [`SDL_GetRGB`] + /// - [`SDL_MapRGB`] + /// - [`SDL_MapRGBA`] + pub fn SDL_GetRGBA( + pixelvalue: Uint32, + format: *const SDL_PixelFormatDetails, + palette: *const SDL_Palette, + r: *mut Uint8, + g: *mut Uint8, + b: *mut Uint8, + a: *mut Uint8, + ); +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/platform.rs b/vendor/sdl3-sys/src/generated/platform.rs new file mode 100644 index 00000000..df5a9cea --- /dev/null +++ b/vendor/sdl3-sys/src/generated/platform.rs @@ -0,0 +1,28 @@ +//! SDL provides a means to identify the app's platform, both at compile time +//! and runtime. + +unsafe extern "C" { + /// Get the name of the platform. + /// + /// Here are the names returned for some (but not all) supported platforms: + /// + /// - "Windows" + /// - "macOS" + /// - "Linux" + /// - "iOS" + /// - "Android" + /// + /// ## Return value + /// Returns the name of the platform. If the correct platform name is not + /// available, returns a string beginning with the text "Unknown". + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetPlatform() -> *const ::core::ffi::c_char; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/power.rs b/vendor/sdl3-sys/src/generated/power.rs new file mode 100644 index 00000000..4423d8d0 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/power.rs @@ -0,0 +1,169 @@ +//! SDL power management routines. +//! +//! There is a single function in this category: [`SDL_GetPowerInfo()`]. +//! +//! This function is useful for games on the go. This allows an app to know if +//! it's running on a draining battery, which can be useful if the app wants to +//! reduce processing, or perhaps framerate, to extend the duration of the +//! battery's charge. Perhaps the app just wants to show a battery meter when +//! fullscreen, or alert the user when the power is getting extremely low, so +//! they can save their game. + +use super::stdinc::*; + +use super::error::*; + +/// The basic state for the system's power supply. +/// +/// These are results returned by [`SDL_GetPowerInfo()`]. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`ERROR`](SDL_PowerState::ERROR) | [`SDL_POWERSTATE_ERROR`] | error determining power status | +/// | [`UNKNOWN`](SDL_PowerState::UNKNOWN) | [`SDL_POWERSTATE_UNKNOWN`] | cannot determine power status | +/// | [`ON_BATTERY`](SDL_PowerState::ON_BATTERY) | [`SDL_POWERSTATE_ON_BATTERY`] | Not plugged in, running on the battery | +/// | [`NO_BATTERY`](SDL_PowerState::NO_BATTERY) | [`SDL_POWERSTATE_NO_BATTERY`] | Plugged in, no battery available | +/// | [`CHARGING`](SDL_PowerState::CHARGING) | [`SDL_POWERSTATE_CHARGING`] | Plugged in, charging battery | +/// | [`CHARGED`](SDL_PowerState::CHARGED) | [`SDL_POWERSTATE_CHARGED`] | Plugged in, battery charged | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PowerState(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PowerState { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PowerState) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PowerState) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PowerState { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::ERROR => "SDL_POWERSTATE_ERROR", + Self::UNKNOWN => "SDL_POWERSTATE_UNKNOWN", + Self::ON_BATTERY => "SDL_POWERSTATE_ON_BATTERY", + Self::NO_BATTERY => "SDL_POWERSTATE_NO_BATTERY", + Self::CHARGING => "SDL_POWERSTATE_CHARGING", + Self::CHARGED => "SDL_POWERSTATE_CHARGED", + + _ => return write!(f, "SDL_PowerState({})", self.0), + }) + } +} + +impl SDL_PowerState { + /// error determining power status + pub const ERROR: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// cannot determine power status + pub const UNKNOWN: Self = Self((0_i32 as ::core::ffi::c_int)); + /// Not plugged in, running on the battery + pub const ON_BATTERY: Self = Self((1_i32 as ::core::ffi::c_int)); + /// Plugged in, no battery available + pub const NO_BATTERY: Self = Self((2_i32 as ::core::ffi::c_int)); + /// Plugged in, charging battery + pub const CHARGING: Self = Self((3_i32 as ::core::ffi::c_int)); + /// Plugged in, battery charged + pub const CHARGED: Self = Self((4_i32 as ::core::ffi::c_int)); +} + +/// error determining power status +pub const SDL_POWERSTATE_ERROR: SDL_PowerState = SDL_PowerState::ERROR; +/// cannot determine power status +pub const SDL_POWERSTATE_UNKNOWN: SDL_PowerState = SDL_PowerState::UNKNOWN; +/// Not plugged in, running on the battery +pub const SDL_POWERSTATE_ON_BATTERY: SDL_PowerState = SDL_PowerState::ON_BATTERY; +/// Plugged in, no battery available +pub const SDL_POWERSTATE_NO_BATTERY: SDL_PowerState = SDL_PowerState::NO_BATTERY; +/// Plugged in, charging battery +pub const SDL_POWERSTATE_CHARGING: SDL_PowerState = SDL_PowerState::CHARGING; +/// Plugged in, battery charged +pub const SDL_POWERSTATE_CHARGED: SDL_PowerState = SDL_PowerState::CHARGED; + +impl SDL_PowerState { + /// Initialize a `SDL_PowerState` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PowerState { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PowerState { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::power::METADATA_SDL_PowerState; +} + +unsafe extern "C" { + /// Get the current power supply details. + /// + /// You should never take a battery status as absolute truth. Batteries + /// (especially failing batteries) are delicate hardware, and the values + /// reported here are best estimates based on what that hardware reports. It's + /// not uncommon for older batteries to lose stored power much faster than it + /// reports, or completely drain when reporting it has 20 percent left, etc. + /// + /// Battery status can change at any time; if you are concerned with power + /// state, you should call this function frequently, and perhaps ignore changes + /// until they seem to be stable for a few seconds. + /// + /// It's possible a platform can only report battery percentage or time left + /// but not both. + /// + /// On some platforms, retrieving power supply details might be expensive. If + /// you want to display continuous status you could call this function every + /// minute or so. + /// + /// ## Parameters + /// - `seconds`: a pointer filled in with the seconds of battery life left, + /// or NULL to ignore. This will be filled in with -1 if we + /// can't determine a value or there is no battery. + /// - `percent`: a pointer filled in with the percentage of battery life + /// left, between 0 and 100, or NULL to ignore. This will be + /// filled in with -1 when we can't determine a value or there + /// is no battery. + /// + /// ## Return value + /// Returns the current battery state or [`SDL_POWERSTATE_ERROR`] on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetPowerInfo( + seconds: *mut ::core::ffi::c_int, + percent: *mut ::core::ffi::c_int, + ) -> SDL_PowerState; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/process.rs b/vendor/sdl3-sys/src/generated/process.rs new file mode 100644 index 00000000..c6271da8 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/process.rs @@ -0,0 +1,587 @@ +//! Process control support. +//! +//! These functions provide a cross-platform way to spawn and manage OS-level +//! processes. +//! +//! You can create a new subprocess with [`SDL_CreateProcess()`] and optionally +//! read and write to it using [`SDL_ReadProcess()`] or [`SDL_GetProcessInput()`] and +//! [`SDL_GetProcessOutput()`]. If more advanced functionality like chaining input +//! between processes is necessary, you can use +//! [`SDL_CreateProcessWithProperties()`]. +//! +//! You can get the status of a created process with [`SDL_WaitProcess()`], or +//! terminate the process with [`SDL_KillProcess()`]. +//! +//! Don't forget to call [`SDL_DestroyProcess()`] to clean up, whether the process +//! process was killed, terminated on its own, or is still running! + +use super::stdinc::*; + +use super::error::*; + +use super::iostream::*; + +use super::properties::*; + +unsafe extern "C" { + /// Create a new process. + /// + /// The path to the executable is supplied in args\[0\]. args\[1..N\] are + /// additional arguments passed on the command line of the new process, and the + /// argument list should be terminated with a NULL, e.g.: + /// + /// ```c + /// const char *args[] = { "myprogram", "argument", NULL }; + /// ``` + /// + /// Setting pipe_stdio to true is equivalent to setting + /// [`SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`] and + /// [`SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`] to [`SDL_PROCESS_STDIO_APP`], and + /// will allow the use of [`SDL_ReadProcess()`] or [`SDL_GetProcessInput()`] and + /// [`SDL_GetProcessOutput()`]. + /// + /// See [`SDL_CreateProcessWithProperties()`] for more details. + /// + /// ## Parameters + /// - `args`: the path and arguments for the new process. + /// - `pipe_stdio`: true to create pipes to the process's standard input and + /// from the process's standard output, false for the process + /// to have no input and inherit the application's standard + /// output. + /// + /// ## Return value + /// Returns the newly created and running process, or NULL if the process + /// couldn't be created. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_GetProcessProperties`] + /// - [`SDL_ReadProcess`] + /// - [`SDL_GetProcessInput`] + /// - [`SDL_GetProcessOutput`] + /// - [`SDL_KillProcess`] + /// - [`SDL_WaitProcess`] + /// - [`SDL_DestroyProcess`] + pub fn SDL_CreateProcess( + args: *const *const ::core::ffi::c_char, + pipe_stdio: ::core::primitive::bool, + ) -> *mut SDL_Process; +} + +/// Description of where standard I/O should be directed when creating a +/// process. +/// +/// If a standard I/O stream is set to [`SDL_PROCESS_STDIO_INHERITED`], it will go +/// to the same place as the application's I/O stream. This is the default for +/// standard output and standard error. +/// +/// If a standard I/O stream is set to [`SDL_PROCESS_STDIO_NULL`], it is connected +/// to `NUL:` on Windows and `/dev/null` on POSIX systems. This is the default +/// for standard input. +/// +/// If a standard I/O stream is set to [`SDL_PROCESS_STDIO_APP`], it is connected +/// to a new [`SDL_IOStream`] that is available to the application. Standard input +/// will be available as [`SDL_PROP_PROCESS_STDIN_POINTER`] and allows +/// [`SDL_GetProcessInput()`], standard output will be available as +/// [`SDL_PROP_PROCESS_STDOUT_POINTER`] and allows [`SDL_ReadProcess()`] and +/// [`SDL_GetProcessOutput()`], and standard error will be available as +/// [`SDL_PROP_PROCESS_STDERR_POINTER`] in the properties for the created +/// process. +/// +/// If a standard I/O stream is set to [`SDL_PROCESS_STDIO_REDIRECT`], it is +/// connected to an existing [`SDL_IOStream`] provided by the application. Standard +/// input is provided using [`SDL_PROP_PROCESS_CREATE_STDIN_POINTER`], standard +/// output is provided using [`SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`], and +/// standard error is provided using [`SDL_PROP_PROCESS_CREATE_STDERR_POINTER`] +/// in the creation properties. These existing streams should be closed by the +/// application once the new process is created. +/// +/// In order to use an [`SDL_IOStream`] with [`SDL_PROCESS_STDIO_REDIRECT`], it must +/// have [`SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`] or +/// [`SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`] set. This is true for streams +/// representing files and process I/O. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateProcessWithProperties`] +/// - [`SDL_GetProcessProperties`] +/// - [`SDL_ReadProcess`] +/// - [`SDL_GetProcessInput`] +/// - [`SDL_GetProcessOutput`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INHERITED`](SDL_ProcessIO::INHERITED) | [`SDL_PROCESS_STDIO_INHERITED`] | The I/O stream is inherited from the application. | +/// | [`NULL`](SDL_ProcessIO::NULL) | [`SDL_PROCESS_STDIO_NULL`] | The I/O stream is ignored. | +/// | [`APP`](SDL_ProcessIO::APP) | [`SDL_PROCESS_STDIO_APP`] | The I/O stream is connected to a new [`SDL_IOStream`] that the application can read or write | +/// | [`REDIRECT`](SDL_ProcessIO::REDIRECT) | [`SDL_PROCESS_STDIO_REDIRECT`] | The I/O stream is redirected to an existing [`SDL_IOStream`]. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ProcessIO(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ProcessIO { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_ProcessIO) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_ProcessIO) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ProcessIO { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INHERITED => "SDL_PROCESS_STDIO_INHERITED", + Self::NULL => "SDL_PROCESS_STDIO_NULL", + Self::APP => "SDL_PROCESS_STDIO_APP", + Self::REDIRECT => "SDL_PROCESS_STDIO_REDIRECT", + + _ => return write!(f, "SDL_ProcessIO({})", self.0), + }) + } +} + +impl SDL_ProcessIO { + /// The I/O stream is inherited from the application. + pub const INHERITED: Self = Self((0 as ::core::ffi::c_int)); + /// The I/O stream is ignored. + pub const NULL: Self = Self((1 as ::core::ffi::c_int)); + /// The I/O stream is connected to a new [`SDL_IOStream`] that the application can read or write + pub const APP: Self = Self((2 as ::core::ffi::c_int)); + /// The I/O stream is redirected to an existing [`SDL_IOStream`]. + pub const REDIRECT: Self = Self((3 as ::core::ffi::c_int)); +} + +/// The I/O stream is inherited from the application. +pub const SDL_PROCESS_STDIO_INHERITED: SDL_ProcessIO = SDL_ProcessIO::INHERITED; +/// The I/O stream is ignored. +pub const SDL_PROCESS_STDIO_NULL: SDL_ProcessIO = SDL_ProcessIO::NULL; +/// The I/O stream is connected to a new [`SDL_IOStream`] that the application can read or write +pub const SDL_PROCESS_STDIO_APP: SDL_ProcessIO = SDL_ProcessIO::APP; +/// The I/O stream is redirected to an existing [`SDL_IOStream`]. +pub const SDL_PROCESS_STDIO_REDIRECT: SDL_ProcessIO = SDL_ProcessIO::REDIRECT; + +impl SDL_ProcessIO { + /// Initialize a `SDL_ProcessIO` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_ProcessIO { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ProcessIO { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::process::METADATA_SDL_ProcessIO; +} + +unsafe extern "C" { + /// Create a new process with the specified properties. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_PROCESS_CREATE_ARGS_POINTER`]\: an array of strings containing + /// the program to run, any arguments, and a NULL pointer, e.g. const char + /// *args\[\] = { "myprogram", "argument", NULL }. This is a required property. + /// - [`SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER`]\: an [`SDL_Environment`] + /// pointer. If this property is set, it will be the entire environment for + /// the process, otherwise the current environment is used. + /// - [`SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING`]\: a UTF-8 encoded + /// string representing the working directory for the process, defaults to + /// the current working directory. + /// - [`SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`]\: an [`SDL_ProcessIO`] value describing + /// where standard input for the process comes from, defaults to + /// [`SDL_PROCESS_STDIO_NULL`]. + /// - [`SDL_PROP_PROCESS_CREATE_STDIN_POINTER`]\: an [`SDL_IOStream`] pointer used for + /// standard input when [`SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`] is set to + /// [`SDL_PROCESS_STDIO_REDIRECT`]. + /// - [`SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`]\: an [`SDL_ProcessIO`] value + /// describing where standard output for the process goes to, defaults to + /// [`SDL_PROCESS_STDIO_INHERITED`]. + /// - [`SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`]\: an [`SDL_IOStream`] pointer used + /// for standard output when [`SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`] is set + /// to [`SDL_PROCESS_STDIO_REDIRECT`]. + /// - [`SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`]\: an [`SDL_ProcessIO`] value + /// describing where standard error for the process goes to, defaults to + /// [`SDL_PROCESS_STDIO_INHERITED`]. + /// - [`SDL_PROP_PROCESS_CREATE_STDERR_POINTER`]\: an [`SDL_IOStream`] pointer used + /// for standard error when [`SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`] is set to + /// [`SDL_PROCESS_STDIO_REDIRECT`]. + /// - [`SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN`]\: true if the error + /// output of the process should be redirected into the standard output of + /// the process. This property has no effect if + /// [`SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`] is set. + /// - [`SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN`]\: true if the process should + /// run in the background. In this case the default input and output is + /// [`SDL_PROCESS_STDIO_NULL`] and the exitcode of the process is not + /// available, and will always be 0. + /// - [`SDL_PROP_PROCESS_CREATE_CMDLINE_STRING`]\: a string containing the program + /// to run and any parameters. This string is passed directly to + /// `CreateProcess` on Windows, and does nothing on other platforms. This + /// property is only important if you want to start programs that does + /// non-standard command-line processing, and in most cases using + /// [`SDL_PROP_PROCESS_CREATE_ARGS_POINTER`] is sufficient. + /// + /// On POSIX platforms, wait() and waitpid(-1, ...) should not be called, and + /// SIGCHLD should not be ignored or handled because those would prevent SDL + /// from properly tracking the lifetime of the underlying process. You should + /// use [`SDL_WaitProcess()`] instead. + /// + /// ## Parameters + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns the newly created and running process, or NULL if the process + /// couldn't be created. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_GetProcessProperties`] + /// - [`SDL_ReadProcess`] + /// - [`SDL_GetProcessInput`] + /// - [`SDL_GetProcessOutput`] + /// - [`SDL_KillProcess`] + /// - [`SDL_WaitProcess`] + /// - [`SDL_DestroyProcess`] + pub fn SDL_CreateProcessWithProperties(props: SDL_PropertiesID) -> *mut SDL_Process; +} + +pub const SDL_PROP_PROCESS_CREATE_ARGS_POINTER: *const ::core::ffi::c_char = + c"SDL.process.create.args".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER: *const ::core::ffi::c_char = + c"SDL.process.create.environment".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING: *const ::core::ffi::c_char = + c"SDL.process.create.working_directory".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDIN_NUMBER: *const ::core::ffi::c_char = + c"SDL.process.create.stdin_option".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDIN_POINTER: *const ::core::ffi::c_char = + c"SDL.process.create.stdin_source".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER: *const ::core::ffi::c_char = + c"SDL.process.create.stdout_option".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDOUT_POINTER: *const ::core::ffi::c_char = + c"SDL.process.create.stdout_source".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDERR_NUMBER: *const ::core::ffi::c_char = + c"SDL.process.create.stderr_option".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDERR_POINTER: *const ::core::ffi::c_char = + c"SDL.process.create.stderr_source".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.process.create.stderr_to_stdout".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.process.create.background".as_ptr(); + +pub const SDL_PROP_PROCESS_CREATE_CMDLINE_STRING: *const ::core::ffi::c_char = + c"SDL.process.create.cmdline".as_ptr(); + +unsafe extern "C" { + /// Get the properties associated with a process. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_PROCESS_PID_NUMBER`]\: the process ID of the process. + /// - [`SDL_PROP_PROCESS_STDIN_POINTER`]\: an [`SDL_IOStream`] that can be used to + /// write input to the process, if it was created with + /// [`SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`] set to [`SDL_PROCESS_STDIO_APP`]. + /// - [`SDL_PROP_PROCESS_STDOUT_POINTER`]\: a non-blocking [`SDL_IOStream`] that can + /// be used to read output from the process, if it was created with + /// [`SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`] set to [`SDL_PROCESS_STDIO_APP`]. + /// - [`SDL_PROP_PROCESS_STDERR_POINTER`]\: a non-blocking [`SDL_IOStream`] that can + /// be used to read error output from the process, if it was created with + /// [`SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`] set to [`SDL_PROCESS_STDIO_APP`]. + /// - [`SDL_PROP_PROCESS_BACKGROUND_BOOLEAN`]\: true if the process is running in + /// the background. + /// + /// ## Parameters + /// - `process`: the process to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + pub fn SDL_GetProcessProperties(process: *mut SDL_Process) -> SDL_PropertiesID; +} + +pub const SDL_PROP_PROCESS_PID_NUMBER: *const ::core::ffi::c_char = c"SDL.process.pid".as_ptr(); + +pub const SDL_PROP_PROCESS_STDIN_POINTER: *const ::core::ffi::c_char = + c"SDL.process.stdin".as_ptr(); + +pub const SDL_PROP_PROCESS_STDOUT_POINTER: *const ::core::ffi::c_char = + c"SDL.process.stdout".as_ptr(); + +pub const SDL_PROP_PROCESS_STDERR_POINTER: *const ::core::ffi::c_char = + c"SDL.process.stderr".as_ptr(); + +pub const SDL_PROP_PROCESS_BACKGROUND_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.process.background".as_ptr(); + +unsafe extern "C" { + /// Read all the output from a process. + /// + /// If a process was created with I/O enabled, you can use this function to + /// read the output. This function blocks until the process is complete, + /// capturing all output, and providing the process exit code. + /// + /// The data is allocated with a zero byte at the end (null terminated) for + /// convenience. This extra byte is not included in the value reported via + /// `datasize`. + /// + /// The data should be freed with [`SDL_free()`]. + /// + /// ## Parameters + /// - `process`: The process to read. + /// - `datasize`: a pointer filled in with the number of bytes read, may be + /// NULL. + /// - `exitcode`: a pointer filled in with the process exit code if the + /// process has exited, may be NULL. + /// + /// ## Return value + /// Returns the data or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_DestroyProcess`] + pub fn SDL_ReadProcess( + process: *mut SDL_Process, + datasize: *mut ::core::primitive::usize, + exitcode: *mut ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Get the [`SDL_IOStream`] associated with process standard input. + /// + /// The process must have been created with [`SDL_CreateProcess()`] and pipe_stdio + /// set to true, or with [`SDL_CreateProcessWithProperties()`] and + /// [`SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`] set to [`SDL_PROCESS_STDIO_APP`]. + /// + /// Writing to this stream can return less data than expected if the process + /// hasn't read its input. It may be blocked waiting for its output to be read, + /// if so you may need to call [`SDL_GetProcessOutput()`] and read the output in + /// parallel with writing input. + /// + /// ## Parameters + /// - `process`: The process to get the input stream for. + /// + /// ## Return value + /// Returns the input stream or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_GetProcessOutput`] + pub fn SDL_GetProcessInput(process: *mut SDL_Process) -> *mut SDL_IOStream; +} + +unsafe extern "C" { + /// Get the [`SDL_IOStream`] associated with process standard output. + /// + /// The process must have been created with [`SDL_CreateProcess()`] and pipe_stdio + /// set to true, or with [`SDL_CreateProcessWithProperties()`] and + /// [`SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`] set to [`SDL_PROCESS_STDIO_APP`]. + /// + /// Reading from this stream can return 0 with [`SDL_GetIOStatus()`] returning + /// [`SDL_IO_STATUS_NOT_READY`] if no output is available yet. + /// + /// ## Parameters + /// - `process`: The process to get the output stream for. + /// + /// ## Return value + /// Returns the output stream or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_GetProcessInput`] + pub fn SDL_GetProcessOutput(process: *mut SDL_Process) -> *mut SDL_IOStream; +} + +unsafe extern "C" { + /// Stop a process. + /// + /// ## Parameters + /// - `process`: The process to stop. + /// - `force`: true to terminate the process immediately, false to try to + /// stop the process gracefully. In general you should try to stop + /// the process gracefully first as terminating a process may + /// leave it with half-written data or in some other unstable + /// state. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_WaitProcess`] + /// - [`SDL_DestroyProcess`] + pub fn SDL_KillProcess( + process: *mut SDL_Process, + force: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Wait for a process to finish. + /// + /// This can be called multiple times to get the status of a process. + /// + /// The exit code will be the exit code of the process if it terminates + /// normally, a negative signal if it terminated due to a signal, or -255 + /// otherwise. It will not be changed if the process is still running. + /// + /// If you create a process with standard output piped to the application + /// (`pipe_stdio` being true) then you should read all of the process output + /// before calling [`SDL_WaitProcess()`]. If you don't do this the process might be + /// blocked indefinitely waiting for output to be read and [`SDL_WaitProcess()`] + /// will never return true; + /// + /// ## Parameters + /// - `process`: The process to wait for. + /// - `block`: If true, block until the process finishes; otherwise, report + /// on the process' status. + /// - `exitcode`: a pointer filled in with the process exit code if the + /// process has exited, may be NULL. + /// + /// ## Return value + /// Returns true if the process exited, false otherwise. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_KillProcess`] + /// - [`SDL_DestroyProcess`] + pub fn SDL_WaitProcess( + process: *mut SDL_Process, + block: ::core::primitive::bool, + exitcode: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy a previously created process object. + /// + /// Note that this does not stop the process, just destroys the SDL object used + /// to track it. If you want to stop the process you should use + /// [`SDL_KillProcess()`]. + /// + /// ## Parameters + /// - `process`: The process object to destroy. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProcess`] + /// - [`SDL_CreateProcessWithProperties`] + /// - [`SDL_KillProcess`] + pub fn SDL_DestroyProcess(process: *mut SDL_Process); +} + +/// An opaque handle representing a system process. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateProcess`] +#[repr(C)] +pub struct SDL_Process { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/properties.rs b/vendor/sdl3-sys/src/generated/properties.rs new file mode 100644 index 00000000..018d30eb --- /dev/null +++ b/vendor/sdl3-sys/src/generated/properties.rs @@ -0,0 +1,852 @@ +//! A property is a variable that can be created and retrieved by name at +//! runtime. +//! +//! All properties are part of a property group ([`SDL_PropertiesID`]). A property +//! group can be created with the [`SDL_CreateProperties`] function and destroyed +//! with the [`SDL_DestroyProperties`] function. +//! +//! Properties can be added to and retrieved from a property group through the +//! following functions: +//! +//! - [`SDL_SetPointerProperty`] and [`SDL_GetPointerProperty`] operate on `void*` +//! pointer types. +//! - [`SDL_SetStringProperty`] and [`SDL_GetStringProperty`] operate on string types. +//! - [`SDL_SetNumberProperty`] and [`SDL_GetNumberProperty`] operate on signed 64-bit +//! integer types. +//! - [`SDL_SetFloatProperty`] and [`SDL_GetFloatProperty`] operate on floating point +//! types. +//! - [`SDL_SetBooleanProperty`] and [`SDL_GetBooleanProperty`] operate on boolean +//! types. +//! +//! Properties can be removed from a group by using [`SDL_ClearProperty`]. + +use super::stdinc::*; + +use super::error::*; + +/// An ID that represents a properties set. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_PropertiesID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_PropertiesID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_PropertiesID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_PropertiesID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_PropertiesID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_PropertiesID { + /// Initialize a `SDL_PropertiesID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_PropertiesID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PropertiesID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::properties::METADATA_SDL_PropertiesID; +} + +/// SDL property type +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_PropertyType::INVALID) | [`SDL_PROPERTY_TYPE_INVALID`] | | +/// | [`POINTER`](SDL_PropertyType::POINTER) | [`SDL_PROPERTY_TYPE_POINTER`] | | +/// | [`STRING`](SDL_PropertyType::STRING) | [`SDL_PROPERTY_TYPE_STRING`] | | +/// | [`NUMBER`](SDL_PropertyType::NUMBER) | [`SDL_PROPERTY_TYPE_NUMBER`] | | +/// | [`FLOAT`](SDL_PropertyType::FLOAT) | [`SDL_PROPERTY_TYPE_FLOAT`] | | +/// | [`BOOLEAN`](SDL_PropertyType::BOOLEAN) | [`SDL_PROPERTY_TYPE_BOOLEAN`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_PropertyType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_PropertyType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_PropertyType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_PropertyType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_PropertyType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_PROPERTY_TYPE_INVALID", + Self::POINTER => "SDL_PROPERTY_TYPE_POINTER", + Self::STRING => "SDL_PROPERTY_TYPE_STRING", + Self::NUMBER => "SDL_PROPERTY_TYPE_NUMBER", + Self::FLOAT => "SDL_PROPERTY_TYPE_FLOAT", + Self::BOOLEAN => "SDL_PROPERTY_TYPE_BOOLEAN", + + _ => return write!(f, "SDL_PropertyType({})", self.0), + }) + } +} + +impl SDL_PropertyType { + pub const INVALID: Self = Self((0 as ::core::ffi::c_int)); + pub const POINTER: Self = Self((1 as ::core::ffi::c_int)); + pub const STRING: Self = Self((2 as ::core::ffi::c_int)); + pub const NUMBER: Self = Self((3 as ::core::ffi::c_int)); + pub const FLOAT: Self = Self((4 as ::core::ffi::c_int)); + pub const BOOLEAN: Self = Self((5 as ::core::ffi::c_int)); +} + +pub const SDL_PROPERTY_TYPE_INVALID: SDL_PropertyType = SDL_PropertyType::INVALID; +pub const SDL_PROPERTY_TYPE_POINTER: SDL_PropertyType = SDL_PropertyType::POINTER; +pub const SDL_PROPERTY_TYPE_STRING: SDL_PropertyType = SDL_PropertyType::STRING; +pub const SDL_PROPERTY_TYPE_NUMBER: SDL_PropertyType = SDL_PropertyType::NUMBER; +pub const SDL_PROPERTY_TYPE_FLOAT: SDL_PropertyType = SDL_PropertyType::FLOAT; +pub const SDL_PROPERTY_TYPE_BOOLEAN: SDL_PropertyType = SDL_PropertyType::BOOLEAN; + +impl SDL_PropertyType { + /// Initialize a `SDL_PropertyType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_PropertyType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_PropertyType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::properties::METADATA_SDL_PropertyType; +} + +/// A generic property for naming things. +/// +/// This property is intended to be added to any [`SDL_PropertiesID`] that needs a +/// generic name associated with the property set. It is not guaranteed that +/// any property set will include this key, but it is convenient to have a +/// standard key that any piece of code could reasonably agree to use. +/// +/// For example, the properties associated with an [`SDL_Texture`] might have a +/// name string of "player sprites", or an [`SDL_AudioStream`] might have +/// "background music", etc. This might also be useful for an [`SDL_IOStream`] to +/// list the path to its asset. +/// +/// There is no format for the value set with this key; it is expected to be +/// human-readable and informational in nature, possibly for logging or +/// debugging purposes. +/// +/// SDL does not currently set this property on any objects it creates, but +/// this may change in later versions; it is currently expected that apps and +/// external libraries will take advantage of it, when appropriate. +/// +/// ## Availability +/// This macro is available since SDL 3.4.0. +pub const SDL_PROP_NAME_STRING: *const ::core::ffi::c_char = c"SDL.name".as_ptr(); + +unsafe extern "C" { + /// Get the global SDL properties. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGlobalProperties() -> SDL_PropertiesID; +} + +unsafe extern "C" { + /// Create a group of properties. + /// + /// All properties are automatically destroyed when [`SDL_Quit()`] is called. + /// + /// ## Return value + /// Returns an ID for a new group of properties, or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyProperties`] + pub fn SDL_CreateProperties() -> SDL_PropertiesID; +} + +unsafe extern "C" { + /// Copy a group of properties. + /// + /// Copy all the properties from one group of properties to another, with the + /// exception of properties requiring cleanup (set using + /// [`SDL_SetPointerPropertyWithCleanup()`]), which will not be copied. Any + /// property that already exists on `dst` will be overwritten. + /// + /// ## Parameters + /// - `src`: the properties to copy. + /// - `dst`: the destination properties. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. This + /// function acquires simultaneous mutex locks on both the source + /// and destination property sets. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CopyProperties( + src: SDL_PropertiesID, + dst: SDL_PropertiesID, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Lock a group of properties. + /// + /// Obtain a multi-threaded lock for these properties. Other threads will wait + /// while trying to lock these properties until they are unlocked. Properties + /// must be unlocked before they are destroyed. + /// + /// The lock is automatically taken when setting individual properties, this + /// function is only needed when you want to set several properties atomically + /// or want to guarantee that properties being queried aren't freed in another + /// thread. + /// + /// ## Parameters + /// - `props`: the properties to lock. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UnlockProperties`] + pub fn SDL_LockProperties(props: SDL_PropertiesID) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unlock a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to unlock. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockProperties`] + pub fn SDL_UnlockProperties(props: SDL_PropertiesID); +} + +/// A callback used to free resources when a property is deleted. +/// +/// This should release any resources associated with `value` that are no +/// longer needed. +/// +/// This callback is set per-property. Different properties in the same group +/// can have different cleanup callbacks. +/// +/// This callback will be called _during_ [`SDL_SetPointerPropertyWithCleanup`] if +/// the function fails for any reason. +/// +/// ## Parameters +/// - `userdata`: an app-defined pointer passed to the callback. +/// - `value`: the pointer assigned to the property to clean up. +/// +/// ## Thread safety +/// This callback may fire without any locks held; if this is a +/// concern, the app should provide its own locking. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetPointerPropertyWithCleanup`] +pub type SDL_CleanupPropertyCallback = ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void, value: *mut ::core::ffi::c_void), +>; + +unsafe extern "C" { + /// Set a pointer property in a group of properties with a cleanup function + /// that is called when the property is deleted. + /// + /// The cleanup function is also called if setting the property fails for any + /// reason. + /// + /// For simply setting basic data types, like numbers, bools, or strings, use + /// [`SDL_SetNumberProperty`], [`SDL_SetBooleanProperty`], or [`SDL_SetStringProperty`] + /// instead, as those functions will handle cleanup on your behalf. This + /// function is only for more complex, custom data. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to modify. + /// - `value`: the new value of the property, or NULL to delete the property. + /// - `cleanup`: the function to call when this property is deleted, or NULL + /// if no cleanup is necessary. + /// - `userdata`: a pointer that is passed to the cleanup function. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPointerProperty`] + /// - [`SDL_SetPointerProperty`] + /// - [`SDL_CleanupPropertyCallback`] + pub fn SDL_SetPointerPropertyWithCleanup( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + value: *mut ::core::ffi::c_void, + cleanup: SDL_CleanupPropertyCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a pointer property in a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to modify. + /// - `value`: the new value of the property, or NULL to delete the property. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPointerProperty`] + /// - [`SDL_HasProperty`] + /// - [`SDL_SetBooleanProperty`] + /// - [`SDL_SetFloatProperty`] + /// - [`SDL_SetNumberProperty`] + /// - [`SDL_SetPointerPropertyWithCleanup`] + /// - [`SDL_SetStringProperty`] + pub fn SDL_SetPointerProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + value: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a string property in a group of properties. + /// + /// This function makes a copy of the string; the caller does not have to + /// preserve the data after this call completes. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to modify. + /// - `value`: the new value of the property, or NULL to delete the property. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetStringProperty`] + pub fn SDL_SetStringProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + value: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an integer property in a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to modify. + /// - `value`: the new value of the property. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumberProperty`] + pub fn SDL_SetNumberProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + value: Sint64, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a floating point property in a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to modify. + /// - `value`: the new value of the property. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetFloatProperty`] + pub fn SDL_SetFloatProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + value: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a boolean property in a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to modify. + /// - `value`: the new value of the property. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetBooleanProperty`] + pub fn SDL_SetBooleanProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + value: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether a property exists in a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// + /// ## Return value + /// Returns true if the property exists, or false if it doesn't. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPropertyType`] + pub fn SDL_HasProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the type of a property in a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// + /// ## Return value + /// Returns the type of the property, or [`SDL_PROPERTY_TYPE_INVALID`] if it is + /// not set. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasProperty`] + pub fn SDL_GetPropertyType( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + ) -> SDL_PropertyType; +} + +unsafe extern "C" { + /// Get a pointer property from a group of properties. + /// + /// By convention, the names of properties that SDL exposes on objects will + /// start with "SDL.", and properties that SDL uses internally will start with + /// "SDL.internal.". These should be considered read-only and should not be + /// modified by applications. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// - `default_value`: the default value of the property. + /// + /// ## Return value + /// Returns the value of the property, or `default_value` if it is not set or + /// not a pointer property. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, although + /// the data returned is not protected and could potentially be + /// freed if you call [`SDL_SetPointerProperty()`] or + /// [`SDL_ClearProperty()`] on these properties from another thread. + /// If you need to avoid this, use [`SDL_LockProperties()`] and + /// [`SDL_UnlockProperties()`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetBooleanProperty`] + /// - [`SDL_GetFloatProperty`] + /// - [`SDL_GetNumberProperty`] + /// - [`SDL_GetPropertyType`] + /// - [`SDL_GetStringProperty`] + /// - [`SDL_HasProperty`] + /// - [`SDL_SetPointerProperty`] + pub fn SDL_GetPointerProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + default_value: *mut ::core::ffi::c_void, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Get a string property from a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// - `default_value`: the default value of the property. + /// + /// ## Return value + /// Returns the value of the property, or `default_value` if it is not set or + /// not a string property. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, although + /// the data returned is not protected and could potentially be + /// freed if you call [`SDL_SetStringProperty()`] or + /// [`SDL_ClearProperty()`] on these properties from another thread. + /// If you need to avoid this, use [`SDL_LockProperties()`] and + /// [`SDL_UnlockProperties()`]. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPropertyType`] + /// - [`SDL_HasProperty`] + /// - [`SDL_SetStringProperty`] + pub fn SDL_GetStringProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + default_value: *const ::core::ffi::c_char, + ) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get a number property from a group of properties. + /// + /// You can use [`SDL_GetPropertyType()`] to query whether the property exists and + /// is a number property. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// - `default_value`: the default value of the property. + /// + /// ## Return value + /// Returns the value of the property, or `default_value` if it is not set or + /// not a number property. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPropertyType`] + /// - [`SDL_HasProperty`] + /// - [`SDL_SetNumberProperty`] + pub fn SDL_GetNumberProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + default_value: Sint64, + ) -> Sint64; +} + +unsafe extern "C" { + /// Get a floating point property from a group of properties. + /// + /// You can use [`SDL_GetPropertyType()`] to query whether the property exists and + /// is a floating point property. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// - `default_value`: the default value of the property. + /// + /// ## Return value + /// Returns the value of the property, or `default_value` if it is not set or + /// not a float property. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPropertyType`] + /// - [`SDL_HasProperty`] + /// - [`SDL_SetFloatProperty`] + pub fn SDL_GetFloatProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + default_value: ::core::ffi::c_float, + ) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Get a boolean property from a group of properties. + /// + /// You can use [`SDL_GetPropertyType()`] to query whether the property exists and + /// is a boolean property. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `name`: the name of the property to query. + /// - `default_value`: the default value of the property. + /// + /// ## Return value + /// Returns the value of the property, or `default_value` if it is not set or + /// not a boolean property. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPropertyType`] + /// - [`SDL_HasProperty`] + /// - [`SDL_SetBooleanProperty`] + pub fn SDL_GetBooleanProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + default_value: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear a property from a group of properties. + /// + /// ## Parameters + /// - `props`: the properties to modify. + /// - `name`: the name of the property to clear. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ClearProperty( + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +/// A callback used to enumerate all the properties in a group of properties. +/// +/// This callback is called from [`SDL_EnumerateProperties()`], and is called once +/// per property in the set. +/// +/// ## Parameters +/// - `userdata`: an app-defined pointer passed to the callback. +/// - `props`: the [`SDL_PropertiesID`] that is being enumerated. +/// - `name`: the next property name in the enumeration. +/// +/// ## Thread safety +/// [`SDL_EnumerateProperties`] holds a lock on `props` during this +/// callback. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_EnumerateProperties`] +pub type SDL_EnumeratePropertiesCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + props: SDL_PropertiesID, + name: *const ::core::ffi::c_char, + ), +>; + +unsafe extern "C" { + /// Enumerate the properties contained in a group of properties. + /// + /// The callback function is called for each property in the group of + /// properties. The properties are locked during enumeration. + /// + /// ## Parameters + /// - `props`: the properties to query. + /// - `callback`: the function to call for each property. + /// - `userdata`: a pointer that is passed to `callback`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EnumerateProperties( + props: SDL_PropertiesID, + callback: SDL_EnumeratePropertiesCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy a group of properties. + /// + /// All properties are deleted and their cleanup functions will be called, if + /// any. + /// + /// ## Parameters + /// - `props`: the properties to destroy. + /// + /// ## Thread safety + /// This function should not be called while these properties are + /// locked or other threads might be setting or getting values + /// from these properties. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProperties`] + pub fn SDL_DestroyProperties(props: SDL_PropertiesID); +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/rect.rs b/vendor/sdl3-sys/src/generated/rect.rs new file mode 100644 index 00000000..36133bfd --- /dev/null +++ b/vendor/sdl3-sys/src/generated/rect.rs @@ -0,0 +1,713 @@ +//! Some helper functions for managing rectangles and 2D points, in both +//! integer and floating point versions. + +use super::stdinc::*; + +use super::error::*; + +/// The structure that defines a point (using integers). +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetRectEnclosingPoints`] +/// - [`SDL_PointInRect`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Point { + pub x: ::core::ffi::c_int, + pub y: ::core::ffi::c_int, +} + +/// The structure that defines a point (using floating point values). +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetRectEnclosingPointsFloat`] +/// - [`SDL_PointInRectFloat`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_FPoint { + pub x: ::core::ffi::c_float, + pub y: ::core::ffi::c_float, +} + +/// A rectangle, with the origin at the upper left (using integers). +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RectEmpty`] +/// - [`SDL_RectsEqual`] +/// - [`SDL_HasRectIntersection`] +/// - [`SDL_GetRectIntersection`] +/// - [`SDL_GetRectAndLineIntersection`] +/// - [`SDL_GetRectUnion`] +/// - [`SDL_GetRectEnclosingPoints`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Rect { + pub x: ::core::ffi::c_int, + pub y: ::core::ffi::c_int, + pub w: ::core::ffi::c_int, + pub h: ::core::ffi::c_int, +} + +/// A rectangle stored using floating point values. +/// +/// The origin of the coordinate space is in the top-left, with increasing +/// values moving down and right. The properties `x` and `y` represent the +/// coordinates of the top-left corner of the rectangle. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RectEmptyFloat`] +/// - [`SDL_RectsEqualFloat`] +/// - [`SDL_RectsEqualEpsilon`] +/// - [`SDL_HasRectIntersectionFloat`] +/// - [`SDL_GetRectIntersectionFloat`] +/// - [`SDL_GetRectAndLineIntersectionFloat`] +/// - [`SDL_GetRectUnionFloat`] +/// - [`SDL_GetRectEnclosingPointsFloat`] +/// - [`SDL_PointInRectFloat`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_FRect { + pub x: ::core::ffi::c_float, + pub y: ::core::ffi::c_float, + pub w: ::core::ffi::c_float, + pub h: ::core::ffi::c_float, +} + +/// Convert an [`SDL_Rect`] to [`SDL_FRect`] +/// +/// ## Parameters +/// - `rect`: a pointer to an [`SDL_Rect`]. +/// - `frect`: a pointer filled in with the floating point representation of +/// `rect`. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_RectToFRect(rect: *const SDL_Rect, frect: *mut SDL_FRect) { + { + let (ptr, value) = ( + unsafe { &raw mut (*frect).x }, + (unsafe { (&raw const (*rect).x).read() } as ::core::ffi::c_float), + ); + unsafe { ptr.write(value) }; + value + }; + { + let (ptr, value) = ( + unsafe { &raw mut (*frect).y }, + (unsafe { (&raw const (*rect).y).read() } as ::core::ffi::c_float), + ); + unsafe { ptr.write(value) }; + value + }; + { + let (ptr, value) = ( + unsafe { &raw mut (*frect).w }, + (unsafe { (&raw const (*rect).w).read() } as ::core::ffi::c_float), + ); + unsafe { ptr.write(value) }; + value + }; + { + let (ptr, value) = ( + unsafe { &raw mut (*frect).h }, + (unsafe { (&raw const (*rect).h).read() } as ::core::ffi::c_float), + ); + unsafe { ptr.write(value) }; + value + }; +} + +/// Determine whether a point resides inside a rectangle. +/// +/// A point is considered part of a rectangle if both `p` and `r` are not NULL, +/// and `p`'s x and y coordinates are >= to the rectangle's top left corner, +/// and < the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0) +/// as "inside" and (0,1) as not. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `p`: the point to test. +/// - `r`: the rectangle to test. +/// +/// ## Return value +/// Returns true if `p` is contained by `r`, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_PointInRect( + p: *const SDL_Point, + r: *const SDL_Rect, +) -> ::core::primitive::bool { + return if (((((!p.is_null() && !r.is_null()) + && (unsafe { (&raw const (*p).x).read() } >= unsafe { (&raw const (*r).x).read() })) + && (unsafe { (&raw const (*p).x).read() } + < (unsafe { (&raw const (*r).x).read() } + unsafe { (&raw const (*r).w).read() }))) + && (unsafe { (&raw const (*p).y).read() } >= unsafe { (&raw const (*r).y).read() })) + && (unsafe { (&raw const (*p).y).read() } + < (unsafe { (&raw const (*r).y).read() } + unsafe { (&raw const (*r).h).read() }))) + { + true + } else { + false + }; +} + +/// Determine whether a rectangle has no area. +/// +/// A rectangle is considered "empty" for this function if `r` is NULL, or if +/// `r`'s width and/or height are <= 0. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `r`: the rectangle to test. +/// +/// ## Return value +/// Returns true if the rectangle is "empty", false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_RectEmpty(r: *const SDL_Rect) -> ::core::primitive::bool { + return if ((!(!r.is_null()) || (unsafe { (&raw const (*r).w).read() } <= 0_i32)) + || (unsafe { (&raw const (*r).h).read() } <= 0_i32)) + { + true + } else { + false + }; +} + +/// Determine whether two rectangles are equal. +/// +/// Rectangles are considered equal if both are not NULL and each of their x, +/// y, width and height match. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `a`: the first rectangle to test. +/// - `b`: the second rectangle to test. +/// +/// ## Return value +/// Returns true if the rectangles are equal, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_RectsEqual( + a: *const SDL_Rect, + b: *const SDL_Rect, +) -> ::core::primitive::bool { + return if (((((!a.is_null() && !b.is_null()) + && (unsafe { (&raw const (*a).x).read() } == unsafe { (&raw const (*b).x).read() })) + && (unsafe { (&raw const (*a).y).read() } == unsafe { (&raw const (*b).y).read() })) + && (unsafe { (&raw const (*a).w).read() } == unsafe { (&raw const (*b).w).read() })) + && (unsafe { (&raw const (*a).h).read() } == unsafe { (&raw const (*b).h).read() })) + { + true + } else { + false + }; +} + +unsafe extern "C" { + /// Determine whether two rectangles intersect. + /// + /// If either pointer is NULL the function will return false. + /// + /// ## Parameters + /// - `A`: an [`SDL_Rect`] structure representing the first rectangle. + /// - `B`: an [`SDL_Rect`] structure representing the second rectangle. + /// + /// ## Return value + /// Returns true if there is an intersection, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRectIntersection`] + pub fn SDL_HasRectIntersection( + A: *const SDL_Rect, + B: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the intersection of two rectangles. + /// + /// If `result` is NULL then this function will return false. + /// + /// ## Parameters + /// - `A`: an [`SDL_Rect`] structure representing the first rectangle. + /// - `B`: an [`SDL_Rect`] structure representing the second rectangle. + /// - `result`: an [`SDL_Rect`] structure filled in with the intersection of + /// rectangles `A` and `B`. + /// + /// ## Return value + /// Returns true if there is an intersection, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasRectIntersection`] + pub fn SDL_GetRectIntersection( + A: *const SDL_Rect, + B: *const SDL_Rect, + result: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the union of two rectangles. + /// + /// ## Parameters + /// - `A`: an [`SDL_Rect`] structure representing the first rectangle. + /// - `B`: an [`SDL_Rect`] structure representing the second rectangle. + /// - `result`: an [`SDL_Rect`] structure filled in with the union of rectangles + /// `A` and `B`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRectUnion( + A: *const SDL_Rect, + B: *const SDL_Rect, + result: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate a minimal rectangle enclosing a set of points. + /// + /// If `clip` is not NULL then only points inside of the clipping rectangle are + /// considered. + /// + /// ## Parameters + /// - `points`: an array of [`SDL_Point`] structures representing points to be + /// enclosed. + /// - `count`: the number of structures in the `points` array. + /// - `clip`: an [`SDL_Rect`] used for clipping or NULL to enclose all points. + /// - `result`: an [`SDL_Rect`] structure filled in with the minimal enclosing + /// rectangle. + /// + /// ## Return value + /// Returns true if any points were enclosed or false if all the points were + /// outside of the clipping rectangle. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRectEnclosingPoints( + points: *const SDL_Point, + count: ::core::ffi::c_int, + clip: *const SDL_Rect, + result: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the intersection of a rectangle and line segment. + /// + /// This function is used to clip a line segment to a rectangle. A line segment + /// contained entirely within the rectangle or that does not intersect will + /// remain unchanged. A line segment that crosses the rectangle at either or + /// both ends will be clipped to the boundary of the rectangle and the new + /// coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. + /// + /// ## Parameters + /// - `rect`: an [`SDL_Rect`] structure representing the rectangle to intersect. + /// - `X1`: a pointer to the starting X-coordinate of the line. + /// - `Y1`: a pointer to the starting Y-coordinate of the line. + /// - `X2`: a pointer to the ending X-coordinate of the line. + /// - `Y2`: a pointer to the ending Y-coordinate of the line. + /// + /// ## Return value + /// Returns true if there is an intersection, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRectAndLineIntersection( + rect: *const SDL_Rect, + X1: *mut ::core::ffi::c_int, + Y1: *mut ::core::ffi::c_int, + X2: *mut ::core::ffi::c_int, + Y2: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +/// Determine whether a point resides inside a floating point rectangle. +/// +/// A point is considered part of a rectangle if both `p` and `r` are not NULL, +/// and `p`'s x and y coordinates are >= to the rectangle's top left corner, +/// and <= the rectangle's x+w and y+h. So a 1x1 rectangle considers point +/// (0,0) and (0,1) as "inside" and (0,2) as not. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `p`: the point to test. +/// - `r`: the rectangle to test. +/// +/// ## Return value +/// Returns true if `p` is contained by `r`, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_PointInRectFloat( + p: *const SDL_FPoint, + r: *const SDL_FRect, +) -> ::core::primitive::bool { + return if (((((!p.is_null() && !r.is_null()) + && (unsafe { (&raw const (*p).x).read() } >= unsafe { (&raw const (*r).x).read() })) + && (unsafe { (&raw const (*p).x).read() } + <= (unsafe { (&raw const (*r).x).read() } + unsafe { (&raw const (*r).w).read() }))) + && (unsafe { (&raw const (*p).y).read() } >= unsafe { (&raw const (*r).y).read() })) + && (unsafe { (&raw const (*p).y).read() } + <= (unsafe { (&raw const (*r).y).read() } + unsafe { (&raw const (*r).h).read() }))) + { + true + } else { + false + }; +} + +/// Determine whether a floating point rectangle takes no space. +/// +/// A rectangle is considered "empty" for this function if `r` is NULL, or if +/// `r`'s width and/or height are < 0.0f. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `r`: the rectangle to test. +/// +/// ## Return value +/// Returns true if the rectangle is "empty", false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_RectEmptyFloat(r: *const SDL_FRect) -> ::core::primitive::bool { + return if ((!(!r.is_null()) || (unsafe { (&raw const (*r).w).read() } < 0.0_f32)) + || (unsafe { (&raw const (*r).h).read() } < 0.0_f32)) + { + true + } else { + false + }; +} + +/// Determine whether two floating point rectangles are equal, within some +/// given epsilon. +/// +/// Rectangles are considered equal if both are not NULL and each of their x, +/// y, width and height are within `epsilon` of each other. If you don't know +/// what value to use for `epsilon`, you should call the [`SDL_RectsEqualFloat`] +/// function instead. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `a`: the first rectangle to test. +/// - `b`: the second rectangle to test. +/// - `epsilon`: the epsilon value for comparison. +/// +/// ## Return value +/// Returns true if the rectangles are equal, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RectsEqualFloat`] +#[inline(always)] +pub unsafe fn SDL_RectsEqualEpsilon( + a: *const SDL_FRect, + b: *const SDL_FRect, + epsilon: ::core::ffi::c_float, +) -> ::core::primitive::bool { + return if ((!a.is_null() && !b.is_null()) + && ((a == b) + || ((((SDL_fabsf( + (unsafe { (&raw const (*a).x).read() } - unsafe { (&raw const (*b).x).read() }), + ) <= epsilon) + && (SDL_fabsf( + (unsafe { (&raw const (*a).y).read() } - unsafe { (&raw const (*b).y).read() }), + ) <= epsilon)) + && (SDL_fabsf( + (unsafe { (&raw const (*a).w).read() } - unsafe { (&raw const (*b).w).read() }), + ) <= epsilon)) + && (SDL_fabsf( + (unsafe { (&raw const (*a).h).read() } - unsafe { (&raw const (*b).h).read() }), + ) <= epsilon)))) + { + true + } else { + false + }; +} + +/// Determine whether two floating point rectangles are equal, within a default +/// epsilon. +/// +/// Rectangles are considered equal if both are not NULL and each of their x, +/// y, width and height are within [`SDL_FLT_EPSILON`] of each other. This is often +/// a reasonable way to compare two floating point rectangles and deal with the +/// slight precision variations in floating point calculations that tend to pop +/// up. +/// +/// Note that this is a forced-inline function in a header, and not a public +/// API function available in the SDL library (which is to say, the code is +/// embedded in the calling program and the linker and dynamic loader will not +/// be able to find this function inside SDL itself). +/// +/// ## Parameters +/// - `a`: the first rectangle to test. +/// - `b`: the second rectangle to test. +/// +/// ## Return value +/// Returns true if the rectangles are equal, false otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RectsEqualEpsilon`] +#[inline(always)] +pub unsafe fn SDL_RectsEqualFloat( + a: *const SDL_FRect, + b: *const SDL_FRect, +) -> ::core::primitive::bool { + return unsafe { SDL_RectsEqualEpsilon(a, b, SDL_FLT_EPSILON) }; +} + +unsafe extern "C" { + /// Determine whether two rectangles intersect with float precision. + /// + /// If either pointer is NULL the function will return false. + /// + /// ## Parameters + /// - `A`: an [`SDL_FRect`] structure representing the first rectangle. + /// - `B`: an [`SDL_FRect`] structure representing the second rectangle. + /// + /// ## Return value + /// Returns true if there is an intersection, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRectIntersectionFloat`] + pub fn SDL_HasRectIntersectionFloat( + A: *const SDL_FRect, + B: *const SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the intersection of two rectangles with float precision. + /// + /// If `result` is NULL then this function will return false. + /// + /// ## Parameters + /// - `A`: an [`SDL_FRect`] structure representing the first rectangle. + /// - `B`: an [`SDL_FRect`] structure representing the second rectangle. + /// - `result`: an [`SDL_FRect`] structure filled in with the intersection of + /// rectangles `A` and `B`. + /// + /// ## Return value + /// Returns true if there is an intersection, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HasRectIntersectionFloat`] + pub fn SDL_GetRectIntersectionFloat( + A: *const SDL_FRect, + B: *const SDL_FRect, + result: *mut SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the union of two rectangles with float precision. + /// + /// ## Parameters + /// - `A`: an [`SDL_FRect`] structure representing the first rectangle. + /// - `B`: an [`SDL_FRect`] structure representing the second rectangle. + /// - `result`: an [`SDL_FRect`] structure filled in with the union of rectangles + /// `A` and `B`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRectUnionFloat( + A: *const SDL_FRect, + B: *const SDL_FRect, + result: *mut SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate a minimal rectangle enclosing a set of points with float + /// precision. + /// + /// If `clip` is not NULL then only points inside of the clipping rectangle are + /// considered. + /// + /// ## Parameters + /// - `points`: an array of [`SDL_FPoint`] structures representing points to be + /// enclosed. + /// - `count`: the number of structures in the `points` array. + /// - `clip`: an [`SDL_FRect`] used for clipping or NULL to enclose all points. + /// - `result`: an [`SDL_FRect`] structure filled in with the minimal enclosing + /// rectangle. + /// + /// ## Return value + /// Returns true if any points were enclosed or false if all the points were + /// outside of the clipping rectangle. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRectEnclosingPointsFloat( + points: *const SDL_FPoint, + count: ::core::ffi::c_int, + clip: *const SDL_FRect, + result: *mut SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Calculate the intersection of a rectangle and line segment with float + /// precision. + /// + /// This function is used to clip a line segment to a rectangle. A line segment + /// contained entirely within the rectangle or that does not intersect will + /// remain unchanged. A line segment that crosses the rectangle at either or + /// both ends will be clipped to the boundary of the rectangle and the new + /// coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. + /// + /// ## Parameters + /// - `rect`: an [`SDL_FRect`] structure representing the rectangle to intersect. + /// - `X1`: a pointer to the starting X-coordinate of the line. + /// - `Y1`: a pointer to the starting Y-coordinate of the line. + /// - `X2`: a pointer to the ending X-coordinate of the line. + /// - `Y2`: a pointer to the ending Y-coordinate of the line. + /// + /// ## Return value + /// Returns true if there is an intersection, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRectAndLineIntersectionFloat( + rect: *const SDL_FRect, + X1: *mut ::core::ffi::c_float, + Y1: *mut ::core::ffi::c_float, + X2: *mut ::core::ffi::c_float, + Y2: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/render.rs b/vendor/sdl3-sys/src/generated/render.rs new file mode 100644 index 00000000..877530a3 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/render.rs @@ -0,0 +1,4380 @@ +//! Header file for SDL 2D rendering functions. +//! +//! This API supports the following features: +//! +//! - single pixel points +//! - single pixel lines +//! - filled rectangles +//! - texture images +//! - 2D polygons +//! +//! The primitives may be drawn in opaque, blended, or additive modes. +//! +//! The texture images may be drawn in opaque, blended, or additive modes. They +//! can have an additional color tint or alpha modulation applied to them, and +//! may also be stretched with linear interpolation. +//! +//! This API is designed to accelerate simple 2D operations. You may want more +//! functionality such as 3D polygons and particle effects, and in that case +//! you should use SDL's OpenGL/Direct3D support, the SDL3 GPU API, or one of +//! the many good 3D engines. +//! +//! These functions must be called from the main thread. See this bug for +//! details: + +use super::stdinc::*; + +use super::blendmode::*; + +use super::error::*; + +use super::events::*; + +use super::pixels::*; + +use super::properties::*; + +use super::rect::*; + +use super::surface::*; + +use super::video::*; + +use super::gpu::*; + +/// The name of the software renderer. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_SOFTWARE_RENDERER: *const ::core::ffi::c_char = c"software".as_ptr(); + +/// The name of the GPU renderer. +/// +/// ## Availability +/// This macro is available since SDL 3.4.0. +pub const SDL_GPU_RENDERER: *const ::core::ffi::c_char = c"gpu".as_ptr(); + +/// Vertex structure. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Vertex { + /// Vertex position, in [`SDL_Renderer`] coordinates + pub position: SDL_FPoint, + /// Vertex color + pub color: SDL_FColor, + /// Normalized texture coordinates, if needed + pub tex_coord: SDL_FPoint, +} + +/// The access pattern allowed for a texture. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`STATIC`](SDL_TextureAccess::STATIC) | [`SDL_TEXTUREACCESS_STATIC`] | Changes rarely, not lockable | +/// | [`STREAMING`](SDL_TextureAccess::STREAMING) | [`SDL_TEXTUREACCESS_STREAMING`] | Changes frequently, lockable | +/// | [`TARGET`](SDL_TextureAccess::TARGET) | [`SDL_TEXTUREACCESS_TARGET`] | Texture can be used as a render target | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_TextureAccess(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_TextureAccess { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_TextureAccess) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_TextureAccess) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TextureAccess { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::STATIC => "SDL_TEXTUREACCESS_STATIC", + Self::STREAMING => "SDL_TEXTUREACCESS_STREAMING", + Self::TARGET => "SDL_TEXTUREACCESS_TARGET", + + _ => return write!(f, "SDL_TextureAccess({})", self.0), + }) + } +} + +impl SDL_TextureAccess { + /// Changes rarely, not lockable + pub const STATIC: Self = Self((0 as ::core::ffi::c_int)); + /// Changes frequently, lockable + pub const STREAMING: Self = Self((1 as ::core::ffi::c_int)); + /// Texture can be used as a render target + pub const TARGET: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Changes rarely, not lockable +pub const SDL_TEXTUREACCESS_STATIC: SDL_TextureAccess = SDL_TextureAccess::STATIC; +/// Changes frequently, lockable +pub const SDL_TEXTUREACCESS_STREAMING: SDL_TextureAccess = SDL_TextureAccess::STREAMING; +/// Texture can be used as a render target +pub const SDL_TEXTUREACCESS_TARGET: SDL_TextureAccess = SDL_TextureAccess::TARGET; + +impl SDL_TextureAccess { + /// Initialize a `SDL_TextureAccess` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_TextureAccess { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TextureAccess { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::render::METADATA_SDL_TextureAccess; +} + +/// The addressing mode for a texture when used in [`SDL_RenderGeometry()`]. +/// +/// This affects how texture coordinates are interpreted outside of \[0, 1\] +/// +/// Texture wrapping is always supported for power of two texture sizes, and is +/// supported for other texture sizes if +/// [`SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN`] is set to true. +/// +/// ## Availability +/// This enum is available since SDL 3.4.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_TextureAddressMode::INVALID) | [`SDL_TEXTURE_ADDRESS_INVALID`] | | +/// | [`AUTO`](SDL_TextureAddressMode::AUTO) | [`SDL_TEXTURE_ADDRESS_AUTO`] | Wrapping is enabled if texture coordinates are outside \[0, 1\], this is the default | +/// | [`CLAMP`](SDL_TextureAddressMode::CLAMP) | [`SDL_TEXTURE_ADDRESS_CLAMP`] | Texture coordinates are clamped to the \[0, 1\] range | +/// | [`WRAP`](SDL_TextureAddressMode::WRAP) | [`SDL_TEXTURE_ADDRESS_WRAP`] | The texture is repeated (tiled) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_TextureAddressMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_TextureAddressMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_TextureAddressMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_TextureAddressMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TextureAddressMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_TEXTURE_ADDRESS_INVALID", + Self::AUTO => "SDL_TEXTURE_ADDRESS_AUTO", + Self::CLAMP => "SDL_TEXTURE_ADDRESS_CLAMP", + Self::WRAP => "SDL_TEXTURE_ADDRESS_WRAP", + + _ => return write!(f, "SDL_TextureAddressMode({})", self.0), + }) + } +} + +impl SDL_TextureAddressMode { + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// Wrapping is enabled if texture coordinates are outside \[0, 1\], this is the default + pub const AUTO: Self = Self((0_i32 as ::core::ffi::c_int)); + /// Texture coordinates are clamped to the \[0, 1\] range + pub const CLAMP: Self = Self((1_i32 as ::core::ffi::c_int)); + /// The texture is repeated (tiled) + pub const WRAP: Self = Self((2_i32 as ::core::ffi::c_int)); +} + +pub const SDL_TEXTURE_ADDRESS_INVALID: SDL_TextureAddressMode = SDL_TextureAddressMode::INVALID; +/// Wrapping is enabled if texture coordinates are outside \[0, 1\], this is the default +pub const SDL_TEXTURE_ADDRESS_AUTO: SDL_TextureAddressMode = SDL_TextureAddressMode::AUTO; +/// Texture coordinates are clamped to the \[0, 1\] range +pub const SDL_TEXTURE_ADDRESS_CLAMP: SDL_TextureAddressMode = SDL_TextureAddressMode::CLAMP; +/// The texture is repeated (tiled) +pub const SDL_TEXTURE_ADDRESS_WRAP: SDL_TextureAddressMode = SDL_TextureAddressMode::WRAP; + +impl SDL_TextureAddressMode { + /// Initialize a `SDL_TextureAddressMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_TextureAddressMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TextureAddressMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::render::METADATA_SDL_TextureAddressMode; +} + +/// How the logical size is mapped to the output. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DISABLED`](SDL_RendererLogicalPresentation::DISABLED) | [`SDL_LOGICAL_PRESENTATION_DISABLED`] | There is no logical size in effect | +/// | [`STRETCH`](SDL_RendererLogicalPresentation::STRETCH) | [`SDL_LOGICAL_PRESENTATION_STRETCH`] | The rendered content is stretched to the output resolution | +/// | [`LETTERBOX`](SDL_RendererLogicalPresentation::LETTERBOX) | [`SDL_LOGICAL_PRESENTATION_LETTERBOX`] | The rendered content is fit to the largest dimension and the other dimension is letterboxed with the clear color | +/// | [`OVERSCAN`](SDL_RendererLogicalPresentation::OVERSCAN) | [`SDL_LOGICAL_PRESENTATION_OVERSCAN`] | The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds | +/// | [`INTEGER_SCALE`](SDL_RendererLogicalPresentation::INTEGER_SCALE) | [`SDL_LOGICAL_PRESENTATION_INTEGER_SCALE`] | The rendered content is scaled up by integer multiples to fit the output resolution | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_RendererLogicalPresentation(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_RendererLogicalPresentation { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_RendererLogicalPresentation) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_RendererLogicalPresentation) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_RendererLogicalPresentation { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::DISABLED => "SDL_LOGICAL_PRESENTATION_DISABLED", + Self::STRETCH => "SDL_LOGICAL_PRESENTATION_STRETCH", + Self::LETTERBOX => "SDL_LOGICAL_PRESENTATION_LETTERBOX", + Self::OVERSCAN => "SDL_LOGICAL_PRESENTATION_OVERSCAN", + Self::INTEGER_SCALE => "SDL_LOGICAL_PRESENTATION_INTEGER_SCALE", + + _ => return write!(f, "SDL_RendererLogicalPresentation({})", self.0), + }) + } +} + +impl SDL_RendererLogicalPresentation { + /// There is no logical size in effect + pub const DISABLED: Self = Self((0 as ::core::ffi::c_int)); + /// The rendered content is stretched to the output resolution + pub const STRETCH: Self = Self((1 as ::core::ffi::c_int)); + /// The rendered content is fit to the largest dimension and the other dimension is letterboxed with the clear color + pub const LETTERBOX: Self = Self((2 as ::core::ffi::c_int)); + /// The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds + pub const OVERSCAN: Self = Self((3 as ::core::ffi::c_int)); + /// The rendered content is scaled up by integer multiples to fit the output resolution + pub const INTEGER_SCALE: Self = Self((4 as ::core::ffi::c_int)); +} + +/// There is no logical size in effect +pub const SDL_LOGICAL_PRESENTATION_DISABLED: SDL_RendererLogicalPresentation = + SDL_RendererLogicalPresentation::DISABLED; +/// The rendered content is stretched to the output resolution +pub const SDL_LOGICAL_PRESENTATION_STRETCH: SDL_RendererLogicalPresentation = + SDL_RendererLogicalPresentation::STRETCH; +/// The rendered content is fit to the largest dimension and the other dimension is letterboxed with the clear color +pub const SDL_LOGICAL_PRESENTATION_LETTERBOX: SDL_RendererLogicalPresentation = + SDL_RendererLogicalPresentation::LETTERBOX; +/// The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds +pub const SDL_LOGICAL_PRESENTATION_OVERSCAN: SDL_RendererLogicalPresentation = + SDL_RendererLogicalPresentation::OVERSCAN; +/// The rendered content is scaled up by integer multiples to fit the output resolution +pub const SDL_LOGICAL_PRESENTATION_INTEGER_SCALE: SDL_RendererLogicalPresentation = + SDL_RendererLogicalPresentation::INTEGER_SCALE; + +impl SDL_RendererLogicalPresentation { + /// Initialize a `SDL_RendererLogicalPresentation` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_RendererLogicalPresentation { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_RendererLogicalPresentation { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::render::METADATA_SDL_RendererLogicalPresentation; +} + +/// An efficient driver-specific representation of pixel data +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateTexture`] +/// - [`SDL_CreateTextureFromSurface`] +/// - [`SDL_CreateTextureWithProperties`] +/// - [`SDL_DestroyTexture`] +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Texture { + /// The format of the texture, read-only + pub format: SDL_PixelFormat, + /// The width of the texture, read-only. + pub w: ::core::ffi::c_int, + /// The height of the texture, read-only. + pub h: ::core::ffi::c_int, + /// Application reference count, used when freeing texture + pub refcount: ::core::ffi::c_int, + #[doc(hidden)] + __non_exhaustive: ::sdl3_sys::NonExhaustive, +} + +unsafe extern "C" { + /// Get the number of 2D rendering drivers available for the current display. + /// + /// A render driver is a set of code that handles rendering and texture + /// management on a particular display. Normally there is only one, but some + /// drivers may have several available with different capabilities. + /// + /// There may be none if SDL was compiled without render support. + /// + /// ## Return value + /// Returns the number of built in render drivers. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRenderer`] + /// - [`SDL_GetRenderDriver`] + pub fn SDL_GetNumRenderDrivers() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Use this function to get the name of a built in 2D rendering driver. + /// + /// The list of rendering drivers is given in the order that they are normally + /// initialized by default; the drivers that seem more reasonable to choose + /// first (as far as the SDL developers believe) are earlier in the list. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "opengl", + /// "direct3d12" or "metal". These never have Unicode characters, and are not + /// meant to be proper names. + /// + /// ## Parameters + /// - `index`: the index of the rendering driver; the value ranges from 0 to + /// [`SDL_GetNumRenderDrivers()`] - 1. + /// + /// ## Return value + /// Returns the name of the rendering driver at the requested index, or NULL + /// if an invalid index was specified. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumRenderDrivers`] + pub fn SDL_GetRenderDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Create a window and default renderer. + /// + /// ## Parameters + /// - `title`: the title of the window, in UTF-8 encoding. + /// - `width`: the width of the window. + /// - `height`: the height of the window. + /// - `window_flags`: the flags used to create the window (see + /// [`SDL_CreateWindow()`]). + /// - `window`: a pointer filled with the window, or NULL on error. + /// - `renderer`: a pointer filled with the renderer, or NULL on error. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRenderer`] + /// - [`SDL_CreateWindow`] + pub fn SDL_CreateWindowAndRenderer( + title: *const ::core::ffi::c_char, + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + window_flags: SDL_WindowFlags, + window: *mut *mut SDL_Window, + renderer: *mut *mut SDL_Renderer, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create a 2D rendering context for a window. + /// + /// If you want a specific renderer, you can specify its name here. A list of + /// available renderers can be obtained by calling [`SDL_GetRenderDriver()`] + /// multiple times, with indices from 0 to [`SDL_GetNumRenderDrivers()`]-1. If you + /// don't need a specific renderer, specify NULL and SDL will attempt to choose + /// the best option for you, based on what is available on the user's system. + /// + /// If `name` is a comma-separated list, SDL will try each name, in the order + /// listed, until one succeeds or all of them fail. + /// + /// By default the rendering size matches the window size in pixels, but you + /// can call [`SDL_SetRenderLogicalPresentation()`] to change the content size and + /// scaling options. + /// + /// ## Parameters + /// - `window`: the window where rendering is displayed. + /// - `name`: the name of the rendering driver to initialize, or NULL to let + /// SDL choose one. + /// + /// ## Return value + /// Returns a valid rendering context or NULL if there was an error; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRendererWithProperties`] + /// - [`SDL_CreateSoftwareRenderer`] + /// - [`SDL_DestroyRenderer`] + /// - [`SDL_GetNumRenderDrivers`] + /// - [`SDL_GetRenderDriver`] + /// - [`SDL_GetRendererName`] + pub fn SDL_CreateRenderer( + window: *mut SDL_Window, + name: *const ::core::ffi::c_char, + ) -> *mut SDL_Renderer; +} + +unsafe extern "C" { + /// Create a 2D rendering context for a window, with the specified properties. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_RENDERER_CREATE_NAME_STRING`]\: the name of the rendering driver + /// to use, if a specific one is desired + /// - [`SDL_PROP_RENDERER_CREATE_WINDOW_POINTER`]\: the window where rendering is + /// displayed, required if this isn't a software renderer using a surface + /// - [`SDL_PROP_RENDERER_CREATE_SURFACE_POINTER`]\: the surface where rendering + /// is displayed, if you want a software renderer without a window + /// - [`SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER`]\: an [`SDL_Colorspace`] + /// value describing the colorspace for output to the display, defaults to + /// [`SDL_COLORSPACE_SRGB`]. The direct3d11, direct3d12, and metal renderers + /// support [`SDL_COLORSPACE_SRGB_LINEAR`], which is a linear color space and + /// supports HDR output. If you select [`SDL_COLORSPACE_SRGB_LINEAR`], drawing + /// still uses the sRGB colorspace, but values can go beyond 1.0 and float + /// (linear) format textures can be used for HDR content. + /// - [`SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER`]\: non-zero if you want + /// present synchronized with the refresh rate. This property can take any + /// value that is supported by [`SDL_SetRenderVSync()`] for the renderer. + /// + /// With the SDL GPU renderer (since SDL 3.4.0): + /// + /// - [`SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER`]\: the device to use with the + /// renderer, optional. + /// - [`SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN`]\: the app is able to + /// provide SPIR-V shaders to [`SDL_GPURenderState`], optional. + /// - [`SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN`]\: the app is able to + /// provide DXIL shaders to [`SDL_GPURenderState`], optional. + /// - [`SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN`]\: the app is able to + /// provide MSL shaders to [`SDL_GPURenderState`], optional. + /// + /// With the vulkan renderer: + /// + /// - [`SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER`]\: the VkInstance to use + /// with the renderer, optional. + /// - [`SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER`]\: the VkSurfaceKHR to use + /// with the renderer, optional. + /// - [`SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER`]\: the + /// VkPhysicalDevice to use with the renderer, optional. + /// - [`SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER`]\: the VkDevice to use + /// with the renderer, optional. + /// - [`SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`]\: the + /// queue family index used for rendering. + /// - [`SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`]\: the + /// queue family index used for presentation. + /// + /// ## Parameters + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns a valid rendering context or NULL if there was an error; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProperties`] + /// - [`SDL_CreateRenderer`] + /// - [`SDL_CreateSoftwareRenderer`] + /// - [`SDL_DestroyRenderer`] + /// - [`SDL_GetRendererName`] + pub fn SDL_CreateRendererWithProperties(props: SDL_PropertiesID) -> *mut SDL_Renderer; +} + +pub const SDL_PROP_RENDERER_CREATE_NAME_STRING: *const ::core::ffi::c_char = + c"SDL.renderer.create.name".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.create.window".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.create.surface".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.create.output_colorspace".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.create.present_vsync".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.create.gpu.device".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.renderer.create.gpu.shaders_spirv".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.renderer.create.gpu.shaders_dxil".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.renderer.create.gpu.shaders_msl".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.create.vulkan.instance".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.create.vulkan.surface".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.create.vulkan.physical_device".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.create.vulkan.device".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER: + *const ::core::ffi::c_char = c"SDL.renderer.create.vulkan.graphics_queue_family_index".as_ptr(); + +pub const SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER: + *const ::core::ffi::c_char = c"SDL.renderer.create.vulkan.present_queue_family_index".as_ptr(); + +unsafe extern "C" { + /// Create a 2D GPU rendering context. + /// + /// The GPU device to use is passed in as a parameter. If this is NULL, then a + /// device will be created normally and can be retrieved using + /// [`SDL_GetGPURendererDevice()`]. + /// + /// The window to use is passed in as a parameter. If this is NULL, then this + /// will become an offscreen renderer. In that case, you should call + /// [`SDL_SetRenderTarget()`] to setup rendering to a texture, and then call + /// [`SDL_RenderPresent()`] normally to complete drawing a frame. + /// + /// ## Parameters + /// - `device`: the GPU device to use with the renderer, or NULL to create a + /// device. + /// - `window`: the window where rendering is displayed, or NULL to create an + /// offscreen renderer. + /// + /// ## Return value + /// Returns a valid rendering context or NULL if there was an error; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// If this function is called with a valid GPU device, it should + /// be called on the thread that created the device. If this + /// function is called with a valid window, it should be called + /// on the thread that created the window. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_CreateRendererWithProperties`] + /// - [`SDL_GetGPURendererDevice`] + /// - [`SDL_CreateGPUShader`] + /// - [`SDL_CreateGPURenderState`] + /// - [`SDL_SetGPURenderState`] + pub fn SDL_CreateGPURenderer( + device: *mut SDL_GPUDevice, + window: *mut SDL_Window, + ) -> *mut SDL_Renderer; +} + +unsafe extern "C" { + /// Return the GPU device used by a renderer. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns the GPU device used by the renderer, or NULL if the renderer is + /// not a GPU renderer; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetGPURendererDevice(renderer: *mut SDL_Renderer) -> *mut SDL_GPUDevice; +} + +unsafe extern "C" { + /// Create a 2D software rendering context for a surface. + /// + /// Two other APIs which can be used to create [`SDL_Renderer`]\: + /// [`SDL_CreateRenderer()`] and [`SDL_CreateWindowAndRenderer()`]. These can _also_ + /// create a software renderer, but they are intended to be used with an + /// [`SDL_Window`] as the final destination and not an [`SDL_Surface`]. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure representing the surface where + /// rendering is done. + /// + /// ## Return value + /// Returns a valid rendering context or NULL if there was an error; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyRenderer`] + pub fn SDL_CreateSoftwareRenderer(surface: *mut SDL_Surface) -> *mut SDL_Renderer; +} + +unsafe extern "C" { + /// Get the renderer associated with a window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the rendering context on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRenderer(window: *mut SDL_Window) -> *mut SDL_Renderer; +} + +unsafe extern "C" { + /// Get the window associated with a renderer. + /// + /// ## Parameters + /// - `renderer`: the renderer to query. + /// + /// ## Return value + /// Returns the window on success or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRenderWindow(renderer: *mut SDL_Renderer) -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Get the name of a renderer. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns the name of the selected renderer, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRenderer`] + /// - [`SDL_CreateRendererWithProperties`] + pub fn SDL_GetRendererName(renderer: *mut SDL_Renderer) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the properties associated with a renderer. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_RENDERER_NAME_STRING`]\: the name of the rendering driver + /// - [`SDL_PROP_RENDERER_WINDOW_POINTER`]\: the window where rendering is + /// displayed, if any + /// - [`SDL_PROP_RENDERER_SURFACE_POINTER`]\: the surface where rendering is + /// displayed, if this is a software renderer without a window + /// - [`SDL_PROP_RENDERER_VSYNC_NUMBER`]\: the current vsync setting + /// - [`SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER`]\: the maximum texture width + /// and height + /// - [`SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`]\: a (const [`SDL_PixelFormat`] *) + /// array of pixel formats, terminated with [`SDL_PIXELFORMAT_UNKNOWN`], + /// representing the available texture formats for this renderer. + /// - [`SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN`]\: true if the renderer + /// supports [`SDL_TEXTURE_ADDRESS_WRAP`] on non-power-of-two textures. + /// - [`SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`]\: an [`SDL_Colorspace`] value + /// describing the colorspace for output to the display, defaults to + /// [`SDL_COLORSPACE_SRGB`]. + /// - [`SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN`]\: true if the output colorspace is + /// [`SDL_COLORSPACE_SRGB_LINEAR`] and the renderer is showing on a display with + /// HDR enabled. This property can change dynamically when + /// [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent. + /// - [`SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT`]\: the value of SDR white in the + /// [`SDL_COLORSPACE_SRGB_LINEAR`] colorspace. When HDR is enabled, this value is + /// automatically multiplied into the color scale. This property can change + /// dynamically when [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent. + /// - [`SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT`]\: the additional high dynamic range + /// that can be displayed, in terms of the SDR white point. When HDR is not + /// enabled, this will be 1.0. This property can change dynamically when + /// [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent. + /// + /// With the direct3d renderer: + /// + /// - [`SDL_PROP_RENDERER_D3D9_DEVICE_POINTER`]\: the IDirect3DDevice9 associated + /// with the renderer + /// + /// With the direct3d11 renderer: + /// + /// - [`SDL_PROP_RENDERER_D3D11_DEVICE_POINTER`]\: the ID3D11Device associated + /// with the renderer + /// - [`SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER`]\: the IDXGISwapChain1 + /// associated with the renderer. This may change when the window is resized. + /// + /// With the direct3d12 renderer: + /// + /// - [`SDL_PROP_RENDERER_D3D12_DEVICE_POINTER`]\: the ID3D12Device associated + /// with the renderer + /// - [`SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER`]\: the IDXGISwapChain4 + /// associated with the renderer. + /// - [`SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER`]\: the ID3D12CommandQueue + /// associated with the renderer + /// + /// With the vulkan renderer: + /// + /// - [`SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER`]\: the VkInstance associated + /// with the renderer + /// - [`SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER`]\: the VkSurfaceKHR associated + /// with the renderer + /// - [`SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER`]\: the VkPhysicalDevice + /// associated with the renderer + /// - [`SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER`]\: the VkDevice associated with + /// the renderer + /// - [`SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`]\: the queue + /// family index used for rendering + /// - [`SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`]\: the queue + /// family index used for presentation + /// - [`SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`]\: the number of + /// swapchain images, or potential frames in flight, used by the Vulkan + /// renderer + /// + /// With the gpu renderer: + /// + /// - [`SDL_PROP_RENDERER_GPU_DEVICE_POINTER`]\: the [`SDL_GPUDevice`] associated with + /// the renderer + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRendererProperties(renderer: *mut SDL_Renderer) -> SDL_PropertiesID; +} + +pub const SDL_PROP_RENDERER_NAME_STRING: *const ::core::ffi::c_char = c"SDL.renderer.name".as_ptr(); + +pub const SDL_PROP_RENDERER_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.window".as_ptr(); + +pub const SDL_PROP_RENDERER_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.surface".as_ptr(); + +pub const SDL_PROP_RENDERER_VSYNC_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.vsync".as_ptr(); + +pub const SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.max_texture_size".as_ptr(); + +pub const SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.texture_formats".as_ptr(); + +pub const SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.renderer.texture_wrapping".as_ptr(); + +pub const SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.output_colorspace".as_ptr(); + +pub const SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.renderer.HDR_enabled".as_ptr(); + +pub const SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT: *const ::core::ffi::c_char = + c"SDL.renderer.SDR_white_point".as_ptr(); + +pub const SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char = + c"SDL.renderer.HDR_headroom".as_ptr(); + +pub const SDL_PROP_RENDERER_D3D9_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.d3d9.device".as_ptr(); + +pub const SDL_PROP_RENDERER_D3D11_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.d3d11.device".as_ptr(); + +pub const SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.d3d11.swap_chain".as_ptr(); + +pub const SDL_PROP_RENDERER_D3D12_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.d3d12.device".as_ptr(); + +pub const SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.d3d12.swap_chain".as_ptr(); + +pub const SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.d3d12.command_queue".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.instance".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.surface".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.physical_device".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.device".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.graphics_queue_family_index".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.present_queue_family_index".as_ptr(); + +pub const SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER: *const ::core::ffi::c_char = + c"SDL.renderer.vulkan.swapchain_image_count".as_ptr(); + +pub const SDL_PROP_RENDERER_GPU_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.renderer.gpu.device".as_ptr(); + +unsafe extern "C" { + /// Get the output size in pixels of a rendering context. + /// + /// This returns the true output size in pixels, ignoring any render targets or + /// logical size and presentation. + /// + /// For the output size of the current rendering target, with logical size + /// adjustments, use [`SDL_GetCurrentRenderOutputSize()`] instead. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `w`: a pointer filled in with the width in pixels. + /// - `h`: a pointer filled in with the height in pixels. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCurrentRenderOutputSize`] + pub fn SDL_GetRenderOutputSize( + renderer: *mut SDL_Renderer, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current output size in pixels of a rendering context. + /// + /// If a rendering target is active, this will return the size of the rendering + /// target in pixels, otherwise return the value of [`SDL_GetRenderOutputSize()`]. + /// + /// Rendering target or not, the output will be adjusted by the current logical + /// presentation state, dictated by [`SDL_SetRenderLogicalPresentation()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `w`: a pointer filled in with the current width. + /// - `h`: a pointer filled in with the current height. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderOutputSize`] + pub fn SDL_GetCurrentRenderOutputSize( + renderer: *mut SDL_Renderer, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create a texture for a rendering context. + /// + /// The contents of a texture when first created are not defined. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `format`: one of the enumerated values in [`SDL_PixelFormat`]. + /// - `access`: one of the enumerated values in [`SDL_TextureAccess`]. + /// - `w`: the width of the texture in pixels. + /// - `h`: the height of the texture in pixels. + /// + /// ## Return value + /// Returns the created texture or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTextureFromSurface`] + /// - [`SDL_CreateTextureWithProperties`] + /// - [`SDL_DestroyTexture`] + /// - [`SDL_GetTextureSize`] + /// - [`SDL_UpdateTexture`] + pub fn SDL_CreateTexture( + renderer: *mut SDL_Renderer, + format: SDL_PixelFormat, + access: SDL_TextureAccess, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + ) -> *mut SDL_Texture; +} + +unsafe extern "C" { + /// Create a texture from an existing surface. + /// + /// The surface is not modified or freed by this function. + /// + /// The [`SDL_TextureAccess`] hint for the created texture is + /// [`SDL_TEXTUREACCESS_STATIC`]. + /// + /// The pixel format of the created texture may be different from the pixel + /// format of the surface, and can be queried using the + /// [`SDL_PROP_TEXTURE_FORMAT_NUMBER`] property. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `surface`: the [`SDL_Surface`] structure containing pixel data used to fill + /// the texture. + /// + /// ## Return value + /// Returns the created texture or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTexture`] + /// - [`SDL_CreateTextureWithProperties`] + /// - [`SDL_DestroyTexture`] + pub fn SDL_CreateTextureFromSurface( + renderer: *mut SDL_Renderer, + surface: *mut SDL_Surface, + ) -> *mut SDL_Texture; +} + +unsafe extern "C" { + /// Create a texture for a rendering context with the specified properties. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`]\: an [`SDL_Colorspace`] value + /// describing the texture colorspace, defaults to [`SDL_COLORSPACE_SRGB_LINEAR`] + /// for floating point textures, [`SDL_COLORSPACE_HDR10`] for 10-bit textures, + /// [`SDL_COLORSPACE_SRGB`] for other RGB textures and [`SDL_COLORSPACE_JPEG`] for + /// YUV textures. + /// - [`SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`]\: one of the enumerated values in + /// [`SDL_PixelFormat`], defaults to the best RGBA format for the renderer + /// - [`SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`]\: one of the enumerated values in + /// [`SDL_TextureAccess`], defaults to [`SDL_TEXTUREACCESS_STATIC`] + /// - [`SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`]\: the width of the texture in + /// pixels, required + /// - [`SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER`]\: the height of the texture in + /// pixels, required + /// - [`SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER`]\: an [`SDL_Palette`] to use with + /// palettized texture formats. This can be set later with + /// [`SDL_SetTexturePalette()`] + /// - [`SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT`]\: for HDR10 and floating + /// point textures, this defines the value of 100% diffuse white, with higher + /// values being displayed in the High Dynamic Range headroom. This defaults + /// to 100 for HDR10 textures and 1.0 for floating point textures. + /// - [`SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT`]\: for HDR10 and floating + /// point textures, this defines the maximum dynamic range used by the + /// content, in terms of the SDR white point. This would be equivalent to + /// maxCLL / [`SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT`] for HDR10 content. + /// If this is defined, any values outside the range supported by the display + /// will be scaled into the available HDR headroom, otherwise they are + /// clipped. + /// + /// With the direct3d11 renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER`]\: the ID3D11Texture2D + /// associated with the texture, if you want to wrap an existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER`]\: the ID3D11Texture2D + /// associated with the U plane of a YUV texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER`]\: the ID3D11Texture2D + /// associated with the V plane of a YUV texture, if you want to wrap an + /// existing texture. + /// + /// With the direct3d12 renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER`]\: the ID3D12Resource + /// associated with the texture, if you want to wrap an existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER`]\: the ID3D12Resource + /// associated with the U plane of a YUV texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER`]\: the ID3D12Resource + /// associated with the V plane of a YUV texture, if you want to wrap an + /// existing texture. + /// + /// With the metal renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER`]\: the CVPixelBufferRef + /// associated with the texture, if you want to create a texture from an + /// existing pixel buffer. + /// + /// With the opengl renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER`]\: the GLuint texture + /// associated with the texture, if you want to wrap an existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER`]\: the GLuint texture + /// associated with the UV plane of an NV12 texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER`]\: the GLuint texture + /// associated with the U plane of a YUV texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER`]\: the GLuint texture + /// associated with the V plane of a YUV texture, if you want to wrap an + /// existing texture. + /// + /// With the opengles2 renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`]\: the GLuint texture + /// associated with the texture, if you want to wrap an existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`]\: the GLuint texture + /// associated with the UV plane of an NV12 texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`]\: the GLuint texture + /// associated with the U plane of a YUV texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`]\: the GLuint texture + /// associated with the V plane of a YUV texture, if you want to wrap an + /// existing texture. + /// + /// With the vulkan renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER`]\: the VkImage associated + /// with the texture, if you want to wrap an existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER`]\: the VkImageLayout for the + /// VkImage, defaults to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. + /// + /// With the GPU renderer: + /// + /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER`]\: the [`SDL_GPUTexture`] + /// associated with the texture, if you want to wrap an existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_NUMBER`]\: the [`SDL_GPUTexture`] + /// associated with the UV plane of an NV12 texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_NUMBER`]\: the [`SDL_GPUTexture`] + /// associated with the U plane of a YUV texture, if you want to wrap an + /// existing texture. + /// - [`SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_NUMBER`]\: the [`SDL_GPUTexture`] + /// associated with the V plane of a YUV texture, if you want to wrap an + /// existing texture. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns the created texture or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProperties`] + /// - [`SDL_CreateTexture`] + /// - [`SDL_CreateTextureFromSurface`] + /// - [`SDL_DestroyTexture`] + /// - [`SDL_GetTextureSize`] + /// - [`SDL_UpdateTexture`] + pub fn SDL_CreateTextureWithProperties( + renderer: *mut SDL_Renderer, + props: SDL_PropertiesID, + ) -> *mut SDL_Texture; +} + +pub const SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.colorspace".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.format".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.access".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.width".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.height".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.palette".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT: *const ::core::ffi::c_char = + c"SDL.texture.create.SDR_white_point".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char = + c"SDL.texture.create.HDR_headroom".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.d3d11.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.d3d11.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.d3d11.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.d3d12.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.d3d12.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.d3d12.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.metal.pixelbuffer".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengl.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengl.texture_uv".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengl.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengl.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengles2.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengles2.texture_uv".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengles2.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.opengles2.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.vulkan.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.create.vulkan.layout".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.gpu.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.gpu.texture_uv".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.gpu.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.create.gpu.texture_v".as_ptr(); + +unsafe extern "C" { + /// Get the properties associated with a texture. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_TEXTURE_COLORSPACE_NUMBER`]\: an [`SDL_Colorspace`] value describing + /// the texture colorspace. + /// - [`SDL_PROP_TEXTURE_FORMAT_NUMBER`]\: one of the enumerated values in + /// [`SDL_PixelFormat`]. + /// - [`SDL_PROP_TEXTURE_ACCESS_NUMBER`]\: one of the enumerated values in + /// [`SDL_TextureAccess`]. + /// - [`SDL_PROP_TEXTURE_WIDTH_NUMBER`]\: the width of the texture in pixels. + /// - [`SDL_PROP_TEXTURE_HEIGHT_NUMBER`]\: the height of the texture in pixels. + /// - [`SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT`]\: for HDR10 and floating point + /// textures, this defines the value of 100% diffuse white, with higher + /// values being displayed in the High Dynamic Range headroom. This defaults + /// to 100 for HDR10 textures and 1.0 for other textures. + /// - [`SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT`]\: for HDR10 and floating point + /// textures, this defines the maximum dynamic range used by the content, in + /// terms of the SDR white point. If this is defined, any values outside the + /// range supported by the display will be scaled into the available HDR + /// headroom, otherwise they are clipped. This defaults to 1.0 for SDR + /// textures, 4.0 for HDR10 textures, and no default for floating point + /// textures. + /// + /// With the direct3d11 renderer: + /// + /// - [`SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`]\: the ID3D11Texture2D associated + /// with the texture + /// - [`SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`]\: the ID3D11Texture2D + /// associated with the U plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`]\: the ID3D11Texture2D + /// associated with the V plane of a YUV texture + /// + /// With the direct3d12 renderer: + /// + /// - [`SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`]\: the ID3D12Resource associated + /// with the texture + /// - [`SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`]\: the ID3D12Resource associated + /// with the U plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`]\: the ID3D12Resource associated + /// with the V plane of a YUV texture + /// + /// With the vulkan renderer: + /// + /// - [`SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER`]\: the VkImage associated with the + /// texture + /// + /// With the opengl renderer: + /// + /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`]\: the GLuint texture associated + /// with the texture + /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`]\: the GLuint texture + /// associated with the UV plane of an NV12 texture + /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`]\: the GLuint texture associated + /// with the U plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`]\: the GLuint texture associated + /// with the V plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER`]\: the GLenum for the + /// texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc) + /// - [`SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`]\: the texture coordinate width of + /// the texture (0.0 - 1.0) + /// - [`SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`]\: the texture coordinate height of + /// the texture (0.0 - 1.0) + /// + /// With the opengles2 renderer: + /// + /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`]\: the GLuint texture + /// associated with the texture + /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`]\: the GLuint texture + /// associated with the UV plane of an NV12 texture + /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`]\: the GLuint texture + /// associated with the U plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`]\: the GLuint texture + /// associated with the V plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`]\: the GLenum for the + /// texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc) + /// + /// With the gpu renderer: + /// + /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER`]\: the [`SDL_GPUTexture`] associated + /// with the texture + /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER`]\: the [`SDL_GPUTexture`] associated + /// with the UV plane of an NV12 texture + /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER`]\: the [`SDL_GPUTexture`] associated + /// with the U plane of a YUV texture + /// - [`SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER`]\: the [`SDL_GPUTexture`] associated + /// with the V plane of a YUV texture + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTextureProperties(texture: *mut SDL_Texture) -> SDL_PropertiesID; +} + +pub const SDL_PROP_TEXTURE_COLORSPACE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.colorspace".as_ptr(); + +pub const SDL_PROP_TEXTURE_FORMAT_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.format".as_ptr(); + +pub const SDL_PROP_TEXTURE_ACCESS_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.access".as_ptr(); + +pub const SDL_PROP_TEXTURE_WIDTH_NUMBER: *const ::core::ffi::c_char = c"SDL.texture.width".as_ptr(); + +pub const SDL_PROP_TEXTURE_HEIGHT_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.height".as_ptr(); + +pub const SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT: *const ::core::ffi::c_char = + c"SDL.texture.SDR_white_point".as_ptr(); + +pub const SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char = + c"SDL.texture.HDR_headroom".as_ptr(); + +pub const SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.d3d11.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.d3d11.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.d3d11.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.d3d12.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.d3d12.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.d3d12.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengl.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengl.texture_uv".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengl.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengl.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengl.target".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT: *const ::core::ffi::c_char = + c"SDL.texture.opengl.tex_w".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT: *const ::core::ffi::c_char = + c"SDL.texture.opengl.tex_h".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengles2.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengles2.texture_uv".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengles2.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengles2.texture_v".as_ptr(); + +pub const SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.opengles2.target".as_ptr(); + +pub const SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER: *const ::core::ffi::c_char = + c"SDL.texture.vulkan.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.gpu.texture".as_ptr(); + +pub const SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.gpu.texture_uv".as_ptr(); + +pub const SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.gpu.texture_u".as_ptr(); + +pub const SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER: *const ::core::ffi::c_char = + c"SDL.texture.gpu.texture_v".as_ptr(); + +unsafe extern "C" { + /// Get the renderer that created an [`SDL_Texture`]. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// + /// ## Return value + /// Returns a pointer to the [`SDL_Renderer`] that created the texture, or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRendererFromTexture(texture: *mut SDL_Texture) -> *mut SDL_Renderer; +} + +unsafe extern "C" { + /// Get the size of a texture, as floating point values. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `w`: a pointer filled in with the width of the texture in pixels. This + /// argument can be NULL if you don't need this information. + /// - `h`: a pointer filled in with the height of the texture in pixels. This + /// argument can be NULL if you don't need this information. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTextureSize( + texture: *mut SDL_Texture, + w: *mut ::core::ffi::c_float, + h: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the palette used by a texture. + /// + /// Setting the palette keeps an internal reference to the palette, which can + /// be safely destroyed afterwards. + /// + /// A single palette can be shared with many textures. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `palette`: the [`SDL_Palette`] structure to use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_CreatePalette`] + /// - [`SDL_GetTexturePalette`] + pub fn SDL_SetTexturePalette( + texture: *mut SDL_Texture, + palette: *mut SDL_Palette, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the palette used by a texture. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// + /// ## Return value + /// Returns a pointer to the palette used by the texture, or NULL if there is + /// no palette used. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_SetTexturePalette`] + pub fn SDL_GetTexturePalette(texture: *mut SDL_Texture) -> *mut SDL_Palette; +} + +unsafe extern "C" { + /// Set an additional color value multiplied into render copy operations. + /// + /// When this texture is rendered, during the copy operation each source color + /// channel is modulated by the appropriate color value according to the + /// following formula: + /// + /// `srcC = srcC * (color / 255)` + /// + /// Color modulation is not always supported by the renderer; it will return + /// false if color modulation is not supported. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `r`: the red color value multiplied into copy operations. + /// - `g`: the green color value multiplied into copy operations. + /// - `b`: the blue color value multiplied into copy operations. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureColorMod`] + /// - [`SDL_SetTextureAlphaMod`] + /// - [`SDL_SetTextureColorModFloat`] + pub fn SDL_SetTextureColorMod( + texture: *mut SDL_Texture, + r: Uint8, + g: Uint8, + b: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an additional color value multiplied into render copy operations. + /// + /// When this texture is rendered, during the copy operation each source color + /// channel is modulated by the appropriate color value according to the + /// following formula: + /// + /// `srcC = srcC * color` + /// + /// Color modulation is not always supported by the renderer; it will return + /// false if color modulation is not supported. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `r`: the red color value multiplied into copy operations. + /// - `g`: the green color value multiplied into copy operations. + /// - `b`: the blue color value multiplied into copy operations. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureColorModFloat`] + /// - [`SDL_SetTextureAlphaModFloat`] + /// - [`SDL_SetTextureColorMod`] + pub fn SDL_SetTextureColorModFloat( + texture: *mut SDL_Texture, + r: ::core::ffi::c_float, + g: ::core::ffi::c_float, + b: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the additional color value multiplied into render copy operations. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `r`: a pointer filled in with the current red color value. + /// - `g`: a pointer filled in with the current green color value. + /// - `b`: a pointer filled in with the current blue color value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureAlphaMod`] + /// - [`SDL_GetTextureColorModFloat`] + /// - [`SDL_SetTextureColorMod`] + pub fn SDL_GetTextureColorMod( + texture: *mut SDL_Texture, + r: *mut Uint8, + g: *mut Uint8, + b: *mut Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the additional color value multiplied into render copy operations. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `r`: a pointer filled in with the current red color value. + /// - `g`: a pointer filled in with the current green color value. + /// - `b`: a pointer filled in with the current blue color value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureAlphaModFloat`] + /// - [`SDL_GetTextureColorMod`] + /// - [`SDL_SetTextureColorModFloat`] + pub fn SDL_GetTextureColorModFloat( + texture: *mut SDL_Texture, + r: *mut ::core::ffi::c_float, + g: *mut ::core::ffi::c_float, + b: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an additional alpha value multiplied into render copy operations. + /// + /// When this texture is rendered, during the copy operation the source alpha + /// value is modulated by this alpha value according to the following formula: + /// + /// `srcA = srcA * (alpha / 255)` + /// + /// Alpha modulation is not always supported by the renderer; it will return + /// false if alpha modulation is not supported. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `alpha`: the source alpha value multiplied into copy operations. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureAlphaMod`] + /// - [`SDL_SetTextureAlphaModFloat`] + /// - [`SDL_SetTextureColorMod`] + pub fn SDL_SetTextureAlphaMod( + texture: *mut SDL_Texture, + alpha: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an additional alpha value multiplied into render copy operations. + /// + /// When this texture is rendered, during the copy operation the source alpha + /// value is modulated by this alpha value according to the following formula: + /// + /// `srcA = srcA * alpha` + /// + /// Alpha modulation is not always supported by the renderer; it will return + /// false if alpha modulation is not supported. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `alpha`: the source alpha value multiplied into copy operations. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureAlphaModFloat`] + /// - [`SDL_SetTextureAlphaMod`] + /// - [`SDL_SetTextureColorModFloat`] + pub fn SDL_SetTextureAlphaModFloat( + texture: *mut SDL_Texture, + alpha: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the additional alpha value multiplied into render copy operations. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `alpha`: a pointer filled in with the current alpha value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureAlphaModFloat`] + /// - [`SDL_GetTextureColorMod`] + /// - [`SDL_SetTextureAlphaMod`] + pub fn SDL_GetTextureAlphaMod( + texture: *mut SDL_Texture, + alpha: *mut Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the additional alpha value multiplied into render copy operations. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `alpha`: a pointer filled in with the current alpha value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureAlphaMod`] + /// - [`SDL_GetTextureColorModFloat`] + /// - [`SDL_SetTextureAlphaModFloat`] + pub fn SDL_GetTextureAlphaModFloat( + texture: *mut SDL_Texture, + alpha: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the blend mode for a texture, used by [`SDL_RenderTexture()`]. + /// + /// This blend mode is used for any drawing that involves this texture. + /// + /// If the blend mode is not supported, the closest supported mode is chosen + /// and this function returns false. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `blendMode`: the [`SDL_BlendMode`] to use for texture blending. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureBlendMode`] + /// - [`SDL_SetRenderDrawBlendMode`] + pub fn SDL_SetTextureBlendMode( + texture: *mut SDL_Texture, + blendMode: SDL_BlendMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the blend mode used for texture copy operations. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `blendMode`: a pointer filled in with the current [`SDL_BlendMode`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetTextureBlendMode`] + pub fn SDL_GetTextureBlendMode( + texture: *mut SDL_Texture, + blendMode: *mut SDL_BlendMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the scale mode used for texture scale operations. + /// + /// The default texture scale mode is [`SDL_SCALEMODE_LINEAR`]. + /// + /// If the scale mode is not supported, the closest supported mode is chosen. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `scaleMode`: the [`SDL_ScaleMode`] to use for texture scaling. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTextureScaleMode`] + pub fn SDL_SetTextureScaleMode( + texture: *mut SDL_Texture, + scaleMode: SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the scale mode used for texture scale operations. + /// + /// ## Parameters + /// - `texture`: the texture to query. + /// - `scaleMode`: a pointer filled in with the current scale mode. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetTextureScaleMode`] + pub fn SDL_GetTextureScaleMode( + texture: *mut SDL_Texture, + scaleMode: *mut SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update the given texture rectangle with new pixel data. + /// + /// The pixel data must be in the pixel format of the texture, which can be + /// queried using the [`SDL_PROP_TEXTURE_FORMAT_NUMBER`] property. + /// + /// This is a fairly slow function, intended for use with static textures that + /// do not change often. + /// + /// If the texture is intended to be updated often, it is preferred to create + /// the texture as streaming and use the locking functions referenced below. + /// While this function will work with streaming textures, for optimization + /// reasons you may not get the pixels back if you lock the texture afterward. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `rect`: an [`SDL_Rect`] structure representing the area to update, or NULL + /// to update the entire texture. + /// - `pixels`: the raw pixel data in the format of the texture. + /// - `pitch`: the number of bytes in a row of pixel data, including padding + /// between lines. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockTexture`] + /// - [`SDL_UnlockTexture`] + /// - [`SDL_UpdateNVTexture`] + /// - [`SDL_UpdateYUVTexture`] + pub fn SDL_UpdateTexture( + texture: *mut SDL_Texture, + rect: *const SDL_Rect, + pixels: *const ::core::ffi::c_void, + pitch: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update a rectangle within a planar YV12 or IYUV texture with new pixel + /// data. + /// + /// You can use [`SDL_UpdateTexture()`] as long as your pixel data is a contiguous + /// block of Y and U/V planes in the proper order, but this function is + /// available if your pixel data is not contiguous. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `rect`: a pointer to the rectangle of pixels to update, or NULL to + /// update the entire texture. + /// - `Yplane`: the raw pixel data for the Y plane. + /// - `Ypitch`: the number of bytes between rows of pixel data for the Y + /// plane. + /// - `Uplane`: the raw pixel data for the U plane. + /// - `Upitch`: the number of bytes between rows of pixel data for the U + /// plane. + /// - `Vplane`: the raw pixel data for the V plane. + /// - `Vpitch`: the number of bytes between rows of pixel data for the V + /// plane. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UpdateNVTexture`] + /// - [`SDL_UpdateTexture`] + pub fn SDL_UpdateYUVTexture( + texture: *mut SDL_Texture, + rect: *const SDL_Rect, + Yplane: *const Uint8, + Ypitch: ::core::ffi::c_int, + Uplane: *const Uint8, + Upitch: ::core::ffi::c_int, + Vplane: *const Uint8, + Vpitch: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update a rectangle within a planar NV12 or NV21 texture with new pixels. + /// + /// You can use [`SDL_UpdateTexture()`] as long as your pixel data is a contiguous + /// block of NV12/21 planes in the proper order, but this function is available + /// if your pixel data is not contiguous. + /// + /// ## Parameters + /// - `texture`: the texture to update. + /// - `rect`: a pointer to the rectangle of pixels to update, or NULL to + /// update the entire texture. + /// - `Yplane`: the raw pixel data for the Y plane. + /// - `Ypitch`: the number of bytes between rows of pixel data for the Y + /// plane. + /// - `UVplane`: the raw pixel data for the UV plane. + /// - `UVpitch`: the number of bytes between rows of pixel data for the UV + /// plane. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UpdateTexture`] + /// - [`SDL_UpdateYUVTexture`] + pub fn SDL_UpdateNVTexture( + texture: *mut SDL_Texture, + rect: *const SDL_Rect, + Yplane: *const Uint8, + Ypitch: ::core::ffi::c_int, + UVplane: *const Uint8, + UVpitch: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Lock a portion of the texture for **write-only** pixel access. + /// + /// As an optimization, the pixels made available for editing don't necessarily + /// contain the old texture data. This is a write-only operation, and if you + /// need to keep a copy of the texture data you should do that at the + /// application level. + /// + /// You must use [`SDL_UnlockTexture()`] to unlock the pixels and apply any + /// changes. + /// + /// ## Parameters + /// - `texture`: the texture to lock for access, which was created with + /// [`SDL_TEXTUREACCESS_STREAMING`]. + /// - `rect`: an [`SDL_Rect`] structure representing the area to lock for access; + /// NULL to lock the entire texture. + /// - `pixels`: this is filled in with a pointer to the locked pixels, + /// appropriately offset by the locked area. + /// - `pitch`: this is filled in with the pitch of the locked pixels; the + /// pitch is the length of one row in bytes. + /// + /// ## Return value + /// Returns true on success or false if the texture is not valid or was not + /// created with [`SDL_TEXTUREACCESS_STREAMING`]; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockTextureToSurface`] + /// - [`SDL_UnlockTexture`] + pub fn SDL_LockTexture( + texture: *mut SDL_Texture, + rect: *const SDL_Rect, + pixels: *mut *mut ::core::ffi::c_void, + pitch: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Lock a portion of the texture for **write-only** pixel access, and expose + /// it as a SDL surface. + /// + /// Besides providing an [`SDL_Surface`] instead of raw pixel data, this function + /// operates like [`SDL_LockTexture`]. + /// + /// As an optimization, the pixels made available for editing don't necessarily + /// contain the old texture data. This is a write-only operation, and if you + /// need to keep a copy of the texture data you should do that at the + /// application level. + /// + /// You must use [`SDL_UnlockTexture()`] to unlock the pixels and apply any + /// changes. + /// + /// The returned surface is freed internally after calling [`SDL_UnlockTexture()`] + /// or [`SDL_DestroyTexture()`]. The caller should not free it. + /// + /// ## Parameters + /// - `texture`: the texture to lock for access, which must be created with + /// [`SDL_TEXTUREACCESS_STREAMING`]. + /// - `rect`: a pointer to the rectangle to lock for access. If the rect is + /// NULL, the entire texture will be locked. + /// - `surface`: a pointer to an SDL surface of size **rect**. Don't assume + /// any specific pixel content. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockTexture`] + /// - [`SDL_UnlockTexture`] + pub fn SDL_LockTextureToSurface( + texture: *mut SDL_Texture, + rect: *const SDL_Rect, + surface: *mut *mut SDL_Surface, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Unlock a texture, uploading the changes to video memory, if needed. + /// + /// **Warning**: Please note that [`SDL_LockTexture()`] is intended to be + /// write-only; it will not guarantee the previous contents of the texture will + /// be provided. You must fully initialize any area of a texture that you lock + /// before unlocking it, as the pixels might otherwise be uninitialized memory. + /// + /// Which is to say: locking and immediately unlocking a texture can result in + /// corrupted textures, depending on the renderer in use. + /// + /// ## Parameters + /// - `texture`: a texture locked by [`SDL_LockTexture()`]. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockTexture`] + pub fn SDL_UnlockTexture(texture: *mut SDL_Texture); +} + +unsafe extern "C" { + /// Set a texture as the current rendering target. + /// + /// The default render target is the window for which the renderer was created. + /// To stop rendering to a texture and render to the window again, call this + /// function with a NULL `texture`. + /// + /// Viewport, cliprect, scale, and logical presentation are unique to each + /// render target. Get and set functions for these states apply to the current + /// render target set by this function, and those states persist on each target + /// when the current render target changes. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `texture`: the targeted texture, which must be created with the + /// [`SDL_TEXTUREACCESS_TARGET`] flag, or NULL to render to the + /// window instead of a texture. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderTarget`] + pub fn SDL_SetRenderTarget( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the current render target. + /// + /// The default render target is the window for which the renderer was created, + /// and is reported a NULL here. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns the current render target or NULL for the default render target. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderTarget`] + pub fn SDL_GetRenderTarget(renderer: *mut SDL_Renderer) -> *mut SDL_Texture; +} + +unsafe extern "C" { + /// Set a device-independent resolution and presentation mode for rendering. + /// + /// This function sets the width and height of the logical rendering output. + /// The renderer will act as if the current render target is always the + /// requested dimensions, scaling to the actual resolution as necessary. + /// + /// This can be useful for games that expect a fixed size, but would like to + /// scale the output to whatever is available, regardless of how a user resizes + /// a window, or if the display is high DPI. + /// + /// Logical presentation can be used with both render target textures and the + /// renderer's window; the state is unique to each render target, and this + /// function sets the state for the current render target. It might be useful + /// to draw to a texture that matches the window dimensions with logical + /// presentation enabled, and then draw that texture across the entire window + /// with logical presentation disabled. Be careful not to render both with + /// logical presentation enabled, however, as this could produce + /// double-letterboxing, etc. + /// + /// You can disable logical coordinates by setting the mode to + /// [`SDL_LOGICAL_PRESENTATION_DISABLED`], and in that case you get the full pixel + /// resolution of the render target; it is safe to toggle logical presentation + /// during the rendering of a frame: perhaps most of the rendering is done to + /// specific dimensions but to make fonts look sharp, the app turns off logical + /// presentation while drawing text, for example. + /// + /// You can convert coordinates in an event into rendering coordinates using + /// [`SDL_ConvertEventToRenderCoordinates()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `w`: the width of the logical resolution. + /// - `h`: the height of the logical resolution. + /// - `mode`: the presentation mode used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ConvertEventToRenderCoordinates`] + /// - [`SDL_GetRenderLogicalPresentation`] + /// - [`SDL_GetRenderLogicalPresentationRect`] + pub fn SDL_SetRenderLogicalPresentation( + renderer: *mut SDL_Renderer, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + mode: SDL_RendererLogicalPresentation, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get device independent resolution and presentation mode for rendering. + /// + /// This function gets the width and height of the logical rendering output, or + /// 0 if a logical resolution is not enabled. + /// + /// Each render target has its own logical presentation state. This function + /// gets the state for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `w`: an int filled with the logical presentation width. + /// - `h`: an int filled with the logical presentation height. + /// - `mode`: a variable filled with the logical presentation mode being + /// used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderLogicalPresentation`] + pub fn SDL_GetRenderLogicalPresentation( + renderer: *mut SDL_Renderer, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + mode: *mut SDL_RendererLogicalPresentation, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the final presentation rectangle for rendering. + /// + /// This function returns the calculated rectangle used for logical + /// presentation, based on the presentation mode and output size. If logical + /// presentation is disabled, it will fill the rectangle with the output size, + /// in pixels. + /// + /// Each render target has its own logical presentation state. This function + /// gets the rectangle for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: a pointer filled in with the final presentation rectangle, may + /// be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderLogicalPresentation`] + pub fn SDL_GetRenderLogicalPresentationRect( + renderer: *mut SDL_Renderer, + rect: *mut SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a point in render coordinates when given a point in window coordinates. + /// + /// This takes into account several states: + /// + /// - The window dimensions. + /// - The logical presentation settings ([`SDL_SetRenderLogicalPresentation`]) + /// - The scale ([`SDL_SetRenderScale`]) + /// - The viewport ([`SDL_SetRenderViewport`]) + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `window_x`: the x coordinate in window coordinates. + /// - `window_y`: the y coordinate in window coordinates. + /// - `x`: a pointer filled with the x coordinate in render coordinates. + /// - `y`: a pointer filled with the y coordinate in render coordinates. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderLogicalPresentation`] + /// - [`SDL_SetRenderScale`] + pub fn SDL_RenderCoordinatesFromWindow( + renderer: *mut SDL_Renderer, + window_x: ::core::ffi::c_float, + window_y: ::core::ffi::c_float, + x: *mut ::core::ffi::c_float, + y: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a point in window coordinates when given a point in render coordinates. + /// + /// This takes into account several states: + /// + /// - The window dimensions. + /// - The logical presentation settings ([`SDL_SetRenderLogicalPresentation`]) + /// - The scale ([`SDL_SetRenderScale`]) + /// - The viewport ([`SDL_SetRenderViewport`]) + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `x`: the x coordinate in render coordinates. + /// - `y`: the y coordinate in render coordinates. + /// - `window_x`: a pointer filled with the x coordinate in window + /// coordinates. + /// - `window_y`: a pointer filled with the y coordinate in window + /// coordinates. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderLogicalPresentation`] + /// - [`SDL_SetRenderScale`] + /// - [`SDL_SetRenderViewport`] + pub fn SDL_RenderCoordinatesToWindow( + renderer: *mut SDL_Renderer, + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + window_x: *mut ::core::ffi::c_float, + window_y: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Convert the coordinates in an event to render coordinates. + /// + /// This takes into account several states: + /// + /// - The window dimensions. + /// - The logical presentation settings ([`SDL_SetRenderLogicalPresentation`]) + /// - The scale ([`SDL_SetRenderScale`]) + /// - The viewport ([`SDL_SetRenderViewport`]) + /// + /// Various event types are converted with this function: mouse, touch, pen, + /// etc. + /// + /// Touch coordinates are converted from normalized coordinates in the window + /// to non-normalized rendering coordinates. + /// + /// Relative mouse coordinates (xrel and yrel event fields) are _also_ + /// converted. Applications that do not want these fields converted should use + /// [`SDL_RenderCoordinatesFromWindow()`] on the specific event fields instead of + /// converting the entire event structure. + /// + /// Once converted, coordinates may be outside the rendering area. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `event`: the event to modify. + /// + /// ## Return value + /// Returns true if the event is converted or doesn't need conversion, or + /// false on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderCoordinatesFromWindow`] + pub fn SDL_ConvertEventToRenderCoordinates( + renderer: *mut SDL_Renderer, + event: *mut SDL_Event, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the drawing area for rendering on the current target. + /// + /// Drawing will clip to this area (separately from any clipping done with + /// [`SDL_SetRenderClipRect`]), and the top left of the area will become coordinate + /// (0, 0) for future drawing commands. + /// + /// The area's width and height must be >= 0. + /// + /// Each render target has its own viewport. This function sets the viewport + /// for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: the [`SDL_Rect`] structure representing the drawing area, or NULL + /// to set the viewport to the entire target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderViewport`] + /// - [`SDL_RenderViewportSet`] + pub fn SDL_SetRenderViewport( + renderer: *mut SDL_Renderer, + rect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the drawing area for the current target. + /// + /// Each render target has its own viewport. This function gets the viewport + /// for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: an [`SDL_Rect`] structure filled in with the current drawing area. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderViewportSet`] + /// - [`SDL_SetRenderViewport`] + pub fn SDL_GetRenderViewport( + renderer: *mut SDL_Renderer, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether an explicit rectangle was set as the viewport. + /// + /// This is useful if you're saving and restoring the viewport and want to know + /// whether you should restore a specific rectangle or NULL. + /// + /// Each render target has its own viewport. This function checks the viewport + /// for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns true if the viewport was set to a specific rectangle, or false if + /// it was set to NULL (the entire target). + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderViewport`] + /// - [`SDL_SetRenderViewport`] + pub fn SDL_RenderViewportSet(renderer: *mut SDL_Renderer) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the safe area for rendering within the current viewport. + /// + /// Some devices have portions of the screen which are partially obscured or + /// not interactive, possibly due to on-screen controls, curved edges, camera + /// notches, TV overscan, etc. This function provides the area of the current + /// viewport which is safe to have interactible content. You should continue + /// rendering into the rest of the render target, but it should not contain + /// visually important or interactible content. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: a pointer filled in with the area that is safe for interactive + /// content. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetRenderSafeArea( + renderer: *mut SDL_Renderer, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the clip rectangle for rendering on the specified target. + /// + /// Each render target has its own clip rectangle. This function sets the + /// cliprect for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: an [`SDL_Rect`] structure representing the clip area, relative to + /// the viewport, or NULL to disable clipping. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderClipRect`] + /// - [`SDL_RenderClipEnabled`] + pub fn SDL_SetRenderClipRect( + renderer: *mut SDL_Renderer, + rect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the clip rectangle for the current target. + /// + /// Each render target has its own clip rectangle. This function gets the + /// cliprect for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: an [`SDL_Rect`] structure filled in with the current clipping area + /// or an empty rectangle if clipping is disabled. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderClipEnabled`] + /// - [`SDL_SetRenderClipRect`] + pub fn SDL_GetRenderClipRect( + renderer: *mut SDL_Renderer, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get whether clipping is enabled on the given render target. + /// + /// Each render target has its own clip rectangle. This function checks the + /// cliprect for the current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns true if clipping is enabled or false if not; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderClipRect`] + /// - [`SDL_SetRenderClipRect`] + pub fn SDL_RenderClipEnabled(renderer: *mut SDL_Renderer) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the drawing scale for rendering on the current target. + /// + /// The drawing coordinates are scaled by the x/y scaling factors before they + /// are used by the renderer. This allows resolution independent drawing with a + /// single coordinate system. + /// + /// If this results in scaling or subpixel drawing by the rendering backend, it + /// will be handled using the appropriate quality hints. For best results use + /// integer scaling factors. + /// + /// Each render target has its own scale. This function sets the scale for the + /// current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `scaleX`: the horizontal scaling factor. + /// - `scaleY`: the vertical scaling factor. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderScale`] + pub fn SDL_SetRenderScale( + renderer: *mut SDL_Renderer, + scaleX: ::core::ffi::c_float, + scaleY: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the drawing scale for the current target. + /// + /// Each render target has its own scale. This function gets the scale for the + /// current render target. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `scaleX`: a pointer filled in with the horizontal scaling factor. + /// - `scaleY`: a pointer filled in with the vertical scaling factor. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderScale`] + pub fn SDL_GetRenderScale( + renderer: *mut SDL_Renderer, + scaleX: *mut ::core::ffi::c_float, + scaleY: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the color used for drawing operations. + /// + /// Set the color for drawing or filling rectangles, lines, and points, and for + /// [`SDL_RenderClear()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `r`: the red value used to draw on the rendering target. + /// - `g`: the green value used to draw on the rendering target. + /// - `b`: the blue value used to draw on the rendering target. + /// - `a`: the alpha value used to draw on the rendering target; usually + /// [`SDL_ALPHA_OPAQUE`] (255). Use [`SDL_SetRenderDrawBlendMode`] to + /// specify how the alpha channel is used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderDrawColor`] + /// - [`SDL_SetRenderDrawColorFloat`] + pub fn SDL_SetRenderDrawColor( + renderer: *mut SDL_Renderer, + r: Uint8, + g: Uint8, + b: Uint8, + a: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the color used for drawing operations (Rect, Line and Clear). + /// + /// Set the color for drawing or filling rectangles, lines, and points, and for + /// [`SDL_RenderClear()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `r`: the red value used to draw on the rendering target. + /// - `g`: the green value used to draw on the rendering target. + /// - `b`: the blue value used to draw on the rendering target. + /// - `a`: the alpha value used to draw on the rendering target. Use + /// [`SDL_SetRenderDrawBlendMode`] to specify how the alpha channel is + /// used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderDrawColorFloat`] + /// - [`SDL_SetRenderDrawColor`] + pub fn SDL_SetRenderDrawColorFloat( + renderer: *mut SDL_Renderer, + r: ::core::ffi::c_float, + g: ::core::ffi::c_float, + b: ::core::ffi::c_float, + a: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the color used for drawing operations (Rect, Line and Clear). + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `r`: a pointer filled in with the red value used to draw on the + /// rendering target. + /// - `g`: a pointer filled in with the green value used to draw on the + /// rendering target. + /// - `b`: a pointer filled in with the blue value used to draw on the + /// rendering target. + /// - `a`: a pointer filled in with the alpha value used to draw on the + /// rendering target; usually [`SDL_ALPHA_OPAQUE`] (255). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderDrawColorFloat`] + /// - [`SDL_SetRenderDrawColor`] + pub fn SDL_GetRenderDrawColor( + renderer: *mut SDL_Renderer, + r: *mut Uint8, + g: *mut Uint8, + b: *mut Uint8, + a: *mut Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the color used for drawing operations (Rect, Line and Clear). + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `r`: a pointer filled in with the red value used to draw on the + /// rendering target. + /// - `g`: a pointer filled in with the green value used to draw on the + /// rendering target. + /// - `b`: a pointer filled in with the blue value used to draw on the + /// rendering target. + /// - `a`: a pointer filled in with the alpha value used to draw on the + /// rendering target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderDrawColorFloat`] + /// - [`SDL_GetRenderDrawColor`] + pub fn SDL_GetRenderDrawColorFloat( + renderer: *mut SDL_Renderer, + r: *mut ::core::ffi::c_float, + g: *mut ::core::ffi::c_float, + b: *mut ::core::ffi::c_float, + a: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the color scale used for render operations. + /// + /// The color scale is an additional scale multiplied into the pixel color + /// value while rendering. This can be used to adjust the brightness of colors + /// during HDR rendering, or changing HDR video brightness when playing on an + /// SDR display. + /// + /// The color scale does not affect the alpha channel, only the color + /// brightness. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `scale`: the color scale value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderColorScale`] + pub fn SDL_SetRenderColorScale( + renderer: *mut SDL_Renderer, + scale: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the color scale used for render operations. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `scale`: a pointer filled in with the current color scale value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderColorScale`] + pub fn SDL_GetRenderColorScale( + renderer: *mut SDL_Renderer, + scale: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the blend mode used for drawing operations. + /// + /// This blend mode is used for any drawing that doesn't involve textures. + /// + /// If the blend mode is not supported, the closest supported mode is chosen. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `blendMode`: the [`SDL_BlendMode`] to use for blending. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderDrawBlendMode`] + /// - [`SDL_SetTextureBlendMode`] + pub fn SDL_SetRenderDrawBlendMode( + renderer: *mut SDL_Renderer, + blendMode: SDL_BlendMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the blend mode used for drawing operations. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `blendMode`: a pointer filled in with the current [`SDL_BlendMode`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderDrawBlendMode`] + pub fn SDL_GetRenderDrawBlendMode( + renderer: *mut SDL_Renderer, + blendMode: *mut SDL_BlendMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear the current rendering target with the drawing color. + /// + /// This function clears the entire rendering target, ignoring the viewport and + /// the clip rectangle. Note, that clearing will also set/fill all pixels of + /// the rendering target to current renderer draw color, so make sure to invoke + /// [`SDL_SetRenderDrawColor()`] when needed. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderDrawColor`] + pub fn SDL_RenderClear(renderer: *mut SDL_Renderer) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw a point on the current rendering target at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw a point. + /// - `x`: the x coordinate of the point. + /// - `y`: the y coordinate of the point. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderPoints`] + pub fn SDL_RenderPoint( + renderer: *mut SDL_Renderer, + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw multiple points on the current rendering target at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw multiple points. + /// - `points`: the points to draw. + /// - `count`: the number of points to draw. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderPoint`] + pub fn SDL_RenderPoints( + renderer: *mut SDL_Renderer, + points: *const SDL_FPoint, + count: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw a line on the current rendering target at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw a line. + /// - `x1`: the x coordinate of the start point. + /// - `y1`: the y coordinate of the start point. + /// - `x2`: the x coordinate of the end point. + /// - `y2`: the y coordinate of the end point. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderLines`] + pub fn SDL_RenderLine( + renderer: *mut SDL_Renderer, + x1: ::core::ffi::c_float, + y1: ::core::ffi::c_float, + x2: ::core::ffi::c_float, + y2: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw a series of connected lines on the current rendering target at + /// subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw multiple lines. + /// - `points`: the points along the lines. + /// - `count`: the number of points, drawing count-1 lines. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderLine`] + pub fn SDL_RenderLines( + renderer: *mut SDL_Renderer, + points: *const SDL_FPoint, + count: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw a rectangle on the current rendering target at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw a rectangle. + /// - `rect`: a pointer to the destination rectangle, or NULL to outline the + /// entire rendering target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderRects`] + pub fn SDL_RenderRect( + renderer: *mut SDL_Renderer, + rect: *const SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw some number of rectangles on the current rendering target at subpixel + /// precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw multiple rectangles. + /// - `rects`: a pointer to an array of destination rectangles. + /// - `count`: the number of rectangles. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderRect`] + pub fn SDL_RenderRects( + renderer: *mut SDL_Renderer, + rects: *const SDL_FRect, + count: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Fill a rectangle on the current rendering target with the drawing color at + /// subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should fill a rectangle. + /// - `rect`: a pointer to the destination rectangle, or NULL for the entire + /// rendering target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderFillRects`] + pub fn SDL_RenderFillRect( + renderer: *mut SDL_Renderer, + rect: *const SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Fill some number of rectangles on the current rendering target with the + /// drawing color at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should fill multiple rectangles. + /// - `rects`: a pointer to an array of destination rectangles. + /// - `count`: the number of rectangles. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderFillRect`] + pub fn SDL_RenderFillRects( + renderer: *mut SDL_Renderer, + rects: *const SDL_FRect, + count: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy a portion of the texture to the current rendering target at subpixel + /// precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should copy parts of a texture. + /// - `texture`: the source texture. + /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire + /// texture. + /// - `dstrect`: a pointer to the destination rectangle, or NULL for the + /// entire rendering target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderTextureRotated`] + /// - [`SDL_RenderTextureTiled`] + pub fn SDL_RenderTexture( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + srcrect: *const SDL_FRect, + dstrect: *const SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy a portion of the source texture to the current rendering target, with + /// rotation and flipping, at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should copy parts of a texture. + /// - `texture`: the source texture. + /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire + /// texture. + /// - `dstrect`: a pointer to the destination rectangle, or NULL for the + /// entire rendering target. + /// - `angle`: an angle in degrees that indicates the rotation that will be + /// applied to dstrect, rotating it in a clockwise direction. + /// - `center`: a pointer to a point indicating the point around which + /// dstrect will be rotated (if NULL, rotation will be done + /// around dstrect.w/2, dstrect.h/2). + /// - `flip`: an [`SDL_FlipMode`] value stating which flipping actions should be + /// performed on the texture. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderTexture`] + pub fn SDL_RenderTextureRotated( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + srcrect: *const SDL_FRect, + dstrect: *const SDL_FRect, + angle: ::core::ffi::c_double, + center: *const SDL_FPoint, + flip: SDL_FlipMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy a portion of the source texture to the current rendering target, with + /// affine transform, at subpixel precision. + /// + /// ## Parameters + /// - `renderer`: the renderer which should copy parts of a texture. + /// - `texture`: the source texture. + /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire + /// texture. + /// - `origin`: a pointer to a point indicating where the top-left corner of + /// srcrect should be mapped to, or NULL for the rendering + /// target's origin. + /// - `right`: a pointer to a point indicating where the top-right corner of + /// srcrect should be mapped to, or NULL for the rendering + /// target's top-right corner. + /// - `down`: a pointer to a point indicating where the bottom-left corner of + /// srcrect should be mapped to, or NULL for the rendering target's + /// bottom-left corner. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// You may only call this function from the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderTexture`] + pub fn SDL_RenderTextureAffine( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + srcrect: *const SDL_FRect, + origin: *const SDL_FPoint, + right: *const SDL_FPoint, + down: *const SDL_FPoint, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Tile a portion of the texture to the current rendering target at subpixel + /// precision. + /// + /// The pixels in `srcrect` will be repeated as many times as needed to + /// completely fill `dstrect`. + /// + /// ## Parameters + /// - `renderer`: the renderer which should copy parts of a texture. + /// - `texture`: the source texture. + /// - `srcrect`: a pointer to the source rectangle, or NULL for the entire + /// texture. + /// - `scale`: the scale used to transform srcrect into the destination + /// rectangle, e.g. a 32x32 texture with a scale of 2 would fill + /// 64x64 tiles. + /// - `dstrect`: a pointer to the destination rectangle, or NULL for the + /// entire rendering target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderTexture`] + pub fn SDL_RenderTextureTiled( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + srcrect: *const SDL_FRect, + scale: ::core::ffi::c_float, + dstrect: *const SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a scaled copy using the 9-grid algorithm to the current rendering + /// target at subpixel precision. + /// + /// The pixels in the texture are split into a 3x3 grid, using the different + /// corner sizes for each corner, and the sides and center making up the + /// remaining pixels. The corners are then scaled using `scale` and fit into + /// the corners of the destination rectangle. The sides and center are then + /// stretched into place to cover the remaining destination rectangle. + /// + /// ## Parameters + /// - `renderer`: the renderer which should copy parts of a texture. + /// - `texture`: the source texture. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be used + /// for the 9-grid, or NULL to use the entire texture. + /// - `left_width`: the width, in pixels, of the left corners in `srcrect`. + /// - `right_width`: the width, in pixels, of the right corners in `srcrect`. + /// - `top_height`: the height, in pixels, of the top corners in `srcrect`. + /// - `bottom_height`: the height, in pixels, of the bottom corners in + /// `srcrect`. + /// - `scale`: the scale used to transform the corner of `srcrect` into the + /// corner of `dstrect`, or 0.0f for an unscaled copy. + /// - `dstrect`: a pointer to the destination rectangle, or NULL for the + /// entire rendering target. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderTexture`] + /// - [`SDL_RenderTexture9GridTiled`] + pub fn SDL_RenderTexture9Grid( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + srcrect: *const SDL_FRect, + left_width: ::core::ffi::c_float, + right_width: ::core::ffi::c_float, + top_height: ::core::ffi::c_float, + bottom_height: ::core::ffi::c_float, + scale: ::core::ffi::c_float, + dstrect: *const SDL_FRect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a scaled copy using the 9-grid algorithm to the current rendering + /// target at subpixel precision. + /// + /// The pixels in the texture are split into a 3x3 grid, using the different + /// corner sizes for each corner, and the sides and center making up the + /// remaining pixels. The corners are then scaled using `scale` and fit into + /// the corners of the destination rectangle. The sides and center are then + /// tiled into place to cover the remaining destination rectangle. + /// + /// ## Parameters + /// - `renderer`: the renderer which should copy parts of a texture. + /// - `texture`: the source texture. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be used + /// for the 9-grid, or NULL to use the entire texture. + /// - `left_width`: the width, in pixels, of the left corners in `srcrect`. + /// - `right_width`: the width, in pixels, of the right corners in `srcrect`. + /// - `top_height`: the height, in pixels, of the top corners in `srcrect`. + /// - `bottom_height`: the height, in pixels, of the bottom corners in + /// `srcrect`. + /// - `scale`: the scale used to transform the corner of `srcrect` into the + /// corner of `dstrect`, or 0.0f for an unscaled copy. + /// - `dstrect`: a pointer to the destination rectangle, or NULL for the + /// entire rendering target. + /// - `tileScale`: the scale used to transform the borders and center of + /// `srcrect` into the borders and middle of `dstrect`, or + /// 1.0f for an unscaled copy. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_RenderTexture`] + /// - [`SDL_RenderTexture9Grid`] + pub fn SDL_RenderTexture9GridTiled( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + srcrect: *const SDL_FRect, + left_width: ::core::ffi::c_float, + right_width: ::core::ffi::c_float, + top_height: ::core::ffi::c_float, + bottom_height: ::core::ffi::c_float, + scale: ::core::ffi::c_float, + dstrect: *const SDL_FRect, + tileScale: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Render a list of triangles, optionally using a texture and indices into the + /// vertex array Color and alpha modulation is done per vertex + /// ([`SDL_SetTextureColorMod`] and [`SDL_SetTextureAlphaMod`] are ignored). + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `texture`: (optional) The SDL texture to use. + /// - `vertices`: vertices. + /// - `num_vertices`: number of vertices. + /// - `indices`: (optional) An array of integer indices into the 'vertices' + /// array, if NULL all vertices will be rendered in sequential + /// order. + /// - `num_indices`: number of indices. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderGeometryRaw`] + /// - [`SDL_SetRenderTextureAddressMode`] + pub fn SDL_RenderGeometry( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + vertices: *const SDL_Vertex, + num_vertices: ::core::ffi::c_int, + indices: *const ::core::ffi::c_int, + num_indices: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Render a list of triangles, optionally using a texture and indices into the + /// vertex arrays Color and alpha modulation is done per vertex + /// ([`SDL_SetTextureColorMod`] and [`SDL_SetTextureAlphaMod`] are ignored). + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `texture`: (optional) The SDL texture to use. + /// - `xy`: vertex positions. + /// - `xy_stride`: byte size to move from one element to the next element. + /// - `color`: vertex colors (as [`SDL_FColor`]). + /// - `color_stride`: byte size to move from one element to the next element. + /// - `uv`: vertex normalized texture coordinates. + /// - `uv_stride`: byte size to move from one element to the next element. + /// - `num_vertices`: number of vertices. + /// - `indices`: (optional) An array of indices into the 'vertices' arrays, + /// if NULL all vertices will be rendered in sequential order. + /// - `num_indices`: number of indices. + /// - `size_indices`: index size: 1 (byte), 2 (short), 4 (int). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderGeometry`] + /// - [`SDL_SetRenderTextureAddressMode`] + pub fn SDL_RenderGeometryRaw( + renderer: *mut SDL_Renderer, + texture: *mut SDL_Texture, + xy: *const ::core::ffi::c_float, + xy_stride: ::core::ffi::c_int, + color: *const SDL_FColor, + color_stride: ::core::ffi::c_int, + uv: *const ::core::ffi::c_float, + uv_stride: ::core::ffi::c_int, + num_vertices: ::core::ffi::c_int, + indices: *const ::core::ffi::c_void, + num_indices: ::core::ffi::c_int, + size_indices: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the texture addressing mode used in [`SDL_RenderGeometry()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `u_mode`: the [`SDL_TextureAddressMode`] to use for horizontal texture + /// coordinates in [`SDL_RenderGeometry()`]. + /// - `v_mode`: the [`SDL_TextureAddressMode`] to use for vertical texture + /// coordinates in [`SDL_RenderGeometry()`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_RenderGeometry`] + /// - [`SDL_RenderGeometryRaw`] + /// - [`SDL_GetRenderTextureAddressMode`] + pub fn SDL_SetRenderTextureAddressMode( + renderer: *mut SDL_Renderer, + u_mode: SDL_TextureAddressMode, + v_mode: SDL_TextureAddressMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the texture addressing mode used in [`SDL_RenderGeometry()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `u_mode`: a pointer filled in with the [`SDL_TextureAddressMode`] to use + /// for horizontal texture coordinates in [`SDL_RenderGeometry()`], + /// may be NULL. + /// - `v_mode`: a pointer filled in with the [`SDL_TextureAddressMode`] to use + /// for vertical texture coordinates in [`SDL_RenderGeometry()`], may + /// be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_SetRenderTextureAddressMode`] + pub fn SDL_GetRenderTextureAddressMode( + renderer: *mut SDL_Renderer, + u_mode: *mut SDL_TextureAddressMode, + v_mode: *mut SDL_TextureAddressMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Read pixels from the current rendering target. + /// + /// The returned surface contains pixels inside the desired area clipped to the + /// current viewport, and should be freed with [`SDL_DestroySurface()`]. + /// + /// Note that this returns the actual pixels on the screen, so if you are using + /// logical presentation you should use [`SDL_GetRenderLogicalPresentationRect()`] + /// to get the area containing your content. + /// + /// **WARNING**: This is a very slow operation, and should not be used + /// frequently. If you're using this on the main rendering target, it should be + /// called after rendering and before [`SDL_RenderPresent()`]. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `rect`: an [`SDL_Rect`] structure representing the area to read, which will + /// be clipped to the current viewport, or NULL for the entire + /// viewport. + /// + /// ## Return value + /// Returns a new [`SDL_Surface`] on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RenderReadPixels( + renderer: *mut SDL_Renderer, + rect: *const SDL_Rect, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Update the screen with any rendering performed since the previous call. + /// + /// SDL's rendering functions operate on a backbuffer; that is, calling a + /// rendering function such as [`SDL_RenderLine()`] does not directly put a line on + /// the screen, but rather updates the backbuffer. As such, you compose your + /// entire scene and *present* the composed backbuffer to the screen as a + /// complete picture. + /// + /// Therefore, when using SDL's rendering API, one does all drawing intended + /// for the frame, and then calls this function once per frame to present the + /// final drawing to the user. + /// + /// The backbuffer should be considered invalidated after each present; do not + /// assume that previous contents will exist between frames. You are strongly + /// encouraged to call [`SDL_RenderClear()`] to initialize the backbuffer before + /// starting each new frame's drawing, even if you plan to overwrite every + /// pixel. + /// + /// Please note, that in case of rendering to a texture - there is **no need** + /// to call [`SDL_RenderPresent`] after drawing needed objects to a texture, and + /// should not be done; you are only required to change back the rendering + /// target to default via `SDL_SetRenderTarget(renderer, NULL)` afterwards, as + /// textures by themselves do not have a concept of backbuffers. Calling + /// [`SDL_RenderPresent`] while rendering to a texture will fail. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRenderer`] + /// - [`SDL_RenderClear`] + /// - [`SDL_RenderFillRect`] + /// - [`SDL_RenderFillRects`] + /// - [`SDL_RenderLine`] + /// - [`SDL_RenderLines`] + /// - [`SDL_RenderPoint`] + /// - [`SDL_RenderPoints`] + /// - [`SDL_RenderRect`] + /// - [`SDL_RenderRects`] + /// - [`SDL_SetRenderDrawBlendMode`] + /// - [`SDL_SetRenderDrawColor`] + pub fn SDL_RenderPresent(renderer: *mut SDL_Renderer) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy the specified texture. + /// + /// Passing NULL or an otherwise invalid texture will set the SDL error message + /// to "Invalid texture". + /// + /// ## Parameters + /// - `texture`: the texture to destroy. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTexture`] + /// - [`SDL_CreateTextureFromSurface`] + pub fn SDL_DestroyTexture(texture: *mut SDL_Texture); +} + +unsafe extern "C" { + /// Destroy the rendering context for a window and free all associated + /// textures. + /// + /// This should be called before destroying the associated window. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateRenderer`] + pub fn SDL_DestroyRenderer(renderer: *mut SDL_Renderer); +} + +unsafe extern "C" { + /// Force the rendering context to flush any pending commands and state. + /// + /// You do not need to (and in fact, shouldn't) call this function unless you + /// are planning to call into OpenGL/Direct3D/Metal/whatever directly, in + /// addition to using an [`SDL_Renderer`]. + /// + /// This is for a very-specific case: if you are using SDL's render API, and + /// you plan to make OpenGL/D3D/whatever calls in addition to SDL render API + /// calls. If this applies, you should call this function between calls to + /// SDL's render API and the low-level API you're using in cooperation. + /// + /// In all other cases, you can ignore this function. + /// + /// This call makes SDL flush any pending rendering work it was queueing up to + /// do later in a single batch, and marks any internal cached state as invalid, + /// so it'll prepare all its state again later, from scratch. + /// + /// This means you do not need to save state in your rendering code to protect + /// the SDL renderer. However, there lots of arbitrary pieces of Direct3D and + /// OpenGL state that can confuse things; you should use your best judgment and + /// be prepared to make changes if specific state needs to be protected. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_FlushRenderer(renderer: *mut SDL_Renderer) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the CAMetalLayer associated with the given Metal renderer. + /// + /// This function returns `void *`, so SDL doesn't have to include Metal's + /// headers, but it can be safely cast to a `CAMetalLayer *`. + /// + /// ## Parameters + /// - `renderer`: the renderer to query. + /// + /// ## Return value + /// Returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a + /// Metal renderer. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderMetalCommandEncoder`] + pub fn SDL_GetRenderMetalLayer(renderer: *mut SDL_Renderer) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Get the Metal command encoder for the current frame. + /// + /// This function returns `void *`, so SDL doesn't have to include Metal's + /// headers, but it can be safely cast to an `id`. + /// + /// This will return NULL if Metal refuses to give SDL a drawable to render to, + /// which might happen if the window is hidden/minimized/offscreen. This + /// doesn't apply to command encoders for render targets, just the window's + /// backbuffer. Check your return values! + /// + /// ## Parameters + /// - `renderer`: the renderer to query. + /// + /// ## Return value + /// Returns an `id` on success, or NULL if the + /// renderer isn't a Metal renderer or there was an error. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderMetalLayer`] + pub fn SDL_GetRenderMetalCommandEncoder( + renderer: *mut SDL_Renderer, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Add a set of synchronization semaphores for the current frame. + /// + /// The Vulkan renderer will wait for `wait_semaphore` before submitting + /// rendering commands and signal `signal_semaphore` after rendering commands + /// are complete for this frame. + /// + /// This should be called each frame that you want semaphore synchronization. + /// The Vulkan renderer may have multiple frames in flight on the GPU, so you + /// should have multiple semaphores that are used for synchronization. Querying + /// [`SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`] will give you the + /// maximum number of semaphores you'll need. + /// + /// ## Parameters + /// - `renderer`: the rendering context. + /// - `wait_stage_mask`: the VkPipelineStageFlags for the wait. + /// - `wait_semaphore`: a VkSempahore to wait on before rendering the current + /// frame, or 0 if not needed. + /// - `signal_semaphore`: a VkSempahore that SDL will signal when rendering + /// for the current frame is complete, or 0 if not + /// needed. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is **NOT** safe to call this function from two threads at + /// once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_AddVulkanRenderSemaphores( + renderer: *mut SDL_Renderer, + wait_stage_mask: Uint32, + wait_semaphore: Sint64, + signal_semaphore: Sint64, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Toggle VSync of the given renderer. + /// + /// When a renderer is created, vsync defaults to [`SDL_RENDERER_VSYNC_DISABLED`]. + /// + /// The `vsync` parameter can be 1 to synchronize present with every vertical + /// refresh, 2 to synchronize present with every second vertical refresh, etc., + /// [`SDL_RENDERER_VSYNC_ADAPTIVE`] for late swap tearing (adaptive vsync), or + /// [`SDL_RENDERER_VSYNC_DISABLED`] to disable. Not every value is supported by + /// every driver, so you should check the return value to see whether the + /// requested setting is supported. + /// + /// ## Parameters + /// - `renderer`: the renderer to toggle. + /// - `vsync`: the vertical refresh sync interval. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderVSync`] + pub fn SDL_SetRenderVSync( + renderer: *mut SDL_Renderer, + vsync: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +pub const SDL_RENDERER_VSYNC_DISABLED: ::core::ffi::c_int = (0 as ::core::ffi::c_int); + +pub const SDL_RENDERER_VSYNC_ADAPTIVE: ::core::ffi::c_int = (-1_i32 as ::core::ffi::c_int); + +unsafe extern "C" { + /// Get VSync of the given renderer. + /// + /// ## Parameters + /// - `renderer`: the renderer to toggle. + /// - `vsync`: an int filled with the current vertical refresh sync interval. + /// See [`SDL_SetRenderVSync()`] for the meaning of the value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetRenderVSync`] + pub fn SDL_GetRenderVSync( + renderer: *mut SDL_Renderer, + vsync: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +/// The size, in pixels, of a single [`SDL_RenderDebugText()`] character. +/// +/// The font is monospaced and square, so this applies to all characters. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_RenderDebugText`] +pub const SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE: ::core::primitive::i32 = 8; + +unsafe extern "C" { + /// Draw debug text to an [`SDL_Renderer`]. + /// + /// This function will render a string of text to an [`SDL_Renderer`]. Note that + /// this is a convenience function for debugging, with severe limitations, and + /// not intended to be used for production apps and games. + /// + /// Among these limitations: + /// + /// - It accepts UTF-8 strings, but will only renders ASCII characters. + /// - It has a single, tiny size (8x8 pixels). You can use logical presentation + /// or [`SDL_SetRenderScale()`] to adjust it. + /// - It uses a simple, hardcoded bitmap font. It does not allow different font + /// selections and it does not support truetype, for proper scaling. + /// - It does no word-wrapping and does not treat newline characters as a line + /// break. If the text goes out of the window, it's gone. + /// + /// For serious text rendering, there are several good options, such as + /// SDL_ttf, stb_truetype, or other external libraries. + /// + /// On first use, this will create an internal texture for rendering glyphs. + /// This texture will live until the renderer is destroyed. + /// + /// The text is drawn in the color specified by [`SDL_SetRenderDrawColor()`]. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw a line of text. + /// - `x`: the x coordinate where the top-left corner of the text will draw. + /// - `y`: the y coordinate where the top-left corner of the text will draw. + /// - `str`: the string to render. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderDebugTextFormat`] + /// - [`SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE`] + pub fn SDL_RenderDebugText( + renderer: *mut SDL_Renderer, + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + str: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Draw debug text to an [`SDL_Renderer`]. + /// + /// This function will render a printf()-style format string to a renderer. + /// Note that this is a convenience function for debugging, with severe + /// limitations, and is not intended to be used for production apps and games. + /// + /// For the full list of limitations and other useful information, see + /// [`SDL_RenderDebugText`]. + /// + /// ## Parameters + /// - `renderer`: the renderer which should draw the text. + /// - `x`: the x coordinate where the top-left corner of the text will draw. + /// - `y`: the y coordinate where the top-left corner of the text will draw. + /// - `fmt`: the format string to draw. + /// - `...`: additional parameters matching % tokens in the `fmt` string, if + /// any. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RenderDebugText`] + /// - [`SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE`] + pub fn SDL_RenderDebugTextFormat( + renderer: *mut SDL_Renderer, + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, + fmt: *const ::core::ffi::c_char, + ... + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set default scale mode for new textures for given renderer. + /// + /// When a renderer is created, scale_mode defaults to [`SDL_SCALEMODE_LINEAR`]. + /// + /// ## Parameters + /// - `renderer`: the renderer to update. + /// - `scale_mode`: the scale mode to change to for new textures. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_GetDefaultTextureScaleMode`] + pub fn SDL_SetDefaultTextureScaleMode( + renderer: *mut SDL_Renderer, + scale_mode: SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get default texture scale mode of the given renderer. + /// + /// ## Parameters + /// - `renderer`: the renderer to get data from. + /// - `scale_mode`: a [`SDL_ScaleMode`] filled with current default scale mode. + /// See [`SDL_SetDefaultTextureScaleMode()`] for the meaning of + /// the value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_SetDefaultTextureScaleMode`] + pub fn SDL_GetDefaultTextureScaleMode( + renderer: *mut SDL_Renderer, + scale_mode: *mut SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +/// A structure specifying the parameters of a GPU render state. +/// +/// ## Availability +/// This struct is available since SDL 3.4.0. +/// +/// ## See also +/// - [`SDL_CreateGPURenderState`] +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_GPURenderStateCreateInfo { + /// The fragment shader to use when this render state is active + pub fragment_shader: *mut SDL_GPUShader, + /// The number of additional fragment samplers to bind when this render state is active + pub num_sampler_bindings: Sint32, + /// Additional fragment samplers to bind when this render state is active + pub sampler_bindings: *const SDL_GPUTextureSamplerBinding, + /// The number of storage textures to bind when this render state is active + pub num_storage_textures: Sint32, + /// Storage textures to bind when this render state is active + pub storage_textures: *const *mut SDL_GPUTexture, + /// The number of storage buffers to bind when this render state is active + pub num_storage_buffers: Sint32, + /// Storage buffers to bind when this render state is active + pub storage_buffers: *const *mut SDL_GPUBuffer, + /// A properties ID for extensions. Should be 0 if no extensions are needed. + pub props: SDL_PropertiesID, +} + +impl ::core::default::Default for SDL_GPURenderStateCreateInfo { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +unsafe extern "C" { + /// Create custom GPU render state. + /// + /// ## Parameters + /// - `renderer`: the renderer to use. + /// - `createinfo`: a struct describing the GPU render state to create. + /// + /// ## Return value + /// Returns a custom GPU render state or NULL on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// renderer. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_SetGPURenderStateFragmentUniforms`] + /// - [`SDL_SetGPURenderState`] + /// - [`SDL_DestroyGPURenderState`] + pub fn SDL_CreateGPURenderState( + renderer: *mut SDL_Renderer, + createinfo: *const SDL_GPURenderStateCreateInfo, + ) -> *mut SDL_GPURenderState; +} + +unsafe extern "C" { + /// Set fragment shader uniform variables in a custom GPU render state. + /// + /// The data is copied and will be pushed using + /// [`SDL_PushGPUFragmentUniformData()`] during draw call execution. + /// + /// ## Parameters + /// - `state`: the state to modify. + /// - `slot_index`: the fragment uniform slot to push data to. + /// - `data`: client data to write. + /// - `length`: the length of the data to write. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// renderer. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_SetGPURenderStateFragmentUniforms( + state: *mut SDL_GPURenderState, + slot_index: Uint32, + data: *const ::core::ffi::c_void, + length: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set custom GPU render state. + /// + /// This function sets custom GPU render state for subsequent draw calls. This + /// allows using custom shaders with the GPU renderer. + /// + /// ## Parameters + /// - `renderer`: the renderer to use. + /// - `state`: the state to to use, or NULL to clear custom GPU render state. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// renderer. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_SetGPURenderState( + renderer: *mut SDL_Renderer, + state: *mut SDL_GPURenderState, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy custom GPU render state. + /// + /// ## Parameters + /// - `state`: the state to destroy. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// renderer. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_CreateGPURenderState`] + pub fn SDL_DestroyGPURenderState(state: *mut SDL_GPURenderState); +} + +/// A custom GPU render state. +/// +/// ## Availability +/// This struct is available since SDL 3.4.0. +/// +/// ## See also +/// - [`SDL_CreateGPURenderState`] +/// - [`SDL_SetGPURenderStateFragmentUniforms`] +/// - [`SDL_SetGPURenderState`] +/// - [`SDL_DestroyGPURenderState`] +#[repr(C)] +pub struct SDL_GPURenderState { + _opaque: [::core::primitive::u8; 0], +} + +/// A structure representing rendering state +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Renderer { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/revision.rs b/vendor/sdl3-sys/src/generated/revision.rs new file mode 100644 index 00000000..c7782a50 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/revision.rs @@ -0,0 +1,28 @@ +apply_cfg!(#[cfg(doc)] => { + /// This macro is a string describing the source at a particular point in + /// development. + /// + /// This string is often generated from revision control's state at build time. + /// + /// This string can be quite complex and does not follow any standard. For + /// example, it might be something like "SDL-prerelease-3.1.1-47-gf687e0732". + /// It might also be user-defined at build time, so it's best to treat it as a + /// clue in debugging forensics and not something the app will parse in any + /// way. + /// + /// SDL_revision.h must be included in your program explicitly if you want + /// access to the [`SDL_REVISION`] constant. + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_REVISION: *const ::core::ffi::c_char = c"Some arbitrary string decided at SDL build time".as_ptr(); + +}); + +apply_cfg!(#[cfg(not(doc))] => { + pub const SDL_REVISION: *const ::core::ffi::c_char = c"SDL-3.4.16".as_ptr(); + +}); + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/scancode.rs b/vendor/sdl3-sys/src/generated/scancode.rs new file mode 100644 index 00000000..eb4dc3f1 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/scancode.rs @@ -0,0 +1,1340 @@ +//! Defines keyboard scancodes. +//! +//! Please refer to the Best Keyboard Practices document for details on what +//! this information means and how best to use it. +//! +//! + +use super::stdinc::*; + +/// The SDL keyboard scancode representation. +/// +/// An SDL scancode is the physical representation of a key on the keyboard, +/// independent of language and keyboard mapping. +/// +/// Values of this type are used to represent keyboard keys, among other places +/// in the `scancode` field of the [`SDL_KeyboardEvent`] structure. +/// +/// The values in this enumeration are based on the USB usage page standard: +/// +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_Scancode::UNKNOWN) | [`SDL_SCANCODE_UNKNOWN`] | | +/// | [`A`](SDL_Scancode::A) | [`SDL_SCANCODE_A`] | | +/// | [`B`](SDL_Scancode::B) | [`SDL_SCANCODE_B`] | | +/// | [`C`](SDL_Scancode::C) | [`SDL_SCANCODE_C`] | | +/// | [`D`](SDL_Scancode::D) | [`SDL_SCANCODE_D`] | | +/// | [`E`](SDL_Scancode::E) | [`SDL_SCANCODE_E`] | | +/// | [`F`](SDL_Scancode::F) | [`SDL_SCANCODE_F`] | | +/// | [`G`](SDL_Scancode::G) | [`SDL_SCANCODE_G`] | | +/// | [`H`](SDL_Scancode::H) | [`SDL_SCANCODE_H`] | | +/// | [`I`](SDL_Scancode::I) | [`SDL_SCANCODE_I`] | | +/// | [`J`](SDL_Scancode::J) | [`SDL_SCANCODE_J`] | | +/// | [`K`](SDL_Scancode::K) | [`SDL_SCANCODE_K`] | | +/// | [`L`](SDL_Scancode::L) | [`SDL_SCANCODE_L`] | | +/// | [`M`](SDL_Scancode::M) | [`SDL_SCANCODE_M`] | | +/// | [`N`](SDL_Scancode::N) | [`SDL_SCANCODE_N`] | | +/// | [`O`](SDL_Scancode::O) | [`SDL_SCANCODE_O`] | | +/// | [`P`](SDL_Scancode::P) | [`SDL_SCANCODE_P`] | | +/// | [`Q`](SDL_Scancode::Q) | [`SDL_SCANCODE_Q`] | | +/// | [`R`](SDL_Scancode::R) | [`SDL_SCANCODE_R`] | | +/// | [`S`](SDL_Scancode::S) | [`SDL_SCANCODE_S`] | | +/// | [`T`](SDL_Scancode::T) | [`SDL_SCANCODE_T`] | | +/// | [`U`](SDL_Scancode::U) | [`SDL_SCANCODE_U`] | | +/// | [`V`](SDL_Scancode::V) | [`SDL_SCANCODE_V`] | | +/// | [`W`](SDL_Scancode::W) | [`SDL_SCANCODE_W`] | | +/// | [`X`](SDL_Scancode::X) | [`SDL_SCANCODE_X`] | | +/// | [`Y`](SDL_Scancode::Y) | [`SDL_SCANCODE_Y`] | | +/// | [`Z`](SDL_Scancode::Z) | [`SDL_SCANCODE_Z`] | | +/// | [`_1`](SDL_Scancode::_1) | [`SDL_SCANCODE_1`] | | +/// | [`_2`](SDL_Scancode::_2) | [`SDL_SCANCODE_2`] | | +/// | [`_3`](SDL_Scancode::_3) | [`SDL_SCANCODE_3`] | | +/// | [`_4`](SDL_Scancode::_4) | [`SDL_SCANCODE_4`] | | +/// | [`_5`](SDL_Scancode::_5) | [`SDL_SCANCODE_5`] | | +/// | [`_6`](SDL_Scancode::_6) | [`SDL_SCANCODE_6`] | | +/// | [`_7`](SDL_Scancode::_7) | [`SDL_SCANCODE_7`] | | +/// | [`_8`](SDL_Scancode::_8) | [`SDL_SCANCODE_8`] | | +/// | [`_9`](SDL_Scancode::_9) | [`SDL_SCANCODE_9`] | | +/// | [`_0`](SDL_Scancode::_0) | [`SDL_SCANCODE_0`] | | +/// | [`RETURN`](SDL_Scancode::RETURN) | [`SDL_SCANCODE_RETURN`] | | +/// | [`ESCAPE`](SDL_Scancode::ESCAPE) | [`SDL_SCANCODE_ESCAPE`] | | +/// | [`BACKSPACE`](SDL_Scancode::BACKSPACE) | [`SDL_SCANCODE_BACKSPACE`] | | +/// | [`TAB`](SDL_Scancode::TAB) | [`SDL_SCANCODE_TAB`] | | +/// | [`SPACE`](SDL_Scancode::SPACE) | [`SDL_SCANCODE_SPACE`] | | +/// | [`MINUS`](SDL_Scancode::MINUS) | [`SDL_SCANCODE_MINUS`] | | +/// | [`EQUALS`](SDL_Scancode::EQUALS) | [`SDL_SCANCODE_EQUALS`] | | +/// | [`LEFTBRACKET`](SDL_Scancode::LEFTBRACKET) | [`SDL_SCANCODE_LEFTBRACKET`] | | +/// | [`RIGHTBRACKET`](SDL_Scancode::RIGHTBRACKET) | [`SDL_SCANCODE_RIGHTBRACKET`] | | +/// | [`BACKSLASH`](SDL_Scancode::BACKSLASH) | [`SDL_SCANCODE_BACKSLASH`] | Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout. | +/// | [`NONUSHASH`](SDL_Scancode::NONUSHASH) | [`SDL_SCANCODE_NONUSHASH`] | ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I've seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate [`SDL_SCANCODE_BACKSLASH`] instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards. | +/// | [`SEMICOLON`](SDL_Scancode::SEMICOLON) | [`SDL_SCANCODE_SEMICOLON`] | | +/// | [`APOSTROPHE`](SDL_Scancode::APOSTROPHE) | [`SDL_SCANCODE_APOSTROPHE`] | | +/// | [`GRAVE`](SDL_Scancode::GRAVE) | [`SDL_SCANCODE_GRAVE`] | Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards. | +/// | [`COMMA`](SDL_Scancode::COMMA) | [`SDL_SCANCODE_COMMA`] | | +/// | [`PERIOD`](SDL_Scancode::PERIOD) | [`SDL_SCANCODE_PERIOD`] | | +/// | [`SLASH`](SDL_Scancode::SLASH) | [`SDL_SCANCODE_SLASH`] | | +/// | [`CAPSLOCK`](SDL_Scancode::CAPSLOCK) | [`SDL_SCANCODE_CAPSLOCK`] | | +/// | [`F1`](SDL_Scancode::F1) | [`SDL_SCANCODE_F1`] | | +/// | [`F2`](SDL_Scancode::F2) | [`SDL_SCANCODE_F2`] | | +/// | [`F3`](SDL_Scancode::F3) | [`SDL_SCANCODE_F3`] | | +/// | [`F4`](SDL_Scancode::F4) | [`SDL_SCANCODE_F4`] | | +/// | [`F5`](SDL_Scancode::F5) | [`SDL_SCANCODE_F5`] | | +/// | [`F6`](SDL_Scancode::F6) | [`SDL_SCANCODE_F6`] | | +/// | [`F7`](SDL_Scancode::F7) | [`SDL_SCANCODE_F7`] | | +/// | [`F8`](SDL_Scancode::F8) | [`SDL_SCANCODE_F8`] | | +/// | [`F9`](SDL_Scancode::F9) | [`SDL_SCANCODE_F9`] | | +/// | [`F10`](SDL_Scancode::F10) | [`SDL_SCANCODE_F10`] | | +/// | [`F11`](SDL_Scancode::F11) | [`SDL_SCANCODE_F11`] | | +/// | [`F12`](SDL_Scancode::F12) | [`SDL_SCANCODE_F12`] | | +/// | [`PRINTSCREEN`](SDL_Scancode::PRINTSCREEN) | [`SDL_SCANCODE_PRINTSCREEN`] | | +/// | [`SCROLLLOCK`](SDL_Scancode::SCROLLLOCK) | [`SDL_SCANCODE_SCROLLLOCK`] | | +/// | [`PAUSE`](SDL_Scancode::PAUSE) | [`SDL_SCANCODE_PAUSE`] | | +/// | [`INSERT`](SDL_Scancode::INSERT) | [`SDL_SCANCODE_INSERT`] | insert on PC, help on some Mac keyboards (but does send code 73, not 117) | +/// | [`HOME`](SDL_Scancode::HOME) | [`SDL_SCANCODE_HOME`] | | +/// | [`PAGEUP`](SDL_Scancode::PAGEUP) | [`SDL_SCANCODE_PAGEUP`] | | +/// | [`DELETE`](SDL_Scancode::DELETE) | [`SDL_SCANCODE_DELETE`] | | +/// | [`END`](SDL_Scancode::END) | [`SDL_SCANCODE_END`] | | +/// | [`PAGEDOWN`](SDL_Scancode::PAGEDOWN) | [`SDL_SCANCODE_PAGEDOWN`] | | +/// | [`RIGHT`](SDL_Scancode::RIGHT) | [`SDL_SCANCODE_RIGHT`] | | +/// | [`LEFT`](SDL_Scancode::LEFT) | [`SDL_SCANCODE_LEFT`] | | +/// | [`DOWN`](SDL_Scancode::DOWN) | [`SDL_SCANCODE_DOWN`] | | +/// | [`UP`](SDL_Scancode::UP) | [`SDL_SCANCODE_UP`] | | +/// | [`NUMLOCKCLEAR`](SDL_Scancode::NUMLOCKCLEAR) | [`SDL_SCANCODE_NUMLOCKCLEAR`] | num lock on PC, clear on Mac keyboards | +/// | [`KP_DIVIDE`](SDL_Scancode::KP_DIVIDE) | [`SDL_SCANCODE_KP_DIVIDE`] | | +/// | [`KP_MULTIPLY`](SDL_Scancode::KP_MULTIPLY) | [`SDL_SCANCODE_KP_MULTIPLY`] | | +/// | [`KP_MINUS`](SDL_Scancode::KP_MINUS) | [`SDL_SCANCODE_KP_MINUS`] | | +/// | [`KP_PLUS`](SDL_Scancode::KP_PLUS) | [`SDL_SCANCODE_KP_PLUS`] | | +/// | [`KP_ENTER`](SDL_Scancode::KP_ENTER) | [`SDL_SCANCODE_KP_ENTER`] | | +/// | [`KP_1`](SDL_Scancode::KP_1) | [`SDL_SCANCODE_KP_1`] | | +/// | [`KP_2`](SDL_Scancode::KP_2) | [`SDL_SCANCODE_KP_2`] | | +/// | [`KP_3`](SDL_Scancode::KP_3) | [`SDL_SCANCODE_KP_3`] | | +/// | [`KP_4`](SDL_Scancode::KP_4) | [`SDL_SCANCODE_KP_4`] | | +/// | [`KP_5`](SDL_Scancode::KP_5) | [`SDL_SCANCODE_KP_5`] | | +/// | [`KP_6`](SDL_Scancode::KP_6) | [`SDL_SCANCODE_KP_6`] | | +/// | [`KP_7`](SDL_Scancode::KP_7) | [`SDL_SCANCODE_KP_7`] | | +/// | [`KP_8`](SDL_Scancode::KP_8) | [`SDL_SCANCODE_KP_8`] | | +/// | [`KP_9`](SDL_Scancode::KP_9) | [`SDL_SCANCODE_KP_9`] | | +/// | [`KP_0`](SDL_Scancode::KP_0) | [`SDL_SCANCODE_KP_0`] | | +/// | [`KP_PERIOD`](SDL_Scancode::KP_PERIOD) | [`SDL_SCANCODE_KP_PERIOD`] | | +/// | [`NONUSBACKSLASH`](SDL_Scancode::NONUSBACKSLASH) | [`SDL_SCANCODE_NONUSBACKSLASH`] | This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Z. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout. | +/// | [`APPLICATION`](SDL_Scancode::APPLICATION) | [`SDL_SCANCODE_APPLICATION`] | windows contextual menu, compose | +/// | [`POWER`](SDL_Scancode::POWER) | [`SDL_SCANCODE_POWER`] | The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key. | +/// | [`KP_EQUALS`](SDL_Scancode::KP_EQUALS) | [`SDL_SCANCODE_KP_EQUALS`] | | +/// | [`F13`](SDL_Scancode::F13) | [`SDL_SCANCODE_F13`] | | +/// | [`F14`](SDL_Scancode::F14) | [`SDL_SCANCODE_F14`] | | +/// | [`F15`](SDL_Scancode::F15) | [`SDL_SCANCODE_F15`] | | +/// | [`F16`](SDL_Scancode::F16) | [`SDL_SCANCODE_F16`] | | +/// | [`F17`](SDL_Scancode::F17) | [`SDL_SCANCODE_F17`] | | +/// | [`F18`](SDL_Scancode::F18) | [`SDL_SCANCODE_F18`] | | +/// | [`F19`](SDL_Scancode::F19) | [`SDL_SCANCODE_F19`] | | +/// | [`F20`](SDL_Scancode::F20) | [`SDL_SCANCODE_F20`] | | +/// | [`F21`](SDL_Scancode::F21) | [`SDL_SCANCODE_F21`] | | +/// | [`F22`](SDL_Scancode::F22) | [`SDL_SCANCODE_F22`] | | +/// | [`F23`](SDL_Scancode::F23) | [`SDL_SCANCODE_F23`] | | +/// | [`F24`](SDL_Scancode::F24) | [`SDL_SCANCODE_F24`] | | +/// | [`EXECUTE`](SDL_Scancode::EXECUTE) | [`SDL_SCANCODE_EXECUTE`] | | +/// | [`HELP`](SDL_Scancode::HELP) | [`SDL_SCANCODE_HELP`] | AL Integrated Help Center | +/// | [`MENU`](SDL_Scancode::MENU) | [`SDL_SCANCODE_MENU`] | Menu (show menu) | +/// | [`SELECT`](SDL_Scancode::SELECT) | [`SDL_SCANCODE_SELECT`] | | +/// | [`STOP`](SDL_Scancode::STOP) | [`SDL_SCANCODE_STOP`] | AC Stop | +/// | [`AGAIN`](SDL_Scancode::AGAIN) | [`SDL_SCANCODE_AGAIN`] | AC Redo/Repeat | +/// | [`UNDO`](SDL_Scancode::UNDO) | [`SDL_SCANCODE_UNDO`] | AC Undo | +/// | [`CUT`](SDL_Scancode::CUT) | [`SDL_SCANCODE_CUT`] | AC Cut | +/// | [`COPY`](SDL_Scancode::COPY) | [`SDL_SCANCODE_COPY`] | AC Copy | +/// | [`PASTE`](SDL_Scancode::PASTE) | [`SDL_SCANCODE_PASTE`] | AC Paste | +/// | [`FIND`](SDL_Scancode::FIND) | [`SDL_SCANCODE_FIND`] | AC Find | +/// | [`MUTE`](SDL_Scancode::MUTE) | [`SDL_SCANCODE_MUTE`] | | +/// | [`VOLUMEUP`](SDL_Scancode::VOLUMEUP) | [`SDL_SCANCODE_VOLUMEUP`] | | +/// | [`VOLUMEDOWN`](SDL_Scancode::VOLUMEDOWN) | [`SDL_SCANCODE_VOLUMEDOWN`] | | +/// | [`KP_COMMA`](SDL_Scancode::KP_COMMA) | [`SDL_SCANCODE_KP_COMMA`] | | +/// | [`KP_EQUALSAS400`](SDL_Scancode::KP_EQUALSAS400) | [`SDL_SCANCODE_KP_EQUALSAS400`] | | +/// | [`INTERNATIONAL1`](SDL_Scancode::INTERNATIONAL1) | [`SDL_SCANCODE_INTERNATIONAL1`] | used on Asian keyboards, see footnotes in USB doc | +/// | [`INTERNATIONAL2`](SDL_Scancode::INTERNATIONAL2) | [`SDL_SCANCODE_INTERNATIONAL2`] | | +/// | [`INTERNATIONAL3`](SDL_Scancode::INTERNATIONAL3) | [`SDL_SCANCODE_INTERNATIONAL3`] | Yen | +/// | [`INTERNATIONAL4`](SDL_Scancode::INTERNATIONAL4) | [`SDL_SCANCODE_INTERNATIONAL4`] | | +/// | [`INTERNATIONAL5`](SDL_Scancode::INTERNATIONAL5) | [`SDL_SCANCODE_INTERNATIONAL5`] | | +/// | [`INTERNATIONAL6`](SDL_Scancode::INTERNATIONAL6) | [`SDL_SCANCODE_INTERNATIONAL6`] | | +/// | [`INTERNATIONAL7`](SDL_Scancode::INTERNATIONAL7) | [`SDL_SCANCODE_INTERNATIONAL7`] | | +/// | [`INTERNATIONAL8`](SDL_Scancode::INTERNATIONAL8) | [`SDL_SCANCODE_INTERNATIONAL8`] | | +/// | [`INTERNATIONAL9`](SDL_Scancode::INTERNATIONAL9) | [`SDL_SCANCODE_INTERNATIONAL9`] | | +/// | [`LANG1`](SDL_Scancode::LANG1) | [`SDL_SCANCODE_LANG1`] | Hangul/English toggle | +/// | [`LANG2`](SDL_Scancode::LANG2) | [`SDL_SCANCODE_LANG2`] | Hanja conversion | +/// | [`LANG3`](SDL_Scancode::LANG3) | [`SDL_SCANCODE_LANG3`] | Katakana | +/// | [`LANG4`](SDL_Scancode::LANG4) | [`SDL_SCANCODE_LANG4`] | Hiragana | +/// | [`LANG5`](SDL_Scancode::LANG5) | [`SDL_SCANCODE_LANG5`] | Zenkaku/Hankaku | +/// | [`LANG6`](SDL_Scancode::LANG6) | [`SDL_SCANCODE_LANG6`] | reserved | +/// | [`LANG7`](SDL_Scancode::LANG7) | [`SDL_SCANCODE_LANG7`] | reserved | +/// | [`LANG8`](SDL_Scancode::LANG8) | [`SDL_SCANCODE_LANG8`] | reserved | +/// | [`LANG9`](SDL_Scancode::LANG9) | [`SDL_SCANCODE_LANG9`] | reserved | +/// | [`ALTERASE`](SDL_Scancode::ALTERASE) | [`SDL_SCANCODE_ALTERASE`] | Erase-Eaze | +/// | [`SYSREQ`](SDL_Scancode::SYSREQ) | [`SDL_SCANCODE_SYSREQ`] | | +/// | [`CANCEL`](SDL_Scancode::CANCEL) | [`SDL_SCANCODE_CANCEL`] | AC Cancel | +/// | [`CLEAR`](SDL_Scancode::CLEAR) | [`SDL_SCANCODE_CLEAR`] | | +/// | [`PRIOR`](SDL_Scancode::PRIOR) | [`SDL_SCANCODE_PRIOR`] | | +/// | [`RETURN2`](SDL_Scancode::RETURN2) | [`SDL_SCANCODE_RETURN2`] | | +/// | [`SEPARATOR`](SDL_Scancode::SEPARATOR) | [`SDL_SCANCODE_SEPARATOR`] | | +/// | [`OUT`](SDL_Scancode::OUT) | [`SDL_SCANCODE_OUT`] | | +/// | [`OPER`](SDL_Scancode::OPER) | [`SDL_SCANCODE_OPER`] | | +/// | [`CLEARAGAIN`](SDL_Scancode::CLEARAGAIN) | [`SDL_SCANCODE_CLEARAGAIN`] | | +/// | [`CRSEL`](SDL_Scancode::CRSEL) | [`SDL_SCANCODE_CRSEL`] | | +/// | [`EXSEL`](SDL_Scancode::EXSEL) | [`SDL_SCANCODE_EXSEL`] | | +/// | [`KP_00`](SDL_Scancode::KP_00) | [`SDL_SCANCODE_KP_00`] | | +/// | [`KP_000`](SDL_Scancode::KP_000) | [`SDL_SCANCODE_KP_000`] | | +/// | [`THOUSANDSSEPARATOR`](SDL_Scancode::THOUSANDSSEPARATOR) | [`SDL_SCANCODE_THOUSANDSSEPARATOR`] | | +/// | [`DECIMALSEPARATOR`](SDL_Scancode::DECIMALSEPARATOR) | [`SDL_SCANCODE_DECIMALSEPARATOR`] | | +/// | [`CURRENCYUNIT`](SDL_Scancode::CURRENCYUNIT) | [`SDL_SCANCODE_CURRENCYUNIT`] | | +/// | [`CURRENCYSUBUNIT`](SDL_Scancode::CURRENCYSUBUNIT) | [`SDL_SCANCODE_CURRENCYSUBUNIT`] | | +/// | [`KP_LEFTPAREN`](SDL_Scancode::KP_LEFTPAREN) | [`SDL_SCANCODE_KP_LEFTPAREN`] | | +/// | [`KP_RIGHTPAREN`](SDL_Scancode::KP_RIGHTPAREN) | [`SDL_SCANCODE_KP_RIGHTPAREN`] | | +/// | [`KP_LEFTBRACE`](SDL_Scancode::KP_LEFTBRACE) | [`SDL_SCANCODE_KP_LEFTBRACE`] | | +/// | [`KP_RIGHTBRACE`](SDL_Scancode::KP_RIGHTBRACE) | [`SDL_SCANCODE_KP_RIGHTBRACE`] | | +/// | [`KP_TAB`](SDL_Scancode::KP_TAB) | [`SDL_SCANCODE_KP_TAB`] | | +/// | [`KP_BACKSPACE`](SDL_Scancode::KP_BACKSPACE) | [`SDL_SCANCODE_KP_BACKSPACE`] | | +/// | [`KP_A`](SDL_Scancode::KP_A) | [`SDL_SCANCODE_KP_A`] | | +/// | [`KP_B`](SDL_Scancode::KP_B) | [`SDL_SCANCODE_KP_B`] | | +/// | [`KP_C`](SDL_Scancode::KP_C) | [`SDL_SCANCODE_KP_C`] | | +/// | [`KP_D`](SDL_Scancode::KP_D) | [`SDL_SCANCODE_KP_D`] | | +/// | [`KP_E`](SDL_Scancode::KP_E) | [`SDL_SCANCODE_KP_E`] | | +/// | [`KP_F`](SDL_Scancode::KP_F) | [`SDL_SCANCODE_KP_F`] | | +/// | [`KP_XOR`](SDL_Scancode::KP_XOR) | [`SDL_SCANCODE_KP_XOR`] | | +/// | [`KP_POWER`](SDL_Scancode::KP_POWER) | [`SDL_SCANCODE_KP_POWER`] | | +/// | [`KP_PERCENT`](SDL_Scancode::KP_PERCENT) | [`SDL_SCANCODE_KP_PERCENT`] | | +/// | [`KP_LESS`](SDL_Scancode::KP_LESS) | [`SDL_SCANCODE_KP_LESS`] | | +/// | [`KP_GREATER`](SDL_Scancode::KP_GREATER) | [`SDL_SCANCODE_KP_GREATER`] | | +/// | [`KP_AMPERSAND`](SDL_Scancode::KP_AMPERSAND) | [`SDL_SCANCODE_KP_AMPERSAND`] | | +/// | [`KP_DBLAMPERSAND`](SDL_Scancode::KP_DBLAMPERSAND) | [`SDL_SCANCODE_KP_DBLAMPERSAND`] | | +/// | [`KP_VERTICALBAR`](SDL_Scancode::KP_VERTICALBAR) | [`SDL_SCANCODE_KP_VERTICALBAR`] | | +/// | [`KP_DBLVERTICALBAR`](SDL_Scancode::KP_DBLVERTICALBAR) | [`SDL_SCANCODE_KP_DBLVERTICALBAR`] | | +/// | [`KP_COLON`](SDL_Scancode::KP_COLON) | [`SDL_SCANCODE_KP_COLON`] | | +/// | [`KP_HASH`](SDL_Scancode::KP_HASH) | [`SDL_SCANCODE_KP_HASH`] | | +/// | [`KP_SPACE`](SDL_Scancode::KP_SPACE) | [`SDL_SCANCODE_KP_SPACE`] | | +/// | [`KP_AT`](SDL_Scancode::KP_AT) | [`SDL_SCANCODE_KP_AT`] | | +/// | [`KP_EXCLAM`](SDL_Scancode::KP_EXCLAM) | [`SDL_SCANCODE_KP_EXCLAM`] | | +/// | [`KP_MEMSTORE`](SDL_Scancode::KP_MEMSTORE) | [`SDL_SCANCODE_KP_MEMSTORE`] | | +/// | [`KP_MEMRECALL`](SDL_Scancode::KP_MEMRECALL) | [`SDL_SCANCODE_KP_MEMRECALL`] | | +/// | [`KP_MEMCLEAR`](SDL_Scancode::KP_MEMCLEAR) | [`SDL_SCANCODE_KP_MEMCLEAR`] | | +/// | [`KP_MEMADD`](SDL_Scancode::KP_MEMADD) | [`SDL_SCANCODE_KP_MEMADD`] | | +/// | [`KP_MEMSUBTRACT`](SDL_Scancode::KP_MEMSUBTRACT) | [`SDL_SCANCODE_KP_MEMSUBTRACT`] | | +/// | [`KP_MEMMULTIPLY`](SDL_Scancode::KP_MEMMULTIPLY) | [`SDL_SCANCODE_KP_MEMMULTIPLY`] | | +/// | [`KP_MEMDIVIDE`](SDL_Scancode::KP_MEMDIVIDE) | [`SDL_SCANCODE_KP_MEMDIVIDE`] | | +/// | [`KP_PLUSMINUS`](SDL_Scancode::KP_PLUSMINUS) | [`SDL_SCANCODE_KP_PLUSMINUS`] | | +/// | [`KP_CLEAR`](SDL_Scancode::KP_CLEAR) | [`SDL_SCANCODE_KP_CLEAR`] | | +/// | [`KP_CLEARENTRY`](SDL_Scancode::KP_CLEARENTRY) | [`SDL_SCANCODE_KP_CLEARENTRY`] | | +/// | [`KP_BINARY`](SDL_Scancode::KP_BINARY) | [`SDL_SCANCODE_KP_BINARY`] | | +/// | [`KP_OCTAL`](SDL_Scancode::KP_OCTAL) | [`SDL_SCANCODE_KP_OCTAL`] | | +/// | [`KP_DECIMAL`](SDL_Scancode::KP_DECIMAL) | [`SDL_SCANCODE_KP_DECIMAL`] | | +/// | [`KP_HEXADECIMAL`](SDL_Scancode::KP_HEXADECIMAL) | [`SDL_SCANCODE_KP_HEXADECIMAL`] | | +/// | [`LCTRL`](SDL_Scancode::LCTRL) | [`SDL_SCANCODE_LCTRL`] | | +/// | [`LSHIFT`](SDL_Scancode::LSHIFT) | [`SDL_SCANCODE_LSHIFT`] | | +/// | [`LALT`](SDL_Scancode::LALT) | [`SDL_SCANCODE_LALT`] | alt, option | +/// | [`LGUI`](SDL_Scancode::LGUI) | [`SDL_SCANCODE_LGUI`] | windows, command (apple), meta | +/// | [`RCTRL`](SDL_Scancode::RCTRL) | [`SDL_SCANCODE_RCTRL`] | | +/// | [`RSHIFT`](SDL_Scancode::RSHIFT) | [`SDL_SCANCODE_RSHIFT`] | | +/// | [`RALT`](SDL_Scancode::RALT) | [`SDL_SCANCODE_RALT`] | alt gr, option | +/// | [`RGUI`](SDL_Scancode::RGUI) | [`SDL_SCANCODE_RGUI`] | windows, command (apple), meta | +/// | [`MODE`](SDL_Scancode::MODE) | [`SDL_SCANCODE_MODE`] | I'm not sure if this is really not covered by any of the above, but since there's a special [`SDL_KMOD_MODE`] for it I'm adding it here | +/// | [`SLEEP`](SDL_Scancode::SLEEP) | [`SDL_SCANCODE_SLEEP`] | Sleep | +/// | [`WAKE`](SDL_Scancode::WAKE) | [`SDL_SCANCODE_WAKE`] | Wake | +/// | [`CHANNEL_INCREMENT`](SDL_Scancode::CHANNEL_INCREMENT) | [`SDL_SCANCODE_CHANNEL_INCREMENT`] | Channel Increment | +/// | [`CHANNEL_DECREMENT`](SDL_Scancode::CHANNEL_DECREMENT) | [`SDL_SCANCODE_CHANNEL_DECREMENT`] | Channel Decrement | +/// | [`MEDIA_PLAY`](SDL_Scancode::MEDIA_PLAY) | [`SDL_SCANCODE_MEDIA_PLAY`] | Play | +/// | [`MEDIA_PAUSE`](SDL_Scancode::MEDIA_PAUSE) | [`SDL_SCANCODE_MEDIA_PAUSE`] | Pause | +/// | [`MEDIA_RECORD`](SDL_Scancode::MEDIA_RECORD) | [`SDL_SCANCODE_MEDIA_RECORD`] | Record | +/// | [`MEDIA_FAST_FORWARD`](SDL_Scancode::MEDIA_FAST_FORWARD) | [`SDL_SCANCODE_MEDIA_FAST_FORWARD`] | Fast Forward | +/// | [`MEDIA_REWIND`](SDL_Scancode::MEDIA_REWIND) | [`SDL_SCANCODE_MEDIA_REWIND`] | Rewind | +/// | [`MEDIA_NEXT_TRACK`](SDL_Scancode::MEDIA_NEXT_TRACK) | [`SDL_SCANCODE_MEDIA_NEXT_TRACK`] | Next Track | +/// | [`MEDIA_PREVIOUS_TRACK`](SDL_Scancode::MEDIA_PREVIOUS_TRACK) | [`SDL_SCANCODE_MEDIA_PREVIOUS_TRACK`] | Previous Track | +/// | [`MEDIA_STOP`](SDL_Scancode::MEDIA_STOP) | [`SDL_SCANCODE_MEDIA_STOP`] | Stop | +/// | [`MEDIA_EJECT`](SDL_Scancode::MEDIA_EJECT) | [`SDL_SCANCODE_MEDIA_EJECT`] | Eject | +/// | [`MEDIA_PLAY_PAUSE`](SDL_Scancode::MEDIA_PLAY_PAUSE) | [`SDL_SCANCODE_MEDIA_PLAY_PAUSE`] | Play / Pause | +/// | [`MEDIA_SELECT`](SDL_Scancode::MEDIA_SELECT) | [`SDL_SCANCODE_MEDIA_SELECT`] | | +/// | [`AC_NEW`](SDL_Scancode::AC_NEW) | [`SDL_SCANCODE_AC_NEW`] | AC New | +/// | [`AC_OPEN`](SDL_Scancode::AC_OPEN) | [`SDL_SCANCODE_AC_OPEN`] | AC Open | +/// | [`AC_CLOSE`](SDL_Scancode::AC_CLOSE) | [`SDL_SCANCODE_AC_CLOSE`] | AC Close | +/// | [`AC_EXIT`](SDL_Scancode::AC_EXIT) | [`SDL_SCANCODE_AC_EXIT`] | AC Exit | +/// | [`AC_SAVE`](SDL_Scancode::AC_SAVE) | [`SDL_SCANCODE_AC_SAVE`] | AC Save | +/// | [`AC_PRINT`](SDL_Scancode::AC_PRINT) | [`SDL_SCANCODE_AC_PRINT`] | AC Print | +/// | [`AC_PROPERTIES`](SDL_Scancode::AC_PROPERTIES) | [`SDL_SCANCODE_AC_PROPERTIES`] | AC Properties | +/// | [`AC_SEARCH`](SDL_Scancode::AC_SEARCH) | [`SDL_SCANCODE_AC_SEARCH`] | AC Search | +/// | [`AC_HOME`](SDL_Scancode::AC_HOME) | [`SDL_SCANCODE_AC_HOME`] | AC Home | +/// | [`AC_BACK`](SDL_Scancode::AC_BACK) | [`SDL_SCANCODE_AC_BACK`] | AC Back | +/// | [`AC_FORWARD`](SDL_Scancode::AC_FORWARD) | [`SDL_SCANCODE_AC_FORWARD`] | AC Forward | +/// | [`AC_STOP`](SDL_Scancode::AC_STOP) | [`SDL_SCANCODE_AC_STOP`] | AC Stop | +/// | [`AC_REFRESH`](SDL_Scancode::AC_REFRESH) | [`SDL_SCANCODE_AC_REFRESH`] | AC Refresh | +/// | [`AC_BOOKMARKS`](SDL_Scancode::AC_BOOKMARKS) | [`SDL_SCANCODE_AC_BOOKMARKS`] | AC Bookmarks | +/// | [`SOFTLEFT`](SDL_Scancode::SOFTLEFT) | [`SDL_SCANCODE_SOFTLEFT`] | Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display. | +/// | [`SOFTRIGHT`](SDL_Scancode::SOFTRIGHT) | [`SDL_SCANCODE_SOFTRIGHT`] | Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display. | +/// | [`CALL`](SDL_Scancode::CALL) | [`SDL_SCANCODE_CALL`] | Used for accepting phone calls. | +/// | [`ENDCALL`](SDL_Scancode::ENDCALL) | [`SDL_SCANCODE_ENDCALL`] | Used for rejecting phone calls. | +/// | [`RESERVED`](SDL_Scancode::RESERVED) | [`SDL_SCANCODE_RESERVED`] | 400-500 reserved for dynamic keycodes | +/// | [`COUNT`](SDL_Scancode::COUNT) | [`SDL_SCANCODE_COUNT`] | not a key, just marks the number of scancodes for array bounds | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_Scancode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_Scancode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_Scancode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_Scancode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Scancode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_SCANCODE_UNKNOWN", + Self::A => "SDL_SCANCODE_A", + Self::B => "SDL_SCANCODE_B", + Self::C => "SDL_SCANCODE_C", + Self::D => "SDL_SCANCODE_D", + Self::E => "SDL_SCANCODE_E", + Self::F => "SDL_SCANCODE_F", + Self::G => "SDL_SCANCODE_G", + Self::H => "SDL_SCANCODE_H", + Self::I => "SDL_SCANCODE_I", + Self::J => "SDL_SCANCODE_J", + Self::K => "SDL_SCANCODE_K", + Self::L => "SDL_SCANCODE_L", + Self::M => "SDL_SCANCODE_M", + Self::N => "SDL_SCANCODE_N", + Self::O => "SDL_SCANCODE_O", + Self::P => "SDL_SCANCODE_P", + Self::Q => "SDL_SCANCODE_Q", + Self::R => "SDL_SCANCODE_R", + Self::S => "SDL_SCANCODE_S", + Self::T => "SDL_SCANCODE_T", + Self::U => "SDL_SCANCODE_U", + Self::V => "SDL_SCANCODE_V", + Self::W => "SDL_SCANCODE_W", + Self::X => "SDL_SCANCODE_X", + Self::Y => "SDL_SCANCODE_Y", + Self::Z => "SDL_SCANCODE_Z", + Self::_1 => "SDL_SCANCODE_1", + Self::_2 => "SDL_SCANCODE_2", + Self::_3 => "SDL_SCANCODE_3", + Self::_4 => "SDL_SCANCODE_4", + Self::_5 => "SDL_SCANCODE_5", + Self::_6 => "SDL_SCANCODE_6", + Self::_7 => "SDL_SCANCODE_7", + Self::_8 => "SDL_SCANCODE_8", + Self::_9 => "SDL_SCANCODE_9", + Self::_0 => "SDL_SCANCODE_0", + Self::RETURN => "SDL_SCANCODE_RETURN", + Self::ESCAPE => "SDL_SCANCODE_ESCAPE", + Self::BACKSPACE => "SDL_SCANCODE_BACKSPACE", + Self::TAB => "SDL_SCANCODE_TAB", + Self::SPACE => "SDL_SCANCODE_SPACE", + Self::MINUS => "SDL_SCANCODE_MINUS", + Self::EQUALS => "SDL_SCANCODE_EQUALS", + Self::LEFTBRACKET => "SDL_SCANCODE_LEFTBRACKET", + Self::RIGHTBRACKET => "SDL_SCANCODE_RIGHTBRACKET", + Self::BACKSLASH => "SDL_SCANCODE_BACKSLASH", + Self::NONUSHASH => "SDL_SCANCODE_NONUSHASH", + Self::SEMICOLON => "SDL_SCANCODE_SEMICOLON", + Self::APOSTROPHE => "SDL_SCANCODE_APOSTROPHE", + Self::GRAVE => "SDL_SCANCODE_GRAVE", + Self::COMMA => "SDL_SCANCODE_COMMA", + Self::PERIOD => "SDL_SCANCODE_PERIOD", + Self::SLASH => "SDL_SCANCODE_SLASH", + Self::CAPSLOCK => "SDL_SCANCODE_CAPSLOCK", + Self::F1 => "SDL_SCANCODE_F1", + Self::F2 => "SDL_SCANCODE_F2", + Self::F3 => "SDL_SCANCODE_F3", + Self::F4 => "SDL_SCANCODE_F4", + Self::F5 => "SDL_SCANCODE_F5", + Self::F6 => "SDL_SCANCODE_F6", + Self::F7 => "SDL_SCANCODE_F7", + Self::F8 => "SDL_SCANCODE_F8", + Self::F9 => "SDL_SCANCODE_F9", + Self::F10 => "SDL_SCANCODE_F10", + Self::F11 => "SDL_SCANCODE_F11", + Self::F12 => "SDL_SCANCODE_F12", + Self::PRINTSCREEN => "SDL_SCANCODE_PRINTSCREEN", + Self::SCROLLLOCK => "SDL_SCANCODE_SCROLLLOCK", + Self::PAUSE => "SDL_SCANCODE_PAUSE", + Self::INSERT => "SDL_SCANCODE_INSERT", + Self::HOME => "SDL_SCANCODE_HOME", + Self::PAGEUP => "SDL_SCANCODE_PAGEUP", + Self::DELETE => "SDL_SCANCODE_DELETE", + Self::END => "SDL_SCANCODE_END", + Self::PAGEDOWN => "SDL_SCANCODE_PAGEDOWN", + Self::RIGHT => "SDL_SCANCODE_RIGHT", + Self::LEFT => "SDL_SCANCODE_LEFT", + Self::DOWN => "SDL_SCANCODE_DOWN", + Self::UP => "SDL_SCANCODE_UP", + Self::NUMLOCKCLEAR => "SDL_SCANCODE_NUMLOCKCLEAR", + Self::KP_DIVIDE => "SDL_SCANCODE_KP_DIVIDE", + Self::KP_MULTIPLY => "SDL_SCANCODE_KP_MULTIPLY", + Self::KP_MINUS => "SDL_SCANCODE_KP_MINUS", + Self::KP_PLUS => "SDL_SCANCODE_KP_PLUS", + Self::KP_ENTER => "SDL_SCANCODE_KP_ENTER", + Self::KP_1 => "SDL_SCANCODE_KP_1", + Self::KP_2 => "SDL_SCANCODE_KP_2", + Self::KP_3 => "SDL_SCANCODE_KP_3", + Self::KP_4 => "SDL_SCANCODE_KP_4", + Self::KP_5 => "SDL_SCANCODE_KP_5", + Self::KP_6 => "SDL_SCANCODE_KP_6", + Self::KP_7 => "SDL_SCANCODE_KP_7", + Self::KP_8 => "SDL_SCANCODE_KP_8", + Self::KP_9 => "SDL_SCANCODE_KP_9", + Self::KP_0 => "SDL_SCANCODE_KP_0", + Self::KP_PERIOD => "SDL_SCANCODE_KP_PERIOD", + Self::NONUSBACKSLASH => "SDL_SCANCODE_NONUSBACKSLASH", + Self::APPLICATION => "SDL_SCANCODE_APPLICATION", + Self::POWER => "SDL_SCANCODE_POWER", + Self::KP_EQUALS => "SDL_SCANCODE_KP_EQUALS", + Self::F13 => "SDL_SCANCODE_F13", + Self::F14 => "SDL_SCANCODE_F14", + Self::F15 => "SDL_SCANCODE_F15", + Self::F16 => "SDL_SCANCODE_F16", + Self::F17 => "SDL_SCANCODE_F17", + Self::F18 => "SDL_SCANCODE_F18", + Self::F19 => "SDL_SCANCODE_F19", + Self::F20 => "SDL_SCANCODE_F20", + Self::F21 => "SDL_SCANCODE_F21", + Self::F22 => "SDL_SCANCODE_F22", + Self::F23 => "SDL_SCANCODE_F23", + Self::F24 => "SDL_SCANCODE_F24", + Self::EXECUTE => "SDL_SCANCODE_EXECUTE", + Self::HELP => "SDL_SCANCODE_HELP", + Self::MENU => "SDL_SCANCODE_MENU", + Self::SELECT => "SDL_SCANCODE_SELECT", + Self::STOP => "SDL_SCANCODE_STOP", + Self::AGAIN => "SDL_SCANCODE_AGAIN", + Self::UNDO => "SDL_SCANCODE_UNDO", + Self::CUT => "SDL_SCANCODE_CUT", + Self::COPY => "SDL_SCANCODE_COPY", + Self::PASTE => "SDL_SCANCODE_PASTE", + Self::FIND => "SDL_SCANCODE_FIND", + Self::MUTE => "SDL_SCANCODE_MUTE", + Self::VOLUMEUP => "SDL_SCANCODE_VOLUMEUP", + Self::VOLUMEDOWN => "SDL_SCANCODE_VOLUMEDOWN", + Self::KP_COMMA => "SDL_SCANCODE_KP_COMMA", + Self::KP_EQUALSAS400 => "SDL_SCANCODE_KP_EQUALSAS400", + Self::INTERNATIONAL1 => "SDL_SCANCODE_INTERNATIONAL1", + Self::INTERNATIONAL2 => "SDL_SCANCODE_INTERNATIONAL2", + Self::INTERNATIONAL3 => "SDL_SCANCODE_INTERNATIONAL3", + Self::INTERNATIONAL4 => "SDL_SCANCODE_INTERNATIONAL4", + Self::INTERNATIONAL5 => "SDL_SCANCODE_INTERNATIONAL5", + Self::INTERNATIONAL6 => "SDL_SCANCODE_INTERNATIONAL6", + Self::INTERNATIONAL7 => "SDL_SCANCODE_INTERNATIONAL7", + Self::INTERNATIONAL8 => "SDL_SCANCODE_INTERNATIONAL8", + Self::INTERNATIONAL9 => "SDL_SCANCODE_INTERNATIONAL9", + Self::LANG1 => "SDL_SCANCODE_LANG1", + Self::LANG2 => "SDL_SCANCODE_LANG2", + Self::LANG3 => "SDL_SCANCODE_LANG3", + Self::LANG4 => "SDL_SCANCODE_LANG4", + Self::LANG5 => "SDL_SCANCODE_LANG5", + Self::LANG6 => "SDL_SCANCODE_LANG6", + Self::LANG7 => "SDL_SCANCODE_LANG7", + Self::LANG8 => "SDL_SCANCODE_LANG8", + Self::LANG9 => "SDL_SCANCODE_LANG9", + Self::ALTERASE => "SDL_SCANCODE_ALTERASE", + Self::SYSREQ => "SDL_SCANCODE_SYSREQ", + Self::CANCEL => "SDL_SCANCODE_CANCEL", + Self::CLEAR => "SDL_SCANCODE_CLEAR", + Self::PRIOR => "SDL_SCANCODE_PRIOR", + Self::RETURN2 => "SDL_SCANCODE_RETURN2", + Self::SEPARATOR => "SDL_SCANCODE_SEPARATOR", + Self::OUT => "SDL_SCANCODE_OUT", + Self::OPER => "SDL_SCANCODE_OPER", + Self::CLEARAGAIN => "SDL_SCANCODE_CLEARAGAIN", + Self::CRSEL => "SDL_SCANCODE_CRSEL", + Self::EXSEL => "SDL_SCANCODE_EXSEL", + Self::KP_00 => "SDL_SCANCODE_KP_00", + Self::KP_000 => "SDL_SCANCODE_KP_000", + Self::THOUSANDSSEPARATOR => "SDL_SCANCODE_THOUSANDSSEPARATOR", + Self::DECIMALSEPARATOR => "SDL_SCANCODE_DECIMALSEPARATOR", + Self::CURRENCYUNIT => "SDL_SCANCODE_CURRENCYUNIT", + Self::CURRENCYSUBUNIT => "SDL_SCANCODE_CURRENCYSUBUNIT", + Self::KP_LEFTPAREN => "SDL_SCANCODE_KP_LEFTPAREN", + Self::KP_RIGHTPAREN => "SDL_SCANCODE_KP_RIGHTPAREN", + Self::KP_LEFTBRACE => "SDL_SCANCODE_KP_LEFTBRACE", + Self::KP_RIGHTBRACE => "SDL_SCANCODE_KP_RIGHTBRACE", + Self::KP_TAB => "SDL_SCANCODE_KP_TAB", + Self::KP_BACKSPACE => "SDL_SCANCODE_KP_BACKSPACE", + Self::KP_A => "SDL_SCANCODE_KP_A", + Self::KP_B => "SDL_SCANCODE_KP_B", + Self::KP_C => "SDL_SCANCODE_KP_C", + Self::KP_D => "SDL_SCANCODE_KP_D", + Self::KP_E => "SDL_SCANCODE_KP_E", + Self::KP_F => "SDL_SCANCODE_KP_F", + Self::KP_XOR => "SDL_SCANCODE_KP_XOR", + Self::KP_POWER => "SDL_SCANCODE_KP_POWER", + Self::KP_PERCENT => "SDL_SCANCODE_KP_PERCENT", + Self::KP_LESS => "SDL_SCANCODE_KP_LESS", + Self::KP_GREATER => "SDL_SCANCODE_KP_GREATER", + Self::KP_AMPERSAND => "SDL_SCANCODE_KP_AMPERSAND", + Self::KP_DBLAMPERSAND => "SDL_SCANCODE_KP_DBLAMPERSAND", + Self::KP_VERTICALBAR => "SDL_SCANCODE_KP_VERTICALBAR", + Self::KP_DBLVERTICALBAR => "SDL_SCANCODE_KP_DBLVERTICALBAR", + Self::KP_COLON => "SDL_SCANCODE_KP_COLON", + Self::KP_HASH => "SDL_SCANCODE_KP_HASH", + Self::KP_SPACE => "SDL_SCANCODE_KP_SPACE", + Self::KP_AT => "SDL_SCANCODE_KP_AT", + Self::KP_EXCLAM => "SDL_SCANCODE_KP_EXCLAM", + Self::KP_MEMSTORE => "SDL_SCANCODE_KP_MEMSTORE", + Self::KP_MEMRECALL => "SDL_SCANCODE_KP_MEMRECALL", + Self::KP_MEMCLEAR => "SDL_SCANCODE_KP_MEMCLEAR", + Self::KP_MEMADD => "SDL_SCANCODE_KP_MEMADD", + Self::KP_MEMSUBTRACT => "SDL_SCANCODE_KP_MEMSUBTRACT", + Self::KP_MEMMULTIPLY => "SDL_SCANCODE_KP_MEMMULTIPLY", + Self::KP_MEMDIVIDE => "SDL_SCANCODE_KP_MEMDIVIDE", + Self::KP_PLUSMINUS => "SDL_SCANCODE_KP_PLUSMINUS", + Self::KP_CLEAR => "SDL_SCANCODE_KP_CLEAR", + Self::KP_CLEARENTRY => "SDL_SCANCODE_KP_CLEARENTRY", + Self::KP_BINARY => "SDL_SCANCODE_KP_BINARY", + Self::KP_OCTAL => "SDL_SCANCODE_KP_OCTAL", + Self::KP_DECIMAL => "SDL_SCANCODE_KP_DECIMAL", + Self::KP_HEXADECIMAL => "SDL_SCANCODE_KP_HEXADECIMAL", + Self::LCTRL => "SDL_SCANCODE_LCTRL", + Self::LSHIFT => "SDL_SCANCODE_LSHIFT", + Self::LALT => "SDL_SCANCODE_LALT", + Self::LGUI => "SDL_SCANCODE_LGUI", + Self::RCTRL => "SDL_SCANCODE_RCTRL", + Self::RSHIFT => "SDL_SCANCODE_RSHIFT", + Self::RALT => "SDL_SCANCODE_RALT", + Self::RGUI => "SDL_SCANCODE_RGUI", + Self::MODE => "SDL_SCANCODE_MODE", + Self::SLEEP => "SDL_SCANCODE_SLEEP", + Self::WAKE => "SDL_SCANCODE_WAKE", + Self::CHANNEL_INCREMENT => "SDL_SCANCODE_CHANNEL_INCREMENT", + Self::CHANNEL_DECREMENT => "SDL_SCANCODE_CHANNEL_DECREMENT", + Self::MEDIA_PLAY => "SDL_SCANCODE_MEDIA_PLAY", + Self::MEDIA_PAUSE => "SDL_SCANCODE_MEDIA_PAUSE", + Self::MEDIA_RECORD => "SDL_SCANCODE_MEDIA_RECORD", + Self::MEDIA_FAST_FORWARD => "SDL_SCANCODE_MEDIA_FAST_FORWARD", + Self::MEDIA_REWIND => "SDL_SCANCODE_MEDIA_REWIND", + Self::MEDIA_NEXT_TRACK => "SDL_SCANCODE_MEDIA_NEXT_TRACK", + Self::MEDIA_PREVIOUS_TRACK => "SDL_SCANCODE_MEDIA_PREVIOUS_TRACK", + Self::MEDIA_STOP => "SDL_SCANCODE_MEDIA_STOP", + Self::MEDIA_EJECT => "SDL_SCANCODE_MEDIA_EJECT", + Self::MEDIA_PLAY_PAUSE => "SDL_SCANCODE_MEDIA_PLAY_PAUSE", + Self::MEDIA_SELECT => "SDL_SCANCODE_MEDIA_SELECT", + Self::AC_NEW => "SDL_SCANCODE_AC_NEW", + Self::AC_OPEN => "SDL_SCANCODE_AC_OPEN", + Self::AC_CLOSE => "SDL_SCANCODE_AC_CLOSE", + Self::AC_EXIT => "SDL_SCANCODE_AC_EXIT", + Self::AC_SAVE => "SDL_SCANCODE_AC_SAVE", + Self::AC_PRINT => "SDL_SCANCODE_AC_PRINT", + Self::AC_PROPERTIES => "SDL_SCANCODE_AC_PROPERTIES", + Self::AC_SEARCH => "SDL_SCANCODE_AC_SEARCH", + Self::AC_HOME => "SDL_SCANCODE_AC_HOME", + Self::AC_BACK => "SDL_SCANCODE_AC_BACK", + Self::AC_FORWARD => "SDL_SCANCODE_AC_FORWARD", + Self::AC_STOP => "SDL_SCANCODE_AC_STOP", + Self::AC_REFRESH => "SDL_SCANCODE_AC_REFRESH", + Self::AC_BOOKMARKS => "SDL_SCANCODE_AC_BOOKMARKS", + Self::SOFTLEFT => "SDL_SCANCODE_SOFTLEFT", + Self::SOFTRIGHT => "SDL_SCANCODE_SOFTRIGHT", + Self::CALL => "SDL_SCANCODE_CALL", + Self::ENDCALL => "SDL_SCANCODE_ENDCALL", + Self::RESERVED => "SDL_SCANCODE_RESERVED", + Self::COUNT => "SDL_SCANCODE_COUNT", + + _ => return write!(f, "SDL_Scancode({})", self.0), + }) + } +} + +impl SDL_Scancode { + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + pub const A: Self = Self((4 as ::core::ffi::c_int)); + pub const B: Self = Self((5 as ::core::ffi::c_int)); + pub const C: Self = Self((6 as ::core::ffi::c_int)); + pub const D: Self = Self((7 as ::core::ffi::c_int)); + pub const E: Self = Self((8 as ::core::ffi::c_int)); + pub const F: Self = Self((9 as ::core::ffi::c_int)); + pub const G: Self = Self((10 as ::core::ffi::c_int)); + pub const H: Self = Self((11 as ::core::ffi::c_int)); + pub const I: Self = Self((12 as ::core::ffi::c_int)); + pub const J: Self = Self((13 as ::core::ffi::c_int)); + pub const K: Self = Self((14 as ::core::ffi::c_int)); + pub const L: Self = Self((15 as ::core::ffi::c_int)); + pub const M: Self = Self((16 as ::core::ffi::c_int)); + pub const N: Self = Self((17 as ::core::ffi::c_int)); + pub const O: Self = Self((18 as ::core::ffi::c_int)); + pub const P: Self = Self((19 as ::core::ffi::c_int)); + pub const Q: Self = Self((20 as ::core::ffi::c_int)); + pub const R: Self = Self((21 as ::core::ffi::c_int)); + pub const S: Self = Self((22 as ::core::ffi::c_int)); + pub const T: Self = Self((23 as ::core::ffi::c_int)); + pub const U: Self = Self((24 as ::core::ffi::c_int)); + pub const V: Self = Self((25 as ::core::ffi::c_int)); + pub const W: Self = Self((26 as ::core::ffi::c_int)); + pub const X: Self = Self((27 as ::core::ffi::c_int)); + pub const Y: Self = Self((28 as ::core::ffi::c_int)); + pub const Z: Self = Self((29 as ::core::ffi::c_int)); + pub const _1: Self = Self((30 as ::core::ffi::c_int)); + pub const _2: Self = Self((31 as ::core::ffi::c_int)); + pub const _3: Self = Self((32 as ::core::ffi::c_int)); + pub const _4: Self = Self((33 as ::core::ffi::c_int)); + pub const _5: Self = Self((34 as ::core::ffi::c_int)); + pub const _6: Self = Self((35 as ::core::ffi::c_int)); + pub const _7: Self = Self((36 as ::core::ffi::c_int)); + pub const _8: Self = Self((37 as ::core::ffi::c_int)); + pub const _9: Self = Self((38 as ::core::ffi::c_int)); + pub const _0: Self = Self((39 as ::core::ffi::c_int)); + pub const RETURN: Self = Self((40 as ::core::ffi::c_int)); + pub const ESCAPE: Self = Self((41 as ::core::ffi::c_int)); + pub const BACKSPACE: Self = Self((42 as ::core::ffi::c_int)); + pub const TAB: Self = Self((43 as ::core::ffi::c_int)); + pub const SPACE: Self = Self((44 as ::core::ffi::c_int)); + pub const MINUS: Self = Self((45 as ::core::ffi::c_int)); + pub const EQUALS: Self = Self((46 as ::core::ffi::c_int)); + pub const LEFTBRACKET: Self = Self((47 as ::core::ffi::c_int)); + pub const RIGHTBRACKET: Self = Self((48 as ::core::ffi::c_int)); + /// Located at the lower left of the return + /// key on ISO keyboards and at the right end + /// of the QWERTY row on ANSI keyboards. + /// Produces REVERSE SOLIDUS (backslash) and + /// VERTICAL LINE in a US layout, REVERSE + /// SOLIDUS and VERTICAL LINE in a UK Mac + /// layout, NUMBER SIGN and TILDE in a UK + /// Windows layout, DOLLAR SIGN and POUND SIGN + /// in a Swiss German layout, NUMBER SIGN and + /// APOSTROPHE in a German layout, GRAVE + /// ACCENT and POUND SIGN in a French Mac + /// layout, and ASTERISK and MICRO SIGN in a + /// French Windows layout. + pub const BACKSLASH: Self = Self((49 as ::core::ffi::c_int)); + /// ISO USB keyboards actually use this code + /// instead of 49 for the same key, but all + /// OSes I've seen treat the two codes + /// identically. So, as an implementor, unless + /// your keyboard generates both of those + /// codes and your OS treats them differently, + /// you should generate [`SDL_SCANCODE_BACKSLASH`] + /// instead of this code. As a user, you + /// should not rely on this code because SDL + /// will never generate it with most (all?) + /// keyboards. + pub const NONUSHASH: Self = Self((50 as ::core::ffi::c_int)); + pub const SEMICOLON: Self = Self((51 as ::core::ffi::c_int)); + pub const APOSTROPHE: Self = Self((52 as ::core::ffi::c_int)); + /// Located in the top left corner (on both ANSI + /// and ISO keyboards). Produces GRAVE ACCENT and + /// TILDE in a US Windows layout and in US and UK + /// Mac layouts on ANSI keyboards, GRAVE ACCENT + /// and NOT SIGN in a UK Windows layout, SECTION + /// SIGN and PLUS-MINUS SIGN in US and UK Mac + /// layouts on ISO keyboards, SECTION SIGN and + /// DEGREE SIGN in a Swiss German layout (Mac: + /// only on ISO keyboards), CIRCUMFLEX ACCENT and + /// DEGREE SIGN in a German layout (Mac: only on + /// ISO keyboards), SUPERSCRIPT TWO and TILDE in a + /// French Windows layout, COMMERCIAL AT and + /// NUMBER SIGN in a French Mac layout on ISO + /// keyboards, and LESS-THAN SIGN and GREATER-THAN + /// SIGN in a Swiss German, German, or French Mac + /// layout on ANSI keyboards. + pub const GRAVE: Self = Self((53 as ::core::ffi::c_int)); + pub const COMMA: Self = Self((54 as ::core::ffi::c_int)); + pub const PERIOD: Self = Self((55 as ::core::ffi::c_int)); + pub const SLASH: Self = Self((56 as ::core::ffi::c_int)); + pub const CAPSLOCK: Self = Self((57 as ::core::ffi::c_int)); + pub const F1: Self = Self((58 as ::core::ffi::c_int)); + pub const F2: Self = Self((59 as ::core::ffi::c_int)); + pub const F3: Self = Self((60 as ::core::ffi::c_int)); + pub const F4: Self = Self((61 as ::core::ffi::c_int)); + pub const F5: Self = Self((62 as ::core::ffi::c_int)); + pub const F6: Self = Self((63 as ::core::ffi::c_int)); + pub const F7: Self = Self((64 as ::core::ffi::c_int)); + pub const F8: Self = Self((65 as ::core::ffi::c_int)); + pub const F9: Self = Self((66 as ::core::ffi::c_int)); + pub const F10: Self = Self((67 as ::core::ffi::c_int)); + pub const F11: Self = Self((68 as ::core::ffi::c_int)); + pub const F12: Self = Self((69 as ::core::ffi::c_int)); + pub const PRINTSCREEN: Self = Self((70 as ::core::ffi::c_int)); + pub const SCROLLLOCK: Self = Self((71 as ::core::ffi::c_int)); + pub const PAUSE: Self = Self((72 as ::core::ffi::c_int)); + /// insert on PC, help on some Mac keyboards (but + /// does send code 73, not 117) + pub const INSERT: Self = Self((73 as ::core::ffi::c_int)); + pub const HOME: Self = Self((74 as ::core::ffi::c_int)); + pub const PAGEUP: Self = Self((75 as ::core::ffi::c_int)); + pub const DELETE: Self = Self((76 as ::core::ffi::c_int)); + pub const END: Self = Self((77 as ::core::ffi::c_int)); + pub const PAGEDOWN: Self = Self((78 as ::core::ffi::c_int)); + pub const RIGHT: Self = Self((79 as ::core::ffi::c_int)); + pub const LEFT: Self = Self((80 as ::core::ffi::c_int)); + pub const DOWN: Self = Self((81 as ::core::ffi::c_int)); + pub const UP: Self = Self((82 as ::core::ffi::c_int)); + /// num lock on PC, clear on Mac keyboards + pub const NUMLOCKCLEAR: Self = Self((83 as ::core::ffi::c_int)); + pub const KP_DIVIDE: Self = Self((84 as ::core::ffi::c_int)); + pub const KP_MULTIPLY: Self = Self((85 as ::core::ffi::c_int)); + pub const KP_MINUS: Self = Self((86 as ::core::ffi::c_int)); + pub const KP_PLUS: Self = Self((87 as ::core::ffi::c_int)); + pub const KP_ENTER: Self = Self((88 as ::core::ffi::c_int)); + pub const KP_1: Self = Self((89 as ::core::ffi::c_int)); + pub const KP_2: Self = Self((90 as ::core::ffi::c_int)); + pub const KP_3: Self = Self((91 as ::core::ffi::c_int)); + pub const KP_4: Self = Self((92 as ::core::ffi::c_int)); + pub const KP_5: Self = Self((93 as ::core::ffi::c_int)); + pub const KP_6: Self = Self((94 as ::core::ffi::c_int)); + pub const KP_7: Self = Self((95 as ::core::ffi::c_int)); + pub const KP_8: Self = Self((96 as ::core::ffi::c_int)); + pub const KP_9: Self = Self((97 as ::core::ffi::c_int)); + pub const KP_0: Self = Self((98 as ::core::ffi::c_int)); + pub const KP_PERIOD: Self = Self((99 as ::core::ffi::c_int)); + /// This is the additional key that ISO + /// keyboards have over ANSI ones, + /// located between left shift and Z. + /// Produces GRAVE ACCENT and TILDE in a + /// US or UK Mac layout, REVERSE SOLIDUS + /// (backslash) and VERTICAL LINE in a + /// US or UK Windows layout, and + /// LESS-THAN SIGN and GREATER-THAN SIGN + /// in a Swiss German, German, or French + /// layout. + pub const NONUSBACKSLASH: Self = Self((100 as ::core::ffi::c_int)); + /// windows contextual menu, compose + pub const APPLICATION: Self = Self((101 as ::core::ffi::c_int)); + /// The USB document says this is a status flag, + /// not a physical key - but some Mac keyboards + /// do have a power key. + pub const POWER: Self = Self((102 as ::core::ffi::c_int)); + pub const KP_EQUALS: Self = Self((103 as ::core::ffi::c_int)); + pub const F13: Self = Self((104 as ::core::ffi::c_int)); + pub const F14: Self = Self((105 as ::core::ffi::c_int)); + pub const F15: Self = Self((106 as ::core::ffi::c_int)); + pub const F16: Self = Self((107 as ::core::ffi::c_int)); + pub const F17: Self = Self((108 as ::core::ffi::c_int)); + pub const F18: Self = Self((109 as ::core::ffi::c_int)); + pub const F19: Self = Self((110 as ::core::ffi::c_int)); + pub const F20: Self = Self((111 as ::core::ffi::c_int)); + pub const F21: Self = Self((112 as ::core::ffi::c_int)); + pub const F22: Self = Self((113 as ::core::ffi::c_int)); + pub const F23: Self = Self((114 as ::core::ffi::c_int)); + pub const F24: Self = Self((115 as ::core::ffi::c_int)); + pub const EXECUTE: Self = Self((116 as ::core::ffi::c_int)); + /// AL Integrated Help Center + pub const HELP: Self = Self((117 as ::core::ffi::c_int)); + /// Menu (show menu) + pub const MENU: Self = Self((118 as ::core::ffi::c_int)); + pub const SELECT: Self = Self((119 as ::core::ffi::c_int)); + /// AC Stop + pub const STOP: Self = Self((120 as ::core::ffi::c_int)); + /// AC Redo/Repeat + pub const AGAIN: Self = Self((121 as ::core::ffi::c_int)); + /// AC Undo + pub const UNDO: Self = Self((122 as ::core::ffi::c_int)); + /// AC Cut + pub const CUT: Self = Self((123 as ::core::ffi::c_int)); + /// AC Copy + pub const COPY: Self = Self((124 as ::core::ffi::c_int)); + /// AC Paste + pub const PASTE: Self = Self((125 as ::core::ffi::c_int)); + /// AC Find + pub const FIND: Self = Self((126 as ::core::ffi::c_int)); + pub const MUTE: Self = Self((127 as ::core::ffi::c_int)); + pub const VOLUMEUP: Self = Self((128 as ::core::ffi::c_int)); + pub const VOLUMEDOWN: Self = Self((129 as ::core::ffi::c_int)); + pub const KP_COMMA: Self = Self((133 as ::core::ffi::c_int)); + pub const KP_EQUALSAS400: Self = Self((134 as ::core::ffi::c_int)); + /// used on Asian keyboards, see + /// footnotes in USB doc + pub const INTERNATIONAL1: Self = Self((135 as ::core::ffi::c_int)); + pub const INTERNATIONAL2: Self = Self((136 as ::core::ffi::c_int)); + /// Yen + pub const INTERNATIONAL3: Self = Self((137 as ::core::ffi::c_int)); + pub const INTERNATIONAL4: Self = Self((138 as ::core::ffi::c_int)); + pub const INTERNATIONAL5: Self = Self((139 as ::core::ffi::c_int)); + pub const INTERNATIONAL6: Self = Self((140 as ::core::ffi::c_int)); + pub const INTERNATIONAL7: Self = Self((141 as ::core::ffi::c_int)); + pub const INTERNATIONAL8: Self = Self((142 as ::core::ffi::c_int)); + pub const INTERNATIONAL9: Self = Self((143 as ::core::ffi::c_int)); + /// Hangul/English toggle + pub const LANG1: Self = Self((144 as ::core::ffi::c_int)); + /// Hanja conversion + pub const LANG2: Self = Self((145 as ::core::ffi::c_int)); + /// Katakana + pub const LANG3: Self = Self((146 as ::core::ffi::c_int)); + /// Hiragana + pub const LANG4: Self = Self((147 as ::core::ffi::c_int)); + /// Zenkaku/Hankaku + pub const LANG5: Self = Self((148 as ::core::ffi::c_int)); + /// reserved + pub const LANG6: Self = Self((149 as ::core::ffi::c_int)); + /// reserved + pub const LANG7: Self = Self((150 as ::core::ffi::c_int)); + /// reserved + pub const LANG8: Self = Self((151 as ::core::ffi::c_int)); + /// reserved + pub const LANG9: Self = Self((152 as ::core::ffi::c_int)); + /// Erase-Eaze + pub const ALTERASE: Self = Self((153 as ::core::ffi::c_int)); + pub const SYSREQ: Self = Self((154 as ::core::ffi::c_int)); + /// AC Cancel + pub const CANCEL: Self = Self((155 as ::core::ffi::c_int)); + pub const CLEAR: Self = Self((156 as ::core::ffi::c_int)); + pub const PRIOR: Self = Self((157 as ::core::ffi::c_int)); + pub const RETURN2: Self = Self((158 as ::core::ffi::c_int)); + pub const SEPARATOR: Self = Self((159 as ::core::ffi::c_int)); + pub const OUT: Self = Self((160 as ::core::ffi::c_int)); + pub const OPER: Self = Self((161 as ::core::ffi::c_int)); + pub const CLEARAGAIN: Self = Self((162 as ::core::ffi::c_int)); + pub const CRSEL: Self = Self((163 as ::core::ffi::c_int)); + pub const EXSEL: Self = Self((164 as ::core::ffi::c_int)); + pub const KP_00: Self = Self((176 as ::core::ffi::c_int)); + pub const KP_000: Self = Self((177 as ::core::ffi::c_int)); + pub const THOUSANDSSEPARATOR: Self = Self((178 as ::core::ffi::c_int)); + pub const DECIMALSEPARATOR: Self = Self((179 as ::core::ffi::c_int)); + pub const CURRENCYUNIT: Self = Self((180 as ::core::ffi::c_int)); + pub const CURRENCYSUBUNIT: Self = Self((181 as ::core::ffi::c_int)); + pub const KP_LEFTPAREN: Self = Self((182 as ::core::ffi::c_int)); + pub const KP_RIGHTPAREN: Self = Self((183 as ::core::ffi::c_int)); + pub const KP_LEFTBRACE: Self = Self((184 as ::core::ffi::c_int)); + pub const KP_RIGHTBRACE: Self = Self((185 as ::core::ffi::c_int)); + pub const KP_TAB: Self = Self((186 as ::core::ffi::c_int)); + pub const KP_BACKSPACE: Self = Self((187 as ::core::ffi::c_int)); + pub const KP_A: Self = Self((188 as ::core::ffi::c_int)); + pub const KP_B: Self = Self((189 as ::core::ffi::c_int)); + pub const KP_C: Self = Self((190 as ::core::ffi::c_int)); + pub const KP_D: Self = Self((191 as ::core::ffi::c_int)); + pub const KP_E: Self = Self((192 as ::core::ffi::c_int)); + pub const KP_F: Self = Self((193 as ::core::ffi::c_int)); + pub const KP_XOR: Self = Self((194 as ::core::ffi::c_int)); + pub const KP_POWER: Self = Self((195 as ::core::ffi::c_int)); + pub const KP_PERCENT: Self = Self((196 as ::core::ffi::c_int)); + pub const KP_LESS: Self = Self((197 as ::core::ffi::c_int)); + pub const KP_GREATER: Self = Self((198 as ::core::ffi::c_int)); + pub const KP_AMPERSAND: Self = Self((199 as ::core::ffi::c_int)); + pub const KP_DBLAMPERSAND: Self = Self((200 as ::core::ffi::c_int)); + pub const KP_VERTICALBAR: Self = Self((201 as ::core::ffi::c_int)); + pub const KP_DBLVERTICALBAR: Self = Self((202 as ::core::ffi::c_int)); + pub const KP_COLON: Self = Self((203 as ::core::ffi::c_int)); + pub const KP_HASH: Self = Self((204 as ::core::ffi::c_int)); + pub const KP_SPACE: Self = Self((205 as ::core::ffi::c_int)); + pub const KP_AT: Self = Self((206 as ::core::ffi::c_int)); + pub const KP_EXCLAM: Self = Self((207 as ::core::ffi::c_int)); + pub const KP_MEMSTORE: Self = Self((208 as ::core::ffi::c_int)); + pub const KP_MEMRECALL: Self = Self((209 as ::core::ffi::c_int)); + pub const KP_MEMCLEAR: Self = Self((210 as ::core::ffi::c_int)); + pub const KP_MEMADD: Self = Self((211 as ::core::ffi::c_int)); + pub const KP_MEMSUBTRACT: Self = Self((212 as ::core::ffi::c_int)); + pub const KP_MEMMULTIPLY: Self = Self((213 as ::core::ffi::c_int)); + pub const KP_MEMDIVIDE: Self = Self((214 as ::core::ffi::c_int)); + pub const KP_PLUSMINUS: Self = Self((215 as ::core::ffi::c_int)); + pub const KP_CLEAR: Self = Self((216 as ::core::ffi::c_int)); + pub const KP_CLEARENTRY: Self = Self((217 as ::core::ffi::c_int)); + pub const KP_BINARY: Self = Self((218 as ::core::ffi::c_int)); + pub const KP_OCTAL: Self = Self((219 as ::core::ffi::c_int)); + pub const KP_DECIMAL: Self = Self((220 as ::core::ffi::c_int)); + pub const KP_HEXADECIMAL: Self = Self((221 as ::core::ffi::c_int)); + pub const LCTRL: Self = Self((224 as ::core::ffi::c_int)); + pub const LSHIFT: Self = Self((225 as ::core::ffi::c_int)); + /// alt, option + pub const LALT: Self = Self((226 as ::core::ffi::c_int)); + /// windows, command (apple), meta + pub const LGUI: Self = Self((227 as ::core::ffi::c_int)); + pub const RCTRL: Self = Self((228 as ::core::ffi::c_int)); + pub const RSHIFT: Self = Self((229 as ::core::ffi::c_int)); + /// alt gr, option + pub const RALT: Self = Self((230 as ::core::ffi::c_int)); + /// windows, command (apple), meta + pub const RGUI: Self = Self((231 as ::core::ffi::c_int)); + /// I'm not sure if this is really not covered + /// by any of the above, but since there's a + /// special [`SDL_KMOD_MODE`] for it I'm adding it here + pub const MODE: Self = Self((257 as ::core::ffi::c_int)); + /// Sleep + pub const SLEEP: Self = Self((258 as ::core::ffi::c_int)); + /// Wake + pub const WAKE: Self = Self((259 as ::core::ffi::c_int)); + /// Channel Increment + pub const CHANNEL_INCREMENT: Self = Self((260 as ::core::ffi::c_int)); + /// Channel Decrement + pub const CHANNEL_DECREMENT: Self = Self((261 as ::core::ffi::c_int)); + /// Play + pub const MEDIA_PLAY: Self = Self((262 as ::core::ffi::c_int)); + /// Pause + pub const MEDIA_PAUSE: Self = Self((263 as ::core::ffi::c_int)); + /// Record + pub const MEDIA_RECORD: Self = Self((264 as ::core::ffi::c_int)); + /// Fast Forward + pub const MEDIA_FAST_FORWARD: Self = Self((265 as ::core::ffi::c_int)); + /// Rewind + pub const MEDIA_REWIND: Self = Self((266 as ::core::ffi::c_int)); + /// Next Track + pub const MEDIA_NEXT_TRACK: Self = Self((267 as ::core::ffi::c_int)); + /// Previous Track + pub const MEDIA_PREVIOUS_TRACK: Self = Self((268 as ::core::ffi::c_int)); + /// Stop + pub const MEDIA_STOP: Self = Self((269 as ::core::ffi::c_int)); + /// Eject + pub const MEDIA_EJECT: Self = Self((270 as ::core::ffi::c_int)); + /// Play / Pause + pub const MEDIA_PLAY_PAUSE: Self = Self((271 as ::core::ffi::c_int)); + pub const MEDIA_SELECT: Self = Self((272 as ::core::ffi::c_int)); + /// AC New + pub const AC_NEW: Self = Self((273 as ::core::ffi::c_int)); + /// AC Open + pub const AC_OPEN: Self = Self((274 as ::core::ffi::c_int)); + /// AC Close + pub const AC_CLOSE: Self = Self((275 as ::core::ffi::c_int)); + /// AC Exit + pub const AC_EXIT: Self = Self((276 as ::core::ffi::c_int)); + /// AC Save + pub const AC_SAVE: Self = Self((277 as ::core::ffi::c_int)); + /// AC Print + pub const AC_PRINT: Self = Self((278 as ::core::ffi::c_int)); + /// AC Properties + pub const AC_PROPERTIES: Self = Self((279 as ::core::ffi::c_int)); + /// AC Search + pub const AC_SEARCH: Self = Self((280 as ::core::ffi::c_int)); + /// AC Home + pub const AC_HOME: Self = Self((281 as ::core::ffi::c_int)); + /// AC Back + pub const AC_BACK: Self = Self((282 as ::core::ffi::c_int)); + /// AC Forward + pub const AC_FORWARD: Self = Self((283 as ::core::ffi::c_int)); + /// AC Stop + pub const AC_STOP: Self = Self((284 as ::core::ffi::c_int)); + /// AC Refresh + pub const AC_REFRESH: Self = Self((285 as ::core::ffi::c_int)); + /// AC Bookmarks + pub const AC_BOOKMARKS: Self = Self((286 as ::core::ffi::c_int)); + /// Usually situated below the display on phones and + /// used as a multi-function feature key for selecting + /// a software defined function shown on the bottom left + /// of the display. + pub const SOFTLEFT: Self = Self((287 as ::core::ffi::c_int)); + /// Usually situated below the display on phones and + /// used as a multi-function feature key for selecting + /// a software defined function shown on the bottom right + /// of the display. + pub const SOFTRIGHT: Self = Self((288 as ::core::ffi::c_int)); + /// Used for accepting phone calls. + pub const CALL: Self = Self((289 as ::core::ffi::c_int)); + /// Used for rejecting phone calls. + pub const ENDCALL: Self = Self((290 as ::core::ffi::c_int)); + /// 400-500 reserved for dynamic keycodes + pub const RESERVED: Self = Self((400 as ::core::ffi::c_int)); + /// not a key, just marks the number of scancodes for array bounds + pub const COUNT: Self = Self((512 as ::core::ffi::c_int)); +} + +pub const SDL_SCANCODE_UNKNOWN: SDL_Scancode = SDL_Scancode::UNKNOWN; +pub const SDL_SCANCODE_A: SDL_Scancode = SDL_Scancode::A; +pub const SDL_SCANCODE_B: SDL_Scancode = SDL_Scancode::B; +pub const SDL_SCANCODE_C: SDL_Scancode = SDL_Scancode::C; +pub const SDL_SCANCODE_D: SDL_Scancode = SDL_Scancode::D; +pub const SDL_SCANCODE_E: SDL_Scancode = SDL_Scancode::E; +pub const SDL_SCANCODE_F: SDL_Scancode = SDL_Scancode::F; +pub const SDL_SCANCODE_G: SDL_Scancode = SDL_Scancode::G; +pub const SDL_SCANCODE_H: SDL_Scancode = SDL_Scancode::H; +pub const SDL_SCANCODE_I: SDL_Scancode = SDL_Scancode::I; +pub const SDL_SCANCODE_J: SDL_Scancode = SDL_Scancode::J; +pub const SDL_SCANCODE_K: SDL_Scancode = SDL_Scancode::K; +pub const SDL_SCANCODE_L: SDL_Scancode = SDL_Scancode::L; +pub const SDL_SCANCODE_M: SDL_Scancode = SDL_Scancode::M; +pub const SDL_SCANCODE_N: SDL_Scancode = SDL_Scancode::N; +pub const SDL_SCANCODE_O: SDL_Scancode = SDL_Scancode::O; +pub const SDL_SCANCODE_P: SDL_Scancode = SDL_Scancode::P; +pub const SDL_SCANCODE_Q: SDL_Scancode = SDL_Scancode::Q; +pub const SDL_SCANCODE_R: SDL_Scancode = SDL_Scancode::R; +pub const SDL_SCANCODE_S: SDL_Scancode = SDL_Scancode::S; +pub const SDL_SCANCODE_T: SDL_Scancode = SDL_Scancode::T; +pub const SDL_SCANCODE_U: SDL_Scancode = SDL_Scancode::U; +pub const SDL_SCANCODE_V: SDL_Scancode = SDL_Scancode::V; +pub const SDL_SCANCODE_W: SDL_Scancode = SDL_Scancode::W; +pub const SDL_SCANCODE_X: SDL_Scancode = SDL_Scancode::X; +pub const SDL_SCANCODE_Y: SDL_Scancode = SDL_Scancode::Y; +pub const SDL_SCANCODE_Z: SDL_Scancode = SDL_Scancode::Z; +pub const SDL_SCANCODE_1: SDL_Scancode = SDL_Scancode::_1; +pub const SDL_SCANCODE_2: SDL_Scancode = SDL_Scancode::_2; +pub const SDL_SCANCODE_3: SDL_Scancode = SDL_Scancode::_3; +pub const SDL_SCANCODE_4: SDL_Scancode = SDL_Scancode::_4; +pub const SDL_SCANCODE_5: SDL_Scancode = SDL_Scancode::_5; +pub const SDL_SCANCODE_6: SDL_Scancode = SDL_Scancode::_6; +pub const SDL_SCANCODE_7: SDL_Scancode = SDL_Scancode::_7; +pub const SDL_SCANCODE_8: SDL_Scancode = SDL_Scancode::_8; +pub const SDL_SCANCODE_9: SDL_Scancode = SDL_Scancode::_9; +pub const SDL_SCANCODE_0: SDL_Scancode = SDL_Scancode::_0; +pub const SDL_SCANCODE_RETURN: SDL_Scancode = SDL_Scancode::RETURN; +pub const SDL_SCANCODE_ESCAPE: SDL_Scancode = SDL_Scancode::ESCAPE; +pub const SDL_SCANCODE_BACKSPACE: SDL_Scancode = SDL_Scancode::BACKSPACE; +pub const SDL_SCANCODE_TAB: SDL_Scancode = SDL_Scancode::TAB; +pub const SDL_SCANCODE_SPACE: SDL_Scancode = SDL_Scancode::SPACE; +pub const SDL_SCANCODE_MINUS: SDL_Scancode = SDL_Scancode::MINUS; +pub const SDL_SCANCODE_EQUALS: SDL_Scancode = SDL_Scancode::EQUALS; +pub const SDL_SCANCODE_LEFTBRACKET: SDL_Scancode = SDL_Scancode::LEFTBRACKET; +pub const SDL_SCANCODE_RIGHTBRACKET: SDL_Scancode = SDL_Scancode::RIGHTBRACKET; +/// Located at the lower left of the return +/// key on ISO keyboards and at the right end +/// of the QWERTY row on ANSI keyboards. +/// Produces REVERSE SOLIDUS (backslash) and +/// VERTICAL LINE in a US layout, REVERSE +/// SOLIDUS and VERTICAL LINE in a UK Mac +/// layout, NUMBER SIGN and TILDE in a UK +/// Windows layout, DOLLAR SIGN and POUND SIGN +/// in a Swiss German layout, NUMBER SIGN and +/// APOSTROPHE in a German layout, GRAVE +/// ACCENT and POUND SIGN in a French Mac +/// layout, and ASTERISK and MICRO SIGN in a +/// French Windows layout. +pub const SDL_SCANCODE_BACKSLASH: SDL_Scancode = SDL_Scancode::BACKSLASH; +/// ISO USB keyboards actually use this code +/// instead of 49 for the same key, but all +/// OSes I've seen treat the two codes +/// identically. So, as an implementor, unless +/// your keyboard generates both of those +/// codes and your OS treats them differently, +/// you should generate [`SDL_SCANCODE_BACKSLASH`] +/// instead of this code. As a user, you +/// should not rely on this code because SDL +/// will never generate it with most (all?) +/// keyboards. +pub const SDL_SCANCODE_NONUSHASH: SDL_Scancode = SDL_Scancode::NONUSHASH; +pub const SDL_SCANCODE_SEMICOLON: SDL_Scancode = SDL_Scancode::SEMICOLON; +pub const SDL_SCANCODE_APOSTROPHE: SDL_Scancode = SDL_Scancode::APOSTROPHE; +/// Located in the top left corner (on both ANSI +/// and ISO keyboards). Produces GRAVE ACCENT and +/// TILDE in a US Windows layout and in US and UK +/// Mac layouts on ANSI keyboards, GRAVE ACCENT +/// and NOT SIGN in a UK Windows layout, SECTION +/// SIGN and PLUS-MINUS SIGN in US and UK Mac +/// layouts on ISO keyboards, SECTION SIGN and +/// DEGREE SIGN in a Swiss German layout (Mac: +/// only on ISO keyboards), CIRCUMFLEX ACCENT and +/// DEGREE SIGN in a German layout (Mac: only on +/// ISO keyboards), SUPERSCRIPT TWO and TILDE in a +/// French Windows layout, COMMERCIAL AT and +/// NUMBER SIGN in a French Mac layout on ISO +/// keyboards, and LESS-THAN SIGN and GREATER-THAN +/// SIGN in a Swiss German, German, or French Mac +/// layout on ANSI keyboards. +pub const SDL_SCANCODE_GRAVE: SDL_Scancode = SDL_Scancode::GRAVE; +pub const SDL_SCANCODE_COMMA: SDL_Scancode = SDL_Scancode::COMMA; +pub const SDL_SCANCODE_PERIOD: SDL_Scancode = SDL_Scancode::PERIOD; +pub const SDL_SCANCODE_SLASH: SDL_Scancode = SDL_Scancode::SLASH; +pub const SDL_SCANCODE_CAPSLOCK: SDL_Scancode = SDL_Scancode::CAPSLOCK; +pub const SDL_SCANCODE_F1: SDL_Scancode = SDL_Scancode::F1; +pub const SDL_SCANCODE_F2: SDL_Scancode = SDL_Scancode::F2; +pub const SDL_SCANCODE_F3: SDL_Scancode = SDL_Scancode::F3; +pub const SDL_SCANCODE_F4: SDL_Scancode = SDL_Scancode::F4; +pub const SDL_SCANCODE_F5: SDL_Scancode = SDL_Scancode::F5; +pub const SDL_SCANCODE_F6: SDL_Scancode = SDL_Scancode::F6; +pub const SDL_SCANCODE_F7: SDL_Scancode = SDL_Scancode::F7; +pub const SDL_SCANCODE_F8: SDL_Scancode = SDL_Scancode::F8; +pub const SDL_SCANCODE_F9: SDL_Scancode = SDL_Scancode::F9; +pub const SDL_SCANCODE_F10: SDL_Scancode = SDL_Scancode::F10; +pub const SDL_SCANCODE_F11: SDL_Scancode = SDL_Scancode::F11; +pub const SDL_SCANCODE_F12: SDL_Scancode = SDL_Scancode::F12; +pub const SDL_SCANCODE_PRINTSCREEN: SDL_Scancode = SDL_Scancode::PRINTSCREEN; +pub const SDL_SCANCODE_SCROLLLOCK: SDL_Scancode = SDL_Scancode::SCROLLLOCK; +pub const SDL_SCANCODE_PAUSE: SDL_Scancode = SDL_Scancode::PAUSE; +/// insert on PC, help on some Mac keyboards (but +/// does send code 73, not 117) +pub const SDL_SCANCODE_INSERT: SDL_Scancode = SDL_Scancode::INSERT; +pub const SDL_SCANCODE_HOME: SDL_Scancode = SDL_Scancode::HOME; +pub const SDL_SCANCODE_PAGEUP: SDL_Scancode = SDL_Scancode::PAGEUP; +pub const SDL_SCANCODE_DELETE: SDL_Scancode = SDL_Scancode::DELETE; +pub const SDL_SCANCODE_END: SDL_Scancode = SDL_Scancode::END; +pub const SDL_SCANCODE_PAGEDOWN: SDL_Scancode = SDL_Scancode::PAGEDOWN; +pub const SDL_SCANCODE_RIGHT: SDL_Scancode = SDL_Scancode::RIGHT; +pub const SDL_SCANCODE_LEFT: SDL_Scancode = SDL_Scancode::LEFT; +pub const SDL_SCANCODE_DOWN: SDL_Scancode = SDL_Scancode::DOWN; +pub const SDL_SCANCODE_UP: SDL_Scancode = SDL_Scancode::UP; +/// num lock on PC, clear on Mac keyboards +pub const SDL_SCANCODE_NUMLOCKCLEAR: SDL_Scancode = SDL_Scancode::NUMLOCKCLEAR; +pub const SDL_SCANCODE_KP_DIVIDE: SDL_Scancode = SDL_Scancode::KP_DIVIDE; +pub const SDL_SCANCODE_KP_MULTIPLY: SDL_Scancode = SDL_Scancode::KP_MULTIPLY; +pub const SDL_SCANCODE_KP_MINUS: SDL_Scancode = SDL_Scancode::KP_MINUS; +pub const SDL_SCANCODE_KP_PLUS: SDL_Scancode = SDL_Scancode::KP_PLUS; +pub const SDL_SCANCODE_KP_ENTER: SDL_Scancode = SDL_Scancode::KP_ENTER; +pub const SDL_SCANCODE_KP_1: SDL_Scancode = SDL_Scancode::KP_1; +pub const SDL_SCANCODE_KP_2: SDL_Scancode = SDL_Scancode::KP_2; +pub const SDL_SCANCODE_KP_3: SDL_Scancode = SDL_Scancode::KP_3; +pub const SDL_SCANCODE_KP_4: SDL_Scancode = SDL_Scancode::KP_4; +pub const SDL_SCANCODE_KP_5: SDL_Scancode = SDL_Scancode::KP_5; +pub const SDL_SCANCODE_KP_6: SDL_Scancode = SDL_Scancode::KP_6; +pub const SDL_SCANCODE_KP_7: SDL_Scancode = SDL_Scancode::KP_7; +pub const SDL_SCANCODE_KP_8: SDL_Scancode = SDL_Scancode::KP_8; +pub const SDL_SCANCODE_KP_9: SDL_Scancode = SDL_Scancode::KP_9; +pub const SDL_SCANCODE_KP_0: SDL_Scancode = SDL_Scancode::KP_0; +pub const SDL_SCANCODE_KP_PERIOD: SDL_Scancode = SDL_Scancode::KP_PERIOD; +/// This is the additional key that ISO +/// keyboards have over ANSI ones, +/// located between left shift and Z. +/// Produces GRAVE ACCENT and TILDE in a +/// US or UK Mac layout, REVERSE SOLIDUS +/// (backslash) and VERTICAL LINE in a +/// US or UK Windows layout, and +/// LESS-THAN SIGN and GREATER-THAN SIGN +/// in a Swiss German, German, or French +/// layout. +pub const SDL_SCANCODE_NONUSBACKSLASH: SDL_Scancode = SDL_Scancode::NONUSBACKSLASH; +/// windows contextual menu, compose +pub const SDL_SCANCODE_APPLICATION: SDL_Scancode = SDL_Scancode::APPLICATION; +/// The USB document says this is a status flag, +/// not a physical key - but some Mac keyboards +/// do have a power key. +pub const SDL_SCANCODE_POWER: SDL_Scancode = SDL_Scancode::POWER; +pub const SDL_SCANCODE_KP_EQUALS: SDL_Scancode = SDL_Scancode::KP_EQUALS; +pub const SDL_SCANCODE_F13: SDL_Scancode = SDL_Scancode::F13; +pub const SDL_SCANCODE_F14: SDL_Scancode = SDL_Scancode::F14; +pub const SDL_SCANCODE_F15: SDL_Scancode = SDL_Scancode::F15; +pub const SDL_SCANCODE_F16: SDL_Scancode = SDL_Scancode::F16; +pub const SDL_SCANCODE_F17: SDL_Scancode = SDL_Scancode::F17; +pub const SDL_SCANCODE_F18: SDL_Scancode = SDL_Scancode::F18; +pub const SDL_SCANCODE_F19: SDL_Scancode = SDL_Scancode::F19; +pub const SDL_SCANCODE_F20: SDL_Scancode = SDL_Scancode::F20; +pub const SDL_SCANCODE_F21: SDL_Scancode = SDL_Scancode::F21; +pub const SDL_SCANCODE_F22: SDL_Scancode = SDL_Scancode::F22; +pub const SDL_SCANCODE_F23: SDL_Scancode = SDL_Scancode::F23; +pub const SDL_SCANCODE_F24: SDL_Scancode = SDL_Scancode::F24; +pub const SDL_SCANCODE_EXECUTE: SDL_Scancode = SDL_Scancode::EXECUTE; +/// AL Integrated Help Center +pub const SDL_SCANCODE_HELP: SDL_Scancode = SDL_Scancode::HELP; +/// Menu (show menu) +pub const SDL_SCANCODE_MENU: SDL_Scancode = SDL_Scancode::MENU; +pub const SDL_SCANCODE_SELECT: SDL_Scancode = SDL_Scancode::SELECT; +/// AC Stop +pub const SDL_SCANCODE_STOP: SDL_Scancode = SDL_Scancode::STOP; +/// AC Redo/Repeat +pub const SDL_SCANCODE_AGAIN: SDL_Scancode = SDL_Scancode::AGAIN; +/// AC Undo +pub const SDL_SCANCODE_UNDO: SDL_Scancode = SDL_Scancode::UNDO; +/// AC Cut +pub const SDL_SCANCODE_CUT: SDL_Scancode = SDL_Scancode::CUT; +/// AC Copy +pub const SDL_SCANCODE_COPY: SDL_Scancode = SDL_Scancode::COPY; +/// AC Paste +pub const SDL_SCANCODE_PASTE: SDL_Scancode = SDL_Scancode::PASTE; +/// AC Find +pub const SDL_SCANCODE_FIND: SDL_Scancode = SDL_Scancode::FIND; +pub const SDL_SCANCODE_MUTE: SDL_Scancode = SDL_Scancode::MUTE; +pub const SDL_SCANCODE_VOLUMEUP: SDL_Scancode = SDL_Scancode::VOLUMEUP; +pub const SDL_SCANCODE_VOLUMEDOWN: SDL_Scancode = SDL_Scancode::VOLUMEDOWN; +pub const SDL_SCANCODE_KP_COMMA: SDL_Scancode = SDL_Scancode::KP_COMMA; +pub const SDL_SCANCODE_KP_EQUALSAS400: SDL_Scancode = SDL_Scancode::KP_EQUALSAS400; +/// used on Asian keyboards, see +/// footnotes in USB doc +pub const SDL_SCANCODE_INTERNATIONAL1: SDL_Scancode = SDL_Scancode::INTERNATIONAL1; +pub const SDL_SCANCODE_INTERNATIONAL2: SDL_Scancode = SDL_Scancode::INTERNATIONAL2; +/// Yen +pub const SDL_SCANCODE_INTERNATIONAL3: SDL_Scancode = SDL_Scancode::INTERNATIONAL3; +pub const SDL_SCANCODE_INTERNATIONAL4: SDL_Scancode = SDL_Scancode::INTERNATIONAL4; +pub const SDL_SCANCODE_INTERNATIONAL5: SDL_Scancode = SDL_Scancode::INTERNATIONAL5; +pub const SDL_SCANCODE_INTERNATIONAL6: SDL_Scancode = SDL_Scancode::INTERNATIONAL6; +pub const SDL_SCANCODE_INTERNATIONAL7: SDL_Scancode = SDL_Scancode::INTERNATIONAL7; +pub const SDL_SCANCODE_INTERNATIONAL8: SDL_Scancode = SDL_Scancode::INTERNATIONAL8; +pub const SDL_SCANCODE_INTERNATIONAL9: SDL_Scancode = SDL_Scancode::INTERNATIONAL9; +/// Hangul/English toggle +pub const SDL_SCANCODE_LANG1: SDL_Scancode = SDL_Scancode::LANG1; +/// Hanja conversion +pub const SDL_SCANCODE_LANG2: SDL_Scancode = SDL_Scancode::LANG2; +/// Katakana +pub const SDL_SCANCODE_LANG3: SDL_Scancode = SDL_Scancode::LANG3; +/// Hiragana +pub const SDL_SCANCODE_LANG4: SDL_Scancode = SDL_Scancode::LANG4; +/// Zenkaku/Hankaku +pub const SDL_SCANCODE_LANG5: SDL_Scancode = SDL_Scancode::LANG5; +/// reserved +pub const SDL_SCANCODE_LANG6: SDL_Scancode = SDL_Scancode::LANG6; +/// reserved +pub const SDL_SCANCODE_LANG7: SDL_Scancode = SDL_Scancode::LANG7; +/// reserved +pub const SDL_SCANCODE_LANG8: SDL_Scancode = SDL_Scancode::LANG8; +/// reserved +pub const SDL_SCANCODE_LANG9: SDL_Scancode = SDL_Scancode::LANG9; +/// Erase-Eaze +pub const SDL_SCANCODE_ALTERASE: SDL_Scancode = SDL_Scancode::ALTERASE; +pub const SDL_SCANCODE_SYSREQ: SDL_Scancode = SDL_Scancode::SYSREQ; +/// AC Cancel +pub const SDL_SCANCODE_CANCEL: SDL_Scancode = SDL_Scancode::CANCEL; +pub const SDL_SCANCODE_CLEAR: SDL_Scancode = SDL_Scancode::CLEAR; +pub const SDL_SCANCODE_PRIOR: SDL_Scancode = SDL_Scancode::PRIOR; +pub const SDL_SCANCODE_RETURN2: SDL_Scancode = SDL_Scancode::RETURN2; +pub const SDL_SCANCODE_SEPARATOR: SDL_Scancode = SDL_Scancode::SEPARATOR; +pub const SDL_SCANCODE_OUT: SDL_Scancode = SDL_Scancode::OUT; +pub const SDL_SCANCODE_OPER: SDL_Scancode = SDL_Scancode::OPER; +pub const SDL_SCANCODE_CLEARAGAIN: SDL_Scancode = SDL_Scancode::CLEARAGAIN; +pub const SDL_SCANCODE_CRSEL: SDL_Scancode = SDL_Scancode::CRSEL; +pub const SDL_SCANCODE_EXSEL: SDL_Scancode = SDL_Scancode::EXSEL; +pub const SDL_SCANCODE_KP_00: SDL_Scancode = SDL_Scancode::KP_00; +pub const SDL_SCANCODE_KP_000: SDL_Scancode = SDL_Scancode::KP_000; +pub const SDL_SCANCODE_THOUSANDSSEPARATOR: SDL_Scancode = SDL_Scancode::THOUSANDSSEPARATOR; +pub const SDL_SCANCODE_DECIMALSEPARATOR: SDL_Scancode = SDL_Scancode::DECIMALSEPARATOR; +pub const SDL_SCANCODE_CURRENCYUNIT: SDL_Scancode = SDL_Scancode::CURRENCYUNIT; +pub const SDL_SCANCODE_CURRENCYSUBUNIT: SDL_Scancode = SDL_Scancode::CURRENCYSUBUNIT; +pub const SDL_SCANCODE_KP_LEFTPAREN: SDL_Scancode = SDL_Scancode::KP_LEFTPAREN; +pub const SDL_SCANCODE_KP_RIGHTPAREN: SDL_Scancode = SDL_Scancode::KP_RIGHTPAREN; +pub const SDL_SCANCODE_KP_LEFTBRACE: SDL_Scancode = SDL_Scancode::KP_LEFTBRACE; +pub const SDL_SCANCODE_KP_RIGHTBRACE: SDL_Scancode = SDL_Scancode::KP_RIGHTBRACE; +pub const SDL_SCANCODE_KP_TAB: SDL_Scancode = SDL_Scancode::KP_TAB; +pub const SDL_SCANCODE_KP_BACKSPACE: SDL_Scancode = SDL_Scancode::KP_BACKSPACE; +pub const SDL_SCANCODE_KP_A: SDL_Scancode = SDL_Scancode::KP_A; +pub const SDL_SCANCODE_KP_B: SDL_Scancode = SDL_Scancode::KP_B; +pub const SDL_SCANCODE_KP_C: SDL_Scancode = SDL_Scancode::KP_C; +pub const SDL_SCANCODE_KP_D: SDL_Scancode = SDL_Scancode::KP_D; +pub const SDL_SCANCODE_KP_E: SDL_Scancode = SDL_Scancode::KP_E; +pub const SDL_SCANCODE_KP_F: SDL_Scancode = SDL_Scancode::KP_F; +pub const SDL_SCANCODE_KP_XOR: SDL_Scancode = SDL_Scancode::KP_XOR; +pub const SDL_SCANCODE_KP_POWER: SDL_Scancode = SDL_Scancode::KP_POWER; +pub const SDL_SCANCODE_KP_PERCENT: SDL_Scancode = SDL_Scancode::KP_PERCENT; +pub const SDL_SCANCODE_KP_LESS: SDL_Scancode = SDL_Scancode::KP_LESS; +pub const SDL_SCANCODE_KP_GREATER: SDL_Scancode = SDL_Scancode::KP_GREATER; +pub const SDL_SCANCODE_KP_AMPERSAND: SDL_Scancode = SDL_Scancode::KP_AMPERSAND; +pub const SDL_SCANCODE_KP_DBLAMPERSAND: SDL_Scancode = SDL_Scancode::KP_DBLAMPERSAND; +pub const SDL_SCANCODE_KP_VERTICALBAR: SDL_Scancode = SDL_Scancode::KP_VERTICALBAR; +pub const SDL_SCANCODE_KP_DBLVERTICALBAR: SDL_Scancode = SDL_Scancode::KP_DBLVERTICALBAR; +pub const SDL_SCANCODE_KP_COLON: SDL_Scancode = SDL_Scancode::KP_COLON; +pub const SDL_SCANCODE_KP_HASH: SDL_Scancode = SDL_Scancode::KP_HASH; +pub const SDL_SCANCODE_KP_SPACE: SDL_Scancode = SDL_Scancode::KP_SPACE; +pub const SDL_SCANCODE_KP_AT: SDL_Scancode = SDL_Scancode::KP_AT; +pub const SDL_SCANCODE_KP_EXCLAM: SDL_Scancode = SDL_Scancode::KP_EXCLAM; +pub const SDL_SCANCODE_KP_MEMSTORE: SDL_Scancode = SDL_Scancode::KP_MEMSTORE; +pub const SDL_SCANCODE_KP_MEMRECALL: SDL_Scancode = SDL_Scancode::KP_MEMRECALL; +pub const SDL_SCANCODE_KP_MEMCLEAR: SDL_Scancode = SDL_Scancode::KP_MEMCLEAR; +pub const SDL_SCANCODE_KP_MEMADD: SDL_Scancode = SDL_Scancode::KP_MEMADD; +pub const SDL_SCANCODE_KP_MEMSUBTRACT: SDL_Scancode = SDL_Scancode::KP_MEMSUBTRACT; +pub const SDL_SCANCODE_KP_MEMMULTIPLY: SDL_Scancode = SDL_Scancode::KP_MEMMULTIPLY; +pub const SDL_SCANCODE_KP_MEMDIVIDE: SDL_Scancode = SDL_Scancode::KP_MEMDIVIDE; +pub const SDL_SCANCODE_KP_PLUSMINUS: SDL_Scancode = SDL_Scancode::KP_PLUSMINUS; +pub const SDL_SCANCODE_KP_CLEAR: SDL_Scancode = SDL_Scancode::KP_CLEAR; +pub const SDL_SCANCODE_KP_CLEARENTRY: SDL_Scancode = SDL_Scancode::KP_CLEARENTRY; +pub const SDL_SCANCODE_KP_BINARY: SDL_Scancode = SDL_Scancode::KP_BINARY; +pub const SDL_SCANCODE_KP_OCTAL: SDL_Scancode = SDL_Scancode::KP_OCTAL; +pub const SDL_SCANCODE_KP_DECIMAL: SDL_Scancode = SDL_Scancode::KP_DECIMAL; +pub const SDL_SCANCODE_KP_HEXADECIMAL: SDL_Scancode = SDL_Scancode::KP_HEXADECIMAL; +pub const SDL_SCANCODE_LCTRL: SDL_Scancode = SDL_Scancode::LCTRL; +pub const SDL_SCANCODE_LSHIFT: SDL_Scancode = SDL_Scancode::LSHIFT; +/// alt, option +pub const SDL_SCANCODE_LALT: SDL_Scancode = SDL_Scancode::LALT; +/// windows, command (apple), meta +pub const SDL_SCANCODE_LGUI: SDL_Scancode = SDL_Scancode::LGUI; +pub const SDL_SCANCODE_RCTRL: SDL_Scancode = SDL_Scancode::RCTRL; +pub const SDL_SCANCODE_RSHIFT: SDL_Scancode = SDL_Scancode::RSHIFT; +/// alt gr, option +pub const SDL_SCANCODE_RALT: SDL_Scancode = SDL_Scancode::RALT; +/// windows, command (apple), meta +pub const SDL_SCANCODE_RGUI: SDL_Scancode = SDL_Scancode::RGUI; +/// I'm not sure if this is really not covered +/// by any of the above, but since there's a +/// special [`SDL_KMOD_MODE`] for it I'm adding it here +pub const SDL_SCANCODE_MODE: SDL_Scancode = SDL_Scancode::MODE; +/// Sleep +pub const SDL_SCANCODE_SLEEP: SDL_Scancode = SDL_Scancode::SLEEP; +/// Wake +pub const SDL_SCANCODE_WAKE: SDL_Scancode = SDL_Scancode::WAKE; +/// Channel Increment +pub const SDL_SCANCODE_CHANNEL_INCREMENT: SDL_Scancode = SDL_Scancode::CHANNEL_INCREMENT; +/// Channel Decrement +pub const SDL_SCANCODE_CHANNEL_DECREMENT: SDL_Scancode = SDL_Scancode::CHANNEL_DECREMENT; +/// Play +pub const SDL_SCANCODE_MEDIA_PLAY: SDL_Scancode = SDL_Scancode::MEDIA_PLAY; +/// Pause +pub const SDL_SCANCODE_MEDIA_PAUSE: SDL_Scancode = SDL_Scancode::MEDIA_PAUSE; +/// Record +pub const SDL_SCANCODE_MEDIA_RECORD: SDL_Scancode = SDL_Scancode::MEDIA_RECORD; +/// Fast Forward +pub const SDL_SCANCODE_MEDIA_FAST_FORWARD: SDL_Scancode = SDL_Scancode::MEDIA_FAST_FORWARD; +/// Rewind +pub const SDL_SCANCODE_MEDIA_REWIND: SDL_Scancode = SDL_Scancode::MEDIA_REWIND; +/// Next Track +pub const SDL_SCANCODE_MEDIA_NEXT_TRACK: SDL_Scancode = SDL_Scancode::MEDIA_NEXT_TRACK; +/// Previous Track +pub const SDL_SCANCODE_MEDIA_PREVIOUS_TRACK: SDL_Scancode = SDL_Scancode::MEDIA_PREVIOUS_TRACK; +/// Stop +pub const SDL_SCANCODE_MEDIA_STOP: SDL_Scancode = SDL_Scancode::MEDIA_STOP; +/// Eject +pub const SDL_SCANCODE_MEDIA_EJECT: SDL_Scancode = SDL_Scancode::MEDIA_EJECT; +/// Play / Pause +pub const SDL_SCANCODE_MEDIA_PLAY_PAUSE: SDL_Scancode = SDL_Scancode::MEDIA_PLAY_PAUSE; +pub const SDL_SCANCODE_MEDIA_SELECT: SDL_Scancode = SDL_Scancode::MEDIA_SELECT; +/// AC New +pub const SDL_SCANCODE_AC_NEW: SDL_Scancode = SDL_Scancode::AC_NEW; +/// AC Open +pub const SDL_SCANCODE_AC_OPEN: SDL_Scancode = SDL_Scancode::AC_OPEN; +/// AC Close +pub const SDL_SCANCODE_AC_CLOSE: SDL_Scancode = SDL_Scancode::AC_CLOSE; +/// AC Exit +pub const SDL_SCANCODE_AC_EXIT: SDL_Scancode = SDL_Scancode::AC_EXIT; +/// AC Save +pub const SDL_SCANCODE_AC_SAVE: SDL_Scancode = SDL_Scancode::AC_SAVE; +/// AC Print +pub const SDL_SCANCODE_AC_PRINT: SDL_Scancode = SDL_Scancode::AC_PRINT; +/// AC Properties +pub const SDL_SCANCODE_AC_PROPERTIES: SDL_Scancode = SDL_Scancode::AC_PROPERTIES; +/// AC Search +pub const SDL_SCANCODE_AC_SEARCH: SDL_Scancode = SDL_Scancode::AC_SEARCH; +/// AC Home +pub const SDL_SCANCODE_AC_HOME: SDL_Scancode = SDL_Scancode::AC_HOME; +/// AC Back +pub const SDL_SCANCODE_AC_BACK: SDL_Scancode = SDL_Scancode::AC_BACK; +/// AC Forward +pub const SDL_SCANCODE_AC_FORWARD: SDL_Scancode = SDL_Scancode::AC_FORWARD; +/// AC Stop +pub const SDL_SCANCODE_AC_STOP: SDL_Scancode = SDL_Scancode::AC_STOP; +/// AC Refresh +pub const SDL_SCANCODE_AC_REFRESH: SDL_Scancode = SDL_Scancode::AC_REFRESH; +/// AC Bookmarks +pub const SDL_SCANCODE_AC_BOOKMARKS: SDL_Scancode = SDL_Scancode::AC_BOOKMARKS; +/// Usually situated below the display on phones and +/// used as a multi-function feature key for selecting +/// a software defined function shown on the bottom left +/// of the display. +pub const SDL_SCANCODE_SOFTLEFT: SDL_Scancode = SDL_Scancode::SOFTLEFT; +/// Usually situated below the display on phones and +/// used as a multi-function feature key for selecting +/// a software defined function shown on the bottom right +/// of the display. +pub const SDL_SCANCODE_SOFTRIGHT: SDL_Scancode = SDL_Scancode::SOFTRIGHT; +/// Used for accepting phone calls. +pub const SDL_SCANCODE_CALL: SDL_Scancode = SDL_Scancode::CALL; +/// Used for rejecting phone calls. +pub const SDL_SCANCODE_ENDCALL: SDL_Scancode = SDL_Scancode::ENDCALL; +/// 400-500 reserved for dynamic keycodes +pub const SDL_SCANCODE_RESERVED: SDL_Scancode = SDL_Scancode::RESERVED; +/// not a key, just marks the number of scancodes for array bounds +pub const SDL_SCANCODE_COUNT: SDL_Scancode = SDL_Scancode::COUNT; + +impl SDL_Scancode { + /// Initialize a `SDL_Scancode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_Scancode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Scancode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::scancode::METADATA_SDL_Scancode; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/sensor.rs b/vendor/sdl3-sys/src/generated/sensor.rs new file mode 100644 index 00000000..566a3bde --- /dev/null +++ b/vendor/sdl3-sys/src/generated/sensor.rs @@ -0,0 +1,490 @@ +//! SDL sensor management. +//! +//! These APIs grant access to gyros and accelerometers on various platforms. +//! +//! In order to use these functions, [`SDL_Init()`] must have been called with the +//! [`SDL_INIT_SENSOR`] flag. This causes SDL to scan the system for sensors, and +//! load appropriate drivers. + +use super::stdinc::*; + +use super::error::*; + +use super::properties::*; + +/// This is a unique ID for a sensor for the time it is connected to the +/// system, and is never reused for the lifetime of the application. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_SensorID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_SensorID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_SensorID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_SensorID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_SensorID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_SensorID { + /// Initialize a `SDL_SensorID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_SensorID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_SensorID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::sensor::METADATA_SDL_SensorID; +} + +/// A constant to represent standard gravity for accelerometer sensors. +/// +/// The accelerometer returns the current acceleration in SI meters per second +/// squared. This measurement includes the force of gravity, so a device at +/// rest will have an value of [`SDL_STANDARD_GRAVITY`] away from the center of the +/// earth, which is a positive Y value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_STANDARD_GRAVITY: ::core::ffi::c_float = 9.80665_f32; + +/// The different sensors defined by SDL. +/// +/// Additional sensors may be available, using platform dependent semantics. +/// +/// Here are the additional Android sensors: +/// +/// +/// +/// Accelerometer sensor notes: +/// +/// The accelerometer returns the current acceleration in SI meters per second +/// squared. This measurement includes the force of gravity, so a device at +/// rest will have an value of [`SDL_STANDARD_GRAVITY`] away from the center of the +/// earth, which is a positive Y value. +/// +/// - `values[0]`: Acceleration on the x axis +/// - `values[1]`: Acceleration on the y axis +/// - `values[2]`: Acceleration on the z axis +/// +/// For phones and tablets held in natural orientation and game controllers +/// held in front of you, the axes are defined as follows: +/// +/// - -X ... +X : left ... right +/// - -Y ... +Y : bottom ... top +/// - -Z ... +Z : farther ... closer +/// +/// The accelerometer axis data is not changed when the device is rotated. +/// +/// Gyroscope sensor notes: +/// +/// The gyroscope returns the current rate of rotation in radians per second. +/// The rotation is positive in the counter-clockwise direction. That is, an +/// observer looking from a positive location on one of the axes would see +/// positive rotation on that axis when it appeared to be rotating +/// counter-clockwise. +/// +/// - `values[0]`: Angular speed around the x axis (pitch) +/// - `values[1]`: Angular speed around the y axis (yaw) +/// - `values[2]`: Angular speed around the z axis (roll) +/// +/// For phones and tablets held in natural orientation and game controllers +/// held in front of you, the axes are defined as follows: +/// +/// - -X ... +X : left ... right +/// - -Y ... +Y : bottom ... top +/// - -Z ... +Z : farther ... closer +/// +/// The gyroscope axis data is not changed when the device is rotated. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetCurrentDisplayOrientation`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_SensorType::INVALID) | [`SDL_SENSOR_INVALID`] | Returned for an invalid sensor | +/// | [`UNKNOWN`](SDL_SensorType::UNKNOWN) | [`SDL_SENSOR_UNKNOWN`] | Unknown sensor type | +/// | [`ACCEL`](SDL_SensorType::ACCEL) | [`SDL_SENSOR_ACCEL`] | Accelerometer | +/// | [`GYRO`](SDL_SensorType::GYRO) | [`SDL_SENSOR_GYRO`] | Gyroscope | +/// | [`ACCEL_L`](SDL_SensorType::ACCEL_L) | [`SDL_SENSOR_ACCEL_L`] | Accelerometer for left Joy-Con controller and Wii nunchuk | +/// | [`GYRO_L`](SDL_SensorType::GYRO_L) | [`SDL_SENSOR_GYRO_L`] | Gyroscope for left Joy-Con controller | +/// | [`ACCEL_R`](SDL_SensorType::ACCEL_R) | [`SDL_SENSOR_ACCEL_R`] | Accelerometer for right Joy-Con controller | +/// | [`GYRO_R`](SDL_SensorType::GYRO_R) | [`SDL_SENSOR_GYRO_R`] | Gyroscope for right Joy-Con controller | +/// | [`COUNT`](SDL_SensorType::COUNT) | [`SDL_SENSOR_COUNT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_SensorType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_SensorType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_SensorType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_SensorType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_SensorType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_SENSOR_INVALID", + Self::UNKNOWN => "SDL_SENSOR_UNKNOWN", + Self::ACCEL => "SDL_SENSOR_ACCEL", + Self::GYRO => "SDL_SENSOR_GYRO", + Self::ACCEL_L => "SDL_SENSOR_ACCEL_L", + Self::GYRO_L => "SDL_SENSOR_GYRO_L", + Self::ACCEL_R => "SDL_SENSOR_ACCEL_R", + Self::GYRO_R => "SDL_SENSOR_GYRO_R", + Self::COUNT => "SDL_SENSOR_COUNT", + + _ => return write!(f, "SDL_SensorType({})", self.0), + }) + } +} + +impl SDL_SensorType { + /// Returned for an invalid sensor + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// Unknown sensor type + pub const UNKNOWN: Self = Self((0_i32 as ::core::ffi::c_int)); + /// Accelerometer + pub const ACCEL: Self = Self((1_i32 as ::core::ffi::c_int)); + /// Gyroscope + pub const GYRO: Self = Self((2_i32 as ::core::ffi::c_int)); + /// Accelerometer for left Joy-Con controller and Wii nunchuk + pub const ACCEL_L: Self = Self((3_i32 as ::core::ffi::c_int)); + /// Gyroscope for left Joy-Con controller + pub const GYRO_L: Self = Self((4_i32 as ::core::ffi::c_int)); + /// Accelerometer for right Joy-Con controller + pub const ACCEL_R: Self = Self((5_i32 as ::core::ffi::c_int)); + /// Gyroscope for right Joy-Con controller + pub const GYRO_R: Self = Self((6_i32 as ::core::ffi::c_int)); + pub const COUNT: Self = Self((7_i32 as ::core::ffi::c_int)); +} + +/// Returned for an invalid sensor +pub const SDL_SENSOR_INVALID: SDL_SensorType = SDL_SensorType::INVALID; +/// Unknown sensor type +pub const SDL_SENSOR_UNKNOWN: SDL_SensorType = SDL_SensorType::UNKNOWN; +/// Accelerometer +pub const SDL_SENSOR_ACCEL: SDL_SensorType = SDL_SensorType::ACCEL; +/// Gyroscope +pub const SDL_SENSOR_GYRO: SDL_SensorType = SDL_SensorType::GYRO; +/// Accelerometer for left Joy-Con controller and Wii nunchuk +pub const SDL_SENSOR_ACCEL_L: SDL_SensorType = SDL_SensorType::ACCEL_L; +/// Gyroscope for left Joy-Con controller +pub const SDL_SENSOR_GYRO_L: SDL_SensorType = SDL_SensorType::GYRO_L; +/// Accelerometer for right Joy-Con controller +pub const SDL_SENSOR_ACCEL_R: SDL_SensorType = SDL_SensorType::ACCEL_R; +/// Gyroscope for right Joy-Con controller +pub const SDL_SENSOR_GYRO_R: SDL_SensorType = SDL_SensorType::GYRO_R; +pub const SDL_SENSOR_COUNT: SDL_SensorType = SDL_SensorType::COUNT; + +impl SDL_SensorType { + /// Initialize a `SDL_SensorType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_SensorType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_SensorType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::sensor::METADATA_SDL_SensorType; +} + +unsafe extern "C" { + /// Get a list of currently connected sensors. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of sensors returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of sensor instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensors(count: *mut ::core::ffi::c_int) -> *mut SDL_SensorID; +} + +unsafe extern "C" { + /// Get the implementation dependent name of a sensor. + /// + /// This can be called before any sensors are opened. + /// + /// ## Parameters + /// - `instance_id`: the sensor instance ID. + /// + /// ## Return value + /// Returns the sensor name, or NULL if `instance_id` is not valid. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorNameForID(instance_id: SDL_SensorID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the type of a sensor. + /// + /// This can be called before any sensors are opened. + /// + /// ## Parameters + /// - `instance_id`: the sensor instance ID. + /// + /// ## Return value + /// Returns the [`SDL_SensorType`], or [`SDL_SENSOR_INVALID`] if `instance_id` is + /// not valid. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorTypeForID(instance_id: SDL_SensorID) -> SDL_SensorType; +} + +unsafe extern "C" { + /// Get the platform dependent type of a sensor. + /// + /// This can be called before any sensors are opened. + /// + /// ## Parameters + /// - `instance_id`: the sensor instance ID. + /// + /// ## Return value + /// Returns the sensor platform dependent type, or -1 if `instance_id` is not + /// valid. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorNonPortableTypeForID(instance_id: SDL_SensorID) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Open a sensor for use. + /// + /// ## Parameters + /// - `instance_id`: the sensor instance ID. + /// + /// ## Return value + /// Returns an [`SDL_Sensor`] object or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OpenSensor(instance_id: SDL_SensorID) -> *mut SDL_Sensor; +} + +unsafe extern "C" { + /// Return the [`SDL_Sensor`] associated with an instance ID. + /// + /// ## Parameters + /// - `instance_id`: the sensor instance ID. + /// + /// ## Return value + /// Returns an [`SDL_Sensor`] object or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorFromID(instance_id: SDL_SensorID) -> *mut SDL_Sensor; +} + +unsafe extern "C" { + /// Get the properties associated with a sensor. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorProperties(sensor: *mut SDL_Sensor) -> SDL_PropertiesID; +} + +unsafe extern "C" { + /// Get the implementation dependent name of a sensor. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object. + /// + /// ## Return value + /// Returns the sensor name or NULL on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorName(sensor: *mut SDL_Sensor) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the type of a sensor. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object to inspect. + /// + /// ## Return value + /// Returns the [`SDL_SensorType`] type, or [`SDL_SENSOR_INVALID`] if `sensor` is + /// NULL. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorType(sensor: *mut SDL_Sensor) -> SDL_SensorType; +} + +unsafe extern "C" { + /// Get the platform dependent type of a sensor. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object to inspect. + /// + /// ## Return value + /// Returns the sensor platform dependent type, or -1 if `sensor` is NULL. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorNonPortableType(sensor: *mut SDL_Sensor) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the instance ID of a sensor. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object to inspect. + /// + /// ## Return value + /// Returns the sensor instance ID, or 0 on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorID(sensor: *mut SDL_Sensor) -> SDL_SensorID; +} + +unsafe extern "C" { + /// Get the current state of an opened sensor. + /// + /// The number of values and interpretation of the data is sensor dependent. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object to query. + /// - `data`: a pointer filled with the current sensor state. + /// - `num_values`: the number of values to write to data. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSensorData( + sensor: *mut SDL_Sensor, + data: *mut ::core::ffi::c_float, + num_values: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Close a sensor previously opened with [`SDL_OpenSensor()`]. + /// + /// ## Parameters + /// - `sensor`: the [`SDL_Sensor`] object to close. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CloseSensor(sensor: *mut SDL_Sensor); +} + +unsafe extern "C" { + /// Update the current state of the open sensors. + /// + /// This is called automatically by the event loop if sensor events are + /// enabled. + /// + /// This needs to be called from the thread that initialized the sensor + /// subsystem. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UpdateSensors(); +} + +/// The opaque structure used to identify an opened SDL sensor. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Sensor { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/stdinc.rs b/vendor/sdl3-sys/src/generated/stdinc.rs new file mode 100644 index 00000000..638fb61e --- /dev/null +++ b/vendor/sdl3-sys/src/generated/stdinc.rs @@ -0,0 +1,6741 @@ +//! SDL provides its own implementation of some of the most important C runtime +//! functions. +//! +//! Using these functions allows an app to have access to common C +//! functionality without depending on a specific C runtime (or a C runtime at +//! all). More importantly, the SDL implementations work identically across +//! platforms, so apps can avoid surprises like snprintf() behaving differently +//! between Windows and Linux builds, or itoa() only existing on some +//! platforms. +//! +//! For many of the most common functions, like [`SDL_memcpy`], SDL might just call +//! through to the usual C runtime behind the scenes, if it makes sense to do +//! so (if it's faster and always available/reliable on a given platform), +//! reducing library size and offering the most optimized option. +//! +//! SDL also offers other C-runtime-adjacent functionality in this header that +//! either isn't, strictly speaking, part of any C runtime standards, like +//! [`SDL_crc32()`] and [`SDL_reinterpret_cast`], etc. It also offers a few better +//! options, like [`SDL_strlcpy()`], which functions as a safer form of strcpy(). + +apply_cfg!(#[cfg(doc)] => { + /// Don't let SDL use "long long" C types. + /// + /// SDL will define this if it believes the compiler doesn't understand the + /// "long long" syntax for C datatypes. This can happen on older compilers. + /// + /// If _your_ compiler doesn't support "long long" but SDL doesn't know it, it + /// is safe to define this yourself to build against the SDL headers. + /// + /// If this is defined, it will remove access to some C runtime support + /// functions, like [`SDL_ulltoa`] and [`SDL_strtoll`] that refer to this datatype + /// explicitly. The rest of SDL will still be available. + /// + /// SDL's own source code cannot be built with a compiler that has this + /// defined, for various technical reasons. + pub const SDL_NOLONGLONG: ::core::primitive::i32 = 1; + +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(doc)] => { + /// The largest value that a `size_t` can hold for the target platform. + /// + /// `size_t` is generally the same size as a pointer in modern times, but this + /// can get weird on very old and very esoteric machines. For example, on a + /// 16-bit Intel 286, you might have a 32-bit "far" pointer (16-bit segment + /// plus 16-bit offset), but `size_t` is 16 bits, because it can only deal with + /// the offset into an individual segment. + /// + /// In modern times, it's generally expected to cover an entire linear address + /// space. But be careful! + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_SIZE_MAX: ::core::primitive::usize = ::core::primitive::usize::MAX; + +}); + +apply_cfg!(#[cfg(not(doc))] => { + pub const SDL_SIZE_MAX: ::core::primitive::usize = ::core::primitive::usize::MAX; + +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +/// A signed 8-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub type Sint8 = ::core::primitive::i8; + +pub const SDL_MAX_SINT8: Sint8 = (0x7f as Sint8); + +pub const SDL_MIN_SINT8: Sint8 = ((-128_i32) as Sint8); + +/// An unsigned 8-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub type Uint8 = ::core::primitive::u8; + +pub const SDL_MAX_UINT8: Uint8 = (0xff as Uint8); + +pub const SDL_MIN_UINT8: Uint8 = (0x00 as Uint8); + +/// A signed 16-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub type Sint16 = ::core::primitive::i16; + +pub const SDL_MAX_SINT16: Sint16 = (0x7fff as Sint16); + +pub const SDL_MIN_SINT16: Sint16 = ((-32768_i32) as Sint16); + +/// An unsigned 16-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub type Uint16 = ::core::primitive::u16; + +pub const SDL_MAX_UINT16: Uint16 = (0xffff as Uint16); + +pub const SDL_MIN_UINT16: Uint16 = (0x0000 as Uint16); + +/// A signed 32-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub type Sint32 = ::core::primitive::i32; + +pub const SDL_MAX_SINT32: Sint32 = (0x7fffffff as Sint32); + +pub const SDL_MIN_SINT32: Sint32 = ((-2147483648_i32) as Sint32); + +/// An unsigned 32-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub type Uint32 = ::core::primitive::u32; + +pub const SDL_MAX_UINT32: Uint32 = (0xffffffff as Uint32); + +pub const SDL_MIN_UINT32: Uint32 = (0x00000000 as Uint32); + +/// A signed 64-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - SDL_SINT64_C +pub type Sint64 = ::core::primitive::i64; + +pub const SDL_MAX_SINT64: ::core::primitive::i64 = 9223372036854775807_i64; + +pub const SDL_MIN_SINT64: ::core::primitive::i64 = -9223372036854775808_i64; + +/// An unsigned 64-bit integer type. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - SDL_UINT64_C +pub type Uint64 = ::core::primitive::u64; + +pub const SDL_MAX_UINT64: ::core::primitive::u64 = 18446744073709551615_u64; + +pub const SDL_MIN_UINT64: ::core::primitive::u64 = 0_u64; + +/// SDL times are signed, 64-bit integers representing nanoseconds since the +/// Unix epoch (Jan 1, 1970). +/// +/// They can be converted between POSIX time_t values with [`SDL_NS_TO_SECONDS()`] +/// and [`SDL_SECONDS_TO_NS()`], and between Windows FILETIME values with +/// [`SDL_TimeToWindows()`] and [`SDL_TimeFromWindows()`]. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_MAX_SINT64`] +/// - [`SDL_MIN_SINT64`] +pub type SDL_Time = Sint64; + +pub const SDL_MAX_TIME: ::core::primitive::i64 = SDL_MAX_SINT64; + +pub const SDL_MIN_TIME: ::core::primitive::i64 = SDL_MIN_SINT64; + +pub const SDL_FLT_EPSILON: ::core::ffi::c_float = ::core::primitive::f32::EPSILON; + +apply_cfg!(#[cfg(doc)] => { + /// A printf-formatting string for an Sint64 value. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIs64 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIs64: *const ::core::ffi::c_char = c"lld".as_ptr(); + + /// A printf-formatting string for a Uint64 value. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIu64 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIu64: *const ::core::ffi::c_char = c"llu".as_ptr(); + + /// A printf-formatting string for a Uint64 value as lower-case hexadecimal. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIx64 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIx64: *const ::core::ffi::c_char = c"llx".as_ptr(); + + /// A printf-formatting string for a Uint64 value as upper-case hexadecimal. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIX64 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIX64: *const ::core::ffi::c_char = c"llX".as_ptr(); + + /// A printf-formatting string for an Sint32 value. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIs32 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIs32: *const ::core::ffi::c_char = c"d".as_ptr(); + + /// A printf-formatting string for a Uint32 value. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIu32 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIu32: *const ::core::ffi::c_char = c"u".as_ptr(); + + /// A printf-formatting string for a Uint32 value as lower-case hexadecimal. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIx32 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIx32: *const ::core::ffi::c_char = c"x".as_ptr(); + + /// A printf-formatting string for a Uint32 value as upper-case hexadecimal. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRIX32 " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRIX32: *const ::core::ffi::c_char = c"X".as_ptr(); + + /// A printf-formatting string prefix for a `long long` value. + /// + /// This is just the prefix! You probably actually want [`SDL_PRILLd`], [`SDL_PRILLu`], + /// [`SDL_PRILLx`], or [`SDL_PRILLX`] instead. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRILL_PREFIX "d bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRILL_PREFIX: *const ::core::ffi::c_char = c"ll".as_ptr(); + + /// A printf-formatting string for a `long long` value. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRILLd " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRILLd: *const ::core::ffi::c_char = c"lld".as_ptr(); + + /// A printf-formatting string for a `unsigned long long` value. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRILLu " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRILLu: *const ::core::ffi::c_char = c"llu".as_ptr(); + + /// A printf-formatting string for an `unsigned long long` value as lower-case + /// hexadecimal. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRILLx " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRILLx: *const ::core::ffi::c_char = c"llx".as_ptr(); + + /// A printf-formatting string for an `unsigned long long` value as upper-case + /// hexadecimal. + /// + /// Use it like this: + /// + /// ```c + /// SDL_Log("There are %" SDL_PRILLX " bottles of beer on the wall.", bottles); + /// ``` + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_PRILLX: *const ::core::ffi::c_char = c"llX".as_ptr(); + +}); + +apply_cfg!(#[cfg(any(doc, windows))] => { + #[cfg(not(doc))] + pub const SDL_PRIs64: *const ::core::ffi::c_char = c"I64d".as_ptr(); + +}); + +apply_cfg!(#[cfg(any(not(windows), doc))] => { + apply_cfg!(#[cfg(all(any(not(target_vendor = "apple"), doc), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64")))] => { + #[cfg(not(doc))] + pub const SDL_PRIs64: *const ::core::ffi::c_char = c"ld".as_ptr(); + + }); + + apply_cfg!(#[cfg(not(all(any(not(target_vendor = "apple"), doc), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64"))))] => { + #[cfg(not(doc))] + pub const SDL_PRIs64: *const ::core::ffi::c_char = c"lld".as_ptr(); + + }); + +}); + +apply_cfg!(#[cfg(any(doc, windows))] => { + #[cfg(not(doc))] + pub const SDL_PRIu64: *const ::core::ffi::c_char = c"I64u".as_ptr(); + +}); + +apply_cfg!(#[cfg(any(not(windows), doc))] => { + apply_cfg!(#[cfg(all(any(not(target_vendor = "apple"), doc), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64")))] => { + #[cfg(not(doc))] + pub const SDL_PRIu64: *const ::core::ffi::c_char = c"lu".as_ptr(); + + }); + + apply_cfg!(#[cfg(not(all(any(not(target_vendor = "apple"), doc), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64"))))] => { + #[cfg(not(doc))] + pub const SDL_PRIu64: *const ::core::ffi::c_char = c"llu".as_ptr(); + + }); + +}); + +apply_cfg!(#[cfg(any(doc, windows))] => { + #[cfg(not(doc))] + pub const SDL_PRIx64: *const ::core::ffi::c_char = c"I64x".as_ptr(); + +}); + +apply_cfg!(#[cfg(any(not(windows), doc))] => { + apply_cfg!(#[cfg(all(any(not(target_vendor = "apple"), doc), all(not(windows), target_pointer_width = "64")))] => { + #[cfg(not(doc))] + pub const SDL_PRIx64: *const ::core::ffi::c_char = c"lx".as_ptr(); + + }); + + apply_cfg!(#[cfg(not(all(any(not(target_vendor = "apple"), doc), all(not(windows), target_pointer_width = "64"))))] => { + #[cfg(not(doc))] + pub const SDL_PRIx64: *const ::core::ffi::c_char = c"llx".as_ptr(); + + }); + +}); + +apply_cfg!(#[cfg(any(doc, windows))] => { + #[cfg(not(doc))] + pub const SDL_PRIX64: *const ::core::ffi::c_char = c"I64X".as_ptr(); + +}); + +apply_cfg!(#[cfg(any(not(windows), doc))] => { + apply_cfg!(#[cfg(all(any(not(target_vendor = "apple"), doc), all(not(windows), target_pointer_width = "64")))] => { + #[cfg(not(doc))] + pub const SDL_PRIX64: *const ::core::ffi::c_char = c"lX".as_ptr(); + + }); + + apply_cfg!(#[cfg(not(all(any(not(target_vendor = "apple"), doc), all(not(windows), target_pointer_width = "64"))))] => { + #[cfg(not(doc))] + pub const SDL_PRIX64: *const ::core::ffi::c_char = c"llX".as_ptr(); + + }); + +}); + +#[cfg(not(doc))] +pub const SDL_PRIs32: *const ::core::ffi::c_char = c"d".as_ptr(); + +#[cfg(not(doc))] +pub const SDL_PRIu32: *const ::core::ffi::c_char = c"u".as_ptr(); + +#[cfg(not(doc))] +pub const SDL_PRIx32: *const ::core::ffi::c_char = c"x".as_ptr(); + +#[cfg(not(doc))] +pub const SDL_PRIX32: *const ::core::ffi::c_char = c"X".as_ptr(); + +apply_cfg!(#[cfg(any(doc, windows))] => { + const _: () = ::core::assert!((::core::mem::size_of::<::core::ffi::c_longlong>() == 8_usize)); + + #[cfg(not(doc))] + pub const SDL_PRILL_PREFIX: *const ::core::ffi::c_char = c"I64".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLd: *const ::core::ffi::c_char = c"I64d".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLu: *const ::core::ffi::c_char = c"I64u".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLx: *const ::core::ffi::c_char = c"I64x".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLX: *const ::core::ffi::c_char = c"I64X".as_ptr(); + +}); + +apply_cfg!(#[cfg(any(not(windows), doc))] => { + #[cfg(not(doc))] + pub const SDL_PRILL_PREFIX: *const ::core::ffi::c_char = c"ll".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLd: *const ::core::ffi::c_char = c"lld".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLu: *const ::core::ffi::c_char = c"llu".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLx: *const ::core::ffi::c_char = c"llx".as_ptr(); + + #[cfg(not(doc))] + pub const SDL_PRILLX: *const ::core::ffi::c_char = c"llX".as_ptr(); + +}); + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +const _: () = ::core::assert!((::core::mem::size_of::<::core::primitive::bool>() == 1_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 1_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 1_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 2_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 2_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 4_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 4_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 8_usize)); + +const _: () = ::core::assert!((::core::mem::size_of::() == 8_usize)); + +const _: () = ::core::assert!( + (::core::mem::size_of::() <= ::core::mem::size_of::<::core::ffi::c_ulonglong>()) +); + +const _: () = ::core::assert!( + (::core::mem::size_of::<::core::primitive::usize>() + <= ::core::mem::size_of::<::core::ffi::c_ulonglong>()) +); + +/// Define a four character code as a Uint32. +/// +/// ## Parameters +/// - `A`: the first ASCII character. +/// - `B`: the second ASCII character. +/// - `C`: the third ASCII character. +/// - `D`: the fourth ASCII character. +/// +/// ## Return value +/// Returns the four characters converted into a Uint32, one character +/// per-byte. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_FOURCC(A: Uint8, B: Uint8, C: Uint8, D: Uint8) -> Uint32 { + (((((A as Uint32) << 0) | ((B as Uint32) << 8)) | ((C as Uint32) << 16)) + | ((D as Uint32) << 24)) +} + +#[doc(hidden)] +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_alignment_test { + pub a: Uint8, + pub b: *mut ::core::ffi::c_void, +} + +impl ::core::default::Default for SDL_alignment_test { + /// Initialize all fields to zero + #[inline(always)] + fn default() -> Self { + unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() } + } +} + +const _: () = ::core::assert!( + (::core::mem::size_of::() + == (2 * ::core::mem::size_of::<*mut ::core::ffi::c_void>())) +); + +const _: () = ::core::assert!((!(0 as ::core::ffi::c_int) == (-1_i32 as ::core::ffi::c_int))); + +apply_cfg!(#[cfg(any(all(not(target_os = "horizon"), not(target_os = "vita")), doc))] => { + #[doc(hidden)] + /// ## Known values (`sdl3-sys`) + /// | Associated constant | Global constant | Description | + /// | ------------------- | --------------- | ----------- | + /// | [`DUMMY_ENUM_VALUE`](SDL_DUMMY_ENUM::DUMMY_ENUM_VALUE) | [`DUMMY_ENUM_VALUE`] | | + #[repr(transparent)] + #[derive(Clone, Copy)] + #[derive(Default)] + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct SDL_DUMMY_ENUM(pub ::core::ffi::c_int); + + impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_DUMMY_ENUM { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } + } + + impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_DUMMY_ENUM) -> bool { + self == &other.0 + } + } + + impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_DUMMY_ENUM) -> Self { + value.0 + } + } + + #[cfg(feature = "debug-impls")] + impl ::core::fmt::Debug for SDL_DUMMY_ENUM { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::DUMMY_ENUM_VALUE => "DUMMY_ENUM_VALUE", + + _ => return write!(f, "SDL_DUMMY_ENUM({})", self.0), + }) + } + } + + impl SDL_DUMMY_ENUM { + pub const DUMMY_ENUM_VALUE: Self = Self((0 as ::core::ffi::c_int)); + } + + #[doc(hidden)] + pub const DUMMY_ENUM_VALUE: SDL_DUMMY_ENUM = SDL_DUMMY_ENUM::DUMMY_ENUM_VALUE; + + impl SDL_DUMMY_ENUM { + /// Initialize a `SDL_DUMMY_ENUM` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } + } + + impl SDL_DUMMY_ENUM { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } + } + + const _: () = ::core::assert!((::core::mem::size_of::() == ::core::mem::size_of::<::core::ffi::c_int>())); + +}); + +/// A macro to initialize an SDL interface. +/// +/// This macro will initialize an SDL interface structure and should be called +/// before you fill out the fields with your implementation. +/// +/// You can use it like this: +/// +/// ```c +/// SDL_IOStreamInterface iface; +/// +/// SDL_INIT_INTERFACE(&iface); +/// +/// // Fill in the interface function pointers with your implementation +/// iface.seek = ... +/// +/// stream = SDL_OpenIO(&iface, NULL); +/// ``` +/// +/// If you are using designated initializers, you can use the size of the +/// interface as the version, e.g. +/// +/// ```c +/// SDL_IOStreamInterface iface = { +/// .version = sizeof(iface), +/// .seek = ... +/// }; +/// stream = SDL_OpenIO(&iface, NULL); +/// ``` +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_IOStreamInterface`] +/// - [`SDL_StorageInterface`] +/// - [`SDL_VirtualJoystickDesc`] +/// +/// ## Safety (`sdl3-sys`) +/// - `iface` must point to memory that is valid for writing the type `T`. +/// - The type `T` must be a `repr(C)` struct. +/// - The first field of the struct must be of type `u32`. It will be set to +/// the size of the struct in bytes. +/// - The rest of the struct will be initialized as all zero bytes. +#[inline(always)] +pub unsafe fn SDL_INIT_INTERFACE(iface: *mut T) { + const { ::core::assert!(::core::mem::size_of::() <= ::core::primitive::u32::MAX as usize) }; + unsafe { + iface.write_bytes(0, 1); + iface + .cast::() + .write(::core::mem::size_of::() as Uint32); + } +} + +apply_cfg!(#[cfg(doc)] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +unsafe extern "C" { + /// Allocate uninitialized memory. + /// + /// The allocated memory returned by this function must be freed with + /// [`SDL_free()`]. + /// + /// If `size` is 0, it will be set to 1. + /// + /// If the allocation is successful, the returned pointer is guaranteed to be + /// aligned to either the *fundamental alignment* (`alignof(max_align_t)` in + /// C11 and later) or `2 * sizeof(void *)`, whichever is smaller. Use + /// [`SDL_aligned_alloc()`] if you need to allocate memory aligned to an alignment + /// greater than this guarantee. + /// + /// ## Parameters + /// - `size`: the size to allocate. + /// + /// ## Return value + /// Returns a pointer to the allocated memory, or NULL if allocation failed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_free`] + /// - [`SDL_calloc`] + /// - [`SDL_realloc`] + /// - [`SDL_aligned_alloc`] + pub fn SDL_malloc(size: ::core::primitive::usize) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Allocate a zero-initialized array. + /// + /// The memory returned by this function must be freed with [`SDL_free()`]. + /// + /// If either of `nmemb` or `size` is 0, they will both be set to 1. + /// + /// If the allocation is successful, the returned pointer is guaranteed to be + /// aligned to either the *fundamental alignment* (`alignof(max_align_t)` in + /// C11 and later) or `2 * sizeof(void *)`, whichever is smaller. + /// + /// ## Parameters + /// - `nmemb`: the number of elements in the array. + /// - `size`: the size of each element of the array. + /// + /// ## Return value + /// Returns a pointer to the allocated array, or NULL if allocation failed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_free`] + /// - [`SDL_malloc`] + /// - [`SDL_realloc`] + pub fn SDL_calloc( + nmemb: ::core::primitive::usize, + size: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Change the size of allocated memory. + /// + /// The memory returned by this function must be freed with [`SDL_free()`]. + /// + /// If `size` is 0, it will be set to 1. Note that this is unlike some other C + /// runtime `realloc` implementations, which may treat `realloc(mem, 0)` the + /// same way as `free(mem)`. + /// + /// If `mem` is NULL, the behavior of this function is equivalent to + /// [`SDL_malloc()`]. Otherwise, the function can have one of three possible + /// outcomes: + /// + /// - If it returns the same pointer as `mem`, it means that `mem` was resized + /// in place without freeing. + /// - If it returns a different non-NULL pointer, it means that `mem` was freed + /// and cannot be dereferenced anymore. + /// - If it returns NULL (indicating failure), then `mem` will remain valid and + /// must still be freed with [`SDL_free()`]. + /// + /// If the allocation is successfully resized, the returned pointer is + /// guaranteed to be aligned to either the *fundamental alignment* + /// (`alignof(max_align_t)` in C11 and later) or `2 * sizeof(void *)`, + /// whichever is smaller. + /// + /// ## Parameters + /// - `mem`: a pointer to allocated memory to reallocate, or NULL. + /// - `size`: the new size of the memory. + /// + /// ## Return value + /// Returns a pointer to the newly allocated memory, or NULL if allocation + /// failed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_free`] + /// - [`SDL_malloc`] + /// - [`SDL_calloc`] + pub fn SDL_realloc( + mem: *mut ::core::ffi::c_void, + size: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Free allocated memory. + /// + /// The pointer is no longer valid after this call and cannot be dereferenced + /// anymore. + /// + /// If `mem` is NULL, this function does nothing. + /// + /// ## Parameters + /// - `mem`: a pointer to allocated memory, or NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_malloc`] + /// - [`SDL_calloc`] + /// - [`SDL_realloc`] + pub fn SDL_free(mem: *mut ::core::ffi::c_void); +} + +/// A callback used to implement [`SDL_malloc()`]. +/// +/// SDL will always ensure that the passed `size` is greater than 0. +/// +/// ## Parameters +/// - `size`: the size to allocate. +/// +/// ## Return value +/// Returns a pointer to the allocated memory, or NULL if allocation failed. +/// +/// ## Thread safety +/// It should be safe to call this callback from any thread. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_malloc`] +/// - [`SDL_GetOriginalMemoryFunctions`] +/// - [`SDL_GetMemoryFunctions`] +/// - [`SDL_SetMemoryFunctions`] +pub type SDL_malloc_func = ::core::option::Option< + unsafe extern "C" fn(size: ::core::primitive::usize) -> *mut ::core::ffi::c_void, +>; + +/// A callback used to implement [`SDL_calloc()`]. +/// +/// SDL will always ensure that the passed `nmemb` and `size` are both greater +/// than 0. +/// +/// ## Parameters +/// - `nmemb`: the number of elements in the array. +/// - `size`: the size of each element of the array. +/// +/// ## Return value +/// Returns a pointer to the allocated array, or NULL if allocation failed. +/// +/// ## Thread safety +/// It should be safe to call this callback from any thread. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_calloc`] +/// - [`SDL_GetOriginalMemoryFunctions`] +/// - [`SDL_GetMemoryFunctions`] +/// - [`SDL_SetMemoryFunctions`] +pub type SDL_calloc_func = ::core::option::Option< + unsafe extern "C" fn( + nmemb: ::core::primitive::usize, + size: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void, +>; + +/// A callback used to implement [`SDL_realloc()`]. +/// +/// SDL will always ensure that the passed `size` is greater than 0. +/// +/// ## Parameters +/// - `mem`: a pointer to allocated memory to reallocate, or NULL. +/// - `size`: the new size of the memory. +/// +/// ## Return value +/// Returns a pointer to the newly allocated memory, or NULL if allocation +/// failed. +/// +/// ## Thread safety +/// It should be safe to call this callback from any thread. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_realloc`] +/// - [`SDL_GetOriginalMemoryFunctions`] +/// - [`SDL_GetMemoryFunctions`] +/// - [`SDL_SetMemoryFunctions`] +pub type SDL_realloc_func = ::core::option::Option< + unsafe extern "C" fn( + mem: *mut ::core::ffi::c_void, + size: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void, +>; + +/// A callback used to implement [`SDL_free()`]. +/// +/// SDL will always ensure that the passed `mem` is a non-NULL pointer. +/// +/// ## Parameters +/// - `mem`: a pointer to allocated memory. +/// +/// ## Thread safety +/// It should be safe to call this callback from any thread. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_free`] +/// - [`SDL_GetOriginalMemoryFunctions`] +/// - [`SDL_GetMemoryFunctions`] +/// - [`SDL_SetMemoryFunctions`] +pub type SDL_free_func = + ::core::option::Option; + +unsafe extern "C" { + /// Get the original set of SDL memory functions. + /// + /// This is what [`SDL_malloc`] and friends will use by default, if there has been + /// no call to [`SDL_SetMemoryFunctions`]. This is not necessarily using the C + /// runtime's `malloc` functions behind the scenes! Different platforms and + /// build configurations might do any number of unexpected things. + /// + /// ## Parameters + /// - `malloc_func`: filled with malloc function. + /// - `calloc_func`: filled with calloc function. + /// - `realloc_func`: filled with realloc function. + /// - `free_func`: filled with free function. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetOriginalMemoryFunctions( + malloc_func: *mut SDL_malloc_func, + calloc_func: *mut SDL_calloc_func, + realloc_func: *mut SDL_realloc_func, + free_func: *mut SDL_free_func, + ); +} + +unsafe extern "C" { + /// Get the current set of SDL memory functions. + /// + /// ## Parameters + /// - `malloc_func`: filled with malloc function. + /// - `calloc_func`: filled with calloc function. + /// - `realloc_func`: filled with realloc function. + /// - `free_func`: filled with free function. + /// + /// ## Thread safety + /// This does not hold a lock, so do not call this in the + /// unlikely event of a background thread calling + /// [`SDL_SetMemoryFunctions`] simultaneously. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetMemoryFunctions`] + /// - [`SDL_GetOriginalMemoryFunctions`] + pub fn SDL_GetMemoryFunctions( + malloc_func: *mut SDL_malloc_func, + calloc_func: *mut SDL_calloc_func, + realloc_func: *mut SDL_realloc_func, + free_func: *mut SDL_free_func, + ); +} + +unsafe extern "C" { + /// Replace SDL's memory allocation functions with a custom set. + /// + /// It is not safe to call this function once any allocations have been made, + /// as future calls to [`SDL_free`] will use the new allocator, even if they came + /// from an [`SDL_malloc`] made with the old one! + /// + /// If used, usually this needs to be the first call made into the SDL library, + /// if not the very first thing done at program startup time. + /// + /// ## Parameters + /// - `malloc_func`: custom malloc function. + /// - `calloc_func`: custom calloc function. + /// - `realloc_func`: custom realloc function. + /// - `free_func`: custom free function. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but one + /// should not replace the memory functions once any allocations + /// are made! + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetMemoryFunctions`] + /// - [`SDL_GetOriginalMemoryFunctions`] + pub fn SDL_SetMemoryFunctions( + malloc_func: SDL_malloc_func, + calloc_func: SDL_calloc_func, + realloc_func: SDL_realloc_func, + free_func: SDL_free_func, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Allocate memory aligned to a specific alignment. + /// + /// The memory returned by this function must be freed with [`SDL_aligned_free()`], + /// _not_ [`SDL_free()`]. + /// + /// If `alignment` is less than the size of `void *`, it will be increased to + /// match that. + /// + /// The returned memory address will be a multiple of the alignment value, and + /// the size of the memory allocated will be a multiple of the alignment value. + /// + /// ## Parameters + /// - `alignment`: the alignment of the memory. + /// - `size`: the size to allocate. + /// + /// ## Return value + /// Returns a pointer to the aligned memory, or NULL if allocation failed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_aligned_free`] + pub fn SDL_aligned_alloc( + alignment: ::core::primitive::usize, + size: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Free memory allocated by [`SDL_aligned_alloc()`]. + /// + /// The pointer is no longer valid after this call and cannot be dereferenced + /// anymore. + /// + /// If `mem` is NULL, this function does nothing. + /// + /// ## Parameters + /// - `mem`: a pointer previously returned by [`SDL_aligned_alloc()`], or NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_aligned_alloc`] + pub fn SDL_aligned_free(mem: *mut ::core::ffi::c_void); +} + +unsafe extern "C" { + /// Get the number of outstanding (unfreed) allocations. + /// + /// ## Return value + /// Returns the number of allocations or -1 if allocation counting is + /// disabled. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_GetNumAllocations() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the process environment. + /// + /// This is initialized at application start and is not affected by setenv() + /// and unsetenv() calls after that point. Use [`SDL_SetEnvironmentVariable()`] and + /// [`SDL_UnsetEnvironmentVariable()`] if you want to modify this environment, or + /// [`SDL_setenv_unsafe()`] or [`SDL_unsetenv_unsafe()`] if you want changes to persist + /// in the C runtime environment after [`SDL_Quit()`]. + /// + /// ## Return value + /// Returns a pointer to the environment for the process or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEnvironmentVariable`] + /// - [`SDL_GetEnvironmentVariables`] + /// - [`SDL_SetEnvironmentVariable`] + /// - [`SDL_UnsetEnvironmentVariable`] + pub fn SDL_GetEnvironment() -> *mut SDL_Environment; +} + +unsafe extern "C" { + /// Create a set of environment variables + /// + /// ## Parameters + /// - `populated`: true to initialize it from the C runtime environment, + /// false to create an empty environment. + /// + /// ## Return value + /// Returns a pointer to the new environment or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// If `populated` is false, it is safe to call this function + /// from any thread, otherwise it is safe if no other threads are + /// calling setenv() or unsetenv() + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEnvironmentVariable`] + /// - [`SDL_GetEnvironmentVariables`] + /// - [`SDL_SetEnvironmentVariable`] + /// - [`SDL_UnsetEnvironmentVariable`] + /// - [`SDL_DestroyEnvironment`] + pub fn SDL_CreateEnvironment(populated: ::core::primitive::bool) -> *mut SDL_Environment; +} + +unsafe extern "C" { + /// Get the value of a variable in the environment. + /// + /// ## Parameters + /// - `env`: the environment to query. + /// - `name`: the name of the variable to get. + /// + /// ## Return value + /// Returns a pointer to the value of the variable or NULL if it can't be + /// found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEnvironment`] + /// - [`SDL_CreateEnvironment`] + /// - [`SDL_GetEnvironmentVariables`] + /// - [`SDL_SetEnvironmentVariable`] + /// - [`SDL_UnsetEnvironmentVariable`] + pub fn SDL_GetEnvironmentVariable( + env: *mut SDL_Environment, + name: *const ::core::ffi::c_char, + ) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get all variables in the environment. + /// + /// ## Parameters + /// - `env`: the environment to query. + /// + /// ## Return value + /// Returns a NULL terminated array of pointers to environment variables in + /// the form "variable=value" or NULL on failure; call [`SDL_GetError()`] + /// for more information. This is a single allocation that should be + /// freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEnvironment`] + /// - [`SDL_CreateEnvironment`] + /// - [`SDL_GetEnvironmentVariables`] + /// - [`SDL_SetEnvironmentVariable`] + /// - [`SDL_UnsetEnvironmentVariable`] + pub fn SDL_GetEnvironmentVariables(env: *mut SDL_Environment) -> *mut *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Set the value of a variable in the environment. + /// + /// ## Parameters + /// - `env`: the environment to modify. + /// - `name`: the name of the variable to set. + /// - `value`: the value of the variable to set. + /// - `overwrite`: true to overwrite the variable if it exists, false to + /// return success without setting the variable if it already + /// exists. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEnvironment`] + /// - [`SDL_CreateEnvironment`] + /// - [`SDL_GetEnvironmentVariable`] + /// - [`SDL_GetEnvironmentVariables`] + /// - [`SDL_UnsetEnvironmentVariable`] + pub fn SDL_SetEnvironmentVariable( + env: *mut SDL_Environment, + name: *const ::core::ffi::c_char, + value: *const ::core::ffi::c_char, + overwrite: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear a variable from the environment. + /// + /// ## Parameters + /// - `env`: the environment to modify. + /// - `name`: the name of the variable to unset. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetEnvironment`] + /// - [`SDL_CreateEnvironment`] + /// - [`SDL_GetEnvironmentVariable`] + /// - [`SDL_GetEnvironmentVariables`] + /// - [`SDL_SetEnvironmentVariable`] + /// - [`SDL_UnsetEnvironmentVariable`] + pub fn SDL_UnsetEnvironmentVariable( + env: *mut SDL_Environment, + name: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy a set of environment variables. + /// + /// ## Parameters + /// - `env`: the environment to destroy. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, as long as + /// the environment is no longer in use. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateEnvironment`] + pub fn SDL_DestroyEnvironment(env: *mut SDL_Environment); +} + +unsafe extern "C" { + /// Get the value of a variable in the environment. + /// + /// The name of the variable is case sensitive on all platforms. + /// + /// This function uses SDL's cached copy of the environment and is thread-safe. + /// + /// ## Parameters + /// - `name`: the name of the variable to get. + /// + /// ## Return value + /// Returns a pointer to the value of the variable or NULL if it can't be + /// found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_getenv(name: *const ::core::ffi::c_char) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the value of a variable in the environment. + /// + /// This function bypasses SDL's cached copy of the environment and is not + /// thread-safe. + /// + /// On some platforms, this may make case-insensitive matches, while other + /// platforms are case-sensitive. It is best to be precise with strings used + /// for queries through this interface. [`SDL_getenv`] is always case-sensitive, + /// however. + /// + /// ## Parameters + /// - `name`: the name of the variable to get. + /// + /// ## Return value + /// Returns a pointer to the value of the variable or NULL if it can't be + /// found. + /// + /// ## Thread safety + /// This function is not thread safe, consider using [`SDL_getenv()`] + /// instead. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_getenv`] + pub fn SDL_getenv_unsafe(name: *const ::core::ffi::c_char) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Set the value of a variable in the environment. + /// + /// ## Parameters + /// - `name`: the name of the variable to set. + /// - `value`: the value of the variable to set. + /// - `overwrite`: 1 to overwrite the variable if it exists, 0 to return + /// success without setting the variable if it already exists. + /// + /// ## Return value + /// Returns 0 on success, -1 on error. + /// + /// ## Thread safety + /// This function is not thread safe, consider using + /// [`SDL_SetEnvironmentVariable()`] instead. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetEnvironmentVariable`] + pub fn SDL_setenv_unsafe( + name: *const ::core::ffi::c_char, + value: *const ::core::ffi::c_char, + overwrite: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Clear a variable from the environment. + /// + /// ## Parameters + /// - `name`: the name of the variable to unset. + /// + /// ## Return value + /// Returns 0 on success, -1 on error. + /// + /// ## Thread safety + /// This function is not thread safe, consider using + /// [`SDL_UnsetEnvironmentVariable()`] instead. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_UnsetEnvironmentVariable`] + pub fn SDL_unsetenv_unsafe(name: *const ::core::ffi::c_char) -> ::core::ffi::c_int; +} + +/// A callback used with SDL sorting and binary search functions. +/// +/// ## Parameters +/// - `a`: a pointer to the first element being compared. +/// - `b`: a pointer to the second element being compared. +/// +/// ## Return value +/// Returns -1 if `a` should be sorted before `b`, 1 if `b` should be sorted +/// before `a`, 0 if they are equal. If two elements are equal, their +/// order in the sorted array is undefined. +/// +/// ## Availability +/// This callback is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_bsearch`] +/// - [`SDL_qsort`] +pub type SDL_CompareCallback = ::core::option::Option< + unsafe extern "C" fn( + a: *const ::core::ffi::c_void, + b: *const ::core::ffi::c_void, + ) -> ::core::ffi::c_int, +>; + +unsafe extern "C" { + /// Sort an array. + /// + /// For example: + /// + /// ```c + /// typedef struct { + /// int key; + /// const char *string; + /// } data; + /// + /// int SDLCALL compare(const void *a, const void *b) + /// { + /// const data *A = (const data *)a; + /// const data *B = (const data *)b; + /// + /// if (A->n < B->n) { + /// return -1; + /// } else if (B->n < A->n) { + /// return 1; + /// } else { + /// return 0; + /// } + /// } + /// + /// data values[] = { + /// { 3, "third" }, { 1, "first" }, { 2, "second" } + /// }; + /// + /// SDL_qsort(values, SDL_arraysize(values), sizeof(values[0]), compare); + /// ``` + /// + /// ## Parameters + /// - `base`: a pointer to the start of the array. + /// - `nmemb`: the number of elements in the array. + /// - `size`: the size of the elements in the array. + /// - `compare`: a function used to compare elements in the array. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_bsearch`] + /// - [`SDL_qsort_r`] + pub fn SDL_qsort( + base: *mut ::core::ffi::c_void, + nmemb: ::core::primitive::usize, + size: ::core::primitive::usize, + compare: SDL_CompareCallback, + ); +} + +unsafe extern "C" { + /// Perform a binary search on a previously sorted array. + /// + /// For example: + /// + /// ```c + /// typedef struct { + /// int key; + /// const char *string; + /// } data; + /// + /// int SDLCALL compare(const void *a, const void *b) + /// { + /// const data *A = (const data *)a; + /// const data *B = (const data *)b; + /// + /// if (A->n < B->n) { + /// return -1; + /// } else if (B->n < A->n) { + /// return 1; + /// } else { + /// return 0; + /// } + /// } + /// + /// data values[] = { + /// { 1, "first" }, { 2, "second" }, { 3, "third" } + /// }; + /// data key = { 2, NULL }; + /// + /// data *result = SDL_bsearch(&key, values, SDL_arraysize(values), sizeof(values[0]), compare); + /// ``` + /// + /// ## Parameters + /// - `key`: a pointer to a key equal to the element being searched for. + /// - `base`: a pointer to the start of the array. + /// - `nmemb`: the number of elements in the array. + /// - `size`: the size of the elements in the array. + /// - `compare`: a function used to compare elements in the array. + /// + /// ## Return value + /// Returns a pointer to the matching element in the array, or NULL if not + /// found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_bsearch_r`] + /// - [`SDL_qsort`] + pub fn SDL_bsearch( + key: *const ::core::ffi::c_void, + base: *const ::core::ffi::c_void, + nmemb: ::core::primitive::usize, + size: ::core::primitive::usize, + compare: SDL_CompareCallback, + ) -> *mut ::core::ffi::c_void; +} + +/// A callback used with SDL sorting and binary search functions. +/// +/// ## Parameters +/// - `userdata`: the `userdata` pointer passed to the sort function. +/// - `a`: a pointer to the first element being compared. +/// - `b`: a pointer to the second element being compared. +/// +/// ## Return value +/// Returns -1 if `a` should be sorted before `b`, 1 if `b` should be sorted +/// before `a`, 0 if they are equal. If two elements are equal, their +/// order in the sorted array is undefined. +/// +/// ## Availability +/// This callback is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_qsort_r`] +/// - [`SDL_bsearch_r`] +pub type SDL_CompareCallback_r = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + a: *const ::core::ffi::c_void, + b: *const ::core::ffi::c_void, + ) -> ::core::ffi::c_int, +>; + +unsafe extern "C" { + /// Sort an array, passing a userdata pointer to the compare function. + /// + /// For example: + /// + /// ```c + /// typedef enum { + /// sort_increasing, + /// sort_decreasing, + /// } sort_method; + /// + /// typedef struct { + /// int key; + /// const char *string; + /// } data; + /// + /// int SDLCALL compare(const void *userdata, const void *a, const void *b) + /// { + /// sort_method method = (sort_method)(uintptr_t)userdata; + /// const data *A = (const data *)a; + /// const data *B = (const data *)b; + /// + /// if (A->key < B->key) { + /// return (method == sort_increasing) ? -1 : 1; + /// } else if (B->key < A->key) { + /// return (method == sort_increasing) ? 1 : -1; + /// } else { + /// return 0; + /// } + /// } + /// + /// data values[] = { + /// { 3, "third" }, { 1, "first" }, { 2, "second" } + /// }; + /// + /// SDL_qsort_r(values, SDL_arraysize(values), sizeof(values[0]), compare, (const void *)(uintptr_t)sort_increasing); + /// ``` + /// + /// ## Parameters + /// - `base`: a pointer to the start of the array. + /// - `nmemb`: the number of elements in the array. + /// - `size`: the size of the elements in the array. + /// - `compare`: a function used to compare elements in the array. + /// - `userdata`: a pointer to pass to the compare function. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_bsearch_r`] + /// - [`SDL_qsort`] + pub fn SDL_qsort_r( + base: *mut ::core::ffi::c_void, + nmemb: ::core::primitive::usize, + size: ::core::primitive::usize, + compare: SDL_CompareCallback_r, + userdata: *mut ::core::ffi::c_void, + ); +} + +unsafe extern "C" { + /// Perform a binary search on a previously sorted array, passing a userdata + /// pointer to the compare function. + /// + /// For example: + /// + /// ```c + /// typedef enum { + /// sort_increasing, + /// sort_decreasing, + /// } sort_method; + /// + /// typedef struct { + /// int key; + /// const char *string; + /// } data; + /// + /// int SDLCALL compare(const void *userdata, const void *a, const void *b) + /// { + /// sort_method method = (sort_method)(uintptr_t)userdata; + /// const data *A = (const data *)a; + /// const data *B = (const data *)b; + /// + /// if (A->key < B->key) { + /// return (method == sort_increasing) ? -1 : 1; + /// } else if (B->key < A->key) { + /// return (method == sort_increasing) ? 1 : -1; + /// } else { + /// return 0; + /// } + /// } + /// + /// data values[] = { + /// { 1, "first" }, { 2, "second" }, { 3, "third" } + /// }; + /// data key = { 2, NULL }; + /// + /// data *result = SDL_bsearch_r(&key, values, SDL_arraysize(values), sizeof(values[0]), compare, (const void *)(uintptr_t)sort_increasing); + /// ``` + /// + /// ## Parameters + /// - `key`: a pointer to a key equal to the element being searched for. + /// - `base`: a pointer to the start of the array. + /// - `nmemb`: the number of elements in the array. + /// - `size`: the size of the elements in the array. + /// - `compare`: a function used to compare elements in the array. + /// - `userdata`: a pointer to pass to the compare function. + /// + /// ## Return value + /// Returns a pointer to the matching element in the array, or NULL if not + /// found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_bsearch`] + /// - [`SDL_qsort_r`] + pub fn SDL_bsearch_r( + key: *const ::core::ffi::c_void, + base: *const ::core::ffi::c_void, + nmemb: ::core::primitive::usize, + size: ::core::primitive::usize, + compare: SDL_CompareCallback_r, + userdata: *mut ::core::ffi::c_void, + ) -> *mut ::core::ffi::c_void; +} + +/// Compute the absolute value of `x`. +/// +/// ## Parameters +/// - `x`: an integer value. +/// +/// ## Return value +/// Returns the absolute value of x. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_abs(x: ::core::ffi::c_int) -> ::core::ffi::c_int { + return x.unsigned_abs() as _; +} + +#[inline(always)] +pub fn SDL_min(x: T, y: T) -> T { + if x < y { x } else { y } +} + +#[inline(always)] +pub fn SDL_max(x: T, y: T) -> T { + if x > y { x } else { y } +} + +#[inline(always)] +pub fn SDL_clamp(x: T, a: T, b: T) -> T { + if x < a { + a + } else if x > b { + b + } else { + x + } +} + +unsafe extern "C" { + /// Query if a character is alphabetic (a letter). + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// for English 'a-z' and 'A-Z' as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isalpha(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Query if a character is alphabetic (a letter) or a number. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// for English 'a-z', 'A-Z', and '0-9' as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isalnum(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is blank (a space or tab). + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// 0x20 (space) or 0x9 (tab) as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isblank(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is a control character. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// 0 through 0x1F, and 0x7F, as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_iscntrl(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is a numeric digit. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// '0' (0x30) through '9' (0x39), as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isdigit(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is a hexadecimal digit. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// 'A' through 'F', 'a' through 'f', and '0' through '9', as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isxdigit(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is a punctuation mark. + /// + /// **WARNING**: Regardless of system locale, this is equivalent to + /// `((SDL_isgraph(x)) && (!SDL_isalnum(x)))`. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_isgraph`] + /// - [`SDL_isalnum`] + pub safe fn SDL_ispunct(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is whitespace. + /// + /// **WARNING**: Regardless of system locale, this will only treat the + /// following ASCII values as true: + /// + /// - space (0x20) + /// - tab (0x09) + /// - newline (0x0A) + /// - vertical tab (0x0B) + /// - form feed (0x0C) + /// - return (0x0D) + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isspace(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is upper case. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// 'A' through 'Z' as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isupper(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is lower case. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// 'a' through 'z' as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_islower(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is "printable". + /// + /// Be advised that "printable" has a definition that goes back to text + /// terminals from the dawn of computing, making this a sort of special case + /// function that is not suitable for Unicode (or most any) text management. + /// + /// **WARNING**: Regardless of system locale, this will only treat ASCII values + /// ' ' (0x20) through '~' (0x7E) as true. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_isprint(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Report if a character is any "printable" except space. + /// + /// Be advised that "printable" has a definition that goes back to text + /// terminals from the dawn of computing, making this a sort of special case + /// function that is not suitable for Unicode (or most any) text management. + /// + /// **WARNING**: Regardless of system locale, this is equivalent to + /// `(SDL_isprint(x)) && ((x) != ' ')`. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns non-zero if x falls within the character class, zero otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_isprint`] + pub safe fn SDL_isgraph(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Convert low-ASCII English letters to uppercase. + /// + /// **WARNING**: Regardless of system locale, this will only convert ASCII + /// values 'a' through 'z' to uppercase. + /// + /// This function returns the uppercase equivalent of `x`. If a character + /// cannot be converted, or is already uppercase, this function returns `x`. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns capitalized version of x, or x if no conversion available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_toupper(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Convert low-ASCII English letters to lowercase. + /// + /// **WARNING**: Regardless of system locale, this will only convert ASCII + /// values 'A' through 'Z' to lowercase. + /// + /// This function returns the lowercase equivalent of `x`. If a character + /// cannot be converted, or is already lowercase, this function returns `x`. + /// + /// ## Parameters + /// - `x`: character value to check. + /// + /// ## Return value + /// Returns lowercase version of x, or x if no conversion available. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_tolower(x: ::core::ffi::c_int) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Calculate a CRC-16 value. + /// + /// + /// + /// This function can be called multiple times, to stream data to be + /// checksummed in blocks. Each call must provide the previous CRC-16 return + /// value to be updated with the next block. The first call to this function + /// for a set of blocks should pass in a zero CRC value. + /// + /// ## Parameters + /// - `crc`: the current checksum for this data set, or 0 for a new data set. + /// - `data`: a new block of data to add to the checksum. + /// - `len`: the size, in bytes, of the new block of data. + /// + /// ## Return value + /// Returns a CRC-16 checksum value of all blocks in the data set. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_crc16( + crc: Uint16, + data: *const ::core::ffi::c_void, + len: ::core::primitive::usize, + ) -> Uint16; +} + +unsafe extern "C" { + /// Calculate a CRC-32 value. + /// + /// + /// + /// This function can be called multiple times, to stream data to be + /// checksummed in blocks. Each call must provide the previous CRC-32 return + /// value to be updated with the next block. The first call to this function + /// for a set of blocks should pass in a zero CRC value. + /// + /// ## Parameters + /// - `crc`: the current checksum for this data set, or 0 for a new data set. + /// - `data`: a new block of data to add to the checksum. + /// - `len`: the size, in bytes, of the new block of data. + /// + /// ## Return value + /// Returns a CRC-32 checksum value of all blocks in the data set. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_crc32( + crc: Uint32, + data: *const ::core::ffi::c_void, + len: ::core::primitive::usize, + ) -> Uint32; +} + +unsafe extern "C" { + /// Calculate a 32-bit MurmurHash3 value for a block of data. + /// + /// + /// + /// A seed may be specified, which changes the final results consistently, but + /// this does not work like [`SDL_crc16`] and [`SDL_crc32`]\: you can't feed a previous + /// result from this function back into itself as the next seed value to + /// calculate a hash in chunks; it won't produce the same hash as it would if + /// the same data was provided in a single call. + /// + /// If you aren't sure what to provide for a seed, zero is fine. Murmur3 is not + /// cryptographically secure, so it shouldn't be used for hashing top-secret + /// data. + /// + /// ## Parameters + /// - `data`: the data to be hashed. + /// - `len`: the size of data, in bytes. + /// - `seed`: a value that alters the final hash value. + /// + /// ## Return value + /// Returns a Murmur3 32-bit hash value. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_murmur3_32( + data: *const ::core::ffi::c_void, + len: ::core::primitive::usize, + seed: Uint32, + ) -> Uint32; +} + +/// Copy non-overlapping memory. +/// +/// The memory regions must not overlap. If they do, use [`SDL_memmove()`] instead. +/// +/// ## Parameters +/// - `dst`: The destination memory region. Must not be NULL, and must not +/// overlap with `src`. +/// - `src`: The source memory region. Must not be NULL, and must not overlap +/// with `dst`. +/// - `len`: The length in bytes of both `dst` and `src`. +/// +/// ## Return value +/// Returns `dst`. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_memmove`] +#[inline(always)] +pub const unsafe fn SDL_memcpy( + dst: *mut ::core::ffi::c_void, + src: *const ::core::ffi::c_void, + len: ::core::primitive::usize, +) -> *mut ::core::ffi::c_void { + unsafe { ::core::ptr::copy_nonoverlapping(src.cast::(), dst.cast::(), len) }; + return dst; +} + +/// A macro to copy memory between objects, with basic type checking. +/// +/// [`SDL_memcpy`] and [`SDL_memmove`] do not care where you copy memory to and from, +/// which can lead to bugs. This macro aims to avoid most of those bugs by +/// making sure that the source and destination are both pointers to objects +/// that are the same size. It does not check that the objects are the same +/// _type_, just that the copy will not overflow either object. +/// +/// The size check happens at compile time, and the compiler will throw an +/// error if the objects are different sizes. +/// +/// Generally this is intended to copy a single object, not an array. +/// +/// This macro looks like it double-evaluates its parameters, but the extras +/// them are in `sizeof` sections, which generate no code nor side-effects. +/// +/// ## Parameters +/// - `dst`: a pointer to the destination object. Must not be NULL. +/// - `src`: a pointer to the source object. Must not be NULL. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// # Safety +/// It must be valid to write the memory pointed to by `src` to the memory pointed to by `dst`, +/// and the memory pointed to by `src` and `dst` must not overlap +#[inline(always)] +pub unsafe fn SDL_copyp(dst: *mut Dst, src: *const Src) -> *mut Dst { + const { assert!(::core::mem::size_of::() == ::core::mem::size_of::()) } + unsafe { + ::core::ptr::copy_nonoverlapping( + src.cast::(), + dst.cast::(), + ::core::mem::size_of::(), + ) + }; + dst +} + +/// Copy memory ranges that might overlap. +/// +/// It is okay for the memory regions to overlap. If you are confident that the +/// regions never overlap, using [`SDL_memcpy()`] may improve performance. +/// +/// ## Parameters +/// - `dst`: The destination memory region. Must not be NULL. +/// - `src`: The source memory region. Must not be NULL. +/// - `len`: The length in bytes of both `dst` and `src`. +/// +/// ## Return value +/// Returns `dst`. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_memcpy`] +#[inline(always)] +pub const unsafe fn SDL_memmove( + dst: *mut ::core::ffi::c_void, + src: *const ::core::ffi::c_void, + len: ::core::primitive::usize, +) -> *mut ::core::ffi::c_void { + unsafe { ::core::ptr::copy(src.cast::(), dst.cast::(), len) }; + return dst; +} + +unsafe extern "C" { + /// Initialize all bytes of buffer of memory to a specific value. + /// + /// This function will set `len` bytes, pointed to by `dst`, to the value + /// specified in `c`. + /// + /// Despite `c` being an `int` instead of a `char`, this only operates on + /// bytes; `c` must be a value between 0 and 255, inclusive. + /// + /// ## Parameters + /// - `dst`: the destination memory region. Must not be NULL. + /// - `c`: the byte value to set. + /// - `len`: the length, in bytes, to set in `dst`. + /// + /// ## Return value + /// Returns `dst`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_memset( + dst: *mut ::core::ffi::c_void, + c: ::core::ffi::c_int, + len: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Initialize all 32-bit words of buffer of memory to a specific value. + /// + /// This function will set a buffer of `dwords` Uint32 values, pointed to by + /// `dst`, to the value specified in `val`. + /// + /// Unlike [`SDL_memset`], this sets 32-bit values, not bytes, so it's not limited + /// to a range of 0-255. + /// + /// ## Parameters + /// - `dst`: the destination memory region. Must not be NULL. + /// - `val`: the Uint32 value to set. + /// - `dwords`: the number of Uint32 values to set in `dst`. + /// + /// ## Return value + /// Returns `dst`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_memset4( + dst: *mut ::core::ffi::c_void, + val: Uint32, + dwords: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +/// Clear an object's memory to zero, using a pointer. +/// +/// This is wrapper over [`SDL_memset`] that handles calculating the object size, +/// so there's no chance of copy/paste errors, and the code is cleaner. +/// +/// This requires a pointer to an object, not an object itself, nor an array. +/// +/// ## Parameters +/// - `x`: a pointer to the object to clear. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_zero`] +/// - [`SDL_zeroa`] +/// +/// # Safety +/// It must be valid to zero all bytes of `T`, and it must be valid to write a `T` to the memory pointed to by `x` +#[inline(always)] +pub unsafe fn SDL_zerop(x: *mut T) -> *mut T { + unsafe { x.write_bytes(0, 1) }; + x +} + +unsafe extern "C" { + /// Compare two buffers of memory. + /// + /// ## Parameters + /// - `s1`: the first buffer to compare. NULL is not permitted! + /// - `s2`: the second buffer to compare. NULL is not permitted! + /// - `len`: the number of bytes to compare between the buffers. + /// + /// ## Return value + /// Returns less than zero if s1 is "less than" s2, greater than zero if s1 is + /// "greater than" s2, and zero if the buffers match exactly for `len` + /// bytes. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_memcmp( + s1: *const ::core::ffi::c_void, + s2: *const ::core::ffi::c_void, + len: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like wcslen() but doesn't require access to a C runtime. + /// + /// Counts the number of wchar_t values in `wstr`, excluding the null + /// terminator. + /// + /// Like [`SDL_strlen`] only counts bytes and not codepoints in a UTF-8 string, + /// this counts wchar_t values in a string, even if the string's encoding is of + /// variable width, like UTF-16. + /// + /// Also be aware that wchar_t is different sizes on different platforms (4 + /// bytes on Linux, 2 on Windows, etc). + /// + /// ## Parameters + /// - `wstr`: The null-terminated wide string to read. Must not be NULL. + /// + /// ## Return value + /// Returns the length (in wchar_t values, excluding the null terminator) of + /// `wstr`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_wcsnlen`] + /// - [`SDL_utf8strlen`] + /// - [`SDL_utf8strnlen`] + pub fn SDL_wcslen(wstr: *const crate::ffi::c_wchar_t) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// This works exactly like wcsnlen() but doesn't require access to a C + /// runtime. + /// + /// Counts up to a maximum of `maxlen` wchar_t values in `wstr`, excluding the + /// null terminator. + /// + /// Like [`SDL_strnlen`] only counts bytes and not codepoints in a UTF-8 string, + /// this counts wchar_t values in a string, even if the string's encoding is of + /// variable width, like UTF-16. + /// + /// Also be aware that wchar_t is different sizes on different platforms (4 + /// bytes on Linux, 2 on Windows, etc). + /// + /// Also, `maxlen` is a count of wide characters, not bytes! + /// + /// ## Parameters + /// - `wstr`: The null-terminated wide string to read. Must not be NULL. + /// - `maxlen`: The maximum amount of wide characters to count. + /// + /// ## Return value + /// Returns the length (in wide characters, excluding the null terminator) of + /// `wstr` but never more than `maxlen`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_wcslen`] + /// - [`SDL_utf8strlen`] + /// - [`SDL_utf8strnlen`] + pub fn SDL_wcsnlen( + wstr: *const crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Copy a wide string. + /// + /// This function copies `maxlen` - 1 wide characters from `src` to `dst`, then + /// appends a null terminator. + /// + /// `src` and `dst` must not overlap. + /// + /// If `maxlen` is 0, no wide characters are copied and no null terminator is + /// written. + /// + /// ## Parameters + /// - `dst`: The destination buffer. Must not be NULL, and must not overlap + /// with `src`. + /// - `src`: The null-terminated wide string to copy. Must not be NULL, and + /// must not overlap with `dst`. + /// - `maxlen`: The length (in wide characters) of the destination buffer. + /// + /// ## Return value + /// Returns the length (in wide characters, excluding the null terminator) of + /// `src`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_wcslcat`] + pub fn SDL_wcslcpy( + dst: *mut crate::ffi::c_wchar_t, + src: *const crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Concatenate wide strings. + /// + /// This function appends up to `maxlen` - SDL_wcslen(dst) - 1 wide characters + /// from `src` to the end of the wide string in `dst`, then appends a null + /// terminator. + /// + /// `src` and `dst` must not overlap. + /// + /// If `maxlen` - SDL_wcslen(dst) - 1 is less than or equal to 0, then `dst` is + /// unmodified. + /// + /// ## Parameters + /// - `dst`: The destination buffer already containing the first + /// null-terminated wide string. Must not be NULL and must not + /// overlap with `src`. + /// - `src`: The second null-terminated wide string. Must not be NULL, and + /// must not overlap with `dst`. + /// - `maxlen`: The length (in wide characters) of the destination buffer. + /// + /// ## Return value + /// Returns the length (in wide characters, excluding the null terminator) of + /// the string in `dst` plus the length of `src`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_wcslcpy`] + pub fn SDL_wcslcat( + dst: *mut crate::ffi::c_wchar_t, + src: *const crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Allocate a copy of a wide string. + /// + /// This allocates enough space for a null-terminated copy of `wstr`, using + /// [`SDL_malloc`], and then makes a copy of the string into this space. + /// + /// The returned string is owned by the caller, and should be passed to + /// [`SDL_free`] when no longer needed. + /// + /// ## Parameters + /// - `wstr`: the string to copy. + /// + /// ## Return value + /// Returns a pointer to the newly-allocated wide string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcsdup(wstr: *const crate::ffi::c_wchar_t) -> *mut crate::ffi::c_wchar_t; +} + +unsafe extern "C" { + /// Search a wide string for the first instance of a specific substring. + /// + /// The search ends once it finds the requested substring, or a null terminator + /// byte to end the string. + /// + /// Note that this looks for strings of _wide characters_, not _codepoints_, so + /// it's legal to search for malformed and incomplete UTF-16 sequences. + /// + /// ## Parameters + /// - `haystack`: the wide string to search. Must not be NULL. + /// - `needle`: the wide string to search for. Must not be NULL. + /// + /// ## Return value + /// Returns a pointer to the first instance of `needle` in the string, or NULL + /// if not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcsstr( + haystack: *const crate::ffi::c_wchar_t, + needle: *const crate::ffi::c_wchar_t, + ) -> *mut crate::ffi::c_wchar_t; +} + +unsafe extern "C" { + /// Search a wide string, up to n wide chars, for the first instance of a + /// specific substring. + /// + /// The search ends once it finds the requested substring, or a null terminator + /// value to end the string, or `maxlen` wide character have been examined. It + /// is possible to use this function on a wide string without a null + /// terminator. + /// + /// Note that this looks for strings of _wide characters_, not _codepoints_, so + /// it's legal to search for malformed and incomplete UTF-16 sequences. + /// + /// ## Parameters + /// - `haystack`: the wide string to search. Must not be NULL. + /// - `needle`: the wide string to search for. Must not be NULL. + /// - `maxlen`: the maximum number of wide characters to search in + /// `haystack`. + /// + /// ## Return value + /// Returns a pointer to the first instance of `needle` in the string, or NULL + /// if not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcsnstr( + haystack: *const crate::ffi::c_wchar_t, + needle: *const crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> *mut crate::ffi::c_wchar_t; +} + +unsafe extern "C" { + /// Compare two null-terminated wide strings. + /// + /// This only compares wchar_t values until it hits a null-terminating + /// character; it does not care if the string is well-formed UTF-16 (or UTF-32, + /// depending on your platform's wchar_t size), or uses valid Unicode values. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcscmp( + str1: *const crate::ffi::c_wchar_t, + str2: *const crate::ffi::c_wchar_t, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Compare two wide strings up to a number of wchar_t values. + /// + /// This only compares wchar_t values; it does not care if the string is + /// well-formed UTF-16 (or UTF-32, depending on your platform's wchar_t size), + /// or uses valid Unicode values. + /// + /// Note that while this function is intended to be used with UTF-16 (or + /// UTF-32, depending on your platform's definition of wchar_t), it is + /// comparing raw wchar_t values and not Unicode codepoints: `maxlen` specifies + /// a wchar_t limit! If the limit lands in the middle of a multi-wchar UTF-16 + /// sequence, it will only compare a portion of the final character. + /// + /// `maxlen` specifies a maximum number of wchar_t to compare; if the strings + /// match to this number of wide chars (or both have matched to a + /// null-terminator character before this count), they will be considered + /// equal. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// - `maxlen`: the maximum number of wchar_t to compare. + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcsncmp( + str1: *const crate::ffi::c_wchar_t, + str2: *const crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Compare two null-terminated wide strings, case-insensitively. + /// + /// This will work with Unicode strings, using a technique called + /// "case-folding" to handle the vast majority of case-sensitive human + /// languages regardless of system locale. It can deal with expanding values: a + /// German Eszett character can compare against two ASCII 's' chars and be + /// considered a match, for example. A notable exception: it does not handle + /// the Turkish 'i' character; human language is complicated! + /// + /// Depending on your platform, "wchar_t" might be 2 bytes, and expected to be + /// UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this + /// handles Unicode, it expects the string to be well-formed and not a + /// null-terminated string of arbitrary bytes. Characters that are not valid + /// UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), which is to say two strings of random bits may turn out to + /// match if they convert to the same amount of replacement characters. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcscasecmp( + str1: *const crate::ffi::c_wchar_t, + str2: *const crate::ffi::c_wchar_t, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Compare two wide strings, case-insensitively, up to a number of wchar_t. + /// + /// This will work with Unicode strings, using a technique called + /// "case-folding" to handle the vast majority of case-sensitive human + /// languages regardless of system locale. It can deal with expanding values: a + /// German Eszett character can compare against two ASCII 's' chars and be + /// considered a match, for example. A notable exception: it does not handle + /// the Turkish 'i' character; human language is complicated! + /// + /// Depending on your platform, "wchar_t" might be 2 bytes, and expected to be + /// UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this + /// handles Unicode, it expects the string to be well-formed and not a + /// null-terminated string of arbitrary bytes. Characters that are not valid + /// UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), which is to say two strings of random bits may turn out to + /// match if they convert to the same amount of replacement characters. + /// + /// Note that while this function might deal with variable-sized characters, + /// `maxlen` specifies a _wchar_ limit! If the limit lands in the middle of a + /// multi-byte UTF-16 sequence, it may convert a portion of the final character + /// to one or more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not + /// to overflow a buffer. + /// + /// `maxlen` specifies a maximum number of wchar_t values to compare; if the + /// strings match to this number of wchar_t (or both have matched to a + /// null-terminator character before this number of bytes), they will be + /// considered equal. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// - `maxlen`: the maximum number of wchar_t values to compare. + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_wcsncasecmp( + str1: *const crate::ffi::c_wchar_t, + str2: *const crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Parse a `long` from a wide string. + /// + /// If `str` starts with whitespace, then those whitespace characters are + /// skipped before attempting to parse the number. + /// + /// If the parsed number does not fit inside a `long`, the result is clamped to + /// the minimum and maximum representable `long` values. + /// + /// ## Parameters + /// - `str`: The null-terminated wide string to read. Must not be NULL. + /// - `endp`: If not NULL, the address of the first invalid wide character + /// (i.e. the next character after the parsed number) will be + /// written to this pointer. + /// - `base`: The base of the integer to read. Supported values are 0 and 2 + /// to 36 inclusive. If 0, the base will be inferred from the + /// number's prefix (0x for hexadecimal, 0 for octal, decimal + /// otherwise). + /// + /// ## Return value + /// Returns the parsed `long`, or 0 if no number could be parsed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strtol`] + pub fn SDL_wcstol( + str: *const crate::ffi::c_wchar_t, + endp: *mut *mut crate::ffi::c_wchar_t, + base: ::core::ffi::c_int, + ) -> ::core::ffi::c_long; +} + +unsafe extern "C" { + /// This works exactly like strlen() but doesn't require access to a C runtime. + /// + /// Counts the bytes in `str`, excluding the null terminator. + /// + /// If you need the length of a UTF-8 string, consider using [`SDL_utf8strlen()`]. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// + /// ## Return value + /// Returns the length (in bytes, excluding the null terminator) of `src`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strnlen`] + /// - [`SDL_utf8strlen`] + /// - [`SDL_utf8strnlen`] + pub fn SDL_strlen(str: *const ::core::ffi::c_char) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// This works exactly like strnlen() but doesn't require access to a C + /// runtime. + /// + /// Counts up to a maximum of `maxlen` bytes in `str`, excluding the null + /// terminator. + /// + /// If you need the length of a UTF-8 string, consider using [`SDL_utf8strnlen()`]. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// - `maxlen`: The maximum amount of bytes to count. + /// + /// ## Return value + /// Returns the length (in bytes, excluding the null terminator) of `src` but + /// never more than `maxlen`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strlen`] + /// - [`SDL_utf8strlen`] + /// - [`SDL_utf8strnlen`] + pub fn SDL_strnlen( + str: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Copy a string. + /// + /// This function copies up to `maxlen` - 1 characters from `src` to `dst`, + /// then appends a null terminator. + /// + /// If `maxlen` is 0, no characters are copied and no null terminator is + /// written. + /// + /// If you want to copy an UTF-8 string but need to ensure that multi-byte + /// sequences are not truncated, consider using [`SDL_utf8strlcpy()`]. + /// + /// ## Parameters + /// - `dst`: The destination buffer. Must not be NULL, and must not overlap + /// with `src`. + /// - `src`: The null-terminated string to copy. Must not be NULL, and must + /// not overlap with `dst`. + /// - `maxlen`: The length (in characters) of the destination buffer. + /// + /// ## Return value + /// Returns the length (in characters, excluding the null terminator) of + /// `src`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strlcat`] + /// - [`SDL_utf8strlcpy`] + pub fn SDL_strlcpy( + dst: *mut ::core::ffi::c_char, + src: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Copy an UTF-8 string. + /// + /// This function copies up to `dst_bytes` - 1 bytes from `src` to `dst` while + /// also ensuring that the string written to `dst` does not end in a truncated + /// multi-byte sequence. Finally, it appends a null terminator. + /// + /// `src` and `dst` must not overlap. + /// + /// Note that unlike [`SDL_strlcpy()`], this function returns the number of bytes + /// written, not the length of `src`. + /// + /// ## Parameters + /// - `dst`: The destination buffer. Must not be NULL, and must not overlap + /// with `src`. + /// - `src`: The null-terminated UTF-8 string to copy. Must not be NULL, and + /// must not overlap with `dst`. + /// - `dst_bytes`: The length (in bytes) of the destination buffer. Must not + /// be 0. + /// + /// ## Return value + /// Returns the number of bytes written, excluding the null terminator. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strlcpy`] + pub fn SDL_utf8strlcpy( + dst: *mut ::core::ffi::c_char, + src: *const ::core::ffi::c_char, + dst_bytes: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Concatenate strings. + /// + /// This function appends up to `maxlen` - SDL_strlen(dst) - 1 characters from + /// `src` to the end of the string in `dst`, then appends a null terminator. + /// + /// `src` and `dst` must not overlap. + /// + /// If `maxlen` - SDL_strlen(dst) - 1 is less than or equal to 0, then `dst` is + /// unmodified. + /// + /// ## Parameters + /// - `dst`: The destination buffer already containing the first + /// null-terminated string. Must not be NULL and must not overlap + /// with `src`. + /// - `src`: The second null-terminated string. Must not be NULL, and must + /// not overlap with `dst`. + /// - `maxlen`: The length (in characters) of the destination buffer. + /// + /// ## Return value + /// Returns the length (in characters, excluding the null terminator) of the + /// string in `dst` plus the length of `src`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strlcpy`] + pub fn SDL_strlcat( + dst: *mut ::core::ffi::c_char, + src: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Allocate a copy of a string. + /// + /// This allocates enough space for a null-terminated copy of `str`, using + /// [`SDL_malloc`], and then makes a copy of the string into this space. + /// + /// The returned string is owned by the caller, and should be passed to + /// [`SDL_free`] when no longer needed. + /// + /// ## Parameters + /// - `str`: the string to copy. + /// + /// ## Return value + /// Returns a pointer to the newly-allocated string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strdup(str: *const ::core::ffi::c_char) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Allocate a copy of a string, up to n characters. + /// + /// This allocates enough space for a null-terminated copy of `str`, up to + /// `maxlen` bytes, using [`SDL_malloc`], and then makes a copy of the string into + /// this space. + /// + /// If the string is longer than `maxlen` bytes, the returned string will be + /// `maxlen` bytes long, plus a null-terminator character that isn't included + /// in the count. + /// + /// The returned string is owned by the caller, and should be passed to + /// [`SDL_free`] when no longer needed. + /// + /// ## Parameters + /// - `str`: the string to copy. + /// - `maxlen`: the maximum length of the copied string, not counting the + /// null-terminator character. + /// + /// ## Return value + /// Returns a pointer to the newly-allocated string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strndup( + str: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Reverse a string's contents. + /// + /// This reverses a null-terminated string in-place. Only the content of the + /// string is reversed; the null-terminator character remains at the end of the + /// reversed string. + /// + /// **WARNING**: This function reverses the _bytes_ of the string, not the + /// codepoints. If `str` is a UTF-8 string with Unicode codepoints > 127, this + /// will ruin the string data. You should only use this function on strings + /// that are completely comprised of low ASCII characters. + /// + /// ## Parameters + /// - `str`: the string to reverse. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strrev(str: *mut ::core::ffi::c_char) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert a string to uppercase. + /// + /// **WARNING**: Regardless of system locale, this will only convert ASCII + /// values 'A' through 'Z' to uppercase. + /// + /// This function operates on a null-terminated string of bytes--even if it is + /// malformed UTF-8!--and converts ASCII characters 'a' through 'z' to their + /// uppercase equivalents in-place, returning the original `str` pointer. + /// + /// ## Parameters + /// - `str`: the string to convert in-place. Can not be NULL. + /// + /// ## Return value + /// Returns the `str` pointer passed into this function. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strlwr`] + pub fn SDL_strupr(str: *mut ::core::ffi::c_char) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert a string to lowercase. + /// + /// **WARNING**: Regardless of system locale, this will only convert ASCII + /// values 'A' through 'Z' to lowercase. + /// + /// This function operates on a null-terminated string of bytes--even if it is + /// malformed UTF-8!--and converts ASCII characters 'A' through 'Z' to their + /// lowercase equivalents in-place, returning the original `str` pointer. + /// + /// ## Parameters + /// - `str`: the string to convert in-place. Can not be NULL. + /// + /// ## Return value + /// Returns the `str` pointer passed into this function. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_strupr`] + pub fn SDL_strlwr(str: *mut ::core::ffi::c_char) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Search a string for the first instance of a specific byte. + /// + /// The search ends once it finds the requested byte value, or a null + /// terminator byte to end the string. + /// + /// Note that this looks for _bytes_, not _characters_, so you cannot match + /// against a Unicode codepoint > 255, regardless of character encoding. + /// + /// ## Parameters + /// - `str`: the string to search. Must not be NULL. + /// - `c`: the byte value to search for. + /// + /// ## Return value + /// Returns a pointer to the first instance of `c` in the string, or NULL if + /// not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strchr( + str: *const ::core::ffi::c_char, + c: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Search a string for the last instance of a specific byte. + /// + /// The search must go until it finds a null terminator byte to end the string. + /// + /// Note that this looks for _bytes_, not _characters_, so you cannot match + /// against a Unicode codepoint > 255, regardless of character encoding. + /// + /// ## Parameters + /// - `str`: the string to search. Must not be NULL. + /// - `c`: the byte value to search for. + /// + /// ## Return value + /// Returns a pointer to the last instance of `c` in the string, or NULL if + /// not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strrchr( + str: *const ::core::ffi::c_char, + c: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Search a string for the first instance of a specific substring. + /// + /// The search ends once it finds the requested substring, or a null terminator + /// byte to end the string. + /// + /// Note that this looks for strings of _bytes_, not _characters_, so it's + /// legal to search for malformed and incomplete UTF-8 sequences. + /// + /// ## Parameters + /// - `haystack`: the string to search. Must not be NULL. + /// - `needle`: the string to search for. Must not be NULL. + /// + /// ## Return value + /// Returns a pointer to the first instance of `needle` in the string, or NULL + /// if not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strstr( + haystack: *const ::core::ffi::c_char, + needle: *const ::core::ffi::c_char, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Search a string, up to n bytes, for the first instance of a specific + /// substring. + /// + /// The search ends once it finds the requested substring, or a null terminator + /// byte to end the string, or `maxlen` bytes have been examined. It is + /// possible to use this function on a string without a null terminator. + /// + /// Note that this looks for strings of _bytes_, not _characters_, so it's + /// legal to search for malformed and incomplete UTF-8 sequences. + /// + /// ## Parameters + /// - `haystack`: the string to search. Must not be NULL. + /// - `needle`: the string to search for. Must not be NULL. + /// - `maxlen`: the maximum number of bytes to search in `haystack`. + /// + /// ## Return value + /// Returns a pointer to the first instance of `needle` in the string, or NULL + /// if not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strnstr( + haystack: *const ::core::ffi::c_char, + needle: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Search a UTF-8 string for the first instance of a specific substring, + /// case-insensitively. + /// + /// This will work with Unicode strings, using a technique called + /// "case-folding" to handle the vast majority of case-sensitive human + /// languages regardless of system locale. It can deal with expanding values: a + /// German Eszett character can compare against two ASCII 's' chars and be + /// considered a match, for example. A notable exception: it does not handle + /// the Turkish 'i' character; human language is complicated! + /// + /// Since this handles Unicode, it expects the strings to be well-formed UTF-8 + /// and not a null-terminated string of arbitrary bytes. Bytes that are not + /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), which is to say two strings of random bits may turn out to + /// match if they convert to the same amount of replacement characters. + /// + /// ## Parameters + /// - `haystack`: the string to search. Must not be NULL. + /// - `needle`: the string to search for. Must not be NULL. + /// + /// ## Return value + /// Returns a pointer to the first instance of `needle` in the string, or NULL + /// if not found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strcasestr( + haystack: *const ::core::ffi::c_char, + needle: *const ::core::ffi::c_char, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// This works exactly like strtok_r() but doesn't require access to a C + /// runtime. + /// + /// Break a string up into a series of tokens. + /// + /// To start tokenizing a new string, `str` should be the non-NULL address of + /// the string to start tokenizing. Future calls to get the next token from the + /// same string should specify a NULL. + /// + /// Note that this function will overwrite pieces of `str` with null chars to + /// split it into tokens. This function cannot be used with const/read-only + /// strings! + /// + /// `saveptr` just needs to point to a `char *` that can be overwritten; SDL + /// will use this to save tokenizing state between calls. It is initialized if + /// `str` is non-NULL, and used to resume tokenizing when `str` is NULL. + /// + /// ## Parameters + /// - `str`: the string to tokenize, or NULL to continue tokenizing. + /// - `delim`: the delimiter string that separates tokens. + /// - `saveptr`: pointer to a char *, used for ongoing state. + /// + /// ## Return value + /// Returns A pointer to the next token, or NULL if no tokens remain. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strtok_r( + str: *mut ::core::ffi::c_char, + delim: *const ::core::ffi::c_char, + saveptr: *mut *mut ::core::ffi::c_char, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Count the number of codepoints in a UTF-8 string. + /// + /// Counts the _codepoints_, not _bytes_, in `str`, excluding the null + /// terminator. + /// + /// If you need to count the bytes in a string instead, consider using + /// [`SDL_strlen()`]. + /// + /// Since this handles Unicode, it expects the strings to be well-formed UTF-8 + /// and not a null-terminated string of arbitrary bytes. Bytes that are not + /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), so a malformed or incomplete UTF-8 sequence might increase the + /// count by several replacement characters. + /// + /// ## Parameters + /// - `str`: The null-terminated UTF-8 string to read. Must not be NULL. + /// + /// ## Return value + /// Returns The length (in codepoints, excluding the null terminator) of + /// `src`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_utf8strnlen`] + /// - [`SDL_strlen`] + pub fn SDL_utf8strlen(str: *const ::core::ffi::c_char) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Count the number of codepoints in a UTF-8 string, up to n bytes. + /// + /// Counts the _codepoints_, not _bytes_, in `str`, excluding the null + /// terminator. + /// + /// If you need to count the bytes in a string instead, consider using + /// [`SDL_strnlen()`]. + /// + /// The counting stops at `bytes` bytes (not codepoints!). This seems + /// counterintuitive, but makes it easy to express the total size of the + /// string's buffer. + /// + /// Since this handles Unicode, it expects the strings to be well-formed UTF-8 + /// and not a null-terminated string of arbitrary bytes. Bytes that are not + /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), so a malformed or incomplete UTF-8 sequence might increase the + /// count by several replacement characters. + /// + /// ## Parameters + /// - `str`: The null-terminated UTF-8 string to read. Must not be NULL. + /// - `bytes`: The maximum amount of bytes to count. + /// + /// ## Return value + /// Returns The length (in codepoints, excluding the null terminator) of `src` + /// but never more than `maxlen`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_utf8strlen`] + /// - [`SDL_strnlen`] + pub fn SDL_utf8strnlen( + str: *const ::core::ffi::c_char, + bytes: ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +unsafe extern "C" { + /// Convert an integer into a string. + /// + /// This requires a radix to specified for string format. Specifying 10 + /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2 + /// to 36. + /// + /// Note that this function will overflow a buffer if `str` is not large enough + /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or + /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate + /// much more space than you expect to use (and don't forget possible negative + /// signs, null terminator bytes, etc). + /// + /// ## Parameters + /// - `value`: the integer to convert. + /// - `str`: the buffer to write the string into. + /// - `radix`: the radix to use for string generation. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_uitoa`] + /// - [`SDL_ltoa`] + /// - [`SDL_lltoa`] + pub fn SDL_itoa( + value: ::core::ffi::c_int, + str: *mut ::core::ffi::c_char, + radix: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert an unsigned integer into a string. + /// + /// This requires a radix to specified for string format. Specifying 10 + /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2 + /// to 36. + /// + /// Note that this function will overflow a buffer if `str` is not large enough + /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or + /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate + /// much more space than you expect to use (and don't forget null terminator + /// bytes, etc). + /// + /// ## Parameters + /// - `value`: the unsigned integer to convert. + /// - `str`: the buffer to write the string into. + /// - `radix`: the radix to use for string generation. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_itoa`] + /// - [`SDL_ultoa`] + /// - [`SDL_ulltoa`] + pub fn SDL_uitoa( + value: ::core::ffi::c_uint, + str: *mut ::core::ffi::c_char, + radix: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert a long integer into a string. + /// + /// This requires a radix to specified for string format. Specifying 10 + /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2 + /// to 36. + /// + /// Note that this function will overflow a buffer if `str` is not large enough + /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or + /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate + /// much more space than you expect to use (and don't forget possible negative + /// signs, null terminator bytes, etc). + /// + /// ## Parameters + /// - `value`: the long integer to convert. + /// - `str`: the buffer to write the string into. + /// - `radix`: the radix to use for string generation. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ultoa`] + /// - [`SDL_itoa`] + /// - [`SDL_lltoa`] + pub fn SDL_ltoa( + value: ::core::ffi::c_long, + str: *mut ::core::ffi::c_char, + radix: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert an unsigned long integer into a string. + /// + /// This requires a radix to specified for string format. Specifying 10 + /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2 + /// to 36. + /// + /// Note that this function will overflow a buffer if `str` is not large enough + /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or + /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate + /// much more space than you expect to use (and don't forget null terminator + /// bytes, etc). + /// + /// ## Parameters + /// - `value`: the unsigned long integer to convert. + /// - `str`: the buffer to write the string into. + /// - `radix`: the radix to use for string generation. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ltoa`] + /// - [`SDL_uitoa`] + /// - [`SDL_ulltoa`] + pub fn SDL_ultoa( + value: ::core::ffi::c_ulong, + str: *mut ::core::ffi::c_char, + radix: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert a long long integer into a string. + /// + /// This requires a radix to specified for string format. Specifying 10 + /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2 + /// to 36. + /// + /// Note that this function will overflow a buffer if `str` is not large enough + /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or + /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate + /// much more space than you expect to use (and don't forget possible negative + /// signs, null terminator bytes, etc). + /// + /// ## Parameters + /// - `value`: the long long integer to convert. + /// - `str`: the buffer to write the string into. + /// - `radix`: the radix to use for string generation. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ulltoa`] + /// - [`SDL_itoa`] + /// - [`SDL_ltoa`] + pub fn SDL_lltoa( + value: ::core::ffi::c_longlong, + str: *mut ::core::ffi::c_char, + radix: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Convert an unsigned long long integer into a string. + /// + /// This requires a radix to specified for string format. Specifying 10 + /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2 + /// to 36. + /// + /// Note that this function will overflow a buffer if `str` is not large enough + /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or + /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate + /// much more space than you expect to use (and don't forget null terminator + /// bytes, etc). + /// + /// ## Parameters + /// - `value`: the unsigned long long integer to convert. + /// - `str`: the buffer to write the string into. + /// - `radix`: the radix to use for string generation. + /// + /// ## Return value + /// Returns `str`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_lltoa`] + /// - [`SDL_uitoa`] + /// - [`SDL_ultoa`] + pub fn SDL_ulltoa( + value: ::core::ffi::c_ulonglong, + str: *mut ::core::ffi::c_char, + radix: ::core::ffi::c_int, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Parse an `int` from a string. + /// + /// The result of calling `SDL_atoi(str)` is equivalent to + /// `(int)SDL_strtol(str, NULL, 10)`. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// + /// ## Return value + /// Returns the parsed `int`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atof`] + /// - [`SDL_strtol`] + /// - [`SDL_strtoul`] + /// - [`SDL_strtoll`] + /// - [`SDL_strtoull`] + /// - [`SDL_strtod`] + /// - [`SDL_itoa`] + pub fn SDL_atoi(str: *const ::core::ffi::c_char) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Parse a `double` from a string. + /// + /// The result of calling `SDL_atof(str)` is equivalent to `SDL_strtod(str, + /// NULL)`. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// + /// ## Return value + /// Returns the parsed `double`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atoi`] + /// - [`SDL_strtol`] + /// - [`SDL_strtoul`] + /// - [`SDL_strtoll`] + /// - [`SDL_strtoull`] + /// - [`SDL_strtod`] + pub fn SDL_atof(str: *const ::core::ffi::c_char) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Parse a `long` from a string. + /// + /// If `str` starts with whitespace, then those whitespace characters are + /// skipped before attempting to parse the number. + /// + /// If the parsed number does not fit inside a `long`, the result is clamped to + /// the minimum and maximum representable `long` values. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// - `endp`: If not NULL, the address of the first invalid character (i.e. + /// the next character after the parsed number) will be written to + /// this pointer. + /// - `base`: The base of the integer to read. Supported values are 0 and 2 + /// to 36 inclusive. If 0, the base will be inferred from the + /// number's prefix (0x for hexadecimal, 0 for octal, decimal + /// otherwise). + /// + /// ## Return value + /// Returns the parsed `long`, or 0 if no number could be parsed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atoi`] + /// - [`SDL_atof`] + /// - [`SDL_strtoul`] + /// - [`SDL_strtoll`] + /// - [`SDL_strtoull`] + /// - [`SDL_strtod`] + /// - [`SDL_ltoa`] + /// - [`SDL_wcstol`] + pub fn SDL_strtol( + str: *const ::core::ffi::c_char, + endp: *mut *mut ::core::ffi::c_char, + base: ::core::ffi::c_int, + ) -> ::core::ffi::c_long; +} + +unsafe extern "C" { + /// Parse an `unsigned long` from a string. + /// + /// If `str` starts with whitespace, then those whitespace characters are + /// skipped before attempting to parse the number. + /// + /// If the parsed number does not fit inside an `unsigned long`, the result is + /// clamped to the maximum representable `unsigned long` value. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// - `endp`: If not NULL, the address of the first invalid character (i.e. + /// the next character after the parsed number) will be written to + /// this pointer. + /// - `base`: The base of the integer to read. Supported values are 0 and 2 + /// to 36 inclusive. If 0, the base will be inferred from the + /// number's prefix (0x for hexadecimal, 0 for octal, decimal + /// otherwise). + /// + /// ## Return value + /// Returns the parsed `unsigned long`, or 0 if no number could be parsed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atoi`] + /// - [`SDL_atof`] + /// - [`SDL_strtol`] + /// - [`SDL_strtoll`] + /// - [`SDL_strtoull`] + /// - [`SDL_strtod`] + /// - [`SDL_ultoa`] + pub fn SDL_strtoul( + str: *const ::core::ffi::c_char, + endp: *mut *mut ::core::ffi::c_char, + base: ::core::ffi::c_int, + ) -> ::core::ffi::c_ulong; +} + +unsafe extern "C" { + /// Parse a `long long` from a string. + /// + /// If `str` starts with whitespace, then those whitespace characters are + /// skipped before attempting to parse the number. + /// + /// If the parsed number does not fit inside a `long long`, the result is + /// clamped to the minimum and maximum representable `long long` values. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// - `endp`: If not NULL, the address of the first invalid character (i.e. + /// the next character after the parsed number) will be written to + /// this pointer. + /// - `base`: The base of the integer to read. Supported values are 0 and 2 + /// to 36 inclusive. If 0, the base will be inferred from the + /// number's prefix (0x for hexadecimal, 0 for octal, decimal + /// otherwise). + /// + /// ## Return value + /// Returns the parsed `long long`, or 0 if no number could be parsed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atoi`] + /// - [`SDL_atof`] + /// - [`SDL_strtol`] + /// - [`SDL_strtoul`] + /// - [`SDL_strtoull`] + /// - [`SDL_strtod`] + /// - [`SDL_lltoa`] + pub fn SDL_strtoll( + str: *const ::core::ffi::c_char, + endp: *mut *mut ::core::ffi::c_char, + base: ::core::ffi::c_int, + ) -> ::core::ffi::c_longlong; +} + +unsafe extern "C" { + /// Parse an `unsigned long long` from a string. + /// + /// If `str` starts with whitespace, then those whitespace characters are + /// skipped before attempting to parse the number. + /// + /// If the parsed number does not fit inside an `unsigned long long`, the + /// result is clamped to the maximum representable `unsigned long long` value. + /// + /// ## Parameters + /// - `str`: The null-terminated string to read. Must not be NULL. + /// - `endp`: If not NULL, the address of the first invalid character (i.e. + /// the next character after the parsed number) will be written to + /// this pointer. + /// - `base`: The base of the integer to read. Supported values are 0 and 2 + /// to 36 inclusive. If 0, the base will be inferred from the + /// number's prefix (0x for hexadecimal, 0 for octal, decimal + /// otherwise). + /// + /// ## Return value + /// Returns the parsed `unsigned long long`, or 0 if no number could be + /// parsed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atoi`] + /// - [`SDL_atof`] + /// - [`SDL_strtol`] + /// - [`SDL_strtoll`] + /// - [`SDL_strtoul`] + /// - [`SDL_strtod`] + /// - [`SDL_ulltoa`] + pub fn SDL_strtoull( + str: *const ::core::ffi::c_char, + endp: *mut *mut ::core::ffi::c_char, + base: ::core::ffi::c_int, + ) -> ::core::ffi::c_ulonglong; +} + +unsafe extern "C" { + /// Parse a `double` from a string. + /// + /// This function makes fewer guarantees than the C runtime `strtod`: + /// + /// - Only decimal notation is guaranteed to be supported. The handling of + /// scientific and hexadecimal notation is unspecified. + /// - Whether or not INF and NAN can be parsed is unspecified. + /// - The precision of the result is unspecified. + /// + /// ## Parameters + /// - `str`: the null-terminated string to read. Must not be NULL. + /// - `endp`: if not NULL, the address of the first invalid character (i.e. + /// the next character after the parsed number) will be written to + /// this pointer. + /// + /// ## Return value + /// Returns the parsed `double`, or 0 if no number could be parsed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atoi`] + /// - [`SDL_atof`] + /// - [`SDL_strtol`] + /// - [`SDL_strtoll`] + /// - [`SDL_strtoul`] + /// - [`SDL_strtoull`] + pub fn SDL_strtod( + str: *const ::core::ffi::c_char, + endp: *mut *mut ::core::ffi::c_char, + ) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compare two null-terminated UTF-8 strings. + /// + /// Due to the nature of UTF-8 encoding, this will work with Unicode strings, + /// since effectively this function just compares bytes until it hits a + /// null-terminating character. Also due to the nature of UTF-8, this can be + /// used with [`SDL_qsort()`] to put strings in (roughly) alphabetical order. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strcmp( + str1: *const ::core::ffi::c_char, + str2: *const ::core::ffi::c_char, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Compare two UTF-8 strings up to a number of bytes. + /// + /// Due to the nature of UTF-8 encoding, this will work with Unicode strings, + /// since effectively this function just compares bytes until it hits a + /// null-terminating character. Also due to the nature of UTF-8, this can be + /// used with [`SDL_qsort()`] to put strings in (roughly) alphabetical order. + /// + /// Note that while this function is intended to be used with UTF-8, it is + /// doing a bytewise comparison, and `maxlen` specifies a _byte_ limit! If the + /// limit lands in the middle of a multi-byte UTF-8 sequence, it will only + /// compare a portion of the final character. + /// + /// `maxlen` specifies a maximum number of bytes to compare; if the strings + /// match to this number of bytes (or both have matched to a null-terminator + /// character before this number of bytes), they will be considered equal. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// - `maxlen`: the maximum number of _bytes_ to compare. + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strncmp( + str1: *const ::core::ffi::c_char, + str2: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Compare two null-terminated UTF-8 strings, case-insensitively. + /// + /// This will work with Unicode strings, using a technique called + /// "case-folding" to handle the vast majority of case-sensitive human + /// languages regardless of system locale. It can deal with expanding values: a + /// German Eszett character can compare against two ASCII 's' chars and be + /// considered a match, for example. A notable exception: it does not handle + /// the Turkish 'i' character; human language is complicated! + /// + /// Since this handles Unicode, it expects the string to be well-formed UTF-8 + /// and not a null-terminated string of arbitrary bytes. Bytes that are not + /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), which is to say two strings of random bits may turn out to + /// match if they convert to the same amount of replacement characters. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strcasecmp( + str1: *const ::core::ffi::c_char, + str2: *const ::core::ffi::c_char, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Compare two UTF-8 strings, case-insensitively, up to a number of bytes. + /// + /// This will work with Unicode strings, using a technique called + /// "case-folding" to handle the vast majority of case-sensitive human + /// languages regardless of system locale. It can deal with expanding values: a + /// German Eszett character can compare against two ASCII 's' chars and be + /// considered a match, for example. A notable exception: it does not handle + /// the Turkish 'i' character; human language is complicated! + /// + /// Since this handles Unicode, it expects the string to be well-formed UTF-8 + /// and not a null-terminated string of arbitrary bytes. Bytes that are not + /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT + /// CHARACTER), which is to say two strings of random bits may turn out to + /// match if they convert to the same amount of replacement characters. + /// + /// Note that while this function is intended to be used with UTF-8, `maxlen` + /// specifies a _byte_ limit! If the limit lands in the middle of a multi-byte + /// UTF-8 sequence, it may convert a portion of the final character to one or + /// more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not to overflow + /// a buffer. + /// + /// `maxlen` specifies a maximum number of bytes to compare; if the strings + /// match to this number of bytes (or both have matched to a null-terminator + /// character before this number of bytes), they will be considered equal. + /// + /// ## Parameters + /// - `str1`: the first string to compare. NULL is not permitted! + /// - `str2`: the second string to compare. NULL is not permitted! + /// - `maxlen`: the maximum number of bytes to compare. + /// + /// ## Return value + /// Returns less than zero if str1 is "less than" str2, greater than zero if + /// str1 is "greater than" str2, and zero if the strings match + /// exactly. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strncasecmp( + str1: *const ::core::ffi::c_char, + str2: *const ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Searches a string for the first occurrence of any character contained in a + /// breakset, and returns a pointer from the string to that character. + /// + /// ## Parameters + /// - `str`: The null-terminated string to be searched. Must not be NULL, and + /// must not overlap with `breakset`. + /// - `breakset`: A null-terminated string containing the list of characters + /// to look for. Must not be NULL, and must not overlap with + /// `str`. + /// + /// ## Return value + /// Returns A pointer to the location, in str, of the first occurrence of a + /// character present in the breakset, or NULL if none is found. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_strpbrk( + str: *const ::core::ffi::c_char, + breakset: *const ::core::ffi::c_char, + ) -> *mut ::core::ffi::c_char; +} + +/// The Unicode REPLACEMENT CHARACTER codepoint. +/// +/// [`SDL_StepUTF8()`] and [`SDL_StepBackUTF8()`] report this codepoint when they +/// encounter a UTF-8 string with encoding errors. +/// +/// This tends to render as something like a question mark in most places. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_StepBackUTF8`] +/// - [`SDL_StepUTF8`] +pub const SDL_INVALID_UNICODE_CODEPOINT: ::core::primitive::i32 = 65533; + +unsafe extern "C" { + /// Decode a UTF-8 string, one Unicode codepoint at a time. + /// + /// This will return the first Unicode codepoint in the UTF-8 encoded string in + /// `*pstr`, and then advance `*pstr` past any consumed bytes before returning. + /// + /// It will not access more than `*pslen` bytes from the string. `*pslen` will + /// be adjusted, as well, subtracting the number of bytes consumed. + /// + /// `pslen` is allowed to be NULL, in which case the string _must_ be + /// NULL-terminated, as the function will blindly read until it sees the NULL + /// char. + /// + /// if `*pslen` is zero, it assumes the end of string is reached and returns a + /// zero codepoint regardless of the contents of the string buffer. + /// + /// If the resulting codepoint is zero (a NULL terminator), or `*pslen` is + /// zero, it will not advance `*pstr` or `*pslen` at all. + /// + /// Generally this function is called in a loop until it returns zero, + /// adjusting its parameters each iteration. + /// + /// If an invalid UTF-8 sequence is encountered, this function returns + /// [`SDL_INVALID_UNICODE_CODEPOINT`] and advances the string/length by one byte + /// (which is to say, a multibyte sequence might produce several + /// [`SDL_INVALID_UNICODE_CODEPOINT`] returns before it syncs to the next valid + /// UTF-8 sequence). + /// + /// Several things can generate invalid UTF-8 sequences, including overlong + /// encodings, the use of UTF-16 surrogate values, and truncated data. Please + /// refer to + /// [RFC3629](https://www.ietf.org/rfc/rfc3629.txt) + /// for details. + /// + /// ## Parameters + /// - `pstr`: a pointer to a UTF-8 string pointer to be read and adjusted. + /// - `pslen`: a pointer to the number of bytes in the string, to be read and + /// adjusted. NULL is allowed. + /// + /// ## Return value + /// Returns the first Unicode codepoint in the string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_StepUTF8( + pstr: *mut *const ::core::ffi::c_char, + pslen: *mut ::core::primitive::usize, + ) -> Uint32; +} + +unsafe extern "C" { + /// Decode a UTF-8 string in reverse, one Unicode codepoint at a time. + /// + /// This will go to the start of the previous Unicode codepoint in the string, + /// move `*pstr` to that location and return that codepoint. + /// + /// If `*pstr` is already at the start of the string), it will not advance + /// `*pstr` at all. + /// + /// Generally this function is called in a loop until it returns zero, + /// adjusting its parameter each iteration. + /// + /// If an invalid UTF-8 sequence is encountered, this function returns + /// [`SDL_INVALID_UNICODE_CODEPOINT`]. + /// + /// Several things can generate invalid UTF-8 sequences, including overlong + /// encodings, the use of UTF-16 surrogate values, and truncated data. Please + /// refer to + /// [RFC3629](https://www.ietf.org/rfc/rfc3629.txt) + /// for details. + /// + /// ## Parameters + /// - `start`: a pointer to the beginning of the UTF-8 string. + /// - `pstr`: a pointer to a UTF-8 string pointer to be read and adjusted. + /// + /// ## Return value + /// Returns the previous Unicode codepoint in the string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_StepBackUTF8( + start: *const ::core::ffi::c_char, + pstr: *mut *const ::core::ffi::c_char, + ) -> Uint32; +} + +unsafe extern "C" { + /// Convert a single Unicode codepoint to UTF-8. + /// + /// The buffer pointed to by `dst` must be at least 4 bytes long, as this + /// function may generate between 1 and 4 bytes of output. + /// + /// This function returns the first byte _after_ the newly-written UTF-8 + /// sequence, which is useful for encoding multiple codepoints in a loop, or + /// knowing where to write a NULL-terminator character to end the string (in + /// either case, plan to have a buffer of _more_ than 4 bytes!). + /// + /// If `codepoint` is an invalid value (outside the Unicode range, or a UTF-16 + /// surrogate value, etc), this will use U+FFFD (REPLACEMENT CHARACTER) for the + /// codepoint instead, and not set an error. + /// + /// If `dst` is NULL, this returns NULL immediately without writing to the + /// pointer and without setting an error. + /// + /// ## Parameters + /// - `codepoint`: a Unicode codepoint to convert to UTF-8. + /// - `dst`: the location to write the encoded UTF-8. Must point to at least + /// 4 bytes! + /// + /// ## Return value + /// Returns the first byte past the newly-written UTF-8 sequence. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UCS4ToUTF8( + codepoint: Uint32, + dst: *mut ::core::ffi::c_char, + ) -> *mut ::core::ffi::c_char; +} + +unsafe extern "C" { + /// This works exactly like sscanf() but doesn't require access to a C runtime. + /// + /// Scan a string, matching a format string, converting each '%' item and + /// storing it to pointers provided through variable arguments. + /// + /// ## Parameters + /// - `text`: the string to scan. Must not be NULL. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `...`: a list of pointers to values to be filled in with scanned items. + /// + /// ## Return value + /// Returns the number of items that matched the format string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_sscanf( + text: *const ::core::ffi::c_char, + fmt: *const ::core::ffi::c_char, + ... + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like vsscanf() but doesn't require access to a C + /// runtime. + /// + /// Functions identically to [`SDL_sscanf()`], except it takes a `va_list` instead + /// of using `...` variable arguments. + /// + /// ## Parameters + /// - `text`: the string to scan. Must not be NULL. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `ap`: a `va_list` of pointers to values to be filled in with scanned + /// items. + /// + /// ## Return value + /// Returns the number of items that matched the format string. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_vsscanf( + text: *const ::core::ffi::c_char, + fmt: *const ::core::ffi::c_char, + ap: crate::ffi::VaList, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like snprintf() but doesn't require access to a C + /// runtime. + /// + /// Format a string of up to `maxlen`-1 bytes, converting each '%' item with + /// values provided through variable arguments. + /// + /// While some C runtimes differ on how to deal with too-large strings, this + /// function null-terminates the output, by treating the null-terminator as + /// part of the `maxlen` count. Note that if `maxlen` is zero, however, no + /// bytes will be written at all. + /// + /// This function returns the number of _bytes_ (not _characters_) that should + /// be written, excluding the null-terminator character. If this returns a + /// number >= `maxlen`, it means the output string was truncated. A negative + /// return value means an error occurred. + /// + /// Referencing the output string's pointer with a format item is undefined + /// behavior. + /// + /// ## Parameters + /// - `text`: the buffer to write the string into. Must not be NULL. + /// - `maxlen`: the maximum bytes to write, including the null-terminator. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `...`: a list of values to be used with the format string. + /// + /// ## Return value + /// Returns the number of bytes that should be written, not counting the + /// null-terminator char, or a negative value on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_snprintf( + text: *mut ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + fmt: *const ::core::ffi::c_char, + ... + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like swprintf() but doesn't require access to a C + /// runtime. + /// + /// Format a wide string of up to `maxlen`-1 wchar_t values, converting each + /// '%' item with values provided through variable arguments. + /// + /// While some C runtimes differ on how to deal with too-large strings, this + /// function null-terminates the output, by treating the null-terminator as + /// part of the `maxlen` count. Note that if `maxlen` is zero, however, no wide + /// characters will be written at all. + /// + /// This function returns the number of _wide characters_ (not _codepoints_) + /// that should be written, excluding the null-terminator character. If this + /// returns a number >= `maxlen`, it means the output string was truncated. A + /// negative return value means an error occurred. + /// + /// Referencing the output string's pointer with a format item is undefined + /// behavior. + /// + /// ## Parameters + /// - `text`: the buffer to write the wide string into. Must not be NULL. + /// - `maxlen`: the maximum wchar_t values to write, including the + /// null-terminator. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `...`: a list of values to be used with the format string. + /// + /// ## Return value + /// Returns the number of wide characters that should be written, not counting + /// the null-terminator char, or a negative value on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_swprintf( + text: *mut crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + fmt: *const crate::ffi::c_wchar_t, + ... + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like vsnprintf() but doesn't require access to a C + /// runtime. + /// + /// Functions identically to [`SDL_snprintf()`], except it takes a `va_list` + /// instead of using `...` variable arguments. + /// + /// ## Parameters + /// - `text`: the buffer to write the string into. Must not be NULL. + /// - `maxlen`: the maximum bytes to write, including the null-terminator. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `ap`: a `va_list` values to be used with the format string. + /// + /// ## Return value + /// Returns the number of bytes that should be written, not counting the + /// null-terminator char, or a negative value on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_vsnprintf( + text: *mut ::core::ffi::c_char, + maxlen: ::core::primitive::usize, + fmt: *const ::core::ffi::c_char, + ap: crate::ffi::VaList, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like vswprintf() but doesn't require access to a C + /// runtime. + /// + /// Functions identically to [`SDL_swprintf()`], except it takes a `va_list` + /// instead of using `...` variable arguments. + /// + /// ## Parameters + /// - `text`: the buffer to write the string into. Must not be NULL. + /// - `maxlen`: the maximum wide characters to write, including the + /// null-terminator. + /// - `fmt`: a printf-style format wide string. Must not be NULL. + /// - `ap`: a `va_list` values to be used with the format string. + /// + /// ## Return value + /// Returns the number of wide characters that should be written, not counting + /// the null-terminator char, or a negative value on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_vswprintf( + text: *mut crate::ffi::c_wchar_t, + maxlen: ::core::primitive::usize, + fmt: *const crate::ffi::c_wchar_t, + ap: crate::ffi::VaList, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like asprintf() but doesn't require access to a C + /// runtime. + /// + /// Functions identically to [`SDL_snprintf()`], except it allocates a buffer large + /// enough to hold the output string on behalf of the caller. + /// + /// On success, this function returns the number of bytes (not characters) + /// comprising the output string, not counting the null-terminator character, + /// and sets `*strp` to the newly-allocated string. + /// + /// On error, this function returns a negative number, and the value of `*strp` + /// is undefined. + /// + /// The returned string is owned by the caller, and should be passed to + /// [`SDL_free`] when no longer needed. + /// + /// ## Parameters + /// - `strp`: on output, is set to the new string. Must not be NULL. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `...`: a list of values to be used with the format string. + /// + /// ## Return value + /// Returns the number of bytes in the newly-allocated string, not counting + /// the null-terminator char, or a negative value on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_asprintf( + strp: *mut *mut ::core::ffi::c_char, + fmt: *const ::core::ffi::c_char, + ... + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This works exactly like vasprintf() but doesn't require access to a C + /// runtime. + /// + /// Functions identically to [`SDL_asprintf()`], except it takes a `va_list` + /// instead of using `...` variable arguments. + /// + /// ## Parameters + /// - `strp`: on output, is set to the new string. Must not be NULL. + /// - `fmt`: a printf-style format string. Must not be NULL. + /// - `ap`: a `va_list` values to be used with the format string. + /// + /// ## Return value + /// Returns the number of bytes in the newly-allocated string, not counting + /// the null-terminator char, or a negative value on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_vasprintf( + strp: *mut *mut ::core::ffi::c_char, + fmt: *const ::core::ffi::c_char, + ap: crate::ffi::VaList, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Seeds the pseudo-random number generator. + /// + /// Reusing the seed number will cause [`SDL_rand()`] to repeat the same stream of + /// 'random' numbers. + /// + /// ## Parameters + /// - `seed`: the value to use as a random number seed, or 0 to use + /// [`SDL_GetPerformanceCounter()`]. + /// + /// ## Thread safety + /// This should be called on the same thread that calls + /// [`SDL_rand()`] + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_rand`] + /// - [`SDL_rand_bits`] + /// - [`SDL_randf`] + pub fn SDL_srand(seed: Uint64); +} + +unsafe extern "C" { + /// Generate a pseudo-random number less than n for positive n + /// + /// The method used is faster and of better quality than `rand() % n`. Odds are + /// roughly 99.9% even for n = 1 million. Evenness is better for smaller n, and + /// much worse as n gets bigger. + /// + /// Example: to simulate a d6 use `SDL_rand(6) + 1` The +1 converts 0..5 to + /// 1..6 + /// + /// If you want to generate a pseudo-random number in the full range of Sint32, + /// you should use: (Sint32)SDL_rand_bits() + /// + /// If you want reproducible output, be sure to initialize with [`SDL_srand()`] + /// first. + /// + /// There are no guarantees as to the quality of the random sequence produced, + /// and this should not be used for security (cryptography, passwords) or where + /// money is on the line (loot-boxes, casinos). There are many random number + /// libraries available with different characteristics and you should pick one + /// of those to meet any serious needs. + /// + /// ## Parameters + /// - `n`: the number of possible outcomes. n must be positive. + /// + /// ## Return value + /// Returns a random value in the range of \[0 .. n-1\]. + /// + /// ## Thread safety + /// All calls should be made from a single thread + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_srand`] + /// - [`SDL_randf`] + pub fn SDL_rand(n: Sint32) -> Sint32; +} + +unsafe extern "C" { + /// Generate a uniform pseudo-random floating point number less than 1.0 + /// + /// If you want reproducible output, be sure to initialize with [`SDL_srand()`] + /// first. + /// + /// There are no guarantees as to the quality of the random sequence produced, + /// and this should not be used for security (cryptography, passwords) or where + /// money is on the line (loot-boxes, casinos). There are many random number + /// libraries available with different characteristics and you should pick one + /// of those to meet any serious needs. + /// + /// ## Return value + /// Returns a random value in the range of [0.0, 1.0). + /// + /// ## Thread safety + /// All calls should be made from a single thread + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_srand`] + /// - [`SDL_rand`] + pub fn SDL_randf() -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Generate 32 pseudo-random bits. + /// + /// You likely want to use [`SDL_rand()`] to get a psuedo-random number instead. + /// + /// There are no guarantees as to the quality of the random sequence produced, + /// and this should not be used for security (cryptography, passwords) or where + /// money is on the line (loot-boxes, casinos). There are many random number + /// libraries available with different characteristics and you should pick one + /// of those to meet any serious needs. + /// + /// ## Return value + /// Returns a random value in the range of \[0-SDL_MAX_UINT32\]. + /// + /// ## Thread safety + /// All calls should be made from a single thread + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_rand`] + /// - [`SDL_randf`] + /// - [`SDL_srand`] + pub fn SDL_rand_bits() -> Uint32; +} + +unsafe extern "C" { + /// Generate a pseudo-random number less than n for positive n + /// + /// The method used is faster and of better quality than `rand() % n`. Odds are + /// roughly 99.9% even for n = 1 million. Evenness is better for smaller n, and + /// much worse as n gets bigger. + /// + /// Example: to simulate a d6 use `SDL_rand_r(state, 6) + 1` The +1 converts + /// 0..5 to 1..6 + /// + /// If you want to generate a pseudo-random number in the full range of Sint32, + /// you should use: (Sint32)SDL_rand_bits_r(state) + /// + /// There are no guarantees as to the quality of the random sequence produced, + /// and this should not be used for security (cryptography, passwords) or where + /// money is on the line (loot-boxes, casinos). There are many random number + /// libraries available with different characteristics and you should pick one + /// of those to meet any serious needs. + /// + /// ## Parameters + /// - `state`: a pointer to the current random number state, this may not be + /// NULL. + /// - `n`: the number of possible outcomes. n must be positive. + /// + /// ## Return value + /// Returns a random value in the range of \[0 .. n-1\]. + /// + /// ## Thread safety + /// This function is thread-safe, as long as the state pointer + /// isn't shared between threads. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_rand`] + /// - [`SDL_rand_bits_r`] + /// - [`SDL_randf_r`] + pub fn SDL_rand_r(state: *mut Uint64, n: Sint32) -> Sint32; +} + +unsafe extern "C" { + /// Generate a uniform pseudo-random floating point number less than 1.0 + /// + /// If you want reproducible output, be sure to initialize with [`SDL_srand()`] + /// first. + /// + /// There are no guarantees as to the quality of the random sequence produced, + /// and this should not be used for security (cryptography, passwords) or where + /// money is on the line (loot-boxes, casinos). There are many random number + /// libraries available with different characteristics and you should pick one + /// of those to meet any serious needs. + /// + /// ## Parameters + /// - `state`: a pointer to the current random number state, this may not be + /// NULL. + /// + /// ## Return value + /// Returns a random value in the range of [0.0, 1.0). + /// + /// ## Thread safety + /// This function is thread-safe, as long as the state pointer + /// isn't shared between threads. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_rand_bits_r`] + /// - [`SDL_rand_r`] + /// - [`SDL_randf`] + pub fn SDL_randf_r(state: *mut Uint64) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Generate 32 pseudo-random bits. + /// + /// You likely want to use [`SDL_rand_r()`] to get a psuedo-random number instead. + /// + /// There are no guarantees as to the quality of the random sequence produced, + /// and this should not be used for security (cryptography, passwords) or where + /// money is on the line (loot-boxes, casinos). There are many random number + /// libraries available with different characteristics and you should pick one + /// of those to meet any serious needs. + /// + /// ## Parameters + /// - `state`: a pointer to the current random number state, this may not be + /// NULL. + /// + /// ## Return value + /// Returns a random value in the range of \[0-SDL_MAX_UINT32\]. + /// + /// ## Thread safety + /// This function is thread-safe, as long as the state pointer + /// isn't shared between threads. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_rand_r`] + /// - [`SDL_randf_r`] + pub fn SDL_rand_bits_r(state: *mut Uint64) -> Uint32; +} + +/// The value of Pi, as a double-precision floating point literal. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_PI_F`] +pub const SDL_PI_D: ::core::ffi::c_double = 3.141592653589793_f64; + +/// The value of Pi, as a single-precision floating point literal. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_PI_D`] +pub const SDL_PI_F: ::core::ffi::c_float = 3.1415927_f32; + +unsafe extern "C" { + /// Compute the arc cosine of `x`. + /// + /// The definition of `y = acos(x)` is `x = cos(y)`. + /// + /// Domain: `-1 <= x <= 1` + /// + /// Range: `0 <= y <= Pi` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_acosf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns arc cosine of `x`, in radians. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_acosf`] + /// - [`SDL_asin`] + /// - [`SDL_cos`] + pub safe fn SDL_acos(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the arc cosine of `x`. + /// + /// The definition of `y = acos(x)` is `x = cos(y)`. + /// + /// Domain: `-1 <= x <= 1` + /// + /// Range: `0 <= y <= Pi` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_acos`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns arc cosine of `x`, in radians. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_acos`] + /// - [`SDL_asinf`] + /// - [`SDL_cosf`] + pub safe fn SDL_acosf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the arc sine of `x`. + /// + /// The definition of `y = asin(x)` is `x = sin(y)`. + /// + /// Domain: `-1 <= x <= 1` + /// + /// Range: `-Pi/2 <= y <= Pi/2` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_asinf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns arc sine of `x`, in radians. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_asinf`] + /// - [`SDL_acos`] + /// - [`SDL_sin`] + pub safe fn SDL_asin(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the arc sine of `x`. + /// + /// The definition of `y = asin(x)` is `x = sin(y)`. + /// + /// Domain: `-1 <= x <= 1` + /// + /// Range: `-Pi/2 <= y <= Pi/2` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_asin`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns arc sine of `x`, in radians. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_asin`] + /// - [`SDL_acosf`] + /// - [`SDL_sinf`] + pub safe fn SDL_asinf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the arc tangent of `x`. + /// + /// The definition of `y = atan(x)` is `x = tan(y)`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-Pi/2 <= y <= Pi/2` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_atanf`] for single-precision floats. + /// + /// To calculate the arc tangent of y / x, use [`SDL_atan2`]. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns arc tangent of of `x` in radians, or 0 if `x = 0`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atanf`] + /// - [`SDL_atan2`] + /// - [`SDL_tan`] + pub safe fn SDL_atan(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the arc tangent of `x`. + /// + /// The definition of `y = atan(x)` is `x = tan(y)`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-Pi/2 <= y <= Pi/2` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_atan`] for dboule-precision floats. + /// + /// To calculate the arc tangent of y / x, use [`SDL_atan2f`]. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns arc tangent of of `x` in radians, or 0 if `x = 0`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atan`] + /// - [`SDL_atan2f`] + /// - [`SDL_tanf`] + pub safe fn SDL_atanf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the arc tangent of `y / x`, using the signs of x and y to adjust + /// the result's quadrant. + /// + /// The definition of `z = atan2(x, y)` is `y = x tan(z)`, where the quadrant + /// of z is determined based on the signs of x and y. + /// + /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF` + /// + /// Range: `-Pi <= y <= Pi` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_atan2f`] for single-precision floats. + /// + /// To calculate the arc tangent of a single value, use [`SDL_atan`]. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `y`: floating point value of the numerator (y coordinate). + /// - `x`: floating point value of the denominator (x coordinate). + /// + /// ## Return value + /// Returns arc tangent of of `y / x` in radians, or, if `x = 0`, either + /// `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atan2f`] + /// - [`SDL_atan`] + /// - [`SDL_tan`] + pub safe fn SDL_atan2( + y: ::core::ffi::c_double, + x: ::core::ffi::c_double, + ) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the arc tangent of `y / x`, using the signs of x and y to adjust + /// the result's quadrant. + /// + /// The definition of `z = atan2(x, y)` is `y = x tan(z)`, where the quadrant + /// of z is determined based on the signs of x and y. + /// + /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF` + /// + /// Range: `-Pi <= y <= Pi` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_atan2`] for double-precision floats. + /// + /// To calculate the arc tangent of a single value, use [`SDL_atanf`]. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `y`: floating point value of the numerator (y coordinate). + /// - `x`: floating point value of the denominator (x coordinate). + /// + /// ## Return value + /// Returns arc tangent of of `y / x` in radians, or, if `x = 0`, either + /// `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_atan2`] + /// - [`SDL_atan`] + /// - [`SDL_tan`] + pub safe fn SDL_atan2f( + y: ::core::ffi::c_float, + x: ::core::ffi::c_float, + ) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the ceiling of `x`. + /// + /// The ceiling of `x` is the smallest integer `y` such that `y >= x`, i.e `x` + /// rounded up to the nearest integer. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_ceilf`] for single-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the ceiling of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ceilf`] + /// - [`SDL_floor`] + /// - [`SDL_trunc`] + /// - [`SDL_round`] + /// - [`SDL_lround`] + pub safe fn SDL_ceil(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the ceiling of `x`. + /// + /// The ceiling of `x` is the smallest integer `y` such that `y >= x`, i.e `x` + /// rounded up to the nearest integer. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_ceil`] for double-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the ceiling of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ceil`] + /// - [`SDL_floorf`] + /// - [`SDL_truncf`] + /// - [`SDL_roundf`] + /// - [`SDL_lroundf`] + pub safe fn SDL_ceilf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +/// Copy the sign of one floating-point value to another. +/// +/// The definition of copysign is that ``copysign(x, y) = abs(x) * sign(y)``. +/// +/// Domain: `-INF <= x <= INF`, ``-INF <= y <= f`` +/// +/// Range: `-INF <= z <= INF` +/// +/// This function operates on double-precision floating point values, use +/// [`SDL_copysignf`] for single-precision floats. +/// +/// ## Parameters +/// - `x`: floating point value to use as the magnitude. +/// - `y`: floating point value to use as the sign. +/// +/// ## Return value +/// Returns the floating point value with the sign of y and the magnitude of +/// x. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_copysignf`] +/// - [`SDL_fabs`] +#[inline(always)] +pub const fn SDL_copysign( + x: ::core::ffi::c_double, + y: ::core::ffi::c_double, +) -> ::core::ffi::c_double { + return x.copysign(y); +} + +/// Copy the sign of one floating-point value to another. +/// +/// The definition of copysign is that ``copysign(x, y) = abs(x) * sign(y)``. +/// +/// Domain: `-INF <= x <= INF`, ``-INF <= y <= f`` +/// +/// Range: `-INF <= z <= INF` +/// +/// This function operates on single-precision floating point values, use +/// [`SDL_copysign`] for double-precision floats. +/// +/// ## Parameters +/// - `x`: floating point value to use as the magnitude. +/// - `y`: floating point value to use as the sign. +/// +/// ## Return value +/// Returns the floating point value with the sign of y and the magnitude of +/// x. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_copysign`] +/// - [`SDL_fabsf`] +#[inline(always)] +pub const fn SDL_copysignf( + x: ::core::ffi::c_float, + y: ::core::ffi::c_float, +) -> ::core::ffi::c_float { + return x.copysign(y); +} + +unsafe extern "C" { + /// Compute the cosine of `x`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-1 <= y <= 1` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_cosf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value, in radians. + /// + /// ## Return value + /// Returns cosine of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_cosf`] + /// - [`SDL_acos`] + /// - [`SDL_sin`] + pub safe fn SDL_cos(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the cosine of `x`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-1 <= y <= 1` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_cos`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value, in radians. + /// + /// ## Return value + /// Returns cosine of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_cos`] + /// - [`SDL_acosf`] + /// - [`SDL_sinf`] + pub safe fn SDL_cosf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the exponential of `x`. + /// + /// The definition of `y = exp(x)` is `y = e^x`, where `e` is the base of the + /// natural logarithm. The inverse is the natural logarithm, [`SDL_log`]. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `0 <= y <= INF` + /// + /// The output will overflow if `exp(x)` is too large to be represented. + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_expf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns value of `e^x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_expf`] + /// - [`SDL_log`] + pub safe fn SDL_exp(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the exponential of `x`. + /// + /// The definition of `y = exp(x)` is `y = e^x`, where `e` is the base of the + /// natural logarithm. The inverse is the natural logarithm, [`SDL_logf`]. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `0 <= y <= INF` + /// + /// The output will overflow if `exp(x)` is too large to be represented. + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_exp`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns value of `e^x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_exp`] + /// - [`SDL_logf`] + pub safe fn SDL_expf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +/// Compute the absolute value of `x` +/// +/// Domain: `-INF <= x <= INF` +/// +/// Range: `0 <= y <= INF` +/// +/// This function operates on double-precision floating point values, use +/// [`SDL_fabsf`] for single-precision floats. +/// +/// ## Parameters +/// - `x`: floating point value to use as the magnitude. +/// +/// ## Return value +/// Returns the absolute value of `x`. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_fabsf`] +#[inline(always)] +pub const fn SDL_fabs(x: ::core::ffi::c_double) -> ::core::ffi::c_double { + return x.abs(); +} + +/// Compute the absolute value of `x` +/// +/// Domain: `-INF <= x <= INF` +/// +/// Range: `0 <= y <= INF` +/// +/// This function operates on single-precision floating point values, use +/// [`SDL_fabs`] for double-precision floats. +/// +/// ## Parameters +/// - `x`: floating point value to use as the magnitude. +/// +/// ## Return value +/// Returns the absolute value of `x`. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_fabs`] +#[inline(always)] +pub const fn SDL_fabsf(x: ::core::ffi::c_float) -> ::core::ffi::c_float { + return x.abs(); +} + +unsafe extern "C" { + /// Compute the floor of `x`. + /// + /// The floor of `x` is the largest integer `y` such that `y <= x`, i.e `x` + /// rounded down to the nearest integer. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_floorf`] for single-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the floor of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_floorf`] + /// - [`SDL_ceil`] + /// - [`SDL_trunc`] + /// - [`SDL_round`] + /// - [`SDL_lround`] + pub safe fn SDL_floor(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the floor of `x`. + /// + /// The floor of `x` is the largest integer `y` such that `y <= x`, i.e `x` + /// rounded down to the nearest integer. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_floor`] for double-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the floor of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_floor`] + /// - [`SDL_ceilf`] + /// - [`SDL_truncf`] + /// - [`SDL_roundf`] + /// - [`SDL_lroundf`] + pub safe fn SDL_floorf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Truncate `x` to an integer. + /// + /// Rounds `x` to the next closest integer to 0. This is equivalent to removing + /// the fractional part of `x`, leaving only the integer part. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_truncf`] for single-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns `x` truncated to an integer. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_truncf`] + /// - [`SDL_fmod`] + /// - [`SDL_ceil`] + /// - [`SDL_floor`] + /// - [`SDL_round`] + /// - [`SDL_lround`] + pub safe fn SDL_trunc(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Truncate `x` to an integer. + /// + /// Rounds `x` to the next closest integer to 0. This is equivalent to removing + /// the fractional part of `x`, leaving only the integer part. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_trunc`] for double-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns `x` truncated to an integer. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_trunc`] + /// - [`SDL_fmodf`] + /// - [`SDL_ceilf`] + /// - [`SDL_floorf`] + /// - [`SDL_roundf`] + /// - [`SDL_lroundf`] + pub safe fn SDL_truncf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Return the floating-point remainder of `x / y` + /// + /// Divides `x` by `y`, and returns the remainder. + /// + /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`, `y != 0` + /// + /// Range: `-y <= z <= y` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_fmodf`] for single-precision floats. + /// + /// ## Parameters + /// - `x`: the numerator. + /// - `y`: the denominator. Must not be 0. + /// + /// ## Return value + /// Returns the remainder of `x / y`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_fmodf`] + /// - [`SDL_modf`] + /// - [`SDL_trunc`] + /// - [`SDL_ceil`] + /// - [`SDL_floor`] + /// - [`SDL_round`] + /// - [`SDL_lround`] + pub safe fn SDL_fmod( + x: ::core::ffi::c_double, + y: ::core::ffi::c_double, + ) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Return the floating-point remainder of `x / y` + /// + /// Divides `x` by `y`, and returns the remainder. + /// + /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`, `y != 0` + /// + /// Range: `-y <= z <= y` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_fmod`] for double-precision floats. + /// + /// ## Parameters + /// - `x`: the numerator. + /// - `y`: the denominator. Must not be 0. + /// + /// ## Return value + /// Returns the remainder of `x / y`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_fmod`] + /// - [`SDL_truncf`] + /// - [`SDL_modff`] + /// - [`SDL_ceilf`] + /// - [`SDL_floorf`] + /// - [`SDL_roundf`] + /// - [`SDL_lroundf`] + pub safe fn SDL_fmodf(x: ::core::ffi::c_float, y: ::core::ffi::c_float) + -> ::core::ffi::c_float; +} + +/// Return whether the value is infinity. +/// +/// ## Parameters +/// - `x`: double-precision floating point value. +/// +/// ## Return value +/// Returns non-zero if the value is infinity, 0 otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_isinff`] +#[inline(always)] +pub const fn SDL_isinf(x: ::core::ffi::c_double) -> ::core::ffi::c_int { + return x.is_infinite() as _; +} + +/// Return whether the value is infinity. +/// +/// ## Parameters +/// - `x`: floating point value. +/// +/// ## Return value +/// Returns non-zero if the value is infinity, 0 otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_isinf`] +#[inline(always)] +pub const fn SDL_isinff(x: ::core::ffi::c_float) -> ::core::ffi::c_int { + return x.is_infinite() as _; +} + +/// Return whether the value is NaN. +/// +/// ## Parameters +/// - `x`: double-precision floating point value. +/// +/// ## Return value +/// Returns non-zero if the value is NaN, 0 otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_isnanf`] +#[inline(always)] +pub const fn SDL_isnan(x: ::core::ffi::c_double) -> ::core::ffi::c_int { + return x.is_nan() as _; +} + +/// Return whether the value is NaN. +/// +/// ## Parameters +/// - `x`: floating point value. +/// +/// ## Return value +/// Returns non-zero if the value is NaN, 0 otherwise. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_isnan`] +#[inline(always)] +pub const fn SDL_isnanf(x: ::core::ffi::c_float) -> ::core::ffi::c_int { + return x.is_nan() as _; +} + +unsafe extern "C" { + /// Compute the natural logarithm of `x`. + /// + /// Domain: `0 < x <= INF` + /// + /// Range: `-INF <= y <= INF` + /// + /// It is an error for `x` to be less than or equal to 0. + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_logf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. Must be greater than 0. + /// + /// ## Return value + /// Returns the natural logarithm of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_logf`] + /// - [`SDL_log10`] + /// - [`SDL_exp`] + pub safe fn SDL_log(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the natural logarithm of `x`. + /// + /// Domain: `0 < x <= INF` + /// + /// Range: `-INF <= y <= INF` + /// + /// It is an error for `x` to be less than or equal to 0. + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_log`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. Must be greater than 0. + /// + /// ## Return value + /// Returns the natural logarithm of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_log`] + /// - [`SDL_expf`] + pub safe fn SDL_logf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the base-10 logarithm of `x`. + /// + /// Domain: `0 < x <= INF` + /// + /// Range: `-INF <= y <= INF` + /// + /// It is an error for `x` to be less than or equal to 0. + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_log10f`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. Must be greater than 0. + /// + /// ## Return value + /// Returns the logarithm of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_log10f`] + /// - [`SDL_log`] + /// - [`SDL_pow`] + pub safe fn SDL_log10(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the base-10 logarithm of `x`. + /// + /// Domain: `0 < x <= INF` + /// + /// Range: `-INF <= y <= INF` + /// + /// It is an error for `x` to be less than or equal to 0. + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_log10`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. Must be greater than 0. + /// + /// ## Return value + /// Returns the logarithm of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_log10`] + /// - [`SDL_logf`] + /// - [`SDL_powf`] + pub safe fn SDL_log10f(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Split `x` into integer and fractional parts + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_modff`] for single-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// - `y`: output pointer to store the integer part of `x`. + /// + /// ## Return value + /// Returns the fractional part of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_modff`] + /// - [`SDL_trunc`] + /// - [`SDL_fmod`] + pub fn SDL_modf( + x: ::core::ffi::c_double, + y: *mut ::core::ffi::c_double, + ) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Split `x` into integer and fractional parts + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_modf`] for double-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value. + /// - `y`: output pointer to store the integer part of `x`. + /// + /// ## Return value + /// Returns the fractional part of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_modf`] + /// - [`SDL_truncf`] + /// - [`SDL_fmodf`] + pub fn SDL_modff(x: ::core::ffi::c_float, y: *mut ::core::ffi::c_float) + -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Raise `x` to the power `y` + /// + /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF` + /// + /// Range: `-INF <= z <= INF` + /// + /// If `y` is the base of the natural logarithm (e), consider using [`SDL_exp`] + /// instead. + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_powf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: the base. + /// - `y`: the exponent. + /// + /// ## Return value + /// Returns `x` raised to the power `y`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_powf`] + /// - [`SDL_exp`] + /// - [`SDL_log`] + pub safe fn SDL_pow( + x: ::core::ffi::c_double, + y: ::core::ffi::c_double, + ) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Raise `x` to the power `y` + /// + /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF` + /// + /// Range: `-INF <= z <= INF` + /// + /// If `y` is the base of the natural logarithm (e), consider using [`SDL_exp`] + /// instead. + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_pow`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: the base. + /// - `y`: the exponent. + /// + /// ## Return value + /// Returns `x` raised to the power `y`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_pow`] + /// - [`SDL_expf`] + /// - [`SDL_logf`] + pub safe fn SDL_powf(x: ::core::ffi::c_float, y: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Round `x` to the nearest integer. + /// + /// Rounds `x` to the nearest integer. Values halfway between integers will be + /// rounded away from zero. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_roundf`] for single-precision floats. To get the result as an integer + /// type, use [`SDL_lround`]. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the nearest integer to `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_roundf`] + /// - [`SDL_lround`] + /// - [`SDL_floor`] + /// - [`SDL_ceil`] + /// - [`SDL_trunc`] + pub safe fn SDL_round(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Round `x` to the nearest integer. + /// + /// Rounds `x` to the nearest integer. Values halfway between integers will be + /// rounded away from zero. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF`, y integer + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_round`] for double-precision floats. To get the result as an integer + /// type, use [`SDL_lroundf`]. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the nearest integer to `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_round`] + /// - [`SDL_lroundf`] + /// - [`SDL_floorf`] + /// - [`SDL_ceilf`] + /// - [`SDL_truncf`] + pub safe fn SDL_roundf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Round `x` to the nearest integer representable as a long + /// + /// Rounds `x` to the nearest integer. Values halfway between integers will be + /// rounded away from zero. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `MIN_LONG <= y <= MAX_LONG` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_lroundf`] for single-precision floats. To get the result as a + /// floating-point type, use [`SDL_round`]. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the nearest integer to `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_lroundf`] + /// - [`SDL_round`] + /// - [`SDL_floor`] + /// - [`SDL_ceil`] + /// - [`SDL_trunc`] + pub safe fn SDL_lround(x: ::core::ffi::c_double) -> ::core::ffi::c_long; +} + +unsafe extern "C" { + /// Round `x` to the nearest integer representable as a long + /// + /// Rounds `x` to the nearest integer. Values halfway between integers will be + /// rounded away from zero. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `MIN_LONG <= y <= MAX_LONG` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_lround`] for double-precision floats. To get the result as a + /// floating-point type, use [`SDL_roundf`]. + /// + /// ## Parameters + /// - `x`: floating point value. + /// + /// ## Return value + /// Returns the nearest integer to `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_lround`] + /// - [`SDL_roundf`] + /// - [`SDL_floorf`] + /// - [`SDL_ceilf`] + /// - [`SDL_truncf`] + pub safe fn SDL_lroundf(x: ::core::ffi::c_float) -> ::core::ffi::c_long; +} + +unsafe extern "C" { + /// Scale `x` by an integer power of two. + /// + /// Multiplies `x` by the `n`th power of the floating point radix (always 2). + /// + /// Domain: `-INF <= x <= INF`, `n` integer + /// + /// Range: `-INF <= y <= INF` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_scalbnf`] for single-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value to be scaled. + /// - `n`: integer exponent. + /// + /// ## Return value + /// Returns `x * 2^n`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_scalbnf`] + /// - [`SDL_pow`] + pub safe fn SDL_scalbn( + x: ::core::ffi::c_double, + n: ::core::ffi::c_int, + ) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Scale `x` by an integer power of two. + /// + /// Multiplies `x` by the `n`th power of the floating point radix (always 2). + /// + /// Domain: `-INF <= x <= INF`, `n` integer + /// + /// Range: `-INF <= y <= INF` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_scalbn`] for double-precision floats. + /// + /// ## Parameters + /// - `x`: floating point value to be scaled. + /// - `n`: integer exponent. + /// + /// ## Return value + /// Returns `x * 2^n`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_scalbn`] + /// - [`SDL_powf`] + pub safe fn SDL_scalbnf(x: ::core::ffi::c_float, n: ::core::ffi::c_int) + -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the sine of `x`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-1 <= y <= 1` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_sinf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value, in radians. + /// + /// ## Return value + /// Returns sine of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_sinf`] + /// - [`SDL_asin`] + /// - [`SDL_cos`] + pub safe fn SDL_sin(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the sine of `x`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-1 <= y <= 1` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_sin`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value, in radians. + /// + /// ## Return value + /// Returns sine of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_sin`] + /// - [`SDL_asinf`] + /// - [`SDL_cosf`] + pub safe fn SDL_sinf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the square root of `x`. + /// + /// Domain: `0 <= x <= INF` + /// + /// Range: `0 <= y <= INF` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_sqrtf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. Must be greater than or equal to 0. + /// + /// ## Return value + /// Returns square root of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_sqrtf`] + pub safe fn SDL_sqrt(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the square root of `x`. + /// + /// Domain: `0 <= x <= INF` + /// + /// Range: `0 <= y <= INF` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_sqrt`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value. Must be greater than or equal to 0. + /// + /// ## Return value + /// Returns square root of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_sqrt`] + pub safe fn SDL_sqrtf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Compute the tangent of `x`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF` + /// + /// This function operates on double-precision floating point values, use + /// [`SDL_tanf`] for single-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value, in radians. + /// + /// ## Return value + /// Returns tangent of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_tanf`] + /// - [`SDL_sin`] + /// - [`SDL_cos`] + /// - [`SDL_atan`] + /// - [`SDL_atan2`] + pub safe fn SDL_tan(x: ::core::ffi::c_double) -> ::core::ffi::c_double; +} + +unsafe extern "C" { + /// Compute the tangent of `x`. + /// + /// Domain: `-INF <= x <= INF` + /// + /// Range: `-INF <= y <= INF` + /// + /// This function operates on single-precision floating point values, use + /// [`SDL_tan`] for double-precision floats. + /// + /// This function may use a different approximation across different versions, + /// platforms and configurations. i.e, it can return a different value given + /// the same input on different machines or operating systems, or if SDL is + /// updated. + /// + /// ## Parameters + /// - `x`: floating point value, in radians. + /// + /// ## Return value + /// Returns tangent of `x`. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_tan`] + /// - [`SDL_sinf`] + /// - [`SDL_cosf`] + /// - [`SDL_atanf`] + /// - [`SDL_atan2f`] + pub safe fn SDL_tanf(x: ::core::ffi::c_float) -> ::core::ffi::c_float; +} + +/// An opaque handle representing string encoding conversion state. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_iconv_open`] +pub type SDL_iconv_t = *mut SDL_iconv_data_t; + +unsafe extern "C" { + /// This function allocates a context for the specified character set + /// conversion. + /// + /// ## Parameters + /// - `tocode`: The target character encoding, must not be NULL. + /// - `fromcode`: The source character encoding, must not be NULL. + /// + /// ## Return value + /// Returns a handle that must be freed with [`SDL_iconv_close`], or + /// [`SDL_ICONV_ERROR`] on failure. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_iconv`] + /// - [`SDL_iconv_close`] + /// - [`SDL_iconv_string`] + pub fn SDL_iconv_open( + tocode: *const ::core::ffi::c_char, + fromcode: *const ::core::ffi::c_char, + ) -> SDL_iconv_t; +} + +unsafe extern "C" { + /// This function frees a context used for character set conversion. + /// + /// ## Parameters + /// - `cd`: The character set conversion handle. + /// + /// ## Return value + /// Returns 0 on success, or -1 on failure. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_iconv`] + /// - [`SDL_iconv_open`] + /// - [`SDL_iconv_string`] + pub fn SDL_iconv_close(cd: SDL_iconv_t) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// This function converts text between encodings, reading from and writing to + /// a buffer. + /// + /// It returns the number of successful conversions on success. On error, + /// [`SDL_ICONV_E2BIG`] is returned when the output buffer is too small, or + /// [`SDL_ICONV_EILSEQ`] is returned when an invalid input sequence is encountered, + /// or [`SDL_ICONV_EINVAL`] is returned when an incomplete input sequence is + /// encountered. + /// + /// On exit: + /// + /// - inbuf will point to the beginning of the next multibyte sequence. On + /// error, this is the location of the problematic input sequence. On + /// success, this is the end of the input sequence. + /// - inbytesleft will be set to the number of bytes left to convert, which + /// will be 0 on success. + /// - outbuf will point to the location where to store the next output byte. + /// - outbytesleft will be set to the number of bytes left in the output + /// buffer. + /// + /// ## Parameters + /// - `cd`: The character set conversion context, created in + /// [`SDL_iconv_open()`]. + /// - `inbuf`: Address of variable that points to the first character of the + /// input sequence. + /// - `inbytesleft`: The number of bytes in the input buffer. + /// - `outbuf`: Address of variable that points to the output buffer. + /// - `outbytesleft`: The number of bytes in the output buffer. + /// + /// ## Return value + /// Returns the number of conversions on success, or a negative error code. + /// + /// ## Thread safety + /// Do not use the same [`SDL_iconv_t`] from two threads at once. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_iconv_open`] + /// - [`SDL_iconv_close`] + /// - [`SDL_iconv_string`] + pub fn SDL_iconv( + cd: SDL_iconv_t, + inbuf: *mut *const ::core::ffi::c_char, + inbytesleft: *mut ::core::primitive::usize, + outbuf: *mut *mut ::core::ffi::c_char, + outbytesleft: *mut ::core::primitive::usize, + ) -> ::core::primitive::usize; +} + +/// Generic error. Check [`SDL_GetError()`]? +pub const SDL_ICONV_ERROR: ::core::primitive::usize = (-1_i32 as ::core::primitive::usize); + +/// Output buffer was too small. +pub const SDL_ICONV_E2BIG: ::core::primitive::usize = (-2_i32 as ::core::primitive::usize); + +/// Invalid input sequence was encountered. +pub const SDL_ICONV_EILSEQ: ::core::primitive::usize = (-3_i32 as ::core::primitive::usize); + +/// Incomplete input sequence was encountered. +pub const SDL_ICONV_EINVAL: ::core::primitive::usize = (-4_i32 as ::core::primitive::usize); + +unsafe extern "C" { + /// Helper function to convert a string's encoding in one call. + /// + /// This function converts a buffer or string between encodings in one pass. + /// + /// The string does not need to be NULL-terminated; this function operates on + /// the number of bytes specified in `inbytesleft` whether there is a NULL + /// character anywhere in the buffer. + /// + /// The returned string is owned by the caller, and should be passed to + /// [`SDL_free`] when no longer needed. + /// + /// ## Parameters + /// - `tocode`: the character encoding of the output string. Examples are + /// "UTF-8", "UCS-4", etc. + /// - `fromcode`: the character encoding of data in `inbuf`. + /// - `inbuf`: the string to convert to a different encoding. + /// - `inbytesleft`: the size of the input string _in bytes_. + /// + /// ## Return value + /// Returns a new string, converted to the new encoding, or NULL on error. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_iconv_open`] + /// - [`SDL_iconv_close`] + /// - [`SDL_iconv`] + pub fn SDL_iconv_string( + tocode: *const ::core::ffi::c_char, + fromcode: *const ::core::ffi::c_char, + inbuf: *const ::core::ffi::c_char, + inbytesleft: ::core::primitive::usize, + ) -> *mut ::core::ffi::c_char; +} + +/// Convert a UTF-8 string to the current locale's character encoding. +/// +/// This is a helper macro that might be more clear than calling +/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so +/// do not use an expression with side-effects here. +/// +/// ## Parameters +/// - `S`: the string to convert. +/// +/// ## Return value +/// Returns a new string, converted to the new encoding, or NULL on error. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub unsafe fn SDL_iconv_utf8_locale(S: *const ::core::ffi::c_char) -> *mut ::core::ffi::c_char { + unsafe { + SDL_iconv_string( + c"".as_ptr(), + c"UTF-8".as_ptr(), + S, + (unsafe { SDL_strlen(S) } + 1_usize), + ) + } +} + +/// Convert a UTF-8 string to UCS-2. +/// +/// This is a helper macro that might be more clear than calling +/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so +/// do not use an expression with side-effects here. +/// +/// ## Parameters +/// - `S`: the string to convert. +/// +/// ## Return value +/// Returns a new string, converted to the new encoding, or NULL on error. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub unsafe fn SDL_iconv_utf8_ucs2(S: *const ::core::ffi::c_char) -> *mut Uint16 { + (unsafe { + SDL_iconv_string( + c"UCS-2".as_ptr(), + c"UTF-8".as_ptr(), + S, + (unsafe { SDL_strlen(S) } + 1_usize), + ) + } as *mut Uint16) +} + +/// Convert a UTF-8 string to UCS-4. +/// +/// This is a helper macro that might be more clear than calling +/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so +/// do not use an expression with side-effects here. +/// +/// ## Parameters +/// - `S`: the string to convert. +/// +/// ## Return value +/// Returns a new string, converted to the new encoding, or NULL on error. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub unsafe fn SDL_iconv_utf8_ucs4(S: *const ::core::ffi::c_char) -> *mut Uint32 { + (unsafe { + SDL_iconv_string( + c"UCS-4".as_ptr(), + c"UTF-8".as_ptr(), + S, + (unsafe { SDL_strlen(S) } + 1_usize), + ) + } as *mut Uint32) +} + +/// Convert a wchar_t string to UTF-8. +/// +/// This is a helper macro that might be more clear than calling +/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so +/// do not use an expression with side-effects here. +/// +/// ## Parameters +/// - `S`: the string to convert. +/// +/// ## Return value +/// Returns a new string, converted to the new encoding, or NULL on error. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub unsafe fn SDL_iconv_wchar_utf8(S: *const crate::ffi::c_wchar_t) -> *mut ::core::ffi::c_char { + unsafe { + SDL_iconv_string( + c"UTF-8".as_ptr(), + c"WCHAR_T".as_ptr(), + (S as *const ::core::ffi::c_char), + ((unsafe { SDL_wcslen(S) } + 1_usize) + * ::core::mem::size_of::()), + ) + } +} + +/// Multiply two integers, checking for overflow. +/// +/// If `a * b` would overflow, return false. +/// +/// Otherwise store `a * b` via ret and return true. +/// +/// ## Parameters +/// - `a`: the multiplicand. +/// - `b`: the multiplier. +/// - `ret`: on non-overflow output, stores the multiplication result, may +/// not be NULL. +/// +/// ## Return value +/// Returns false on overflow, true if result is multiplied without overflow. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_size_mul_check_overflow( + a: ::core::primitive::usize, + b: ::core::primitive::usize, + ret: *mut ::core::primitive::usize, +) -> ::core::primitive::bool { + if ((a != 0_usize) && (b > (SDL_SIZE_MAX / a))) { + return false; + } + unsafe { + let (ptr, value) = (ret, (a * b)); + ptr.write(value); + value + }; + return true; +} + +apply_cfg!(#[cfg(not(doc))] => { +}); + +/// Add two integers, checking for overflow. +/// +/// If `a + b` would overflow, return false. +/// +/// Otherwise store `a + b` via ret and return true. +/// +/// ## Parameters +/// - `a`: the first addend. +/// - `b`: the second addend. +/// - `ret`: on non-overflow output, stores the addition result, may not be +/// NULL. +/// +/// ## Return value +/// Returns false on overflow, true if result is added without overflow. +/// +/// ## Thread safety +/// It is safe to call this function from any thread. +/// +/// ## Availability +/// This function is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_size_add_check_overflow( + a: ::core::primitive::usize, + b: ::core::primitive::usize, + ret: *mut ::core::primitive::usize, +) -> ::core::primitive::bool { + if (b > (SDL_SIZE_MAX - a)) { + return false; + } + unsafe { + let (ptr, value) = (ret, (a + b)); + ptr.write(value); + value + }; + return true; +} + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(doc)] => { + /// A generic function pointer. + /// + /// In theory, generic function pointers should use this, instead of `void *`, + /// since some platforms could treat code addresses differently than data + /// addresses. Although in current times no popular platforms make this + /// distinction, it is more correct and portable to use the correct type for a + /// generic pointer. + /// + /// If for some reason you need to force this typedef to be an actual `void *`, + /// perhaps to work around a compiler or existing code, you can define + /// `SDL_FUNCTION_POINTER_IS_VOID_POINTER` before including any SDL headers. + /// + /// ## Availability + /// This datatype is available since SDL 3.2.0. + pub type SDL_FunctionPointer = ::core::option::Option; + +}); + +apply_cfg!(#[cfg(not(doc))] => { + pub type SDL_FunctionPointer = ::core::option::Option; + +}); + +/// A thread-safe set of environment variables +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetEnvironment`] +/// - [`SDL_CreateEnvironment`] +/// - [`SDL_GetEnvironmentVariable`] +/// - [`SDL_GetEnvironmentVariables`] +/// - [`SDL_SetEnvironmentVariable`] +/// - [`SDL_UnsetEnvironmentVariable`] +/// - [`SDL_DestroyEnvironment`] +#[repr(C)] +pub struct SDL_Environment { + _opaque: [::core::primitive::u8; 0], +} + +#[repr(C)] +pub struct SDL_iconv_data_t { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/storage.rs b/vendor/sdl3-sys/src/generated/storage.rs new file mode 100644 index 00000000..a40d367f --- /dev/null +++ b/vendor/sdl3-sys/src/generated/storage.rs @@ -0,0 +1,839 @@ +//! The storage API is a high-level API designed to abstract away the +//! portability issues that come up when using something lower-level (in SDL's +//! case, this sits on top of the [Filesystem](CategoryFilesystem) and +//! [IOStream](CategoryIOStream) subsystems). It is significantly more +//! restrictive than a typical filesystem API, for a number of reasons: +//! +//! 1. **What to Access:** A common pitfall with existing filesystem APIs is +//! the assumption that all storage is monolithic. However, many other +//! platforms (game consoles in particular) are more strict about what _type_ +//! of filesystem is being accessed; for example, game content and user data +//! are usually two separate storage devices with entirely different +//! characteristics (and possibly different low-level APIs altogether!). +//! +//! 2. **How to Access:** Another common mistake is applications assuming that +//! all storage is universally writeable - again, many platforms treat game +//! content and user data as two separate storage devices, and only user data +//! is writeable while game content is read-only. +//! +//! 3. **When to Access:** The most common portability issue with filesystem +//! access is _timing_ - you cannot always assume that the storage device is +//! always accessible all of the time, nor can you assume that there are no +//! limits to how long you have access to a particular device. +//! +//! Consider the following example: +//! +//! ```c +//! void ReadGameData(void) +//! { +//! extern char** fileNames; +//! extern size_t numFiles; +//! for (size_t i = 0; i < numFiles; i += 1) { +//! FILE *data = fopen(fileNames[i], "rwb"); +//! if (data == NULL) { +//! // Something bad happened! +//! } else { +//! // A bunch of stuff happens here +//! fclose(data); +//! } +//! } +//! } +//! +//! void ReadSave(void) +//! { +//! FILE *save = fopen("saves/save0.sav", "rb"); +//! if (save == NULL) { +//! // Something bad happened! +//! } else { +//! // A bunch of stuff happens here +//! fclose(save); +//! } +//! } +//! +//! void WriteSave(void) +//! { +//! FILE *save = fopen("saves/save0.sav", "wb"); +//! if (save == NULL) { +//! // Something bad happened! +//! } else { +//! // A bunch of stuff happens here +//! fclose(save); +//! } +//! } +//! ``` +//! +//! Going over the bullet points again: +//! +//! 1. **What to Access:** This code accesses a global filesystem; game data +//! and saves are all presumed to be in the current working directory (which +//! may or may not be the game's installation folder!). +//! +//! 2. **How to Access:** This code assumes that content paths are writeable, +//! and that save data is also writeable despite being in the same location as +//! the game data. +//! +//! 3. **When to Access:** This code assumes that they can be called at any +//! time, since the filesystem is always accessible and has no limits on how +//! long the filesystem is being accessed. +//! +//! Due to these assumptions, the filesystem code is not portable and will fail +//! under these common scenarios: +//! +//! - The game is installed on a device that is read-only, both content loading +//! and game saves will fail or crash outright +//! - Game/User storage is not implicitly mounted, so no files will be found +//! for either scenario when a platform requires explicitly mounting +//! filesystems +//! - Save data may not be safe since the I/O is not being flushed or +//! validated, so an error occurring elsewhere in the program may result in +//! missing/corrupted save data +//! +//! When using [`SDL_Storage`], these types of problems are virtually impossible to +//! trip over: +//! +//! ```c +//! void ReadGameData(void) +//! { +//! extern char** fileNames; +//! extern size_t numFiles; +//! +//! SDL_Storage *title = SDL_OpenTitleStorage(NULL, 0); +//! if (title == NULL) { +//! // Something bad happened! +//! } +//! while (!SDL_StorageReady(title)) { +//! SDL_Delay(1); +//! } +//! +//! for (size_t i = 0; i < numFiles; i += 1) { +//! void* dst; +//! Uint64 dstLen = 0; +//! +//! if (SDL_GetStorageFileSize(title, fileNames[i], &dstLen) && dstLen > 0) { +//! dst = SDL_malloc(dstLen); +//! if (SDL_ReadStorageFile(title, fileNames[i], dst, dstLen)) { +//! // A bunch of stuff happens here +//! } else { +//! // Something bad happened! +//! } +//! SDL_free(dst); +//! } else { +//! // Something bad happened! +//! } +//! } +//! +//! SDL_CloseStorage(title); +//! } +//! +//! void ReadSave(void) +//! { +//! SDL_Storage *user = SDL_OpenUserStorage("libsdl", "Storage Example", 0); +//! if (user == NULL) { +//! // Something bad happened! +//! } +//! while (!SDL_StorageReady(user)) { +//! SDL_Delay(1); +//! } +//! +//! Uint64 saveLen = 0; +//! if (SDL_GetStorageFileSize(user, "save0.sav", &saveLen) && saveLen > 0) { +//! void* dst = SDL_malloc(saveLen); +//! if (SDL_ReadStorageFile(user, "save0.sav", dst, saveLen)) { +//! // A bunch of stuff happens here +//! } else { +//! // Something bad happened! +//! } +//! SDL_free(dst); +//! } else { +//! // Something bad happened! +//! } +//! +//! SDL_CloseStorage(user); +//! } +//! +//! void WriteSave(void) +//! { +//! SDL_Storage *user = SDL_OpenUserStorage("libsdl", "Storage Example", 0); +//! if (user == NULL) { +//! // Something bad happened! +//! } +//! while (!SDL_StorageReady(user)) { +//! SDL_Delay(1); +//! } +//! +//! extern void *saveData; // A bunch of stuff happened here... +//! extern Uint64 saveLen; +//! if (!SDL_WriteStorageFile(user, "save0.sav", saveData, saveLen)) { +//! // Something bad happened! +//! } +//! +//! SDL_CloseStorage(user); +//! } +//! ``` +//! +//! Note the improvements that [`SDL_Storage`] makes: +//! +//! 1. **What to Access:** This code explicitly reads from a title or user +//! storage device based on the context of the function. +//! +//! 2. **How to Access:** This code explicitly uses either a read or write +//! function based on the context of the function. +//! +//! 3. **When to Access:** This code explicitly opens the device when it needs +//! to, and closes it when it is finished working with the filesystem. +//! +//! The result is an application that is significantly more robust against the +//! increasing demands of platforms and their filesystems! +//! +//! A publicly available example of an [`SDL_Storage`] backend is the +//! [Steam Cloud](https://partner.steamgames.com/doc/features/cloud) +//! backend - you can initialize Steamworks when starting the program, and then +//! SDL will recognize that Steamworks is initialized and automatically use +//! ISteamRemoteStorage when the application opens user storage. More +//! importantly, when you _open_ storage it knows to begin a "batch" of +//! filesystem operations, and when you _close_ storage it knows to end and +//! flush the batch. This is used by Steam to support +//! [Dynamic Cloud Sync](https://steamcommunity.com/groups/steamworks/announcements/detail/3142949576401813670) +//! ; users can save data on one PC, put the device to sleep, and then continue +//! playing on another PC (and vice versa) with the save data fully +//! synchronized across all devices, allowing for a seamless experience without +//! having to do full restarts of the program. +//! +//! ## Notes on valid paths +//! +//! All paths in the Storage API use Unix-style path separators ('/'). Using a +//! different path separator will not work, even if the underlying platform +//! would otherwise accept it. This is to keep code using the Storage API +//! portable between platforms and Storage implementations and simplify app +//! code. +//! +//! Paths with relative directories ("." and "..") are forbidden by the Storage +//! API. +//! +//! All valid UTF-8 strings (discounting the NULL terminator character and the +//! '/' path separator) are usable for filenames, however, an underlying +//! Storage implementation may not support particularly strange sequences and +//! refuse to create files with those names, etc. + +use super::stdinc::*; + +use super::error::*; + +use super::filesystem::*; + +use super::properties::*; + +/// Function interface for [`SDL_Storage`]. +/// +/// Apps that want to supply a custom implementation of [`SDL_Storage`] will fill +/// in all the functions in this struct, and then pass it to [`SDL_OpenStorage`] to +/// create a custom [`SDL_Storage`] object. +/// +/// It is not usually necessary to do this; SDL provides standard +/// implementations for many things you might expect to do with an [`SDL_Storage`]. +/// +/// This structure should be initialized using [`SDL_INIT_INTERFACE()`] +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_INIT_INTERFACE`] +/// +/// ## Notes for `sdl3-sys` +/// This interface struct can be initialized with [`SDL_StorageInterface::new()`] or `Default::default()`. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_StorageInterface { + pub version: Uint32, + pub close: ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> ::core::primitive::bool, + >, + pub ready: ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> ::core::primitive::bool, + >, + pub enumerate: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + path: *const ::core::ffi::c_char, + callback: SDL_EnumerateDirectoryCallback, + callback_userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool, + >, + pub info: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + path: *const ::core::ffi::c_char, + info: *mut SDL_PathInfo, + ) -> ::core::primitive::bool, + >, + pub read_file: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + path: *const ::core::ffi::c_char, + destination: *mut ::core::ffi::c_void, + length: Uint64, + ) -> ::core::primitive::bool, + >, + pub write_file: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + path: *const ::core::ffi::c_char, + source: *const ::core::ffi::c_void, + length: Uint64, + ) -> ::core::primitive::bool, + >, + pub mkdir: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + path: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool, + >, + pub remove: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + path: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool, + >, + pub rename: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + oldpath: *const ::core::ffi::c_char, + newpath: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool, + >, + pub copy: ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + oldpath: *const ::core::ffi::c_char, + newpath: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool, + >, + pub space_remaining: + ::core::option::Option Uint64>, +} + +impl SDL_StorageInterface { + /// Create a new `SDL_StorageInterface` initialized with `SDL_INIT_INTERFACE` + #[inline] + pub const fn new() -> Self { + const { ::core::assert!(::core::mem::size_of::() <= ::core::primitive::u32::MAX as usize) }; + let mut this = unsafe { ::core::mem::MaybeUninit::::zeroed().assume_init() }; + this.version = ::core::mem::size_of::() as ::core::primitive::u32; + this + } +} + +impl ::core::default::Default for SDL_StorageInterface { + /// Create a new `SDL_StorageInterface` initialized with `SDL_INIT_INTERFACE` + #[inline(always)] + fn default() -> Self { + Self::new() + } +} + +const _: () = ::core::assert!( + (((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 4_usize) + && (::core::mem::size_of::() == 48_usize)) + || ((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 8_usize) + && (::core::mem::size_of::() == 96_usize))) +); + +unsafe extern "C" { + /// Opens up a read-only container for the application's filesystem. + /// + /// By default, [`SDL_OpenTitleStorage`] uses the generic storage implementation. + /// When the path override is not provided, the generic implementation will use + /// the output of [`SDL_GetBasePath`] as the base path. + /// + /// ## Parameters + /// - `override`: a path to override the backend's default title root. + /// - `props`: a property list that may contain backend-specific information. + /// + /// ## Return value + /// Returns a title storage container on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseStorage`] + /// - [`SDL_GetStorageFileSize`] + /// - [`SDL_OpenUserStorage`] + /// - [`SDL_ReadStorageFile`] + pub fn SDL_OpenTitleStorage( + r#override: *const ::core::ffi::c_char, + props: SDL_PropertiesID, + ) -> *mut SDL_Storage; +} + +unsafe extern "C" { + /// Opens up a container for a user's unique read/write filesystem. + /// + /// While title storage can generally be kept open throughout runtime, user + /// storage should only be opened when the client is ready to read/write files. + /// This allows the backend to properly batch file operations and flush them + /// when the container has been closed; ensuring safe and optimal save I/O. + /// + /// ## Parameters + /// - `org`: the name of your organization. + /// - `app`: the name of your application. + /// - `props`: a property list that may contain backend-specific information. + /// + /// ## Return value + /// Returns a user storage container on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseStorage`] + /// - [`SDL_GetStorageFileSize`] + /// - [`SDL_GetStorageSpaceRemaining`] + /// - [`SDL_OpenTitleStorage`] + /// - [`SDL_ReadStorageFile`] + /// - [`SDL_StorageReady`] + /// - [`SDL_WriteStorageFile`] + pub fn SDL_OpenUserStorage( + org: *const ::core::ffi::c_char, + app: *const ::core::ffi::c_char, + props: SDL_PropertiesID, + ) -> *mut SDL_Storage; +} + +unsafe extern "C" { + /// Opens up a container for local filesystem storage. + /// + /// This is provided for development and tools. Portable applications should + /// use [`SDL_OpenTitleStorage()`] for access to game data and + /// [`SDL_OpenUserStorage()`] for access to user data. + /// + /// ## Parameters + /// - `path`: the base path prepended to all storage paths, or NULL for no + /// base path. + /// + /// ## Return value + /// Returns a filesystem storage container on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseStorage`] + /// - [`SDL_GetStorageFileSize`] + /// - [`SDL_GetStorageSpaceRemaining`] + /// - [`SDL_OpenTitleStorage`] + /// - [`SDL_OpenUserStorage`] + /// - [`SDL_ReadStorageFile`] + /// - [`SDL_WriteStorageFile`] + pub fn SDL_OpenFileStorage(path: *const ::core::ffi::c_char) -> *mut SDL_Storage; +} + +unsafe extern "C" { + /// Opens up a container using a client-provided storage interface. + /// + /// Applications do not need to use this function unless they are providing + /// their own [`SDL_Storage`] implementation. If you just need an [`SDL_Storage`], you + /// should use the built-in implementations in SDL, like [`SDL_OpenTitleStorage()`] + /// or [`SDL_OpenUserStorage()`]. + /// + /// This function makes a copy of `iface` and the caller does not need to keep + /// it around after this call. + /// + /// ## Parameters + /// - `iface`: the interface that implements this storage, initialized using + /// [`SDL_INIT_INTERFACE()`]. + /// - `userdata`: the pointer that will be passed to the interface functions. + /// + /// ## Return value + /// Returns a storage container on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CloseStorage`] + /// - [`SDL_GetStorageFileSize`] + /// - [`SDL_GetStorageSpaceRemaining`] + /// - [`SDL_INIT_INTERFACE`] + /// - [`SDL_ReadStorageFile`] + /// - [`SDL_StorageReady`] + /// - [`SDL_WriteStorageFile`] + pub fn SDL_OpenStorage( + iface: *const SDL_StorageInterface, + userdata: *mut ::core::ffi::c_void, + ) -> *mut SDL_Storage; +} + +unsafe extern "C" { + /// Closes and frees a storage container. + /// + /// ## Parameters + /// - `storage`: a storage container to close. + /// + /// ## Return value + /// Returns true if the container was freed with no errors, false otherwise; + /// call [`SDL_GetError()`] for more information. Even if the function + /// returns an error, the container data will be freed; the error is + /// only for informational purposes. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_OpenFileStorage`] + /// - [`SDL_OpenStorage`] + /// - [`SDL_OpenTitleStorage`] + /// - [`SDL_OpenUserStorage`] + pub fn SDL_CloseStorage(storage: *mut SDL_Storage) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Checks if the storage container is ready to use. + /// + /// This function should be called in regular intervals until it returns true - + /// however, it is not recommended to spinwait on this call, as the backend may + /// depend on a synchronous message loop. You might instead poll this in your + /// game's main loop while processing events and drawing a loading screen. + /// + /// ## Parameters + /// - `storage`: a storage container to query. + /// + /// ## Return value + /// Returns true if the container is ready, false otherwise. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_StorageReady(storage: *mut SDL_Storage) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Query the size of a file within a storage container. + /// + /// ## Parameters + /// - `storage`: a storage container to query. + /// - `path`: the relative path of the file to query. + /// - `length`: a pointer to be filled with the file's length. + /// + /// ## Return value + /// Returns true if the file could be queried or false on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ReadStorageFile`] + /// - [`SDL_StorageReady`] + pub fn SDL_GetStorageFileSize( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + length: *mut Uint64, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Synchronously read a file from a storage container into a client-provided + /// buffer. + /// + /// The value of `length` must match the length of the file exactly; call + /// [`SDL_GetStorageFileSize()`] to get this value. This behavior may be relaxed in + /// a future release. + /// + /// ## Parameters + /// - `storage`: a storage container to read from. + /// - `path`: the relative path of the file to read. + /// - `destination`: a client-provided buffer to read the file into. + /// - `length`: the length of the destination buffer. + /// + /// ## Return value + /// Returns true if the file was read or false on failure; call [`SDL_GetError()`] + /// for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetStorageFileSize`] + /// - [`SDL_StorageReady`] + /// - [`SDL_WriteStorageFile`] + pub fn SDL_ReadStorageFile( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + destination: *mut ::core::ffi::c_void, + length: Uint64, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Synchronously write a file from client memory into a storage container. + /// + /// ## Parameters + /// - `storage`: a storage container to write to. + /// - `path`: the relative path of the file to write. + /// - `source`: a client-provided buffer to write from. + /// - `length`: the length of the source buffer. + /// + /// ## Return value + /// Returns true if the file was written or false on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetStorageSpaceRemaining`] + /// - [`SDL_ReadStorageFile`] + /// - [`SDL_StorageReady`] + pub fn SDL_WriteStorageFile( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + source: *const ::core::ffi::c_void, + length: Uint64, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create a directory in a writable storage container. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `path`: the path of the directory to create. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + pub fn SDL_CreateStorageDirectory( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Enumerate a directory in a storage container through a callback function. + /// + /// This function provides every directory entry through an app-provided + /// callback, called once for each directory entry, until all results have been + /// provided or the callback returns either [`SDL_ENUM_SUCCESS`] or + /// [`SDL_ENUM_FAILURE`]. + /// + /// This will return false if there was a system problem in general, or if a + /// callback returns [`SDL_ENUM_FAILURE`]. A successful return means a callback + /// returned [`SDL_ENUM_SUCCESS`] to halt enumeration, or all directory entries + /// were enumerated. + /// + /// If `path` is NULL, this is treated as a request to enumerate the root of + /// the storage container's tree. An empty string also works for this. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `path`: the path of the directory to enumerate, or NULL for the root. + /// - `callback`: a function that is called for each entry in the directory. + /// - `userdata`: a pointer that is passed to `callback`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + pub fn SDL_EnumerateStorageDirectory( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + callback: SDL_EnumerateDirectoryCallback, + userdata: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Remove a file or an empty directory in a writable storage container. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `path`: the path to remove from the filesystem. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + pub fn SDL_RemoveStoragePath( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Rename a file or directory in a writable storage container. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `oldpath`: the old path. + /// - `newpath`: the new path. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + pub fn SDL_RenameStoragePath( + storage: *mut SDL_Storage, + oldpath: *const ::core::ffi::c_char, + newpath: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy a file in a writable storage container. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `oldpath`: the old path. + /// - `newpath`: the new path. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + pub fn SDL_CopyStorageFile( + storage: *mut SDL_Storage, + oldpath: *const ::core::ffi::c_char, + newpath: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get information about a filesystem path in a storage container. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `path`: the path to query. + /// - `info`: a pointer filled in with information about the path, or NULL to + /// check for the existence of a file. + /// + /// ## Return value + /// Returns true on success or false if the file doesn't exist, or another + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + pub fn SDL_GetStoragePathInfo( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + info: *mut SDL_PathInfo, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Queries the remaining space in a storage container. + /// + /// ## Parameters + /// - `storage`: a storage container to query. + /// + /// ## Return value + /// Returns the amount of remaining space, in bytes. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_StorageReady`] + /// - [`SDL_WriteStorageFile`] + pub fn SDL_GetStorageSpaceRemaining(storage: *mut SDL_Storage) -> Uint64; +} + +unsafe extern "C" { + /// Enumerate a directory tree, filtered by pattern, and return a list. + /// + /// Files are filtered out if they don't match the string in `pattern`, which + /// may contain wildcard characters `*` (match everything) and `?` (match one + /// character). If pattern is NULL, no filtering is done and all results are + /// returned. Subdirectories are permitted, and are specified with a path + /// separator of '/'. Wildcard characters `*` and `?` never match a path + /// separator. + /// + /// `flags` may be set to [`SDL_GLOB_CASEINSENSITIVE`] to make the pattern matching + /// case-insensitive. + /// + /// The returned array is always NULL-terminated, for your iterating + /// convenience, but if `count` is non-NULL, on return it will contain the + /// number of items in the array, not counting the NULL terminator. + /// + /// If `path` is NULL, this is treated as a request to enumerate the root of + /// the storage container's tree. An empty string also works for this. + /// + /// ## Parameters + /// - `storage`: a storage container. + /// - `path`: the path of the directory to enumerate, or NULL for the root. + /// - `pattern`: the pattern that files in the directory must match. Can be + /// NULL. + /// - `flags`: `SDL_GLOB_*` bitflags that affect this search. + /// - `count`: on return, will be set to the number of items in the returned + /// array. Can be NULL. + /// + /// ## Return value + /// Returns an array of strings on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. The caller should pass the + /// returned pointer to [`SDL_free`] when done with it. This is a single + /// allocation that should be freed with [`SDL_free()`] when it is no + /// longer needed. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, assuming + /// the `storage` object is thread-safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GlobStorageDirectory( + storage: *mut SDL_Storage, + path: *const ::core::ffi::c_char, + pattern: *const ::core::ffi::c_char, + flags: SDL_GlobFlags, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut ::core::ffi::c_char; +} + +/// An abstract interface for filesystem access. +/// +/// This is an opaque datatype. One can create this object using standard SDL +/// functions like [`SDL_OpenTitleStorage`] or [`SDL_OpenUserStorage`], etc, or create +/// an object with a custom implementation using [`SDL_OpenStorage`]. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Storage { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/surface.rs b/vendor/sdl3-sys/src/generated/surface.rs new file mode 100644 index 00000000..9f6b0fb1 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/surface.rs @@ -0,0 +1,2804 @@ +//! SDL surfaces are buffers of pixels in system RAM. These are useful for +//! passing around and manipulating images that are not stored in GPU memory. +//! +//! [`SDL_Surface`] makes serious efforts to manage images in various formats, and +//! provides a reasonable toolbox for transforming the data, including copying +//! between surfaces, filling rectangles in the image data, etc. +//! +//! There is also a simple .bmp loader, [`SDL_LoadBMP()`], and a simple .png +//! loader, [`SDL_LoadPNG()`]. SDL itself does not provide loaders for other file +//! formats, but there are several excellent external libraries that do, +//! including its own satellite library, +//! [SDL_image](https://wiki.libsdl.org/SDL3_image) +//! . +//! +//! In general these functions are thread-safe in that they can be called on +//! different threads with different surfaces. You should not try to modify any +//! surface from two threads simultaneously. + +use super::stdinc::*; + +use super::error::*; + +use super::blendmode::*; + +use super::pixels::*; + +use super::properties::*; + +use super::rect::*; + +use super::iostream::*; + +/// The flags on an [`SDL_Surface`]. +/// +/// These are generally considered read-only. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`PREALLOCATED`](SDL_SurfaceFlags::PREALLOCATED) | [`SDL_SURFACE_PREALLOCATED`] | Surface uses preallocated pixel memory | +/// | [`LOCK_NEEDED`](SDL_SurfaceFlags::LOCK_NEEDED) | [`SDL_SURFACE_LOCK_NEEDED`] | Surface needs to be locked to access pixels | +/// | [`LOCKED`](SDL_SurfaceFlags::LOCKED) | [`SDL_SURFACE_LOCKED`] | Surface is currently locked | +/// | [`SIMD_ALIGNED`](SDL_SurfaceFlags::SIMD_ALIGNED) | [`SDL_SURFACE_SIMD_ALIGNED`] | Surface uses pixel memory allocated with [`SDL_aligned_alloc()`] | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_SurfaceFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_SurfaceFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_SurfaceFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_SurfaceFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_SurfaceFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_SurfaceFlags(")?; + let all_bits = all_bits | Self::PREALLOCATED.0; + if (Self::PREALLOCATED != 0 || self.0 == 0) + && *self & Self::PREALLOCATED == Self::PREALLOCATED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "PREALLOCATED")?; + } + let all_bits = all_bits | Self::LOCK_NEEDED.0; + if (Self::LOCK_NEEDED != 0 || self.0 == 0) && *self & Self::LOCK_NEEDED == Self::LOCK_NEEDED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LOCK_NEEDED")?; + } + let all_bits = all_bits | Self::LOCKED.0; + if (Self::LOCKED != 0 || self.0 == 0) && *self & Self::LOCKED == Self::LOCKED { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LOCKED")?; + } + let all_bits = all_bits | Self::SIMD_ALIGNED.0; + if (Self::SIMD_ALIGNED != 0 || self.0 == 0) + && *self & Self::SIMD_ALIGNED == Self::SIMD_ALIGNED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SIMD_ALIGNED")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_SurfaceFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_SurfaceFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_SurfaceFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_SurfaceFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_SurfaceFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_SurfaceFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_SurfaceFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_SurfaceFlags { + /// Surface uses preallocated pixel memory + pub const PREALLOCATED: Self = Self((0x00000001 as Uint32)); + /// Surface needs to be locked to access pixels + pub const LOCK_NEEDED: Self = Self((0x00000002 as Uint32)); + /// Surface is currently locked + pub const LOCKED: Self = Self((0x00000004 as Uint32)); + /// Surface uses pixel memory allocated with [`SDL_aligned_alloc()`] + pub const SIMD_ALIGNED: Self = Self((0x00000008 as Uint32)); +} + +/// Surface uses preallocated pixel memory +pub const SDL_SURFACE_PREALLOCATED: SDL_SurfaceFlags = SDL_SurfaceFlags::PREALLOCATED; +/// Surface needs to be locked to access pixels +pub const SDL_SURFACE_LOCK_NEEDED: SDL_SurfaceFlags = SDL_SurfaceFlags::LOCK_NEEDED; +/// Surface is currently locked +pub const SDL_SURFACE_LOCKED: SDL_SurfaceFlags = SDL_SurfaceFlags::LOCKED; +/// Surface uses pixel memory allocated with [`SDL_aligned_alloc()`] +pub const SDL_SURFACE_SIMD_ALIGNED: SDL_SurfaceFlags = SDL_SurfaceFlags::SIMD_ALIGNED; + +impl SDL_SurfaceFlags { + /// Initialize a `SDL_SurfaceFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_SurfaceFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_SurfaceFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::surface::METADATA_SDL_SurfaceFlags; +} + +/// The scaling mode. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_ScaleMode::INVALID) | [`SDL_SCALEMODE_INVALID`] | | +/// | [`NEAREST`](SDL_ScaleMode::NEAREST) | [`SDL_SCALEMODE_NEAREST`] | nearest pixel sampling | +/// | [`LINEAR`](SDL_ScaleMode::LINEAR) | [`SDL_SCALEMODE_LINEAR`] | linear filtering | +/// | [`PIXELART`](SDL_ScaleMode::PIXELART) | [`SDL_SCALEMODE_PIXELART`] | nearest pixel sampling with improved scaling for pixel art, available since SDL 3.4.0 | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ScaleMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ScaleMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_ScaleMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_ScaleMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ScaleMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_SCALEMODE_INVALID", + Self::NEAREST => "SDL_SCALEMODE_NEAREST", + Self::LINEAR => "SDL_SCALEMODE_LINEAR", + Self::PIXELART => "SDL_SCALEMODE_PIXELART", + + _ => return write!(f, "SDL_ScaleMode({})", self.0), + }) + } +} + +impl SDL_ScaleMode { + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// nearest pixel sampling + pub const NEAREST: Self = Self((0_i32 as ::core::ffi::c_int)); + /// linear filtering + pub const LINEAR: Self = Self((1_i32 as ::core::ffi::c_int)); + /// nearest pixel sampling with improved scaling for pixel art, available since SDL 3.4.0 + pub const PIXELART: Self = Self((2_i32 as ::core::ffi::c_int)); +} + +pub const SDL_SCALEMODE_INVALID: SDL_ScaleMode = SDL_ScaleMode::INVALID; +/// nearest pixel sampling +pub const SDL_SCALEMODE_NEAREST: SDL_ScaleMode = SDL_ScaleMode::NEAREST; +/// linear filtering +pub const SDL_SCALEMODE_LINEAR: SDL_ScaleMode = SDL_ScaleMode::LINEAR; +/// nearest pixel sampling with improved scaling for pixel art, available since SDL 3.4.0 +pub const SDL_SCALEMODE_PIXELART: SDL_ScaleMode = SDL_ScaleMode::PIXELART; + +impl SDL_ScaleMode { + /// Initialize a `SDL_ScaleMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_ScaleMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ScaleMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::surface::METADATA_SDL_ScaleMode; +} + +/// The flip mode. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_FlipMode::NONE) | [`SDL_FLIP_NONE`] | Do not flip | +/// | [`HORIZONTAL`](SDL_FlipMode::HORIZONTAL) | [`SDL_FLIP_HORIZONTAL`] | flip horizontally | +/// | [`VERTICAL`](SDL_FlipMode::VERTICAL) | [`SDL_FLIP_VERTICAL`] | flip vertically | +/// | [`HORIZONTAL_AND_VERTICAL`](SDL_FlipMode::HORIZONTAL_AND_VERTICAL) | [`SDL_FLIP_HORIZONTAL_AND_VERTICAL`] | flip horizontally and vertically (not a diagonal flip) | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_FlipMode(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_FlipMode { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_FlipMode) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_FlipMode) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_FlipMode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_FlipMode(")?; + let all_bits = all_bits | Self::NONE.0; + if (Self::NONE != 0 || self.0 == 0) && *self & Self::NONE == Self::NONE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NONE")?; + } + let all_bits = all_bits | Self::HORIZONTAL.0; + if (Self::HORIZONTAL != 0 || self.0 == 0) && *self & Self::HORIZONTAL == Self::HORIZONTAL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "HORIZONTAL")?; + } + let all_bits = all_bits | Self::VERTICAL.0; + if (Self::VERTICAL != 0 || self.0 == 0) && *self & Self::VERTICAL == Self::VERTICAL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "VERTICAL")?; + } + let all_bits = all_bits | Self::HORIZONTAL_AND_VERTICAL.0; + if (Self::HORIZONTAL_AND_VERTICAL != 0 || self.0 == 0) + && *self & Self::HORIZONTAL_AND_VERTICAL == Self::HORIZONTAL_AND_VERTICAL + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "HORIZONTAL_AND_VERTICAL")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_FlipMode { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_FlipMode { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_FlipMode { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_FlipMode { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_FlipMode { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_FlipMode { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_FlipMode { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_FlipMode { + /// Do not flip + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + /// flip horizontally + pub const HORIZONTAL: Self = Self((1 as ::core::ffi::c_int)); + /// flip vertically + pub const VERTICAL: Self = Self((2 as ::core::ffi::c_int)); + /// flip horizontally and vertically (not a diagonal flip) + pub const HORIZONTAL_AND_VERTICAL: Self = Self((SDL_FLIP_HORIZONTAL.0 | SDL_FLIP_VERTICAL.0)); +} + +/// Do not flip +pub const SDL_FLIP_NONE: SDL_FlipMode = SDL_FlipMode::NONE; +/// flip horizontally +pub const SDL_FLIP_HORIZONTAL: SDL_FlipMode = SDL_FlipMode::HORIZONTAL; +/// flip vertically +pub const SDL_FLIP_VERTICAL: SDL_FlipMode = SDL_FlipMode::VERTICAL; +/// flip horizontally and vertically (not a diagonal flip) +pub const SDL_FLIP_HORIZONTAL_AND_VERTICAL: SDL_FlipMode = SDL_FlipMode::HORIZONTAL_AND_VERTICAL; + +impl SDL_FlipMode { + /// Initialize a `SDL_FlipMode` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_FlipMode { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_FlipMode { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::surface::METADATA_SDL_FlipMode; +} + +/// A collection of pixels used in software blitting. +/// +/// Pixels are arranged in memory in rows, with the top row first. Each row +/// occupies an amount of memory given by the pitch (sometimes known as the row +/// stride in non-SDL APIs). +/// +/// Within each row, pixels are arranged from left to right until the width is +/// reached. Each pixel occupies a number of bits appropriate for its format, +/// with most formats representing each pixel as one or more whole bytes (in +/// some indexed formats, instead multiple pixels are packed into each byte), +/// and a byte order given by the format. After encoding all pixels, any +/// remaining bytes to reach the pitch are used as padding to reach a desired +/// alignment, and have undefined contents. +/// +/// When a surface holds YUV format data, the planes are assumed to be +/// contiguous without padding between them, e.g. a 32x32 surface in NV12 +/// format with a pitch of 32 would consist of 32x32 bytes of Y plane followed +/// by 32x16 bytes of UV plane. +/// +/// When a surface holds MJPG format data, pixels points at the compressed JPEG +/// image and pitch is the length of that data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateSurface`] +/// - [`SDL_DestroySurface`] +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Surface { + /// The flags of the surface, read-only + pub flags: SDL_SurfaceFlags, + /// The format of the surface, read-only + pub format: SDL_PixelFormat, + /// The width of the surface, read-only. + pub w: ::core::ffi::c_int, + /// The height of the surface, read-only. + pub h: ::core::ffi::c_int, + /// The distance in bytes between rows of pixels, read-only + pub pitch: ::core::ffi::c_int, + /// A pointer to the pixels of the surface, the pixels are writeable if non-NULL + pub pixels: *mut ::core::ffi::c_void, + /// Application reference count, used when freeing surface + pub refcount: ::core::ffi::c_int, + /// Reserved for internal use + pub reserved: *mut ::core::ffi::c_void, + #[doc(hidden)] + __non_exhaustive: ::sdl3_sys::NonExhaustive, +} + +/// Evaluates to true if the surface needs to be locked before access. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const unsafe fn SDL_MUSTLOCK(S: *const SDL_Surface) -> ::core::primitive::bool { + ((unsafe { (&raw const (*S).flags).read() }.0 & SDL_SURFACE_LOCK_NEEDED.0) + == SDL_SURFACE_LOCK_NEEDED.0) +} + +unsafe extern "C" { + /// Allocate a new surface with a specific pixel format. + /// + /// The pixels of the new surface are initialized to zero. + /// + /// ## Parameters + /// - `width`: the width of the surface. + /// - `height`: the height of the surface. + /// - `format`: the [`SDL_PixelFormat`] for the new surface's pixel format. + /// + /// ## Return value + /// Returns the new [`SDL_Surface`] structure that is created or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateSurfaceFrom`] + /// - [`SDL_DestroySurface`] + pub fn SDL_CreateSurface( + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + format: SDL_PixelFormat, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Allocate a new surface with a specific pixel format and existing pixel + /// data. + /// + /// No copy is made of the pixel data. Pixel data is not managed automatically; + /// you must free the surface before you free the pixel data. + /// + /// Pitch is the offset in bytes from one row of pixels to the next, e.g. + /// `width*4` for [`SDL_PIXELFORMAT_RGBA8888`]. + /// + /// You may pass NULL for pixels and 0 for pitch to create a surface that you + /// will fill in with valid values later. + /// + /// ## Parameters + /// - `width`: the width of the surface. + /// - `height`: the height of the surface. + /// - `format`: the [`SDL_PixelFormat`] for the new surface's pixel format. + /// - `pixels`: a pointer to existing pixel data. + /// - `pitch`: the number of bytes between each row, including padding. + /// + /// ## Return value + /// Returns the new [`SDL_Surface`] structure that is created or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateSurface`] + /// - [`SDL_DestroySurface`] + pub fn SDL_CreateSurfaceFrom( + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + format: SDL_PixelFormat, + pixels: *mut ::core::ffi::c_void, + pitch: ::core::ffi::c_int, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Free a surface. + /// + /// It is safe to pass NULL to this function. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] to free. + /// + /// ## Thread safety + /// No other thread should be using the surface when it is freed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateSurface`] + /// - [`SDL_CreateSurfaceFrom`] + pub fn SDL_DestroySurface(surface: *mut SDL_Surface); +} + +unsafe extern "C" { + /// Get the properties associated with a surface. + /// + /// The following properties are understood by SDL: + /// + /// - [`SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT`]\: for HDR10 and floating point + /// surfaces, this defines the value of 100% diffuse white, with higher + /// values being displayed in the High Dynamic Range headroom. This defaults + /// to 203 for HDR10 surfaces and 1.0 for floating point surfaces. + /// - [`SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT`]\: for HDR10 and floating point + /// surfaces, this defines the maximum dynamic range used by the content, in + /// terms of the SDR white point. This defaults to 0.0, which disables tone + /// mapping. + /// - [`SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`]\: the tone mapping operator + /// used when compressing from a surface with high dynamic range to another + /// with lower dynamic range. Currently this supports "chrome", which uses + /// the same tone mapping that Chrome uses for HDR content, the form "*=N", + /// where N is a floating point scale factor applied in linear space, and + /// "none", which disables tone mapping. This defaults to "chrome". + /// - [`SDL_PROP_SURFACE_HOTSPOT_X_NUMBER`]\: the hotspot pixel offset from the + /// left edge of the image, if this surface is being used as a cursor. + /// - [`SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER`]\: the hotspot pixel offset from the + /// top edge of the image, if this surface is being used as a cursor. + /// - [`SDL_PROP_SURFACE_ROTATION_FLOAT`]\: the number of degrees a surface's data + /// is meant to be rotated clockwise to make the image right-side up. Default + /// 0. This is used by the camera API, if a mobile device is oriented + /// differently than what its camera provides (i.e. - the camera always + /// provides portrait images but the phone is being held in landscape + /// orientation). Since SDL 3.4.0. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSurfaceProperties(surface: *mut SDL_Surface) -> SDL_PropertiesID; +} + +pub const SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT: *const ::core::ffi::c_char = + c"SDL.surface.SDR_white_point".as_ptr(); + +pub const SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char = + c"SDL.surface.HDR_headroom".as_ptr(); + +pub const SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING: *const ::core::ffi::c_char = + c"SDL.surface.tonemap".as_ptr(); + +pub const SDL_PROP_SURFACE_HOTSPOT_X_NUMBER: *const ::core::ffi::c_char = + c"SDL.surface.hotspot.x".as_ptr(); + +pub const SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER: *const ::core::ffi::c_char = + c"SDL.surface.hotspot.y".as_ptr(); + +pub const SDL_PROP_SURFACE_ROTATION_FLOAT: *const ::core::ffi::c_char = + c"SDL.surface.rotation".as_ptr(); + +unsafe extern "C" { + /// Set the colorspace used by a surface. + /// + /// Setting the colorspace doesn't change the pixels, only how they are + /// interpreted in color operations. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `colorspace`: an [`SDL_Colorspace`] value describing the surface + /// colorspace. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceColorspace`] + pub fn SDL_SetSurfaceColorspace( + surface: *mut SDL_Surface, + colorspace: SDL_Colorspace, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the colorspace used by a surface. + /// + /// The colorspace defaults to [`SDL_COLORSPACE_SRGB_LINEAR`] for floating point + /// formats, [`SDL_COLORSPACE_HDR10`] for 10-bit formats, [`SDL_COLORSPACE_SRGB`] for + /// other RGB surfaces and [`SDL_COLORSPACE_BT709_FULL`] for YUV textures. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// + /// ## Return value + /// Returns the colorspace used by the surface, or [`SDL_COLORSPACE_UNKNOWN`] if + /// the surface is NULL. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfaceColorspace`] + pub fn SDL_GetSurfaceColorspace(surface: *mut SDL_Surface) -> SDL_Colorspace; +} + +unsafe extern "C" { + /// Create a palette and associate it with a surface. + /// + /// This function creates a palette compatible with the provided surface. The + /// palette is then returned for you to modify, and the surface will + /// automatically use the new palette in future operations. You do not need to + /// destroy the returned palette, it will be freed when the reference count + /// reaches 0, usually when the surface is destroyed. + /// + /// Bitmap surfaces (with format [`SDL_PIXELFORMAT_INDEX1LSB`] or + /// [`SDL_PIXELFORMAT_INDEX1MSB`]) will have the palette initialized with 0 as + /// white and 1 as black. Other surfaces will get a palette initialized with + /// white in every entry. + /// + /// If this function is called for a surface that already has a palette, a new + /// palette will be created to replace it. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// + /// ## Return value + /// Returns a new [`SDL_Palette`] structure on success or NULL on failure (e.g. if + /// the surface didn't have an index format); call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetPaletteColors`] + pub fn SDL_CreateSurfacePalette(surface: *mut SDL_Surface) -> *mut SDL_Palette; +} + +unsafe extern "C" { + /// Set the palette used by a surface. + /// + /// Setting the palette keeps an internal reference to the palette, which can + /// be safely destroyed afterwards. + /// + /// A single palette can be shared with many surfaces. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `palette`: the [`SDL_Palette`] structure to use. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreatePalette`] + /// - [`SDL_GetSurfacePalette`] + pub fn SDL_SetSurfacePalette( + surface: *mut SDL_Surface, + palette: *mut SDL_Palette, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the palette used by a surface. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// + /// ## Return value + /// Returns a pointer to the palette used by the surface, or NULL if there is + /// no palette used. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfacePalette`] + pub fn SDL_GetSurfacePalette(surface: *mut SDL_Surface) -> *mut SDL_Palette; +} + +unsafe extern "C" { + /// Add an alternate version of a surface. + /// + /// This function adds an alternate version of this surface, usually used for + /// content with high DPI representations like cursors or icons. The size, + /// format, and content do not need to match the original surface, and these + /// alternate versions will not be updated when the original surface changes. + /// + /// This function adds a reference to the alternate version, so you should call + /// [`SDL_DestroySurface()`] on the image after this call. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `image`: a pointer to an alternate [`SDL_Surface`] to associate with this + /// surface. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RemoveSurfaceAlternateImages`] + /// - [`SDL_GetSurfaceImages`] + /// - [`SDL_SurfaceHasAlternateImages`] + pub fn SDL_AddSurfaceAlternateImage( + surface: *mut SDL_Surface, + image: *mut SDL_Surface, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether a surface has alternate versions available. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// + /// ## Return value + /// Returns true if alternate versions are available or false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddSurfaceAlternateImage`] + /// - [`SDL_RemoveSurfaceAlternateImages`] + /// - [`SDL_GetSurfaceImages`] + pub fn SDL_SurfaceHasAlternateImages(surface: *mut SDL_Surface) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get an array including all versions of a surface. + /// + /// This returns all versions of a surface, with the surface being queried as + /// the first element in the returned array. + /// + /// Freeing the array of surfaces does not affect the surfaces in the array. + /// They are still referenced by the surface being queried and will be cleaned + /// up normally. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// - `count`: a pointer filled in with the number of surface pointers + /// returned, may be NULL. + /// + /// ## Return value + /// Returns a NULL terminated array of [`SDL_Surface`] pointers or NULL on + /// failure; call [`SDL_GetError()`] for more information. This should be + /// freed with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddSurfaceAlternateImage`] + /// - [`SDL_RemoveSurfaceAlternateImages`] + /// - [`SDL_SurfaceHasAlternateImages`] + pub fn SDL_GetSurfaceImages( + surface: *mut SDL_Surface, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut SDL_Surface; +} + +unsafe extern "C" { + /// Remove all alternate versions of a surface. + /// + /// This function removes a reference from all the alternative versions, + /// destroying them if this is the last reference to them. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddSurfaceAlternateImage`] + /// - [`SDL_GetSurfaceImages`] + /// - [`SDL_SurfaceHasAlternateImages`] + pub fn SDL_RemoveSurfaceAlternateImages(surface: *mut SDL_Surface); +} + +unsafe extern "C" { + /// Set up a surface for directly accessing the pixels. + /// + /// Between calls to [`SDL_LockSurface()`] / [`SDL_UnlockSurface()`], you can write to + /// and read from `surface->pixels`, using the pixel format stored in + /// `surface->format`. Once you are done accessing the surface, you should use + /// [`SDL_UnlockSurface()`] to release it. + /// + /// Not all surfaces require locking. If `SDL_MUSTLOCK(surface)` evaluates to + /// 0, then you can read and write to the surface at any time, and the pixel + /// format of the surface will not change. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to be locked. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. The locking referred to by this function + /// is making the pixels available for direct access, not + /// thread-safe locking. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MUSTLOCK`] + /// - [`SDL_UnlockSurface`] + pub fn SDL_LockSurface(surface: *mut SDL_Surface) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Release a surface after directly accessing the pixels. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to be unlocked. + /// + /// ## Thread safety + /// This function is not thread safe. The locking referred to by + /// this function is making the pixels available for direct + /// access, not thread-safe locking. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LockSurface`] + pub fn SDL_UnlockSurface(surface: *mut SDL_Surface); +} + +unsafe extern "C" { + /// Load a BMP or PNG image from a seekable SDL data stream. + /// + /// The new surface should be freed with [`SDL_DestroySurface()`]. Not doing so + /// will result in a memory leak. + /// + /// ## Parameters + /// - `src`: the data stream for the surface. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_Surface`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + /// - [`SDL_LoadSurface`] + pub fn SDL_LoadSurface_IO( + src: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Load a BMP or PNG image from a file. + /// + /// The new surface should be freed with [`SDL_DestroySurface()`]. Not doing so + /// will result in a memory leak. + /// + /// ## Parameters + /// - `file`: the file to load. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_Surface`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + /// - [`SDL_LoadSurface_IO`] + pub fn SDL_LoadSurface(file: *const ::core::ffi::c_char) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Load a BMP image from a seekable SDL data stream. + /// + /// The new surface should be freed with [`SDL_DestroySurface()`]. Not doing so + /// will result in a memory leak. + /// + /// ## Parameters + /// - `src`: the data stream for the surface. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_Surface`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + /// - [`SDL_LoadBMP`] + /// - [`SDL_SaveBMP_IO`] + pub fn SDL_LoadBMP_IO( + src: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Load a BMP image from a file. + /// + /// The new surface should be freed with [`SDL_DestroySurface()`]. Not doing so + /// will result in a memory leak. + /// + /// ## Parameters + /// - `file`: the BMP file to load. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_Surface`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + /// - [`SDL_LoadBMP_IO`] + /// - [`SDL_SaveBMP`] + pub fn SDL_LoadBMP(file: *const ::core::ffi::c_char) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Save a surface to a seekable SDL data stream in BMP format. + /// + /// Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + /// BMP directly. Other RGB formats with 8-bit or higher get converted to a + /// 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + /// surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + /// not supported. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure containing the image to be saved. + /// - `dst`: a data stream to save to. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `dst` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadBMP_IO`] + /// - [`SDL_SaveBMP`] + pub fn SDL_SaveBMP_IO( + surface: *mut SDL_Surface, + dst: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Save a surface to a file in BMP format. + /// + /// Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + /// BMP directly. Other RGB formats with 8-bit or higher get converted to a + /// 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + /// surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + /// not supported. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure containing the image to be saved. + /// - `file`: a file to save to. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_LoadBMP`] + /// - [`SDL_SaveBMP_IO`] + pub fn SDL_SaveBMP( + surface: *mut SDL_Surface, + file: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Load a PNG image from a seekable SDL data stream. + /// + /// This is intended as a convenience function for loading images from trusted + /// sources. If you want to load arbitrary images you should use libpng or + /// another image loading library designed with security in mind. + /// + /// The new surface should be freed with [`SDL_DestroySurface()`]. Not doing so + /// will result in a memory leak. + /// + /// ## Parameters + /// - `src`: the data stream for the surface. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_Surface`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + /// - [`SDL_LoadPNG`] + /// - [`SDL_SavePNG_IO`] + pub fn SDL_LoadPNG_IO( + src: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Load a PNG image from a file. + /// + /// This is intended as a convenience function for loading images from trusted + /// sources. If you want to load arbitrary images you should use libpng or + /// another image loading library designed with security in mind. + /// + /// The new surface should be freed with [`SDL_DestroySurface()`]. Not doing so + /// will result in a memory leak. + /// + /// ## Parameters + /// - `file`: the PNG file to load. + /// + /// ## Return value + /// Returns a pointer to a new [`SDL_Surface`] structure or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + /// - [`SDL_LoadPNG_IO`] + /// - [`SDL_SavePNG`] + pub fn SDL_LoadPNG(file: *const ::core::ffi::c_char) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Save a surface to a seekable SDL data stream in PNG format. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure containing the image to be saved. + /// - `dst`: a data stream to save to. + /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `dst` before returning, even + /// in the case of an error. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_LoadPNG_IO`] + /// - [`SDL_SavePNG`] + pub fn SDL_SavePNG_IO( + surface: *mut SDL_Surface, + dst: *mut SDL_IOStream, + closeio: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Save a surface to a file in PNG format. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure containing the image to be saved. + /// - `file`: a file to save to. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_LoadPNG`] + /// - [`SDL_SavePNG_IO`] + pub fn SDL_SavePNG( + surface: *mut SDL_Surface, + file: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the RLE acceleration hint for a surface. + /// + /// If RLE is enabled, color key and alpha blending blits are much faster, but + /// the surface must be locked before directly accessing the pixels. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to optimize. + /// - `enabled`: true to enable RLE acceleration, false to disable it. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurface`] + /// - [`SDL_LockSurface`] + /// - [`SDL_UnlockSurface`] + pub fn SDL_SetSurfaceRLE( + surface: *mut SDL_Surface, + enabled: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Returns whether the surface is RLE enabled. + /// + /// It is safe to pass a NULL `surface` here; it will return false. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// + /// ## Return value + /// Returns true if the surface is RLE enabled, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfaceRLE`] + pub fn SDL_SurfaceHasRLE(surface: *mut SDL_Surface) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the color key (transparent pixel) in a surface. + /// + /// The color key defines a pixel value that will be treated as transparent in + /// a blit. For example, one can use this to specify that cyan pixels should be + /// considered transparent, and therefore not rendered. + /// + /// It is a pixel of the format used by the surface, as generated by + /// [`SDL_MapRGB()`]. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `enabled`: true to enable color key, false to disable color key. + /// - `key`: the transparent pixel. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceColorKey`] + /// - [`SDL_SetSurfaceRLE`] + /// - [`SDL_SurfaceHasColorKey`] + pub fn SDL_SetSurfaceColorKey( + surface: *mut SDL_Surface, + enabled: ::core::primitive::bool, + key: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Returns whether the surface has a color key. + /// + /// It is safe to pass a NULL `surface` here; it will return false. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// + /// ## Return value + /// Returns true if the surface has a color key, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfaceColorKey`] + /// - [`SDL_GetSurfaceColorKey`] + pub fn SDL_SurfaceHasColorKey(surface: *mut SDL_Surface) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the color key (transparent pixel) for a surface. + /// + /// The color key is a pixel of the format used by the surface, as generated by + /// [`SDL_MapRGB()`]. + /// + /// If the surface doesn't have color key enabled this function returns false. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// - `key`: a pointer filled in with the transparent pixel. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfaceColorKey`] + /// - [`SDL_SurfaceHasColorKey`] + pub fn SDL_GetSurfaceColorKey( + surface: *mut SDL_Surface, + key: *mut Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an additional color value multiplied into blit operations. + /// + /// When this surface is blitted, during the blit operation each source color + /// channel is modulated by the appropriate color value according to the + /// following formula: + /// + /// `srcC = srcC * (color / 255)` + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `r`: the red color value multiplied into blit operations. + /// - `g`: the green color value multiplied into blit operations. + /// - `b`: the blue color value multiplied into blit operations. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceColorMod`] + /// - [`SDL_SetSurfaceAlphaMod`] + pub fn SDL_SetSurfaceColorMod( + surface: *mut SDL_Surface, + r: Uint8, + g: Uint8, + b: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the additional color value multiplied into blit operations. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// - `r`: a pointer filled in with the current red color value. + /// - `g`: a pointer filled in with the current green color value. + /// - `b`: a pointer filled in with the current blue color value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceAlphaMod`] + /// - [`SDL_SetSurfaceColorMod`] + pub fn SDL_GetSurfaceColorMod( + surface: *mut SDL_Surface, + r: *mut Uint8, + g: *mut Uint8, + b: *mut Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set an additional alpha value used in blit operations. + /// + /// When this surface is blitted, during the blit operation the source alpha + /// value is modulated by this alpha value according to the following formula: + /// + /// `srcA = srcA * (alpha / 255)` + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `alpha`: the alpha value multiplied into blit operations. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceAlphaMod`] + /// - [`SDL_SetSurfaceColorMod`] + pub fn SDL_SetSurfaceAlphaMod( + surface: *mut SDL_Surface, + alpha: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the additional alpha value used in blit operations. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// - `alpha`: a pointer filled in with the current alpha value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceColorMod`] + /// - [`SDL_SetSurfaceAlphaMod`] + pub fn SDL_GetSurfaceAlphaMod( + surface: *mut SDL_Surface, + alpha: *mut Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the blend mode used for blit operations. + /// + /// To copy a surface to another surface (or texture) without blending with the + /// existing data, the blendmode of the SOURCE surface should be set to + /// [`SDL_BLENDMODE_NONE`]. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to update. + /// - `blendMode`: the [`SDL_BlendMode`] to use for blit blending. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceBlendMode`] + pub fn SDL_SetSurfaceBlendMode( + surface: *mut SDL_Surface, + blendMode: SDL_BlendMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the blend mode used for blit operations. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to query. + /// - `blendMode`: a pointer filled in with the current [`SDL_BlendMode`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfaceBlendMode`] + pub fn SDL_GetSurfaceBlendMode( + surface: *mut SDL_Surface, + blendMode: *mut SDL_BlendMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the clipping rectangle for a surface. + /// + /// When `surface` is the destination of a blit, only the area within the clip + /// rectangle is drawn into. + /// + /// Note that blits are automatically clipped to the edges of the source and + /// destination surfaces. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure to be clipped. + /// - `rect`: the [`SDL_Rect`] structure representing the clipping rectangle, or + /// NULL to disable clipping. + /// + /// ## Return value + /// Returns true if the rectangle intersects the surface, otherwise false and + /// blits will be completely clipped. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetSurfaceClipRect`] + pub fn SDL_SetSurfaceClipRect( + surface: *mut SDL_Surface, + rect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the clipping rectangle for a surface. + /// + /// When `surface` is the destination of a blit, only the area within the clip + /// rectangle is drawn into. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] structure representing the surface to be + /// clipped. + /// - `rect`: an [`SDL_Rect`] structure filled in with the clipping rectangle for + /// the surface. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetSurfaceClipRect`] + pub fn SDL_GetSurfaceClipRect( + surface: *mut SDL_Surface, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Flip a surface vertically or horizontally. + /// + /// ## Parameters + /// - `surface`: the surface to flip. + /// - `flip`: the direction to flip. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_FlipSurface( + surface: *mut SDL_Surface, + flip: SDL_FlipMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return a copy of a surface rotated clockwise a number of degrees. + /// + /// The angle of rotation can be negative for counter-clockwise rotation. + /// + /// When the rotation isn't a multiple of 90 degrees, the resulting surface is + /// larger than the original, with the background filled in with the colorkey, + /// if available, or RGBA 255/255/255/0 if not. + /// + /// If `surface` has the [`SDL_PROP_SURFACE_ROTATION_FLOAT`] property set on it, + /// the new copy will have the adjusted value set: if the rotation property is + /// 90 and `angle` was 30, the new surface will have a property value of 60 + /// (that is: to be upright vs gravity, this surface needs to rotate 60 more + /// degrees). However, note that further rotations on the new surface in this + /// example will produce unexpected results, since the image will have resized + /// and padded to accommodate the not-90 degree angle. + /// + /// ## Parameters + /// - `surface`: the surface to rotate. + /// - `angle`: the rotation angle, in degrees. + /// + /// ## Return value + /// Returns a rotated copy of the surface or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_RotateSurface( + surface: *mut SDL_Surface, + angle: ::core::ffi::c_float, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Creates a new surface identical to the existing surface. + /// + /// If the original surface has alternate images, the new surface will have a + /// reference to them as well. + /// + /// The returned surface should be freed with [`SDL_DestroySurface()`]. + /// + /// ## Parameters + /// - `surface`: the surface to duplicate. + /// + /// ## Return value + /// Returns a copy of the surface or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + pub fn SDL_DuplicateSurface(surface: *mut SDL_Surface) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Creates a new surface identical to the existing surface, scaled to the + /// desired size. + /// + /// The returned surface should be freed with [`SDL_DestroySurface()`]. + /// + /// ## Parameters + /// - `surface`: the surface to duplicate and scale. + /// - `width`: the width of the new surface. + /// - `height`: the height of the new surface. + /// - `scaleMode`: the [`SDL_ScaleMode`] to be used. + /// + /// ## Return value + /// Returns a copy of the surface or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroySurface`] + pub fn SDL_ScaleSurface( + surface: *mut SDL_Surface, + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + scaleMode: SDL_ScaleMode, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Copy an existing surface to a new surface of the specified format. + /// + /// This function is used to optimize images for faster *repeat* blitting. This + /// is accomplished by converting the original and storing the result as a new + /// surface. The new, optimized surface can then be used as the source for + /// future blits, making them faster. + /// + /// If you are converting to an indexed surface and want to map colors to a + /// palette, you can use [`SDL_ConvertSurfaceAndColorspace()`] instead. + /// + /// If the original surface has alternate images, the new surface will have a + /// reference to them as well. + /// + /// ## Parameters + /// - `surface`: the existing [`SDL_Surface`] structure to convert. + /// - `format`: the new pixel format. + /// + /// ## Return value + /// Returns the new [`SDL_Surface`] structure that is created or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ConvertSurfaceAndColorspace`] + /// - [`SDL_DestroySurface`] + pub fn SDL_ConvertSurface( + surface: *mut SDL_Surface, + format: SDL_PixelFormat, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Copy an existing surface to a new surface of the specified format and + /// colorspace. + /// + /// This function converts an existing surface to a new format and colorspace + /// and returns the new surface. This will perform any pixel format and + /// colorspace conversion needed. + /// + /// If the original surface has alternate images, the new surface will have a + /// reference to them as well. + /// + /// ## Parameters + /// - `surface`: the existing [`SDL_Surface`] structure to convert. + /// - `format`: the new pixel format. + /// - `palette`: an optional palette to use for indexed formats, may be NULL. + /// - `colorspace`: the new colorspace. + /// - `props`: an [`SDL_PropertiesID`] with additional color properties, or 0. + /// + /// ## Return value + /// Returns the new [`SDL_Surface`] structure that is created or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ConvertSurface`] + /// - [`SDL_DestroySurface`] + pub fn SDL_ConvertSurfaceAndColorspace( + surface: *mut SDL_Surface, + format: SDL_PixelFormat, + palette: *mut SDL_Palette, + colorspace: SDL_Colorspace, + props: SDL_PropertiesID, + ) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Copy a block of pixels of one format to another format. + /// + /// ## Parameters + /// - `width`: the width of the block to copy, in pixels. + /// - `height`: the height of the block to copy, in pixels. + /// - `src_format`: an [`SDL_PixelFormat`] value of the `src` pixels format. + /// - `src`: a pointer to the source pixels. + /// - `src_pitch`: the pitch of the source pixels, in bytes. + /// - `dst_format`: an [`SDL_PixelFormat`] value of the `dst` pixels format. + /// - `dst`: a pointer to be filled in with new pixel data. + /// - `dst_pitch`: the pitch of the destination pixels, in bytes. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// The same destination pixels should not be used from two + /// threads at once. It is safe to use the same source pixels + /// from multiple threads. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ConvertPixelsAndColorspace`] + pub fn SDL_ConvertPixels( + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + src_format: SDL_PixelFormat, + src: *const ::core::ffi::c_void, + src_pitch: ::core::ffi::c_int, + dst_format: SDL_PixelFormat, + dst: *mut ::core::ffi::c_void, + dst_pitch: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy a block of pixels of one format and colorspace to another format and + /// colorspace. + /// + /// ## Parameters + /// - `width`: the width of the block to copy, in pixels. + /// - `height`: the height of the block to copy, in pixels. + /// - `src_format`: an [`SDL_PixelFormat`] value of the `src` pixels format. + /// - `src_colorspace`: an [`SDL_Colorspace`] value describing the colorspace of + /// the `src` pixels. + /// - `src_properties`: an [`SDL_PropertiesID`] with additional source color + /// properties, or 0. + /// - `src`: a pointer to the source pixels. + /// - `src_pitch`: the pitch of the source pixels, in bytes. + /// - `dst_format`: an [`SDL_PixelFormat`] value of the `dst` pixels format. + /// - `dst_colorspace`: an [`SDL_Colorspace`] value describing the colorspace of + /// the `dst` pixels. + /// - `dst_properties`: an [`SDL_PropertiesID`] with additional destination color + /// properties, or 0. + /// - `dst`: a pointer to be filled in with new pixel data. + /// - `dst_pitch`: the pitch of the destination pixels, in bytes. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// The same destination pixels should not be used from two + /// threads at once. It is safe to use the same source pixels + /// from multiple threads. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ConvertPixels`] + pub fn SDL_ConvertPixelsAndColorspace( + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + src_format: SDL_PixelFormat, + src_colorspace: SDL_Colorspace, + src_properties: SDL_PropertiesID, + src: *const ::core::ffi::c_void, + src_pitch: ::core::ffi::c_int, + dst_format: SDL_PixelFormat, + dst_colorspace: SDL_Colorspace, + dst_properties: SDL_PropertiesID, + dst: *mut ::core::ffi::c_void, + dst_pitch: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Premultiply the alpha on a block of pixels. + /// + /// This is safe to use with src == dst, but not for other overlapping areas. + /// + /// ## Parameters + /// - `width`: the width of the block to convert, in pixels. + /// - `height`: the height of the block to convert, in pixels. + /// - `src_format`: an [`SDL_PixelFormat`] value of the `src` pixels format. + /// - `src`: a pointer to the source pixels. + /// - `src_pitch`: the pitch of the source pixels, in bytes. + /// - `dst_format`: an [`SDL_PixelFormat`] value of the `dst` pixels format. + /// - `dst`: a pointer to be filled in with premultiplied pixel data. + /// - `dst_pitch`: the pitch of the destination pixels, in bytes. + /// - `linear`: true to convert from sRGB to linear space for the alpha + /// multiplication, false to do multiplication in sRGB space. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// The same destination pixels should not be used from two + /// threads at once. It is safe to use the same source pixels + /// from multiple threads. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_PremultiplyAlpha( + width: ::core::ffi::c_int, + height: ::core::ffi::c_int, + src_format: SDL_PixelFormat, + src: *const ::core::ffi::c_void, + src_pitch: ::core::ffi::c_int, + dst_format: SDL_PixelFormat, + dst: *mut ::core::ffi::c_void, + dst_pitch: ::core::ffi::c_int, + linear: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Premultiply the alpha in a surface. + /// + /// This is safe to use with src == dst, but not for other overlapping areas. + /// + /// ## Parameters + /// - `surface`: the surface to modify. + /// - `linear`: true to convert from sRGB to linear space for the alpha + /// multiplication, false to do multiplication in sRGB space. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_PremultiplySurfaceAlpha( + surface: *mut SDL_Surface, + linear: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Clear a surface with a specific color, with floating point precision. + /// + /// This function handles all surface formats, and ignores any clip rectangle. + /// + /// If the surface is YUV, the color is assumed to be in the sRGB colorspace, + /// otherwise the color is assumed to be in the colorspace of the surface. + /// + /// ## Parameters + /// - `surface`: the [`SDL_Surface`] to clear. + /// - `r`: the red component of the pixel, normally in the range 0-1. + /// - `g`: the green component of the pixel, normally in the range 0-1. + /// - `b`: the blue component of the pixel, normally in the range 0-1. + /// - `a`: the alpha component of the pixel, normally in the range 0-1. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ClearSurface( + surface: *mut SDL_Surface, + r: ::core::ffi::c_float, + g: ::core::ffi::c_float, + b: ::core::ffi::c_float, + a: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a fast fill of a rectangle with a specific color. + /// + /// `color` should be a pixel of the format used by the surface, and can be + /// generated by [`SDL_MapRGB()`] or [`SDL_MapRGBA()`]. If the color value contains an + /// alpha component then the destination is simply filled with that alpha + /// information, no blending takes place. + /// + /// If there is a clip rectangle set on the destination (set via + /// [`SDL_SetSurfaceClipRect()`]), then this function will fill based on the + /// intersection of the clip rectangle and `rect`. + /// + /// ## Parameters + /// - `dst`: the [`SDL_Surface`] structure that is the drawing target. + /// - `rect`: the [`SDL_Rect`] structure representing the rectangle to fill, or + /// NULL to fill the entire surface. + /// - `color`: the color to fill with. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_FillSurfaceRects`] + pub fn SDL_FillSurfaceRect( + dst: *mut SDL_Surface, + rect: *const SDL_Rect, + color: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a fast fill of a set of rectangles with a specific color. + /// + /// `color` should be a pixel of the format used by the surface, and can be + /// generated by [`SDL_MapRGB()`] or [`SDL_MapRGBA()`]. If the color value contains an + /// alpha component then the destination is simply filled with that alpha + /// information, no blending takes place. + /// + /// If there is a clip rectangle set on the destination (set via + /// [`SDL_SetSurfaceClipRect()`]), then this function will fill based on the + /// intersection of the clip rectangle and `rect`. + /// + /// ## Parameters + /// - `dst`: the [`SDL_Surface`] structure that is the drawing target. + /// - `rects`: an array of [`SDL_Rect`]s representing the rectangles to fill. + /// - `count`: the number of rectangles in the array. + /// - `color`: the color to fill with. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_FillSurfaceRect`] + pub fn SDL_FillSurfaceRects( + dst: *mut SDL_Surface, + rects: *const SDL_Rect, + count: ::core::ffi::c_int, + color: Uint32, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Performs a fast blit from the source surface to the destination surface + /// with clipping. + /// + /// If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or + /// `dst`) is copied while ensuring clipping to `dst->clip_rect`. + /// + /// The blit function should not be called on a locked surface. + /// + /// The blit semantics for surfaces with and without blending and colorkey are + /// defined as follows: + /// + /// ```text + /// RGBA->RGB: + /// Source surface blend mode set to SDL_BLENDMODE_BLEND: + /// alpha-blend (using the source alpha-channel and per-surface alpha) + /// SDL_SRCCOLORKEY ignored. + /// Source surface blend mode set to SDL_BLENDMODE_NONE: + /// copy RGB. + /// if SDL_SRCCOLORKEY set, only copy the pixels that do not match the + /// RGB values of the source color key, ignoring alpha in the + /// comparison. + /// + /// RGB->RGBA: + /// Source surface blend mode set to SDL_BLENDMODE_BLEND: + /// alpha-blend (using the source per-surface alpha) + /// Source surface blend mode set to SDL_BLENDMODE_NONE: + /// copy RGB, set destination alpha to source per-surface alpha value. + /// both: + /// if SDL_SRCCOLORKEY set, only copy the pixels that do not match the + /// source color key. + /// + /// RGBA->RGBA: + /// Source surface blend mode set to SDL_BLENDMODE_BLEND: + /// alpha-blend (using the source alpha-channel and per-surface alpha) + /// SDL_SRCCOLORKEY ignored. + /// Source surface blend mode set to SDL_BLENDMODE_NONE: + /// copy all of RGBA to the destination. + /// if SDL_SRCCOLORKEY set, only copy the pixels that do not match the + /// RGB values of the source color key, ignoring alpha in the + /// comparison. + /// + /// RGB->RGB: + /// Source surface blend mode set to SDL_BLENDMODE_BLEND: + /// alpha-blend (using the source per-surface alpha) + /// Source surface blend mode set to SDL_BLENDMODE_NONE: + /// copy RGB. + /// both: + /// if SDL_SRCCOLORKEY set, only copy the pixels that do not match the + /// source color key. + /// ``` + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, or NULL to copy the entire surface. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the x and y position in + /// the destination surface, or NULL for (0,0). The width and + /// height are ignored, and are copied from `srcrect`. If you + /// want a specific width and height, you should use + /// [`SDL_BlitSurfaceScaled()`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurfaceScaled`] + pub fn SDL_BlitSurface( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform low-level surface blitting only. + /// + /// This is a semi-private blit function and it performs low-level surface + /// blitting, assuming the input rectangles have already been clipped. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, may not be NULL. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, may not be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurface`] + pub fn SDL_BlitSurfaceUnchecked( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a scaled blit to a destination surface, which may be of a different + /// format. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, or NULL to copy the entire surface. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, or NULL to fill the entire + /// destination surface. + /// - `scaleMode`: the [`SDL_ScaleMode`] to be used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurface`] + pub fn SDL_BlitSurfaceScaled( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + scaleMode: SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform low-level surface scaled blitting only. + /// + /// This is a semi-private function and it performs low-level surface blitting, + /// assuming the input rectangles have already been clipped. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, may not be NULL. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, may not be NULL. + /// - `scaleMode`: the [`SDL_ScaleMode`] to be used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurfaceScaled`] + pub fn SDL_BlitSurfaceUncheckedScaled( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + scaleMode: SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a stretched pixel copy from one surface to another. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, or NULL to copy the entire surface. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, or NULL to fill the entire + /// destination surface. + /// - `scaleMode`: the [`SDL_ScaleMode`] to be used. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_BlitSurfaceScaled`] + pub fn SDL_StretchSurface( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + scaleMode: SDL_ScaleMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a tiled blit to a destination surface, which may be of a different + /// format. + /// + /// The pixels in `srcrect` will be repeated as many times as needed to + /// completely fill `dstrect`. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, or NULL to copy the entire surface. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, or NULL to fill the entire surface. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurface`] + pub fn SDL_BlitSurfaceTiled( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a scaled and tiled blit to a destination surface, which may be of a + /// different format. + /// + /// The pixels in `srcrect` will be scaled and repeated as many times as needed + /// to completely fill `dstrect`. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be + /// copied, or NULL to copy the entire surface. + /// - `scale`: the scale used to transform srcrect into the destination + /// rectangle, e.g. a 32x32 texture with a scale of 2 would fill + /// 64x64 tiles. + /// - `scaleMode`: scale algorithm to be used. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, or NULL to fill the entire surface. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurface`] + pub fn SDL_BlitSurfaceTiledWithScale( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + scale: ::core::ffi::c_float, + scaleMode: SDL_ScaleMode, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Perform a scaled blit using the 9-grid algorithm to a destination surface, + /// which may be of a different format. + /// + /// The pixels in the source surface are split into a 3x3 grid, using the + /// different corner sizes for each corner, and the sides and center making up + /// the remaining pixels. The corners are then scaled using `scale` and fit + /// into the corners of the destination rectangle. The sides and center are + /// then stretched into place to cover the remaining destination rectangle. + /// + /// ## Parameters + /// - `src`: the [`SDL_Surface`] structure to be copied from. + /// - `srcrect`: the [`SDL_Rect`] structure representing the rectangle to be used + /// for the 9-grid, or NULL to use the entire surface. + /// - `left_width`: the width, in pixels, of the left corners in `srcrect`. + /// - `right_width`: the width, in pixels, of the right corners in `srcrect`. + /// - `top_height`: the height, in pixels, of the top corners in `srcrect`. + /// - `bottom_height`: the height, in pixels, of the bottom corners in + /// `srcrect`. + /// - `scale`: the scale used to transform the corner of `srcrect` into the + /// corner of `dstrect`, or 0.0f for an unscaled blit. + /// - `scaleMode`: scale algorithm to be used. + /// - `dst`: the [`SDL_Surface`] structure that is the blit target. + /// - `dstrect`: the [`SDL_Rect`] structure representing the target rectangle in + /// the destination surface, or NULL to fill the entire surface. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// Only one thread should be using the `src` and `dst` surfaces + /// at any given time. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_BlitSurface`] + pub fn SDL_BlitSurface9Grid( + src: *mut SDL_Surface, + srcrect: *const SDL_Rect, + left_width: ::core::ffi::c_int, + right_width: ::core::ffi::c_int, + top_height: ::core::ffi::c_int, + bottom_height: ::core::ffi::c_int, + scale: ::core::ffi::c_float, + scaleMode: SDL_ScaleMode, + dst: *mut SDL_Surface, + dstrect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Map an RGB triple to an opaque pixel value for a surface. + /// + /// This function maps the RGB color value to the specified pixel format and + /// returns the pixel value best approximating the given RGB color value for + /// the given pixel format. + /// + /// If the surface has a palette, the index of the closest matching color in + /// the palette will be returned. + /// + /// If the surface pixel format has an alpha component it will be returned as + /// all 1 bits (fully opaque). + /// + /// If the pixel format bpp (color depth) is less than 32-bpp then the unused + /// upper bits of the return value can safely be ignored (e.g., with a 16-bpp + /// format the return value can be assigned to a Uint16, and similarly a Uint8 + /// for an 8-bpp format). + /// + /// ## Parameters + /// - `surface`: the surface to use for the pixel format and palette. + /// - `r`: the red component of the pixel in the range 0-255. + /// - `g`: the green component of the pixel in the range 0-255. + /// - `b`: the blue component of the pixel in the range 0-255. + /// + /// ## Return value + /// Returns a pixel value. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MapSurfaceRGBA`] + pub fn SDL_MapSurfaceRGB(surface: *mut SDL_Surface, r: Uint8, g: Uint8, b: Uint8) -> Uint32; +} + +unsafe extern "C" { + /// Map an RGBA quadruple to a pixel value for a surface. + /// + /// This function maps the RGBA color value to the specified pixel format and + /// returns the pixel value best approximating the given RGBA color value for + /// the given pixel format. + /// + /// If the surface pixel format has no alpha component the alpha value will be + /// ignored (as it will be in formats with a palette). + /// + /// If the surface has a palette, the index of the closest matching color in + /// the palette will be returned. + /// + /// If the pixel format bpp (color depth) is less than 32-bpp then the unused + /// upper bits of the return value can safely be ignored (e.g., with a 16-bpp + /// format the return value can be assigned to a Uint16, and similarly a Uint8 + /// for an 8-bpp format). + /// + /// ## Parameters + /// - `surface`: the surface to use for the pixel format and palette. + /// - `r`: the red component of the pixel in the range 0-255. + /// - `g`: the green component of the pixel in the range 0-255. + /// - `b`: the blue component of the pixel in the range 0-255. + /// - `a`: the alpha component of the pixel in the range 0-255. + /// + /// ## Return value + /// Returns a pixel value. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MapSurfaceRGB`] + pub fn SDL_MapSurfaceRGBA( + surface: *mut SDL_Surface, + r: Uint8, + g: Uint8, + b: Uint8, + a: Uint8, + ) -> Uint32; +} + +unsafe extern "C" { + /// Retrieves a single pixel from a surface. + /// + /// This function prioritizes correctness over speed: it is suitable for unit + /// tests, but is not intended for use in a game engine. + /// + /// Like [`SDL_GetRGBA`], this uses the entire 0..255 range when converting color + /// components from pixel formats with less than 8 bits per RGB component. + /// + /// ## Parameters + /// - `surface`: the surface to read. + /// - `x`: the horizontal coordinate, 0 <= x < width. + /// - `y`: the vertical coordinate, 0 <= y < height. + /// - `r`: a pointer filled in with the red channel, 0-255, or NULL to ignore + /// this channel. + /// - `g`: a pointer filled in with the green channel, 0-255, or NULL to + /// ignore this channel. + /// - `b`: a pointer filled in with the blue channel, 0-255, or NULL to + /// ignore this channel. + /// - `a`: a pointer filled in with the alpha channel, 0-255, or NULL to + /// ignore this channel. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadSurfacePixel( + surface: *mut SDL_Surface, + x: ::core::ffi::c_int, + y: ::core::ffi::c_int, + r: *mut Uint8, + g: *mut Uint8, + b: *mut Uint8, + a: *mut Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Retrieves a single pixel from a surface. + /// + /// This function prioritizes correctness over speed: it is suitable for unit + /// tests, but is not intended for use in a game engine. + /// + /// ## Parameters + /// - `surface`: the surface to read. + /// - `x`: the horizontal coordinate, 0 <= x < width. + /// - `y`: the vertical coordinate, 0 <= y < height. + /// - `r`: a pointer filled in with the red channel, normally in the range + /// 0-1, or NULL to ignore this channel. + /// - `g`: a pointer filled in with the green channel, normally in the range + /// 0-1, or NULL to ignore this channel. + /// - `b`: a pointer filled in with the blue channel, normally in the range + /// 0-1, or NULL to ignore this channel. + /// - `a`: a pointer filled in with the alpha channel, normally in the range + /// 0-1, or NULL to ignore this channel. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ReadSurfacePixelFloat( + surface: *mut SDL_Surface, + x: ::core::ffi::c_int, + y: ::core::ffi::c_int, + r: *mut ::core::ffi::c_float, + g: *mut ::core::ffi::c_float, + b: *mut ::core::ffi::c_float, + a: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Writes a single pixel to a surface. + /// + /// This function prioritizes correctness over speed: it is suitable for unit + /// tests, but is not intended for use in a game engine. + /// + /// Like [`SDL_MapRGBA`], this uses the entire 0..255 range when converting color + /// components from pixel formats with less than 8 bits per RGB component. + /// + /// ## Parameters + /// - `surface`: the surface to write. + /// - `x`: the horizontal coordinate, 0 <= x < width. + /// - `y`: the vertical coordinate, 0 <= y < height. + /// - `r`: the red channel value, 0-255. + /// - `g`: the green channel value, 0-255. + /// - `b`: the blue channel value, 0-255. + /// - `a`: the alpha channel value, 0-255. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteSurfacePixel( + surface: *mut SDL_Surface, + x: ::core::ffi::c_int, + y: ::core::ffi::c_int, + r: Uint8, + g: Uint8, + b: Uint8, + a: Uint8, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Writes a single pixel to a surface. + /// + /// This function prioritizes correctness over speed: it is suitable for unit + /// tests, but is not intended for use in a game engine. + /// + /// ## Parameters + /// - `surface`: the surface to write. + /// - `x`: the horizontal coordinate, 0 <= x < width. + /// - `y`: the vertical coordinate, 0 <= y < height. + /// - `r`: the red channel value, normally in the range 0-1. + /// - `g`: the green channel value, normally in the range 0-1. + /// - `b`: the blue channel value, normally in the range 0-1. + /// - `a`: the alpha channel value, normally in the range 0-1. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function can be called on different threads with + /// different surfaces. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_WriteSurfacePixelFloat( + surface: *mut SDL_Surface, + x: ::core::ffi::c_int, + y: ::core::ffi::c_int, + r: ::core::ffi::c_float, + g: ::core::ffi::c_float, + b: ::core::ffi::c_float, + a: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/system.rs b/vendor/sdl3-sys/src/generated/system.rs new file mode 100644 index 00000000..029a229e --- /dev/null +++ b/vendor/sdl3-sys/src/generated/system.rs @@ -0,0 +1,1020 @@ +//! Platform-specific SDL API functions. These are functions that deal with +//! needs of specific operating systems, that didn't make sense to offer as +//! platform-independent, generic APIs. +//! +//! Most apps can make do without these functions, but they can be useful for +//! integrating with other parts of a specific system, adding platform-specific +//! polish to an app, or solving problems that only affect one target. + +use super::stdinc::*; + +use super::error::*; + +use super::keyboard::*; + +use super::video::*; + +apply_cfg!(#[cfg(any(doc, windows))] => { + apply_cfg!(#[cfg(feature = "use-windows-sys-v0-59")] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(windows)))] + /// (`sdl3-sys`) Enable a `use-windows-sys-*` feature to alias this to `MSG` from the `windows-sys` crate. Otherwise it's an opaque struct. + pub type MSG = ::windows_sys_v0_59::Win32::UI::WindowsAndMessaging::MSG; + }); + + apply_cfg!(#[cfg(not(feature = "use-windows-sys-v0-59"))] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(windows)))] + /// (`sdl3-sys`) Enable a `use-windows-sys-*` feature to alias this to `MSG` from the `windows-sys` crate. Otherwise it's an opaque struct. + pub type MSG = tagMSG; + + }); + + /// A callback to be used with [`SDL_SetWindowsMessageHook`]. + /// + /// This callback may modify the message, and should return true if the message + /// should continue to be processed, or false to prevent further processing. + /// + /// As this is processing a message directly from the Windows event loop, this + /// callback should do the minimum required work and return quickly. + /// + /// ## Parameters + /// - `userdata`: the app-defined pointer provided to + /// [`SDL_SetWindowsMessageHook`]. + /// - `msg`: a pointer to a Win32 event structure to process. + /// + /// ## Return value + /// Returns true to let event continue on, false to drop it. + /// + /// ## Thread safety + /// This may only be called (by SDL) from the thread handling the + /// Windows event loop. + /// + /// ## Availability + /// This datatype is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowsMessageHook`] + /// - [`SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP`] + pub type SDL_WindowsMessageHook = ::core::option::Option ::core::primitive::bool>; + + unsafe extern "C" { + /// Set a callback for every Windows message, run before TranslateMessage(). + /// + /// The callback may modify the message, and should return true if the message + /// should continue to be processed, or false to prevent further processing. + /// + /// ## Parameters + /// - `callback`: the [`SDL_WindowsMessageHook`] function to call. + /// - `userdata`: a pointer to pass to every iteration of `callback`. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_WindowsMessageHook`] + /// - [`SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP`] + pub fn SDL_SetWindowsMessageHook(callback: SDL_WindowsMessageHook, userdata: *mut ::core::ffi::c_void); + } + + #[doc(hidden)] + #[repr(C)] + pub struct tagMSG { _opaque: [::core::primitive::u8; 0] } + +}); + +apply_cfg!(#[cfg(any(doc, target_os = "windows", all(target_os = "windows", feature = "target-gdk")))] => { + unsafe extern "C" { + /// Get the D3D9 adapter index that matches the specified display. + /// + /// The returned adapter index can be passed to `IDirect3D9::CreateDevice` and + /// controls on which monitor a full screen application will appear. + /// + /// ## Parameters + /// - `displayID`: the instance of the display to query. + /// + /// ## Return value + /// Returns the D3D9 adapter index on success or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetDirect3D9AdapterIndex(displayID: SDL_DisplayID) -> ::core::ffi::c_int; + } + + unsafe extern "C" { + /// Get the DXGI Adapter and Output indices for the specified display. + /// + /// The DXGI Adapter and Output indices can be passed to `EnumAdapters` and + /// `EnumOutputs` respectively to get the objects required to create a DX10 or + /// DX11 device and swap chain. + /// + /// ## Parameters + /// - `displayID`: the instance of the display to query. + /// - `adapterIndex`: a pointer to be filled in with the adapter index. + /// - `outputIndex`: a pointer to be filled in with the output index. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetDXGIOutputInfo(displayID: SDL_DisplayID, adapterIndex: *mut ::core::ffi::c_int, outputIndex: *mut ::core::ffi::c_int) -> ::core::primitive::bool; + } + +}); + +apply_cfg!(#[cfg(feature = "use-x11-v2")] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable either a `use-x11-*` or a `use-x11-dl-*` feature to alias this to `XEvent` from the `x11` or `x11-dl` crates, respectively. Otherwise it's an opaque struct. + pub type XEvent = ::x11_v2::xlib::XEvent; +}); + +apply_cfg!(#[cfg(all(not(feature = "use-x11-v2"), feature = "use-x11-dl-v2"))] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable either a `use-x11-*` or a `use-x11-dl-*` feature to alias this to `XEvent` from the `x11` or `x11-dl` crates, respectively. Otherwise it's an opaque struct. + pub type XEvent = ::x11_dl_v2::xlib::XEvent; +}); + +apply_cfg!(#[cfg(not(any(feature = "use-x11-dl-v2", feature = "use-x11-v2")))] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable either a `use-x11-*` or a `use-x11-dl-*` feature to alias this to `XEvent` from the `x11` or `x11-dl` crates, respectively. Otherwise it's an opaque struct. + pub type XEvent = _XEvent; + +}); + +/// A callback to be used with [`SDL_SetX11EventHook`]. +/// +/// This callback may modify the event, and should return true if the event +/// should continue to be processed, or false to prevent further processing. +/// +/// As this is processing an event directly from the X11 event loop, this +/// callback should do the minimum required work and return quickly. +/// +/// ## Parameters +/// - `userdata`: the app-defined pointer provided to [`SDL_SetX11EventHook`]. +/// - `xevent`: a pointer to an Xlib XEvent union to process. +/// +/// ## Return value +/// Returns true to let event continue on, false to drop it. +/// +/// ## Thread safety +/// This may only be called (by SDL) from the thread handling the +/// X11 event loop. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetX11EventHook`] +pub type SDL_X11EventHook = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + xevent: *mut XEvent, + ) -> ::core::primitive::bool, +>; + +unsafe extern "C" { + /// Set a callback for every X11 event. + /// + /// The callback may modify the event, and should return true if the event + /// should continue to be processed, or false to prevent further processing. + /// + /// ## Parameters + /// - `callback`: the [`SDL_X11EventHook`] function to call. + /// - `userdata`: a pointer to pass to every iteration of `callback`. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetX11EventHook(callback: SDL_X11EventHook, userdata: *mut ::core::ffi::c_void); +} + +apply_cfg!(#[cfg(any(doc, target_os = "linux"))] => { + unsafe extern "C" { + /// Sets the UNIX nice value for a thread. + /// + /// This uses setpriority() if possible, and RealtimeKit if available. + /// + /// ## Parameters + /// - `threadID`: the Unix thread ID to change priority of. + /// - `priority`: the new, Unix-specific, priority value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetLinuxThreadPriority(threadID: Sint64, priority: ::core::ffi::c_int) -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Sets the priority (not nice level) and scheduling policy for a thread. + /// + /// This uses setpriority() if possible, and RealtimeKit if available. + /// + /// ## Parameters + /// - `threadID`: the Unix thread ID to change priority of. + /// - `sdlPriority`: the new [`SDL_ThreadPriority`] value. + /// - `schedPolicy`: the new scheduling policy (SCHED_FIFO, SCHED_RR, + /// SCHED_OTHER, etc...). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetLinuxThreadPriorityAndPolicy(threadID: Sint64, sdlPriority: ::core::ffi::c_int, schedPolicy: ::core::ffi::c_int) -> ::core::primitive::bool; + } + +}); + +apply_cfg!(#[cfg(any(doc, any(target_os = "ios", target_os = "tvos", target_os = "visionos", target_os = "watchos")))] => { + /// The prototype for an Apple iOS animation callback. + /// + /// This datatype is only useful on Apple iOS. + /// + /// After passing a function pointer of this type to + /// [`SDL_SetiOSAnimationCallback`], the system will call that function pointer at + /// a regular interval. + /// + /// ## Parameters + /// - `userdata`: what was passed as `callbackParam` to + /// [`SDL_SetiOSAnimationCallback`] as `callbackParam`. + /// + /// ## Availability + /// This datatype is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetiOSAnimationCallback`] + pub type SDL_iOSAnimationCallback = ::core::option::Option; + + unsafe extern "C" { + /// Use this function to set the animation callback on Apple iOS. + /// + /// The function prototype for `callback` is: + /// + /// ```c + /// void callback(void *callbackParam); + /// ``` + /// + /// Where its parameter, `callbackParam`, is what was passed as `callbackParam` + /// to [`SDL_SetiOSAnimationCallback()`]. + /// + /// This function is only available on Apple iOS. + /// + /// For more information see: + /// + /// + /// + /// Note that if you use the "main callbacks" instead of a standard C `main` + /// function, you don't have to use this API, as SDL will manage this for you. + /// + /// Details on main callbacks are here: + /// + /// + /// + /// ## Parameters + /// - `window`: the window for which the animation callback should be set. + /// - `interval`: the number of frames after which **callback** will be + /// called. + /// - `callback`: the function to call for every frame. + /// - `callbackParam`: a pointer that is passed to `callback`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetiOSEventPump`] + pub fn SDL_SetiOSAnimationCallback(window: *mut SDL_Window, interval: ::core::ffi::c_int, callback: SDL_iOSAnimationCallback, callbackParam: *mut ::core::ffi::c_void) -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Use this function to enable or disable the SDL event pump on Apple iOS. + /// + /// This function is only available on Apple iOS. + /// + /// ## Parameters + /// - `enabled`: true to enable the event pump, false to disable it. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetiOSAnimationCallback`] + pub fn SDL_SetiOSEventPump(enabled: ::core::primitive::bool); + } + +}); + +apply_cfg!(#[cfg(any(doc, target_os = "android"))] => { + unsafe extern "C" { + /// Get the Android Java Native Interface Environment of the current thread. + /// + /// This is the JNIEnv one needs to access the Java virtual machine from native + /// code, and is needed for many Android APIs to be usable from C. + /// + /// The prototype of the function in SDL's code actually declare a void* return + /// type, even if the implementation returns a pointer to a JNIEnv. The + /// rationale being that the SDL headers can avoid including jni.h. + /// + /// ## Return value + /// Returns a pointer to Java native interface object (JNIEnv) to which the + /// current thread is attached, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAndroidActivity`] + pub fn SDL_GetAndroidJNIEnv() -> *mut ::core::ffi::c_void; + } + + unsafe extern "C" { + /// Retrieve the Java instance of the Android activity class. + /// + /// The prototype of the function in SDL's code actually declares a void* + /// return type, even if the implementation returns a jobject. The rationale + /// being that the SDL headers can avoid including jni.h. + /// + /// The jobject returned by the function is a local reference and must be + /// released by the caller. See the PushLocalFrame() and PopLocalFrame() or + /// DeleteLocalRef() functions of the Java native interface: + /// + /// + /// + /// ## Return value + /// Returns the jobject representing the instance of the Activity class of the + /// Android application, or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAndroidJNIEnv`] + pub fn SDL_GetAndroidActivity() -> *mut ::core::ffi::c_void; + } + + unsafe extern "C" { + /// Query Android API level of the current device. + /// + /// - API level 35: Android 15 (VANILLA_ICE_CREAM) + /// - API level 34: Android 14 (UPSIDE_DOWN_CAKE) + /// - API level 33: Android 13 (TIRAMISU) + /// - API level 32: Android 12L (S_V2) + /// - API level 31: Android 12 (S) + /// - API level 30: Android 11 (R) + /// - API level 29: Android 10 (Q) + /// - API level 28: Android 9 (P) + /// - API level 27: Android 8.1 (O_MR1) + /// - API level 26: Android 8.0 (O) + /// - API level 25: Android 7.1 (N_MR1) + /// - API level 24: Android 7.0 (N) + /// - API level 23: Android 6.0 (M) + /// - API level 22: Android 5.1 (LOLLIPOP_MR1) + /// - API level 21: Android 5.0 (LOLLIPOP, L) + /// - API level 20: Android 4.4W (KITKAT_WATCH) + /// - API level 19: Android 4.4 (KITKAT) + /// - API level 18: Android 4.3 (JELLY_BEAN_MR2) + /// - API level 17: Android 4.2 (JELLY_BEAN_MR1) + /// - API level 16: Android 4.1 (JELLY_BEAN) + /// - API level 15: Android 4.0.3 (ICE_CREAM_SANDWICH_MR1) + /// - API level 14: Android 4.0 (ICE_CREAM_SANDWICH) + /// - API level 13: Android 3.2 (HONEYCOMB_MR2) + /// - API level 12: Android 3.1 (HONEYCOMB_MR1) + /// - API level 11: Android 3.0 (HONEYCOMB) + /// - API level 10: Android 2.3.3 (GINGERBREAD_MR1) + /// + /// ## Return value + /// Returns the Android API level. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetAndroidSDKVersion() -> ::core::ffi::c_int; + } + + unsafe extern "C" { + /// Query if the application is running on a Chromebook. + /// + /// ## Return value + /// Returns true if this is a Chromebook, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_IsChromebook() -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Query if the application is running on a Samsung DeX docking station. + /// + /// ## Return value + /// Returns true if this is a DeX docking station, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_IsDeXMode() -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Trigger the Android system back button behavior. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SendAndroidBackButton(); + } + + /// See the official Android developer guide for more information: + /// + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_ANDROID_EXTERNAL_STORAGE_READ: Uint32 = (0x01 as Uint32); + + /// See the official Android developer guide for more information: + /// + /// + /// ## Availability + /// This macro is available since SDL 3.2.0. + pub const SDL_ANDROID_EXTERNAL_STORAGE_WRITE: Uint32 = (0x02 as Uint32); + + unsafe extern "C" { + /// Get the path used for internal storage for this Android application. + /// + /// This path is unique to your application and cannot be written to by other + /// applications. + /// + /// Your internal storage path is typically: + /// `/data/data/your.app.package/files`. + /// + /// This is a C wrapper over `android.content.Context.getFilesDir()`: + /// + /// + /// + /// ## Return value + /// Returns the path used for internal storage or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAndroidExternalStoragePath`] + /// - [`SDL_GetAndroidCachePath`] + pub fn SDL_GetAndroidInternalStoragePath() -> *const ::core::ffi::c_char; + } + + unsafe extern "C" { + /// Get the current state of external storage for this Android application. + /// + /// The current state of external storage, a bitmask of these values: + /// [`SDL_ANDROID_EXTERNAL_STORAGE_READ`], [`SDL_ANDROID_EXTERNAL_STORAGE_WRITE`]. + /// + /// If external storage is currently unavailable, this will return 0. + /// + /// ## Return value + /// Returns the current state of external storage, or 0 if external storage is + /// currently unavailable. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAndroidExternalStoragePath`] + pub fn SDL_GetAndroidExternalStorageState() -> Uint32; + } + + unsafe extern "C" { + /// Get the path used for external storage for this Android application. + /// + /// This path is unique to your application, but is public and can be written + /// to by other applications. + /// + /// Your external storage path is typically: + /// `/storage/sdcard0/Android/data/your.app.package/files`. + /// + /// This is a C wrapper over `android.content.Context.getExternalFilesDir()`: + /// + /// + /// + /// ## Return value + /// Returns the path used for external storage for this application on success + /// or NULL on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAndroidExternalStorageState`] + /// - [`SDL_GetAndroidInternalStoragePath`] + /// - [`SDL_GetAndroidCachePath`] + pub fn SDL_GetAndroidExternalStoragePath() -> *const ::core::ffi::c_char; + } + + unsafe extern "C" { + /// Get the path used for caching data for this Android application. + /// + /// This path is unique to your application, but is public and can be written + /// to by other applications. + /// + /// Your cache path is typically: `/data/data/your.app.package/cache/`. + /// + /// This is a C wrapper over `android.content.Context.getCacheDir()`: + /// + /// + /// + /// ## Return value + /// Returns the path used for caches for this application on success or NULL + /// on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetAndroidInternalStoragePath`] + /// - [`SDL_GetAndroidExternalStoragePath`] + pub fn SDL_GetAndroidCachePath() -> *const ::core::ffi::c_char; + } + + /// Callback that presents a response from a [`SDL_RequestAndroidPermission`] call. + /// + /// ## Parameters + /// - `userdata`: an app-controlled pointer that is passed to the callback. + /// - `permission`: the Android-specific permission name that was requested. + /// - `granted`: true if permission is granted, false if denied. + /// + /// ## Availability + /// This datatype is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RequestAndroidPermission`] + pub type SDL_RequestAndroidPermissionCallback = ::core::option::Option; + + unsafe extern "C" { + /// Request permissions at runtime, asynchronously. + /// + /// You do not need to call this for built-in functionality of SDL; recording + /// from a microphone or reading images from a camera, using standard SDL APIs, + /// will manage permission requests for you. + /// + /// This function never blocks. Instead, the app-supplied callback will be + /// called when a decision has been made. This callback may happen on a + /// different thread, and possibly much later, as it might wait on a user to + /// respond to a system dialog. If permission has already been granted for a + /// specific entitlement, the callback will still fire, probably on the current + /// thread and before this function returns. + /// + /// If the request submission fails, this function returns -1 and the callback + /// will NOT be called, but this should only happen in catastrophic conditions, + /// like memory running out. Normally there will be a yes or no to the request + /// through the callback. + /// + /// For the `permission` parameter, choose a value from here: + /// + /// + /// + /// ## Parameters + /// - `permission`: the permission to request. + /// - `cb`: the callback to trigger when the request has a response. + /// - `userdata`: an app-controlled pointer that is passed to the callback. + /// + /// ## Return value + /// Returns true if the request was submitted, false if there was an error + /// submitting. The result of the request is only ever reported + /// through the callback, not this return value. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RequestAndroidPermission(permission: *const ::core::ffi::c_char, cb: SDL_RequestAndroidPermissionCallback, userdata: *mut ::core::ffi::c_void) -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Shows an Android toast notification. + /// + /// Toasts are a sort of lightweight notification that are unique to Android. + /// + /// + /// + /// Shows toast in UI thread. + /// + /// For the `gravity` parameter, choose a value from here, or -1 if you don't + /// have a preference: + /// + /// + /// + /// ## Parameters + /// - `message`: text message to be shown. + /// - `duration`: 0=short, 1=long. + /// - `gravity`: where the notification should appear on the screen. + /// - `xoffset`: set this parameter only when gravity >=0. + /// - `yoffset`: set this parameter only when gravity >=0. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ShowAndroidToast(message: *const ::core::ffi::c_char, duration: ::core::ffi::c_int, gravity: ::core::ffi::c_int, xoffset: ::core::ffi::c_int, yoffset: ::core::ffi::c_int) -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Send a user command to SDLActivity. + /// + /// Override "boolean onUnhandledMessage(Message msg)" to handle the message. + /// + /// ## Parameters + /// - `command`: user command that must be greater or equal to 0x8000. + /// - `param`: user parameter. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SendAndroidMessage(command: Uint32, param: ::core::ffi::c_int) -> ::core::primitive::bool; + } + +}); + +unsafe extern "C" { + /// Query if the current device is a tablet. + /// + /// If SDL can't determine this, it will return false. + /// + /// ## Return value + /// Returns true if the device is a tablet, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_IsTablet() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Query if the current device is a TV. + /// + /// If SDL can't determine this, it will return false. + /// + /// ## Return value + /// Returns true if the device is a TV, false otherwise. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_IsTV() -> ::core::primitive::bool; +} + +/// Application sandbox environment. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_Sandbox::NONE) | [`SDL_SANDBOX_NONE`] | | +/// | [`UNKNOWN_CONTAINER`](SDL_Sandbox::UNKNOWN_CONTAINER) | [`SDL_SANDBOX_UNKNOWN_CONTAINER`] | | +/// | [`FLATPAK`](SDL_Sandbox::FLATPAK) | [`SDL_SANDBOX_FLATPAK`] | | +/// | [`SNAP`](SDL_Sandbox::SNAP) | [`SDL_SANDBOX_SNAP`] | | +/// | [`MACOS`](SDL_Sandbox::MACOS) | [`SDL_SANDBOX_MACOS`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_Sandbox(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_Sandbox { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_Sandbox) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_Sandbox) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_Sandbox { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NONE => "SDL_SANDBOX_NONE", + Self::UNKNOWN_CONTAINER => "SDL_SANDBOX_UNKNOWN_CONTAINER", + Self::FLATPAK => "SDL_SANDBOX_FLATPAK", + Self::SNAP => "SDL_SANDBOX_SNAP", + Self::MACOS => "SDL_SANDBOX_MACOS", + + _ => return write!(f, "SDL_Sandbox({})", self.0), + }) + } +} + +impl SDL_Sandbox { + pub const NONE: Self = Self((0 as ::core::ffi::c_int)); + pub const UNKNOWN_CONTAINER: Self = Self((1 as ::core::ffi::c_int)); + pub const FLATPAK: Self = Self((2 as ::core::ffi::c_int)); + pub const SNAP: Self = Self((3 as ::core::ffi::c_int)); + pub const MACOS: Self = Self((4 as ::core::ffi::c_int)); +} + +pub const SDL_SANDBOX_NONE: SDL_Sandbox = SDL_Sandbox::NONE; +pub const SDL_SANDBOX_UNKNOWN_CONTAINER: SDL_Sandbox = SDL_Sandbox::UNKNOWN_CONTAINER; +pub const SDL_SANDBOX_FLATPAK: SDL_Sandbox = SDL_Sandbox::FLATPAK; +pub const SDL_SANDBOX_SNAP: SDL_Sandbox = SDL_Sandbox::SNAP; +pub const SDL_SANDBOX_MACOS: SDL_Sandbox = SDL_Sandbox::MACOS; + +impl SDL_Sandbox { + /// Initialize a `SDL_Sandbox` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_Sandbox { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_Sandbox { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::system::METADATA_SDL_Sandbox; +} + +unsafe extern "C" { + /// Get the application sandbox environment, if any. + /// + /// ## Return value + /// Returns the application sandbox environment or [`SDL_SANDBOX_NONE`] if the + /// application is not running in a sandbox environment. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSandbox() -> SDL_Sandbox; +} + +unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationWillTerminate. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationWillTerminate(); +} + +unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationDidReceiveMemoryWarning. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationDidReceiveMemoryWarning(); +} + +unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationWillResignActive. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationWillEnterBackground(); +} + +unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationDidEnterBackground. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationDidEnterBackground(); +} + +unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationWillEnterForeground. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationWillEnterForeground(); +} + +unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationDidBecomeActive. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationDidEnterForeground(); +} + +apply_cfg!(#[cfg(any(doc, any(target_os = "ios", target_os = "tvos", target_os = "visionos", target_os = "watchos")))] => { + unsafe extern "C" { + /// Let iOS apps with external event handling report + /// onApplicationDidChangeStatusBarOrientation. + /// + /// This functions allows iOS apps that have their own event handling to hook + /// into SDL to generate SDL events. This maps directly to an iOS-specific + /// event, but since it doesn't do anything iOS-specific internally, it is + /// available on all platforms, in case it might be useful for some specific + /// paradigm. Most apps do not need to use this directly; SDL's internal event + /// code will handle all this for windows created by SDL_CreateWindow! + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_OnApplicationDidChangeStatusBarOrientation(); + } + +}); + +apply_cfg!(#[cfg(any(doc, all(windows, feature = "target-gdk")))] => { + pub type XTaskQueueHandle = *mut XTaskQueueObject; + + pub type XUserHandle = *mut XUser; + + unsafe extern "C" { + /// Gets a reference to the global async task queue handle for GDK, + /// initializing if needed. + /// + /// Once you are done with the task queue, you should call + /// XTaskQueueCloseHandle to reduce the reference count to avoid a resource + /// leak. + /// + /// ## Parameters + /// - `outTaskQueue`: a pointer to be filled in with task queue handle. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGDKTaskQueue(outTaskQueue: *mut XTaskQueueHandle) -> ::core::primitive::bool; + } + + unsafe extern "C" { + /// Gets a reference to the default user handle for GDK. + /// + /// This is effectively a synchronous version of XUserAddAsync, which always + /// prefers the default user and allows a sign-in UI. + /// + /// ## Parameters + /// - `outUserHandle`: a pointer to be filled in with the default user + /// handle. + /// + /// ## Return value + /// Returns true if success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetGDKDefaultUser(outUserHandle: *mut XUserHandle) -> ::core::primitive::bool; + } + + #[repr(C)] + pub struct XTaskQueueObject { _opaque: [::core::primitive::u8; 0] } + + #[repr(C)] + pub struct XUser { _opaque: [::core::primitive::u8; 0] } + +}); + +#[doc(hidden)] +#[repr(C)] +pub struct _XEvent { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/thread.rs b/vendor/sdl3-sys/src/generated/thread.rs new file mode 100644 index 00000000..22816923 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/thread.rs @@ -0,0 +1,855 @@ +//! SDL offers cross-platform thread management functions. These are mostly +//! concerned with starting threads, setting their priority, and dealing with +//! their termination. +//! +//! In addition, there is support for Thread Local Storage (data that is unique +//! to each thread, but accessed from a single key). +//! +//! On platforms without thread support (such as Emscripten when built without +//! pthreads), these functions still exist, but things like [`SDL_CreateThread()`] +//! will report failure without doing anything. +//! +//! If you're going to work with threads, you almost certainly need to have a +//! good understanding of thread safety measures: locking and synchronization +//! mechanisms are handled by the functions in SDL_mutex.h. + +use super::stdinc::*; + +use super::error::*; + +use super::properties::*; + +use super::atomic::*; + +apply_cfg!(#[cfg(any(doc, windows))] => { +}); + +/// A unique numeric ID that identifies a thread. +/// +/// These are different from [`SDL_Thread`] objects, which are generally what an +/// application will operate on, but having a way to uniquely identify a thread +/// can be useful at times. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetThreadID`] +/// - [`SDL_GetCurrentThreadID`] +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_ThreadID(pub Uint64); + +impl ::core::cmp::PartialEq for SDL_ThreadID { + #[inline(always)] + fn eq(&self, other: &Uint64) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint64 { + #[inline(always)] + fn eq(&self, other: &SDL_ThreadID) -> bool { + self == &other.0 + } +} + +impl From for Uint64 { + #[inline(always)] + fn from(value: SDL_ThreadID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_ThreadID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_ThreadID { + /// Initialize a `SDL_ThreadID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint64) -> Self { + Self(value) + } +} + +impl SDL_ThreadID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint64 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ThreadID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::thread::METADATA_SDL_ThreadID; +} + +/// Thread local storage ID. +/// +/// 0 is the invalid ID. An app can create these and then set data for these +/// IDs that is unique to each thread. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetTLS`] +/// - [`SDL_SetTLS`] +#[repr(transparent)] +#[derive(Default)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TLSID(pub SDL_AtomicInt); + +impl From for SDL_AtomicInt { + #[inline(always)] + fn from(value: SDL_TLSID) -> Self { + value.0 + } +} + +impl SDL_TLSID { + /// Initialize a `SDL_TLSID` from a raw value. + #[inline(always)] + pub const fn new(value: SDL_AtomicInt) -> Self { + Self(value) + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TLSID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::thread::METADATA_SDL_TLSID; +} + +/// The SDL thread priority. +/// +/// SDL will make system changes as necessary in order to apply the thread +/// priority. Code which attempts to control thread state related to priority +/// should be aware that calling [`SDL_SetCurrentThreadPriority`] may alter such +/// state. [`SDL_HINT_THREAD_PRIORITY_POLICY`] can be used to control aspects of +/// this behavior. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`LOW`](SDL_ThreadPriority::LOW) | [`SDL_THREAD_PRIORITY_LOW`] | | +/// | [`NORMAL`](SDL_ThreadPriority::NORMAL) | [`SDL_THREAD_PRIORITY_NORMAL`] | | +/// | [`HIGH`](SDL_ThreadPriority::HIGH) | [`SDL_THREAD_PRIORITY_HIGH`] | | +/// | [`TIME_CRITICAL`](SDL_ThreadPriority::TIME_CRITICAL) | [`SDL_THREAD_PRIORITY_TIME_CRITICAL`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ThreadPriority(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ThreadPriority { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_ThreadPriority) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_ThreadPriority) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ThreadPriority { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::LOW => "SDL_THREAD_PRIORITY_LOW", + Self::NORMAL => "SDL_THREAD_PRIORITY_NORMAL", + Self::HIGH => "SDL_THREAD_PRIORITY_HIGH", + Self::TIME_CRITICAL => "SDL_THREAD_PRIORITY_TIME_CRITICAL", + + _ => return write!(f, "SDL_ThreadPriority({})", self.0), + }) + } +} + +impl SDL_ThreadPriority { + pub const LOW: Self = Self((0 as ::core::ffi::c_int)); + pub const NORMAL: Self = Self((1 as ::core::ffi::c_int)); + pub const HIGH: Self = Self((2 as ::core::ffi::c_int)); + pub const TIME_CRITICAL: Self = Self((3 as ::core::ffi::c_int)); +} + +pub const SDL_THREAD_PRIORITY_LOW: SDL_ThreadPriority = SDL_ThreadPriority::LOW; +pub const SDL_THREAD_PRIORITY_NORMAL: SDL_ThreadPriority = SDL_ThreadPriority::NORMAL; +pub const SDL_THREAD_PRIORITY_HIGH: SDL_ThreadPriority = SDL_ThreadPriority::HIGH; +pub const SDL_THREAD_PRIORITY_TIME_CRITICAL: SDL_ThreadPriority = SDL_ThreadPriority::TIME_CRITICAL; + +impl SDL_ThreadPriority { + /// Initialize a `SDL_ThreadPriority` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_ThreadPriority { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ThreadPriority { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::thread::METADATA_SDL_ThreadPriority; +} + +/// The SDL thread state. +/// +/// The current state of a thread can be checked by calling [`SDL_GetThreadState`]. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetThreadState`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_ThreadState::UNKNOWN) | [`SDL_THREAD_UNKNOWN`] | The thread is not valid | +/// | [`ALIVE`](SDL_ThreadState::ALIVE) | [`SDL_THREAD_ALIVE`] | The thread is currently running | +/// | [`DETACHED`](SDL_ThreadState::DETACHED) | [`SDL_THREAD_DETACHED`] | The thread is detached and can't be waited on | +/// | [`COMPLETE`](SDL_ThreadState::COMPLETE) | [`SDL_THREAD_COMPLETE`] | The thread has finished and should be cleaned up with [`SDL_WaitThread()`] | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ThreadState(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ThreadState { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_ThreadState) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_ThreadState) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ThreadState { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_THREAD_UNKNOWN", + Self::ALIVE => "SDL_THREAD_ALIVE", + Self::DETACHED => "SDL_THREAD_DETACHED", + Self::COMPLETE => "SDL_THREAD_COMPLETE", + + _ => return write!(f, "SDL_ThreadState({})", self.0), + }) + } +} + +impl SDL_ThreadState { + /// The thread is not valid + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + /// The thread is currently running + pub const ALIVE: Self = Self((1 as ::core::ffi::c_int)); + /// The thread is detached and can't be waited on + pub const DETACHED: Self = Self((2 as ::core::ffi::c_int)); + /// The thread has finished and should be cleaned up with [`SDL_WaitThread()`] + pub const COMPLETE: Self = Self((3 as ::core::ffi::c_int)); +} + +/// The thread is not valid +pub const SDL_THREAD_UNKNOWN: SDL_ThreadState = SDL_ThreadState::UNKNOWN; +/// The thread is currently running +pub const SDL_THREAD_ALIVE: SDL_ThreadState = SDL_ThreadState::ALIVE; +/// The thread is detached and can't be waited on +pub const SDL_THREAD_DETACHED: SDL_ThreadState = SDL_ThreadState::DETACHED; +/// The thread has finished and should be cleaned up with [`SDL_WaitThread()`] +pub const SDL_THREAD_COMPLETE: SDL_ThreadState = SDL_ThreadState::COMPLETE; + +impl SDL_ThreadState { + /// Initialize a `SDL_ThreadState` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_ThreadState { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ThreadState { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::thread::METADATA_SDL_ThreadState; +} + +/// The function passed to [`SDL_CreateThread()`] as the new thread's entry point. +/// +/// ## Parameters +/// - `data`: what was passed as `data` to [`SDL_CreateThread()`]. +/// +/// ## Return value +/// Returns a value that can be reported through [`SDL_WaitThread()`]. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_ThreadFunction = ::core::option::Option< + unsafe extern "C" fn(data: *mut ::core::ffi::c_void) -> ::core::ffi::c_int, +>; + +apply_cfg!(#[cfg(doc)] => { + unsafe extern "C" { + /// Create a new thread with a default stack size. + /// + /// This is a convenience function, equivalent to calling + /// [`SDL_CreateThreadWithProperties`] with the following properties set: + /// + /// - [`SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER`]\: `fn` + /// - [`SDL_PROP_THREAD_CREATE_NAME_STRING`]\: `name` + /// - [`SDL_PROP_THREAD_CREATE_USERDATA_POINTER`]\: `data` + /// + /// Note that this "function" is actually a macro that calls an internal + /// function with two extra parameters not listed here; they are hidden through + /// preprocessor macros and are needed to support various C runtimes at the + /// point of the function call. Language bindings that aren't using the C + /// headers will need to deal with this. + /// + /// Usually, apps should just call this function the same way on every platform + /// and let the macros hide the details. + /// + /// ## Parameters + /// - `fn`: the [`SDL_ThreadFunction`] function to call in the new thread. + /// - `name`: the name of the thread. + /// - `data`: a pointer that is passed to `fn`. + /// + /// ## Return value + /// Returns an opaque pointer to the new thread object on success, NULL if the + /// new thread could not be created; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateThreadWithProperties`] + /// - [`SDL_WaitThread`] + pub fn SDL_CreateThread(r#fn: SDL_ThreadFunction, name: *const ::core::ffi::c_char, data: *mut ::core::ffi::c_void) -> *mut SDL_Thread; + } + + unsafe extern "C" { + /// Create a new thread with with the specified properties. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER`]\: an [`SDL_ThreadFunction`] + /// value that will be called at the start of the new thread's life. + /// Required. + /// - [`SDL_PROP_THREAD_CREATE_NAME_STRING`]\: the name of the new thread, which + /// might be available to debuggers. Optional, defaults to NULL. + /// - [`SDL_PROP_THREAD_CREATE_USERDATA_POINTER`]\: an arbitrary app-defined + /// pointer, which is passed to the entry function on the new thread, as its + /// only parameter. Optional, defaults to NULL. + /// - [`SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER`]\: the size, in bytes, of the new + /// thread's stack. Optional, defaults to 0 (system-defined default). + /// + /// SDL makes an attempt to report [`SDL_PROP_THREAD_CREATE_NAME_STRING`] to the + /// system, so that debuggers can display it. Not all platforms support this. + /// + /// Thread naming is a little complicated: Most systems have very small limits + /// for the string length (Haiku has 32 bytes, Linux currently has 16, Visual + /// C++ 6.0 has _nine_!), and possibly other arbitrary rules. You'll have to + /// see what happens with your system's debugger. The name should be UTF-8 (but + /// using the naming limits of C identifiers is a better bet). There are no + /// requirements for thread naming conventions, so long as the string is + /// null-terminated UTF-8, but these guidelines are helpful in choosing a name: + /// + /// + /// + /// If a system imposes requirements, SDL will try to munge the string for it + /// (truncate, etc), but the original string contents will be available from + /// [`SDL_GetThreadName()`]. + /// + /// The size (in bytes) of the new stack can be specified with + /// [`SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER`]. Zero means "use the system + /// default" which might be wildly different between platforms. x86 Linux + /// generally defaults to eight megabytes, an embedded device might be a few + /// kilobytes instead. You generally need to specify a stack that is a multiple + /// of the system's page size (in many cases, this is 4 kilobytes, but check + /// your system documentation). + /// + /// Note that this "function" is actually a macro that calls an internal + /// function with two extra parameters not listed here; they are hidden through + /// preprocessor macros and are needed to support various C runtimes at the + /// point of the function call. Language bindings that aren't using the C + /// headers will need to deal with this. + /// + /// The actual symbol in SDL is [`SDL_CreateThreadWithPropertiesRuntime`], so + /// there is no symbol clash, but trying to load an SDL shared library and look + /// for "SDL_CreateThreadWithProperties" will fail. + /// + /// Usually, apps should just call this function the same way on every platform + /// and let the macros hide the details. + /// + /// ## Parameters + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns an opaque pointer to the new thread object on success, NULL if the + /// new thread could not be created; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateThread`] + /// - [`SDL_WaitThread`] + pub fn SDL_CreateThreadWithProperties(props: SDL_PropertiesID) -> *mut SDL_Thread; + } + + pub const SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER: *const ::core::ffi::c_char = c"SDL.thread.create.entry_function".as_ptr(); + + pub const SDL_PROP_THREAD_CREATE_NAME_STRING: *const ::core::ffi::c_char = c"SDL.thread.create.name".as_ptr(); + + pub const SDL_PROP_THREAD_CREATE_USERDATA_POINTER: *const ::core::ffi::c_char = c"SDL.thread.create.userdata".as_ptr(); + + pub const SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER: *const ::core::ffi::c_char = c"SDL.thread.create.stacksize".as_ptr(); + +}); + +apply_cfg!(#[cfg(not(doc))] => { + apply_cfg!(#[cfg(any(doc, windows))] => { + }); + +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { +}); + +apply_cfg!(#[cfg(not(doc))] => { + unsafe extern "C" { + /// The actual entry point for [`SDL_CreateThread`]. + /// + /// ## Parameters + /// - `fn`: the [`SDL_ThreadFunction`] function to call in the new thread + /// - `name`: the name of the thread + /// - `data`: a pointer that is passed to `fn` + /// - `pfnBeginThread`: the C runtime's _beginthreadex (or whatnot). Can be NULL. + /// - `pfnEndThread`: the C runtime's _endthreadex (or whatnot). Can be NULL. + /// + /// ## Return value + /// Returns an opaque pointer to the new thread object on success, NULL if the + /// new thread could not be created; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CreateThreadRuntime(r#fn: SDL_ThreadFunction, name: *const ::core::ffi::c_char, data: *mut ::core::ffi::c_void, pfnBeginThread: SDL_FunctionPointer, pfnEndThread: SDL_FunctionPointer) -> *mut SDL_Thread; + } + + unsafe extern "C" { + /// The actual entry point for [`SDL_CreateThreadWithProperties`]. + /// + /// ## Parameters + /// - `props`: the properties to use + /// - `pfnBeginThread`: the C runtime's _beginthreadex (or whatnot). Can be NULL. + /// - `pfnEndThread`: the C runtime's _endthreadex (or whatnot). Can be NULL. + /// + /// ## Return value + /// Returns an opaque pointer to the new thread object on success, NULL if the + /// new thread could not be created; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CreateThreadWithPropertiesRuntime(props: SDL_PropertiesID, pfnBeginThread: SDL_FunctionPointer, pfnEndThread: SDL_FunctionPointer) -> *mut SDL_Thread; + } + + #[cfg(not(windows))] + pub const SDL_BeginThreadFunction: SDL_FunctionPointer = unsafe { ::core::mem::transmute::<*const ::core::ffi::c_void, SDL_FunctionPointer>(core::ptr::null()) }; + #[cfg(not(windows))] + pub const SDL_EndThreadFunction: SDL_FunctionPointer = unsafe { ::core::mem::transmute::<*const ::core::ffi::c_void, SDL_FunctionPointer>(core::ptr::null()) }; + #[cfg(windows)] + unsafe extern "C" { + fn _beginthreadex(security: *mut ::core::ffi::c_void, stack_size: ::core::ffi::c_uint, start_address: Option ::core::ffi::c_uint>, arglist: *mut ::core::ffi::c_void, initflag: ::core::ffi::c_uint, thrdaddr: ::core::ffi::c_uint) -> ::core::primitive::usize; + fn _endthreadex(retval: ::core::ffi::c_uint); + } + #[cfg(windows)] + pub const SDL_BeginThreadFunction: SDL_FunctionPointer = unsafe { ::core::mem::transmute:: ::core::ffi::c_uint>, *mut ::core::ffi::c_void, ::core::ffi::c_uint, ::core::ffi::c_uint) -> ::core::primitive::usize, SDL_FunctionPointer>(_beginthreadex) }; + #[cfg(windows)] + pub const SDL_EndThreadFunction: SDL_FunctionPointer = unsafe { ::core::mem::transmute::(_endthreadex) }; + + #[inline(always)] + pub unsafe fn SDL_CreateThread(r#fn: SDL_ThreadFunction, name: *const ::core::ffi::c_char, data: *mut ::core::ffi::c_void, ) -> *mut SDL_Thread { + unsafe { SDL_CreateThreadRuntime((r#fn), (name), (data), SDL_BeginThreadFunction, SDL_EndThreadFunction) } + } + + + #[inline(always)] + pub unsafe fn SDL_CreateThreadWithProperties(props: SDL_PropertiesID, ) -> *mut SDL_Thread { + unsafe { SDL_CreateThreadWithPropertiesRuntime(props, SDL_BeginThreadFunction, SDL_EndThreadFunction) } + } + + + pub const SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER: *const ::core::ffi::c_char = c"SDL.thread.create.entry_function".as_ptr(); + + pub const SDL_PROP_THREAD_CREATE_NAME_STRING: *const ::core::ffi::c_char = c"SDL.thread.create.name".as_ptr(); + + pub const SDL_PROP_THREAD_CREATE_USERDATA_POINTER: *const ::core::ffi::c_char = c"SDL.thread.create.userdata".as_ptr(); + + pub const SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER: *const ::core::ffi::c_char = c"SDL.thread.create.stacksize".as_ptr(); + +}); + +unsafe extern "C" { + /// Get the thread name as it was specified in [`SDL_CreateThread()`]. + /// + /// ## Parameters + /// - `thread`: the thread to query. + /// + /// ## Return value + /// Returns a pointer to a UTF-8 string that names the specified thread, or + /// NULL if it doesn't have a name. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetThreadName(thread: *mut SDL_Thread) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the thread identifier for the current thread. + /// + /// This thread identifier is as reported by the underlying operating system. + /// If SDL is running on a platform that does not support threads the return + /// value will always be zero. + /// + /// This function also returns a valid thread ID when called from the main + /// thread. + /// + /// ## Return value + /// Returns the ID of the current thread. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetThreadID`] + pub safe fn SDL_GetCurrentThreadID() -> SDL_ThreadID; +} + +unsafe extern "C" { + /// Get the thread identifier for the specified thread. + /// + /// This thread identifier is as reported by the underlying operating system. + /// If SDL is running on a platform that does not support threads the return + /// value will always be zero. + /// + /// ## Parameters + /// - `thread`: the thread to query. + /// + /// ## Return value + /// Returns the ID of the specified thread, or the ID of the current thread if + /// `thread` is NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCurrentThreadID`] + pub fn SDL_GetThreadID(thread: *mut SDL_Thread) -> SDL_ThreadID; +} + +unsafe extern "C" { + /// Set the priority for the current thread. + /// + /// Note that some platforms will not let you alter the priority (or at least, + /// promote the thread to a higher priority) at all, and some require you to be + /// an administrator account. Be prepared for this to fail. + /// + /// ## Parameters + /// - `priority`: the [`SDL_ThreadPriority`] to set. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetCurrentThreadPriority(priority: SDL_ThreadPriority) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Wait for a thread to finish. + /// + /// Threads that haven't been detached will remain until this function cleans + /// them up. Not doing so is a resource leak. + /// + /// Once a thread has been cleaned up through this function, the [`SDL_Thread`] + /// that references it becomes invalid and should not be referenced again. As + /// such, only one thread may call [`SDL_WaitThread()`] on another. + /// + /// The return code from the thread function is placed in the area pointed to + /// by `status`, if `status` is not NULL. + /// + /// You may not wait on a thread that has been used in a call to + /// [`SDL_DetachThread()`]. Use either that function or this one, but not both, or + /// behavior is undefined. + /// + /// It is safe to pass a NULL thread to this function; it is a no-op. + /// + /// Note that the thread pointer is freed by this function and is not valid + /// afterward. + /// + /// ## Parameters + /// - `thread`: the [`SDL_Thread`] pointer that was returned from the + /// [`SDL_CreateThread()`] call that started this thread. + /// - `status`: a pointer filled in with the value returned from the thread + /// function by its 'return', or -1 if the thread has been + /// detached or isn't valid, may be NULL. + /// + /// ## Thread safety + /// It is safe to call this function from any thread, but only a + /// single thread can wait any specific thread to finish. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateThread`] + /// - [`SDL_DetachThread`] + pub fn SDL_WaitThread(thread: *mut SDL_Thread, status: *mut ::core::ffi::c_int); +} + +unsafe extern "C" { + /// Get the current state of a thread. + /// + /// ## Parameters + /// - `thread`: the thread to query. + /// + /// ## Return value + /// Returns the current state of a thread, or [`SDL_THREAD_UNKNOWN`] if the thread + /// isn't valid. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ThreadState`] + pub fn SDL_GetThreadState(thread: *mut SDL_Thread) -> SDL_ThreadState; +} + +unsafe extern "C" { + /// Let a thread clean up on exit without intervention. + /// + /// A thread may be "detached" to signify that it should not remain until + /// another thread has called [`SDL_WaitThread()`] on it. Detaching a thread is + /// useful for long-running threads that nothing needs to synchronize with or + /// further manage. When a detached thread is done, it simply goes away. + /// + /// There is no way to recover the return code of a detached thread. If you + /// need this, don't detach the thread and instead use [`SDL_WaitThread()`]. + /// + /// Once a thread is detached, you should usually assume the [`SDL_Thread`] isn't + /// safe to reference again, as it will become invalid immediately upon the + /// detached thread's exit, instead of remaining until someone has called + /// [`SDL_WaitThread()`] to finally clean it up. As such, don't detach the same + /// thread more than once. + /// + /// If a thread has already exited when passed to [`SDL_DetachThread()`], it will + /// stop waiting for a call to [`SDL_WaitThread()`] and clean up immediately. It is + /// not safe to detach a thread that might be used with [`SDL_WaitThread()`]. + /// + /// You may not call [`SDL_WaitThread()`] on a thread that has been detached. Use + /// either that function or this one, but not both, or behavior is undefined. + /// + /// It is safe to pass NULL to this function; it is a no-op. + /// + /// ## Parameters + /// - `thread`: the [`SDL_Thread`] pointer that was returned from the + /// [`SDL_CreateThread()`] call that started this thread. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateThread`] + /// - [`SDL_WaitThread`] + pub fn SDL_DetachThread(thread: *mut SDL_Thread); +} + +unsafe extern "C" { + /// Get the current thread's value associated with a thread local storage ID. + /// + /// ## Parameters + /// - `id`: a pointer to the thread local storage ID, may not be NULL. + /// + /// ## Return value + /// Returns the value associated with the ID for the current thread or NULL if + /// no value has been set; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetTLS`] + pub fn SDL_GetTLS(id: *mut SDL_TLSID) -> *mut ::core::ffi::c_void; +} + +/// The callback used to cleanup data passed to [`SDL_SetTLS`]. +/// +/// This is called when a thread exits, to allow an app to free any resources. +/// +/// ## Parameters +/// - `value`: a pointer previously handed to [`SDL_SetTLS`]. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetTLS`] +pub type SDL_TLSDestructorCallback = + ::core::option::Option; + +unsafe extern "C" { + /// Set the current thread's value associated with a thread local storage ID. + /// + /// If the thread local storage ID is not initialized (the value is 0), a new + /// ID will be created in a thread-safe way, so all calls using a pointer to + /// the same ID will refer to the same local storage. + /// + /// Note that replacing a value from a previous call to this function on the + /// same thread does _not_ call the previous value's destructor! + /// + /// `destructor` can be NULL; it is assumed that `value` does not need to be + /// cleaned up if so. + /// + /// ## Parameters + /// - `id`: a pointer to the thread local storage ID, may not be NULL. + /// - `value`: the value to associate with the ID for the current thread. + /// - `destructor`: a function called when the thread exits, to free the + /// value, may be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTLS`] + pub fn SDL_SetTLS( + id: *mut SDL_TLSID, + value: *const ::core::ffi::c_void, + destructor: SDL_TLSDestructorCallback, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Cleanup all TLS data for this thread. + /// + /// If you are creating your threads outside of SDL and then calling SDL + /// functions, you should call this function before your thread exits, to + /// properly clean up SDL memory. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_CleanupTLS(); +} + +/// The SDL thread object. +/// +/// These are opaque data. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateThread`] +/// - [`SDL_WaitThread`] +#[repr(C)] +pub struct SDL_Thread { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/time.rs b/vendor/sdl3-sys/src/generated/time.rs new file mode 100644 index 00000000..26d42a47 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/time.rs @@ -0,0 +1,438 @@ +//! SDL realtime clock and date/time routines. +//! +//! There are two data types that are used in this category: [`SDL_Time`], which +//! represents the nanoseconds since a specific moment (an "epoch"), and +//! [`SDL_DateTime`], which breaks time down into human-understandable components: +//! years, months, days, hours, etc. +//! +//! Much of the functionality is involved in converting those two types to +//! other useful forms. + +use super::error::*; + +use super::stdinc::*; + +/// A structure holding a calendar date and time broken down into its +/// components. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_DateTime { + /// Year + pub year: ::core::ffi::c_int, + /// Month \[01-12\] + pub month: ::core::ffi::c_int, + /// Day of the month \[01-31\] + pub day: ::core::ffi::c_int, + /// Hour \[0-23\] + pub hour: ::core::ffi::c_int, + /// Minute \[0-59\] + pub minute: ::core::ffi::c_int, + /// Seconds \[0-60\] + pub second: ::core::ffi::c_int, + /// Nanoseconds \[0-999999999\] + pub nanosecond: ::core::ffi::c_int, + /// Day of the week \[0-6\] (0 being Sunday) + pub day_of_week: ::core::ffi::c_int, + /// Seconds east of UTC + pub utc_offset: ::core::ffi::c_int, +} + +/// The preferred date format of the current system locale. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetDateTimeLocalePreferences`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`YYYYMMDD`](SDL_DateFormat::YYYYMMDD) | [`SDL_DATE_FORMAT_YYYYMMDD`] | Year/Month/Day | +/// | [`DDMMYYYY`](SDL_DateFormat::DDMMYYYY) | [`SDL_DATE_FORMAT_DDMMYYYY`] | Day/Month/Year | +/// | [`MMDDYYYY`](SDL_DateFormat::MMDDYYYY) | [`SDL_DATE_FORMAT_MMDDYYYY`] | Month/Day/Year | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_DateFormat(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_DateFormat { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_DateFormat) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_DateFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_DateFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::YYYYMMDD => "SDL_DATE_FORMAT_YYYYMMDD", + Self::DDMMYYYY => "SDL_DATE_FORMAT_DDMMYYYY", + Self::MMDDYYYY => "SDL_DATE_FORMAT_MMDDYYYY", + + _ => return write!(f, "SDL_DateFormat({})", self.0), + }) + } +} + +impl SDL_DateFormat { + /// Year/Month/Day + pub const YYYYMMDD: Self = Self((0 as ::core::ffi::c_int)); + /// Day/Month/Year + pub const DDMMYYYY: Self = Self((1 as ::core::ffi::c_int)); + /// Month/Day/Year + pub const MMDDYYYY: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Year/Month/Day +pub const SDL_DATE_FORMAT_YYYYMMDD: SDL_DateFormat = SDL_DateFormat::YYYYMMDD; +/// Day/Month/Year +pub const SDL_DATE_FORMAT_DDMMYYYY: SDL_DateFormat = SDL_DateFormat::DDMMYYYY; +/// Month/Day/Year +pub const SDL_DATE_FORMAT_MMDDYYYY: SDL_DateFormat = SDL_DateFormat::MMDDYYYY; + +impl SDL_DateFormat { + /// Initialize a `SDL_DateFormat` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_DateFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_DateFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::time::METADATA_SDL_DateFormat; +} + +/// The preferred time format of the current system locale. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetDateTimeLocalePreferences`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`_24HR`](SDL_TimeFormat::_24HR) | [`SDL_TIME_FORMAT_24HR`] | 24 hour time | +/// | [`_12HR`](SDL_TimeFormat::_12HR) | [`SDL_TIME_FORMAT_12HR`] | 12 hour time | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_TimeFormat(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_TimeFormat { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_TimeFormat) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_TimeFormat) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TimeFormat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::_24HR => "SDL_TIME_FORMAT_24HR", + Self::_12HR => "SDL_TIME_FORMAT_12HR", + + _ => return write!(f, "SDL_TimeFormat({})", self.0), + }) + } +} + +impl SDL_TimeFormat { + /// 24 hour time + pub const _24HR: Self = Self((0 as ::core::ffi::c_int)); + /// 12 hour time + pub const _12HR: Self = Self((1 as ::core::ffi::c_int)); +} + +/// 24 hour time +pub const SDL_TIME_FORMAT_24HR: SDL_TimeFormat = SDL_TimeFormat::_24HR; +/// 12 hour time +pub const SDL_TIME_FORMAT_12HR: SDL_TimeFormat = SDL_TimeFormat::_12HR; + +impl SDL_TimeFormat { + /// Initialize a `SDL_TimeFormat` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_TimeFormat { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TimeFormat { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::time::METADATA_SDL_TimeFormat; +} + +unsafe extern "C" { + /// Gets the current preferred date and time format for the system locale. + /// + /// This might be a "slow" call that has to query the operating system. It's + /// best to ask for this once and save the results. However, the preferred + /// formats can change, usually because the user has changed a system + /// preference outside of your program. + /// + /// ## Parameters + /// - `dateFormat`: a pointer to the [`SDL_DateFormat`] to hold the returned date + /// format, may be NULL. + /// - `timeFormat`: a pointer to the [`SDL_TimeFormat`] to hold the returned time + /// format, may be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetDateTimeLocalePreferences( + dateFormat: *mut SDL_DateFormat, + timeFormat: *mut SDL_TimeFormat, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Gets the current value of the system realtime clock in nanoseconds since + /// Jan 1, 1970 in Universal Coordinated Time (UTC). + /// + /// ## Parameters + /// - `ticks`: the [`SDL_Time`] to hold the returned tick count. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetCurrentTime(ticks: *mut SDL_Time) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Converts an [`SDL_Time`] in nanoseconds since the epoch to a calendar time in + /// the [`SDL_DateTime`] format. + /// + /// ## Parameters + /// - `ticks`: the [`SDL_Time`] to be converted. + /// - `dt`: the resulting [`SDL_DateTime`]. + /// - `localTime`: the resulting [`SDL_DateTime`] will be expressed in local time + /// if true, otherwise it will be in Universal Coordinated + /// Time (UTC). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_TimeToDateTime( + ticks: SDL_Time, + dt: *mut SDL_DateTime, + localTime: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Converts a calendar time to an [`SDL_Time`] in nanoseconds since the epoch. + /// + /// This function ignores the day_of_week member of the [`SDL_DateTime`] struct, so + /// it may remain unset. + /// + /// ## Parameters + /// - `dt`: the source [`SDL_DateTime`]. + /// - `ticks`: the resulting [`SDL_Time`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_DateTimeToTime( + dt: *const SDL_DateTime, + ticks: *mut SDL_Time, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Converts an SDL time into a Windows FILETIME (100-nanosecond intervals + /// since January 1, 1601). + /// + /// This function fills in the two 32-bit values of the FILETIME structure. + /// + /// ## Parameters + /// - `ticks`: the time to convert. + /// - `dwLowDateTime`: a pointer filled in with the low portion of the + /// Windows FILETIME value. + /// - `dwHighDateTime`: a pointer filled in with the high portion of the + /// Windows FILETIME value. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_TimeToWindows( + ticks: SDL_Time, + dwLowDateTime: *mut Uint32, + dwHighDateTime: *mut Uint32, + ); +} + +unsafe extern "C" { + /// Converts a Windows FILETIME (100-nanosecond intervals since January 1, + /// 1601) to an SDL time. + /// + /// This function takes the two 32-bit values of the FILETIME structure as + /// parameters. + /// + /// ## Parameters + /// - `dwLowDateTime`: the low portion of the Windows FILETIME value. + /// - `dwHighDateTime`: the high portion of the Windows FILETIME value. + /// + /// ## Return value + /// Returns the converted SDL time. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_TimeFromWindows(dwLowDateTime: Uint32, dwHighDateTime: Uint32) -> SDL_Time; +} + +unsafe extern "C" { + /// Get the number of days in a month for a given year. + /// + /// ## Parameters + /// - `year`: the year. + /// - `month`: the month \[1-12\]. + /// + /// ## Return value + /// Returns the number of days in the requested month or -1 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_GetDaysInMonth( + year: ::core::ffi::c_int, + month: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the day of year for a calendar date. + /// + /// ## Parameters + /// - `year`: the year component of the date. + /// - `month`: the month component of the date. + /// - `day`: the day component of the date. + /// + /// ## Return value + /// Returns the day of year \[0-365\] if the date is valid or -1 on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_GetDayOfYear( + year: ::core::ffi::c_int, + month: ::core::ffi::c_int, + day: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the day of week for a calendar date. + /// + /// ## Parameters + /// - `year`: the year component of the date. + /// - `month`: the month component of the date. + /// - `day`: the day component of the date. + /// + /// ## Return value + /// Returns a value between 0 and 6 (0 being Sunday) if the date is valid or + /// -1 on failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub safe fn SDL_GetDayOfWeek( + year: ::core::ffi::c_int, + month: ::core::ffi::c_int, + day: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/timer.rs b/vendor/sdl3-sys/src/generated/timer.rs new file mode 100644 index 00000000..27f08bb8 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/timer.rs @@ -0,0 +1,570 @@ +//! SDL provides time management functionality. It is useful for dealing with +//! (usually) small durations of time. +//! +//! This is not to be confused with _calendar time_ management, which is +//! provided by [CategoryTime](CategoryTime). +//! +//! This category covers measuring time elapsed ([`SDL_GetTicks()`], +//! [`SDL_GetPerformanceCounter()`]), putting a thread to sleep for a certain +//! amount of time ([`SDL_Delay()`], [`SDL_DelayNS()`], [`SDL_DelayPrecise()`]), and firing +//! a callback function after a certain amount of time has elapsed +//! ([`SDL_AddTimer()`], etc). +//! +//! There are also useful macros to convert between time units, like +//! [`SDL_SECONDS_TO_NS()`] and such. + +use super::stdinc::*; + +use super::error::*; + +/// Number of milliseconds in a second. +/// +/// This is always 1000. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_MS_PER_SECOND: ::core::primitive::i32 = 1000; + +/// Number of microseconds in a second. +/// +/// This is always 1000000. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_US_PER_SECOND: ::core::primitive::i32 = 1000000; + +/// Number of nanoseconds in a second. +/// +/// This is always 1000000000. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_NS_PER_SECOND: ::core::primitive::i64 = 1000000000_i64; + +/// Number of nanoseconds in a millisecond. +/// +/// This is always 1000000. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_NS_PER_MS: ::core::primitive::i32 = 1000000; + +/// Number of nanoseconds in a microsecond. +/// +/// This is always 1000. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_NS_PER_US: ::core::primitive::i32 = 1000; + +/// Convert seconds to nanoseconds. +/// +/// This only converts whole numbers, not fractional seconds. +/// +/// ## Parameters +/// - `S`: the number of seconds to convert. +/// +/// ## Return value +/// Returns S, expressed in nanoseconds. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_SECONDS_TO_NS(S: Uint64) -> Uint64 { + (S * (SDL_NS_PER_SECOND as Uint64)) +} + +/// Convert nanoseconds to seconds. +/// +/// This performs a division, so the results can be dramatically different if +/// `NS` is an integer or floating point value. +/// +/// ## Parameters +/// - `NS`: the number of nanoseconds to convert. +/// +/// ## Return value +/// Returns NS, expressed in seconds. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_NS_TO_SECONDS(NS: Uint64) -> Uint64 { + (NS / (SDL_NS_PER_SECOND as Uint64)) +} + +/// Convert milliseconds to nanoseconds. +/// +/// This only converts whole numbers, not fractional milliseconds. +/// +/// ## Parameters +/// - `MS`: the number of milliseconds to convert. +/// +/// ## Return value +/// Returns MS, expressed in nanoseconds. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_MS_TO_NS(MS: Uint64) -> Uint64 { + (MS * (SDL_NS_PER_MS as Uint64)) +} + +/// Convert nanoseconds to milliseconds. +/// +/// This performs a division, so the results can be dramatically different if +/// `NS` is an integer or floating point value. +/// +/// ## Parameters +/// - `NS`: the number of nanoseconds to convert. +/// +/// ## Return value +/// Returns NS, expressed in milliseconds. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_NS_TO_MS(NS: Uint64) -> Uint64 { + (NS / (SDL_NS_PER_MS as Uint64)) +} + +/// Convert microseconds to nanoseconds. +/// +/// This only converts whole numbers, not fractional microseconds. +/// +/// ## Parameters +/// - `US`: the number of microseconds to convert. +/// +/// ## Return value +/// Returns US, expressed in nanoseconds. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_US_TO_NS(US: Uint64) -> Uint64 { + (US * (SDL_NS_PER_US as Uint64)) +} + +/// Convert nanoseconds to microseconds. +/// +/// This performs a division, so the results can be dramatically different if +/// `NS` is an integer or floating point value. +/// +/// ## Parameters +/// - `NS`: the number of nanoseconds to convert. +/// +/// ## Return value +/// Returns NS, expressed in microseconds. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_NS_TO_US(NS: Uint64) -> Uint64 { + (NS / (SDL_NS_PER_US as Uint64)) +} + +unsafe extern "C" { + /// Get the number of milliseconds that have elapsed since the SDL library + /// initialization. + /// + /// ## Return value + /// Returns an unsigned 64‑bit integer that represents the number of + /// milliseconds that have elapsed since the SDL library was + /// initialized (typically via a call to [`SDL_Init`]). + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTicksNS`] + pub fn SDL_GetTicks() -> Uint64; +} + +unsafe extern "C" { + /// Get the number of nanoseconds since SDL library initialization. + /// + /// ## Return value + /// Returns an unsigned 64-bit value representing the number of nanoseconds + /// since the SDL library initialized. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTicksNS() -> Uint64; +} + +unsafe extern "C" { + /// Get the current value of the high resolution counter. + /// + /// This function is typically used for profiling. + /// + /// The counter values are only meaningful relative to each other. Differences + /// between values can be converted to times by using + /// [`SDL_GetPerformanceFrequency()`]. + /// + /// ## Return value + /// Returns the current counter value. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPerformanceFrequency`] + pub fn SDL_GetPerformanceCounter() -> Uint64; +} + +unsafe extern "C" { + /// Get the count per second of the high resolution counter. + /// + /// ## Return value + /// Returns a platform-specific count per second. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetPerformanceCounter`] + pub fn SDL_GetPerformanceFrequency() -> Uint64; +} + +unsafe extern "C" { + /// Wait a specified number of milliseconds before returning. + /// + /// This function waits a specified number of milliseconds before returning. It + /// waits at least the specified time, but possibly longer due to OS + /// scheduling. + /// + /// ## Parameters + /// - `ms`: the number of milliseconds to delay. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DelayNS`] + /// - [`SDL_DelayPrecise`] + pub fn SDL_Delay(ms: Uint32); +} + +unsafe extern "C" { + /// Wait a specified number of nanoseconds before returning. + /// + /// This function waits a specified number of nanoseconds before returning. It + /// waits at least the specified time, but possibly longer due to OS + /// scheduling. + /// + /// ## Parameters + /// - `ns`: the number of nanoseconds to delay. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Delay`] + /// - [`SDL_DelayPrecise`] + pub fn SDL_DelayNS(ns: Uint64); +} + +unsafe extern "C" { + /// Wait a specified number of nanoseconds before returning. + /// + /// This function waits a specified number of nanoseconds before returning. It + /// will attempt to wait as close to the requested time as possible, busy + /// waiting if necessary, but could return later due to OS scheduling. + /// + /// ## Parameters + /// - `ns`: the number of nanoseconds to delay. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Delay`] + /// - [`SDL_DelayNS`] + pub fn SDL_DelayPrecise(ns: Uint64); +} + +/// Definition of the timer ID type. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TimerID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_TimerID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_TimerID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_TimerID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_TimerID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_TimerID { + /// Initialize a `SDL_TimerID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_TimerID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TimerID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::timer::METADATA_SDL_TimerID; +} + +/// Function prototype for the millisecond timer callback function. +/// +/// The callback function is passed the current timer interval and returns the +/// next timer interval, in milliseconds. If the returned value is the same as +/// the one passed in, the periodic alarm continues, otherwise a new alarm is +/// scheduled. If the callback returns 0, the periodic alarm is canceled and +/// will be removed. +/// +/// ## Parameters +/// - `userdata`: an arbitrary pointer provided by the app through +/// [`SDL_AddTimer`], for its own use. +/// - `timerID`: the current timer being processed. +/// - `interval`: the current callback time interval. +/// +/// ## Return value +/// Returns the new callback time interval, or 0 to disable further runs of +/// the callback. +/// +/// ## Thread safety +/// SDL may call this callback at any time from a background +/// thread; the application is responsible for locking resources +/// the callback touches that need to be protected. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AddTimer`] +pub type SDL_TimerCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + timerID: SDL_TimerID, + interval: Uint32, + ) -> Uint32, +>; + +unsafe extern "C" { + /// Call a callback function at a future time. + /// + /// The callback function is passed the current timer interval and the user + /// supplied parameter from the [`SDL_AddTimer()`] call and should return the next + /// timer interval. If the value returned from the callback is 0, the timer is + /// canceled and will be removed. + /// + /// The callback is run on a separate thread, and for short timeouts can + /// potentially be called before this function returns. + /// + /// Timers take into account the amount of time it took to execute the + /// callback. For example, if the callback took 250 ms to execute and returned + /// 1000 (ms), the timer would only wait another 750 ms before its next + /// iteration. + /// + /// Timing may be inexact due to OS scheduling. Be sure to note the current + /// time with [`SDL_GetTicksNS()`] or [`SDL_GetPerformanceCounter()`] in case your + /// callback needs to adjust for variances. + /// + /// ## Parameters + /// - `interval`: the timer delay, in milliseconds, passed to `callback`. + /// - `callback`: the [`SDL_TimerCallback`] function to call when the specified + /// `interval` elapses. + /// - `userdata`: a pointer that is passed to `callback`. + /// + /// ## Return value + /// Returns a timer ID or 0 on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddTimerNS`] + /// - [`SDL_RemoveTimer`] + pub fn SDL_AddTimer( + interval: Uint32, + callback: SDL_TimerCallback, + userdata: *mut ::core::ffi::c_void, + ) -> SDL_TimerID; +} + +/// Function prototype for the nanosecond timer callback function. +/// +/// The callback function is passed the current timer interval and returns the +/// next timer interval, in nanoseconds. If the returned value is the same as +/// the one passed in, the periodic alarm continues, otherwise a new alarm is +/// scheduled. If the callback returns 0, the periodic alarm is canceled and +/// will be removed. +/// +/// ## Parameters +/// - `userdata`: an arbitrary pointer provided by the app through +/// [`SDL_AddTimer`], for its own use. +/// - `timerID`: the current timer being processed. +/// - `interval`: the current callback time interval. +/// +/// ## Return value +/// Returns the new callback time interval, or 0 to disable further runs of +/// the callback. +/// +/// ## Thread safety +/// SDL may call this callback at any time from a background +/// thread; the application is responsible for locking resources +/// the callback touches that need to be protected. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_AddTimerNS`] +pub type SDL_NSTimerCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + timerID: SDL_TimerID, + interval: Uint64, + ) -> Uint64, +>; + +unsafe extern "C" { + /// Call a callback function at a future time. + /// + /// The callback function is passed the current timer interval and the user + /// supplied parameter from the [`SDL_AddTimerNS()`] call and should return the + /// next timer interval. If the value returned from the callback is 0, the + /// timer is canceled and will be removed. + /// + /// The callback is run on a separate thread, and for short timeouts can + /// potentially be called before this function returns. + /// + /// Timers take into account the amount of time it took to execute the + /// callback. For example, if the callback took 250 ns to execute and returned + /// 1000 (ns), the timer would only wait another 750 ns before its next + /// iteration. + /// + /// Timing may be inexact due to OS scheduling. Be sure to note the current + /// time with [`SDL_GetTicksNS()`] or [`SDL_GetPerformanceCounter()`] in case your + /// callback needs to adjust for variances. + /// + /// ## Parameters + /// - `interval`: the timer delay, in nanoseconds, passed to `callback`. + /// - `callback`: the [`SDL_TimerCallback`] function to call when the specified + /// `interval` elapses. + /// - `userdata`: a pointer that is passed to `callback`. + /// + /// ## Return value + /// Returns a timer ID or 0 on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddTimer`] + /// - [`SDL_RemoveTimer`] + pub fn SDL_AddTimerNS( + interval: Uint64, + callback: SDL_NSTimerCallback, + userdata: *mut ::core::ffi::c_void, + ) -> SDL_TimerID; +} + +unsafe extern "C" { + /// Remove a timer created with [`SDL_AddTimer()`]. + /// + /// ## Parameters + /// - `id`: the ID of the timer to remove. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddTimer`] + pub fn SDL_RemoveTimer(id: SDL_TimerID) -> ::core::primitive::bool; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/touch.rs b/vendor/sdl3-sys/src/generated/touch.rs new file mode 100644 index 00000000..51685371 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/touch.rs @@ -0,0 +1,356 @@ +//! SDL offers touch input, on platforms that support it. It can manage +//! multiple touch devices and track multiple fingers on those devices. +//! +//! Touches are mostly dealt with through the event system, in the +//! [`SDL_EVENT_FINGER_DOWN`], [`SDL_EVENT_FINGER_MOTION`], and [`SDL_EVENT_FINGER_UP`] +//! events, but there are also functions to query for hardware details, etc. +//! +//! The touch system, by default, will also send virtual mouse events; this can +//! be useful for making a some desktop apps work on a phone without +//! significant changes. For apps that care about mouse and touch input +//! separately, they should ignore mouse events that have a `which` field of +//! [`SDL_TOUCH_MOUSEID`]. + +use super::stdinc::*; + +use super::error::*; + +use super::mouse::*; + +/// A unique ID for a touch device. +/// +/// This ID is valid for the time the device is connected to the system, and is +/// never reused for the lifetime of the application. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_TouchID(pub Uint64); + +impl ::core::cmp::PartialEq for SDL_TouchID { + #[inline(always)] + fn eq(&self, other: &Uint64) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint64 { + #[inline(always)] + fn eq(&self, other: &SDL_TouchID) -> bool { + self == &other.0 + } +} + +impl From for Uint64 { + #[inline(always)] + fn from(value: SDL_TouchID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_TouchID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_TouchID { + /// Initialize a `SDL_TouchID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint64) -> Self { + Self(value) + } +} + +impl SDL_TouchID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint64 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TouchID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::touch::METADATA_SDL_TouchID; +} + +/// A unique ID for a single finger on a touch device. +/// +/// This ID is valid for the time the finger (stylus, etc) is touching and will +/// be unique for all fingers currently in contact, so this ID tracks the +/// lifetime of a single continuous touch. This value may represent an index, a +/// pointer, or some other unique ID, depending on the platform. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_FingerID(pub Uint64); + +impl ::core::cmp::PartialEq for SDL_FingerID { + #[inline(always)] + fn eq(&self, other: &Uint64) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint64 { + #[inline(always)] + fn eq(&self, other: &SDL_FingerID) -> bool { + self == &other.0 + } +} + +impl From for Uint64 { + #[inline(always)] + fn from(value: SDL_FingerID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_FingerID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_FingerID { + /// Initialize a `SDL_FingerID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint64) -> Self { + Self(value) + } +} + +impl SDL_FingerID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint64 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_FingerID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::touch::METADATA_SDL_FingerID; +} + +/// An enum that describes the type of a touch device. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_TouchDeviceType::INVALID) | [`SDL_TOUCH_DEVICE_INVALID`] | | +/// | [`DIRECT`](SDL_TouchDeviceType::DIRECT) | [`SDL_TOUCH_DEVICE_DIRECT`] | touch screen with window-relative coordinates | +/// | [`INDIRECT_ABSOLUTE`](SDL_TouchDeviceType::INDIRECT_ABSOLUTE) | [`SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE`] | trackpad with absolute device coordinates | +/// | [`INDIRECT_RELATIVE`](SDL_TouchDeviceType::INDIRECT_RELATIVE) | [`SDL_TOUCH_DEVICE_INDIRECT_RELATIVE`] | trackpad with screen cursor-relative coordinates | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_TouchDeviceType(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_TouchDeviceType { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_TouchDeviceType) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_TouchDeviceType) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TouchDeviceType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_TOUCH_DEVICE_INVALID", + Self::DIRECT => "SDL_TOUCH_DEVICE_DIRECT", + Self::INDIRECT_ABSOLUTE => "SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE", + Self::INDIRECT_RELATIVE => "SDL_TOUCH_DEVICE_INDIRECT_RELATIVE", + + _ => return write!(f, "SDL_TouchDeviceType({})", self.0), + }) + } +} + +impl SDL_TouchDeviceType { + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// touch screen with window-relative coordinates + pub const DIRECT: Self = Self((0_i32 as ::core::ffi::c_int)); + /// trackpad with absolute device coordinates + pub const INDIRECT_ABSOLUTE: Self = Self((1_i32 as ::core::ffi::c_int)); + /// trackpad with screen cursor-relative coordinates + pub const INDIRECT_RELATIVE: Self = Self((2_i32 as ::core::ffi::c_int)); +} + +pub const SDL_TOUCH_DEVICE_INVALID: SDL_TouchDeviceType = SDL_TouchDeviceType::INVALID; +/// touch screen with window-relative coordinates +pub const SDL_TOUCH_DEVICE_DIRECT: SDL_TouchDeviceType = SDL_TouchDeviceType::DIRECT; +/// trackpad with absolute device coordinates +pub const SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE: SDL_TouchDeviceType = + SDL_TouchDeviceType::INDIRECT_ABSOLUTE; +/// trackpad with screen cursor-relative coordinates +pub const SDL_TOUCH_DEVICE_INDIRECT_RELATIVE: SDL_TouchDeviceType = + SDL_TouchDeviceType::INDIRECT_RELATIVE; + +impl SDL_TouchDeviceType { + /// Initialize a `SDL_TouchDeviceType` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_TouchDeviceType { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TouchDeviceType { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::touch::METADATA_SDL_TouchDeviceType; +} + +/// Data about a single finger in a multitouch event. +/// +/// Each touch event is a collection of fingers that are simultaneously in +/// contact with the touch device (so a "touch" can be a "multitouch," in +/// reality), and this struct reports details of the specific fingers. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetTouchFingers`] +#[repr(C)] +#[derive(Clone, Copy, Default, PartialEq)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_Finger { + /// the finger ID + pub id: SDL_FingerID, + /// the x-axis location of the touch event, normalized (0...1) + pub x: ::core::ffi::c_float, + /// the y-axis location of the touch event, normalized (0...1) + pub y: ::core::ffi::c_float, + /// the quantity of pressure applied, normalized (0...1) + pub pressure: ::core::ffi::c_float, +} + +/// The [`SDL_MouseID`] for mouse events simulated with touch input. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_TOUCH_MOUSEID: SDL_MouseID = SDL_MouseID((-1_i32 as Uint32)); + +/// The [`SDL_TouchID`] for touch events simulated with mouse input. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_MOUSE_TOUCHID: SDL_TouchID = SDL_TouchID((-1_i32 as Uint64)); + +unsafe extern "C" { + /// Get a list of registered touch devices. + /// + /// On some platforms SDL first sees the touch device if it was actually used. + /// Therefore the returned list might be empty, although devices are available. + /// After using all devices at least once the number will be correct. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of devices returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of touch device IDs or NULL on failure; call + /// [`SDL_GetError()`] for more information. This should be freed with + /// [`SDL_free()`] when it is no longer needed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTouchDevices(count: *mut ::core::ffi::c_int) -> *mut SDL_TouchID; +} + +unsafe extern "C" { + /// Get the touch device name as reported from the driver. + /// + /// ## Parameters + /// - `touchID`: the touch device instance ID. + /// + /// ## Return value + /// Returns touch device name, or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTouchDeviceName(touchID: SDL_TouchID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the type of the given touch device. + /// + /// ## Parameters + /// - `touchID`: the ID of a touch device. + /// + /// ## Return value + /// Returns touch device type. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTouchDeviceType(touchID: SDL_TouchID) -> SDL_TouchDeviceType; +} + +unsafe extern "C" { + /// Get a list of active fingers for a given touch device. + /// + /// ## Parameters + /// - `touchID`: the ID of a touch device. + /// - `count`: a pointer filled in with the number of fingers returned, can + /// be NULL. + /// + /// ## Return value + /// Returns a NULL terminated array of [`SDL_Finger`] pointers or NULL on failure; + /// call [`SDL_GetError()`] for more information. This is a single + /// allocation that should be freed with [`SDL_free()`] when it is no + /// longer needed. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetTouchFingers( + touchID: SDL_TouchID, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut SDL_Finger; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/tray.rs b/vendor/sdl3-sys/src/generated/tray.rs new file mode 100644 index 00000000..94f99a8d --- /dev/null +++ b/vendor/sdl3-sys/src/generated/tray.rs @@ -0,0 +1,835 @@ +//! SDL offers a way to add items to the "system tray" (more correctly called +//! the "notification area" on Windows). On platforms that offer this concept, +//! an SDL app can add a tray icon, submenus, checkboxes, and clickable +//! entries, and register a callback that is fired when the user clicks on +//! these pieces. + +use super::stdinc::*; + +use super::error::*; + +use super::surface::*; + +use super::video::*; + +/// Flags that control the creation of system tray entries. +/// +/// Some of these flags are required; exactly one of them must be specified at +/// the time a tray entry is created. Other flags are optional; zero or more of +/// those can be OR'ed together with the required flag. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_InsertTrayEntryAt`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`BUTTON`](SDL_TrayEntryFlags::BUTTON) | [`SDL_TRAYENTRY_BUTTON`] | Make the entry a simple button. Required. | +/// | [`CHECKBOX`](SDL_TrayEntryFlags::CHECKBOX) | [`SDL_TRAYENTRY_CHECKBOX`] | Make the entry a checkbox. Required. | +/// | [`SUBMENU`](SDL_TrayEntryFlags::SUBMENU) | [`SDL_TRAYENTRY_SUBMENU`] | Prepare the entry to have a submenu. Required | +/// | [`DISABLED`](SDL_TrayEntryFlags::DISABLED) | [`SDL_TRAYENTRY_DISABLED`] | Make the entry disabled. Optional. | +/// | [`CHECKED`](SDL_TrayEntryFlags::CHECKED) | [`SDL_TRAYENTRY_CHECKED`] | Make the entry checked. This is valid only for checkboxes. Optional. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_TrayEntryFlags(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_TrayEntryFlags { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_TrayEntryFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_TrayEntryFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_TrayEntryFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_TrayEntryFlags(")?; + let all_bits = all_bits | Self::BUTTON.0; + if (Self::BUTTON != 0 || self.0 == 0) && *self & Self::BUTTON == Self::BUTTON { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BUTTON")?; + } + let all_bits = all_bits | Self::CHECKBOX.0; + if (Self::CHECKBOX != 0 || self.0 == 0) && *self & Self::CHECKBOX == Self::CHECKBOX { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CHECKBOX")?; + } + let all_bits = all_bits | Self::SUBMENU.0; + if (Self::SUBMENU != 0 || self.0 == 0) && *self & Self::SUBMENU == Self::SUBMENU { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "SUBMENU")?; + } + let all_bits = all_bits | Self::DISABLED.0; + if (Self::DISABLED != 0 || self.0 == 0) && *self & Self::DISABLED == Self::DISABLED { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DISABLED")?; + } + let all_bits = all_bits | Self::CHECKED.0; + if (Self::CHECKED != 0 || self.0 == 0) && *self & Self::CHECKED == Self::CHECKED { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CHECKED")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_TrayEntryFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_TrayEntryFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_TrayEntryFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_TrayEntryFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_TrayEntryFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_TrayEntryFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_TrayEntryFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_TrayEntryFlags { + /// Make the entry a simple button. Required. + pub const BUTTON: Self = Self((0x00000001 as Uint32)); + /// Make the entry a checkbox. Required. + pub const CHECKBOX: Self = Self((0x00000002 as Uint32)); + /// Prepare the entry to have a submenu. Required + pub const SUBMENU: Self = Self((0x00000004 as Uint32)); + /// Make the entry disabled. Optional. + pub const DISABLED: Self = Self((0x80000000 as Uint32)); + /// Make the entry checked. This is valid only for checkboxes. Optional. + pub const CHECKED: Self = Self((0x40000000 as Uint32)); +} + +/// Make the entry a simple button. Required. +pub const SDL_TRAYENTRY_BUTTON: SDL_TrayEntryFlags = SDL_TrayEntryFlags::BUTTON; +/// Make the entry a checkbox. Required. +pub const SDL_TRAYENTRY_CHECKBOX: SDL_TrayEntryFlags = SDL_TrayEntryFlags::CHECKBOX; +/// Prepare the entry to have a submenu. Required +pub const SDL_TRAYENTRY_SUBMENU: SDL_TrayEntryFlags = SDL_TrayEntryFlags::SUBMENU; +/// Make the entry disabled. Optional. +pub const SDL_TRAYENTRY_DISABLED: SDL_TrayEntryFlags = SDL_TrayEntryFlags::DISABLED; +/// Make the entry checked. This is valid only for checkboxes. Optional. +pub const SDL_TRAYENTRY_CHECKED: SDL_TrayEntryFlags = SDL_TrayEntryFlags::CHECKED; + +impl SDL_TrayEntryFlags { + /// Initialize a `SDL_TrayEntryFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_TrayEntryFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_TrayEntryFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::tray::METADATA_SDL_TrayEntryFlags; +} + +/// A callback that is invoked when a tray entry is selected. +/// +/// ## Parameters +/// - `userdata`: an optional pointer to pass extra data to the callback when +/// it will be invoked. +/// - `entry`: the tray entry that was selected. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetTrayEntryCallback`] +pub type SDL_TrayCallback = ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void, entry: *mut SDL_TrayEntry), +>; + +unsafe extern "C" { + /// Create an icon to be placed in the operating system's tray, or equivalent. + /// + /// Many platforms advise not using a system tray unless persistence is a + /// necessary feature. Avoid needlessly creating a tray icon, as the user may + /// feel like it clutters their interface. + /// + /// Using tray icons require the video subsystem. + /// + /// ## Parameters + /// - `icon`: a surface to be used as icon. May be NULL. + /// - `tooltip`: a tooltip to be displayed when the mouse hovers the icon in + /// UTF-8 encoding. Not supported on all platforms. May be NULL. + /// + /// ## Return value + /// Returns The newly created system tray icon. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTrayMenu`] + /// - [`SDL_GetTrayMenu`] + /// - [`SDL_DestroyTray`] + pub fn SDL_CreateTray( + icon: *mut SDL_Surface, + tooltip: *const ::core::ffi::c_char, + ) -> *mut SDL_Tray; +} + +unsafe extern "C" { + /// Updates the system tray icon's icon. + /// + /// ## Parameters + /// - `tray`: the tray icon to be updated. + /// - `icon`: the new icon. May be NULL. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTray`] + pub fn SDL_SetTrayIcon(tray: *mut SDL_Tray, icon: *mut SDL_Surface); +} + +unsafe extern "C" { + /// Updates the system tray icon's tooltip. + /// + /// ## Parameters + /// - `tray`: the tray icon to be updated. + /// - `tooltip`: the new tooltip in UTF-8 encoding. May be NULL. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTray`] + pub fn SDL_SetTrayTooltip(tray: *mut SDL_Tray, tooltip: *const ::core::ffi::c_char); +} + +unsafe extern "C" { + /// Create a menu for a system tray. + /// + /// This should be called at most once per tray icon. + /// + /// This function does the same thing as [`SDL_CreateTraySubmenu()`], except that + /// it takes a [`SDL_Tray`] instead of a [`SDL_TrayEntry`]. + /// + /// A menu does not need to be destroyed; it will be destroyed with the tray. + /// + /// ## Parameters + /// - `tray`: the tray to bind the menu to. + /// + /// ## Return value + /// Returns the newly created menu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTray`] + /// - [`SDL_GetTrayMenu`] + /// - [`SDL_GetTrayMenuParentTray`] + pub fn SDL_CreateTrayMenu(tray: *mut SDL_Tray) -> *mut SDL_TrayMenu; +} + +unsafe extern "C" { + /// Create a submenu for a system tray entry. + /// + /// This should be called at most once per tray entry. + /// + /// This function does the same thing as [`SDL_CreateTrayMenu`], except that it + /// takes a [`SDL_TrayEntry`] instead of a [`SDL_Tray`]. + /// + /// A menu does not need to be destroyed; it will be destroyed with the tray. + /// + /// ## Parameters + /// - `entry`: the tray entry to bind the menu to. + /// + /// ## Return value + /// Returns the newly created menu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_GetTraySubmenu`] + /// - [`SDL_GetTrayMenuParentEntry`] + pub fn SDL_CreateTraySubmenu(entry: *mut SDL_TrayEntry) -> *mut SDL_TrayMenu; +} + +unsafe extern "C" { + /// Gets a previously created tray menu. + /// + /// You should have called [`SDL_CreateTrayMenu()`] on the tray object. This + /// function allows you to fetch it again later. + /// + /// This function does the same thing as [`SDL_GetTraySubmenu()`], except that it + /// takes a [`SDL_Tray`] instead of a [`SDL_TrayEntry`]. + /// + /// A menu does not need to be destroyed; it will be destroyed with the tray. + /// + /// ## Parameters + /// - `tray`: the tray entry to bind the menu to. + /// + /// ## Return value + /// Returns the newly created menu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTray`] + /// - [`SDL_CreateTrayMenu`] + pub fn SDL_GetTrayMenu(tray: *mut SDL_Tray) -> *mut SDL_TrayMenu; +} + +unsafe extern "C" { + /// Gets a previously created tray entry submenu. + /// + /// You should have called [`SDL_CreateTraySubmenu()`] on the entry object. This + /// function allows you to fetch it again later. + /// + /// This function does the same thing as [`SDL_GetTrayMenu()`], except that it + /// takes a [`SDL_TrayEntry`] instead of a [`SDL_Tray`]. + /// + /// A menu does not need to be destroyed; it will be destroyed with the tray. + /// + /// ## Parameters + /// - `entry`: the tray entry to bind the menu to. + /// + /// ## Return value + /// Returns the newly created menu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_CreateTraySubmenu`] + pub fn SDL_GetTraySubmenu(entry: *mut SDL_TrayEntry) -> *mut SDL_TrayMenu; +} + +unsafe extern "C" { + /// Returns a list of entries in the menu, in order. + /// + /// ## Parameters + /// - `menu`: The menu to get entries from. + /// - `count`: An optional pointer to obtain the number of entries in the + /// menu. + /// + /// ## Return value + /// Returns a NULL-terminated list of entries within the given menu. The + /// pointer becomes invalid when any function that inserts or deletes + /// entries in the menu is called. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_RemoveTrayEntry`] + /// - [`SDL_InsertTrayEntryAt`] + pub fn SDL_GetTrayEntries( + menu: *mut SDL_TrayMenu, + count: *mut ::core::ffi::c_int, + ) -> *mut *const SDL_TrayEntry; +} + +unsafe extern "C" { + /// Removes a tray entry. + /// + /// ## Parameters + /// - `entry`: The entry to be deleted. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + pub fn SDL_RemoveTrayEntry(entry: *mut SDL_TrayEntry); +} + +unsafe extern "C" { + /// Insert a tray entry at a given position. + /// + /// If label is NULL, the entry will be a separator. Many functions won't work + /// for an entry that is a separator. + /// + /// An entry does not need to be destroyed; it will be destroyed with the tray. + /// + /// ## Parameters + /// - `menu`: the menu to append the entry to. + /// - `pos`: the desired position for the new entry. Entries at or following + /// this place will be moved. If pos is -1, the entry is appended. + /// - `label`: the text to be displayed on the entry, in UTF-8 encoding, or + /// NULL for a separator. + /// - `flags`: a combination of flags, some of which are mandatory. + /// + /// ## Return value + /// Returns the newly created entry, or NULL if pos is out of bounds. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_TrayEntryFlags`] + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_RemoveTrayEntry`] + /// - [`SDL_GetTrayEntryParent`] + pub fn SDL_InsertTrayEntryAt( + menu: *mut SDL_TrayMenu, + pos: ::core::ffi::c_int, + label: *const ::core::ffi::c_char, + flags: SDL_TrayEntryFlags, + ) -> *mut SDL_TrayEntry; +} + +unsafe extern "C" { + /// Sets the label of an entry. + /// + /// An entry cannot change between a separator and an ordinary entry; that is, + /// it is not possible to set a non-NULL label on an entry that has a NULL + /// label (separators), or to set a NULL label to an entry that has a non-NULL + /// label. The function will silently fail if that happens. + /// + /// ## Parameters + /// - `entry`: the entry to be updated. + /// - `label`: the new label for the entry in UTF-8 encoding. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_GetTrayEntryLabel`] + pub fn SDL_SetTrayEntryLabel(entry: *mut SDL_TrayEntry, label: *const ::core::ffi::c_char); +} + +unsafe extern "C" { + /// Gets the label of an entry. + /// + /// If the returned value is NULL, the entry is a separator. + /// + /// ## Parameters + /// - `entry`: the entry to be read. + /// + /// ## Return value + /// Returns the label of the entry in UTF-8 encoding. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_SetTrayEntryLabel`] + pub fn SDL_GetTrayEntryLabel(entry: *mut SDL_TrayEntry) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Sets whether or not an entry is checked. + /// + /// The entry must have been created with the [`SDL_TRAYENTRY_CHECKBOX`] flag. + /// + /// ## Parameters + /// - `entry`: the entry to be updated. + /// - `checked`: true if the entry should be checked; false otherwise. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_GetTrayEntryChecked`] + pub fn SDL_SetTrayEntryChecked(entry: *mut SDL_TrayEntry, checked: ::core::primitive::bool); +} + +unsafe extern "C" { + /// Gets whether or not an entry is checked. + /// + /// The entry must have been created with the [`SDL_TRAYENTRY_CHECKBOX`] flag. + /// + /// ## Parameters + /// - `entry`: the entry to be read. + /// + /// ## Return value + /// Returns true if the entry is checked; false otherwise. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_SetTrayEntryChecked`] + pub fn SDL_GetTrayEntryChecked(entry: *mut SDL_TrayEntry) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Sets whether or not an entry is enabled. + /// + /// ## Parameters + /// - `entry`: the entry to be updated. + /// - `enabled`: true if the entry should be enabled; false otherwise. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_GetTrayEntryEnabled`] + pub fn SDL_SetTrayEntryEnabled(entry: *mut SDL_TrayEntry, enabled: ::core::primitive::bool); +} + +unsafe extern "C" { + /// Gets whether or not an entry is enabled. + /// + /// ## Parameters + /// - `entry`: the entry to be read. + /// + /// ## Return value + /// Returns true if the entry is enabled; false otherwise. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + /// - [`SDL_SetTrayEntryEnabled`] + pub fn SDL_GetTrayEntryEnabled(entry: *mut SDL_TrayEntry) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Sets a callback to be invoked when the entry is selected. + /// + /// ## Parameters + /// - `entry`: the entry to be updated. + /// - `callback`: a callback to be invoked when the entry is selected. + /// - `userdata`: an optional pointer to pass extra data to the callback when + /// it will be invoked. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetTrayEntries`] + /// - [`SDL_InsertTrayEntryAt`] + pub fn SDL_SetTrayEntryCallback( + entry: *mut SDL_TrayEntry, + callback: SDL_TrayCallback, + userdata: *mut ::core::ffi::c_void, + ); +} + +unsafe extern "C" { + /// Simulate a click on a tray entry. + /// + /// ## Parameters + /// - `entry`: The entry to activate. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ClickTrayEntry(entry: *mut SDL_TrayEntry); +} + +unsafe extern "C" { + /// Destroys a tray object. + /// + /// This also destroys all associated menus and entries. + /// + /// ## Parameters + /// - `tray`: the tray icon to be destroyed. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTray`] + pub fn SDL_DestroyTray(tray: *mut SDL_Tray); +} + +unsafe extern "C" { + /// Gets the menu containing a certain tray entry. + /// + /// ## Parameters + /// - `entry`: the entry for which to get the parent menu. + /// + /// ## Return value + /// Returns the parent menu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_InsertTrayEntryAt`] + pub fn SDL_GetTrayEntryParent(entry: *mut SDL_TrayEntry) -> *mut SDL_TrayMenu; +} + +unsafe extern "C" { + /// Gets the entry for which the menu is a submenu, if the current menu is a + /// submenu. + /// + /// Either this function or [`SDL_GetTrayMenuParentTray()`] will return non-NULL + /// for any given menu. + /// + /// ## Parameters + /// - `menu`: the menu for which to get the parent entry. + /// + /// ## Return value + /// Returns the parent entry, or NULL if this menu is not a submenu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTraySubmenu`] + /// - [`SDL_GetTrayMenuParentTray`] + pub fn SDL_GetTrayMenuParentEntry(menu: *mut SDL_TrayMenu) -> *mut SDL_TrayEntry; +} + +unsafe extern "C" { + /// Gets the tray for which this menu is the first-level menu, if the current + /// menu isn't a submenu. + /// + /// Either this function or [`SDL_GetTrayMenuParentEntry()`] will return non-NULL + /// for any given menu. + /// + /// ## Parameters + /// - `menu`: the menu for which to get the parent enttrayry. + /// + /// ## Return value + /// Returns the parent tray, or NULL if this menu is a submenu. + /// + /// ## Thread safety + /// This function should be called on the thread that created the + /// tray. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateTrayMenu`] + /// - [`SDL_GetTrayMenuParentEntry`] + pub fn SDL_GetTrayMenuParentTray(menu: *mut SDL_TrayMenu) -> *mut SDL_Tray; +} + +unsafe extern "C" { + /// Update the trays. + /// + /// This is called automatically by the event loop and is only needed if you're + /// using trays but aren't handling SDL events. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_UpdateTrays(); +} + +/// An opaque handle representing a toplevel system tray object. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_Tray { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing an entry on a system tray object. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_TrayEntry { + _opaque: [::core::primitive::u8; 0], +} + +/// An opaque handle representing a menu/submenu on a system tray object. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +#[repr(C)] +pub struct SDL_TrayMenu { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/version.rs b/vendor/sdl3-sys/src/generated/version.rs new file mode 100644 index 00000000..5d3bc334 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/version.rs @@ -0,0 +1,188 @@ +//! Functionality to query the current SDL version, both as headers the app was +//! compiled against, and a library the app is linked to. + +use super::stdinc::*; + +/// The current major version of SDL headers. +/// +/// If this were SDL version 3.2.1, this value would be 3. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_MAJOR_VERSION: ::core::primitive::i32 = 3; + +/// The current minor version of the SDL headers. +/// +/// If this were SDL version 3.2.1, this value would be 2. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_MINOR_VERSION: ::core::primitive::i32 = 4; + +/// The current micro (or patchlevel) version of the SDL headers. +/// +/// If this were SDL version 3.2.1, this value would be 1. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_MICRO_VERSION: ::core::primitive::i32 = 16; + +/// This macro turns the version numbers into a numeric value. +/// +/// (1,2,3) becomes 1002003. +/// +/// ## Parameters +/// - `major`: the major version number. +/// - `minor`: the minorversion number. +/// - `patch`: the patch version number. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_VERSIONNUM( + major: ::core::primitive::i32, + minor: ::core::primitive::i32, + patch: ::core::primitive::i32, +) -> ::core::primitive::i32 { + (((major * 1000000_i32) + (minor * 1000_i32)) + patch) +} + +/// This macro extracts the major version from a version number +/// +/// 1002003 becomes 1. +/// +/// ## Parameters +/// - `version`: the version number. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_VERSIONNUM_MAJOR(version: ::core::primitive::i32) -> ::core::primitive::i32 { + (version / 1000000_i32) +} + +/// This macro extracts the minor version from a version number +/// +/// 1002003 becomes 2. +/// +/// ## Parameters +/// - `version`: the version number. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_VERSIONNUM_MINOR(version: ::core::primitive::i32) -> ::core::primitive::i32 { + ((version / 1000_i32) % 1000_i32) +} + +/// This macro extracts the micro version from a version number +/// +/// 1002003 becomes 3. +/// +/// ## Parameters +/// - `version`: the version number. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_VERSIONNUM_MICRO(version: ::core::primitive::i32) -> ::core::primitive::i32 { + (version % 1000_i32) +} + +/// This is the version number macro for the current SDL version. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetVersion`] +pub const SDL_VERSION: ::core::primitive::i32 = + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION); + +/// This macro will evaluate to true if compiled with SDL at least X.Y.Z. +/// +/// ## Thread safety +/// It is safe to call this macro from any thread. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +#[inline(always)] +pub const fn SDL_VERSION_ATLEAST( + X: ::core::primitive::i32, + Y: ::core::primitive::i32, + Z: ::core::primitive::i32, +) -> ::core::primitive::bool { + (SDL_VERSION >= SDL_VERSIONNUM(X, Y, Z)) +} + +unsafe extern "C" { + /// Get the version of SDL that is linked against your program. + /// + /// If you are linking to SDL dynamically, then it is possible that the current + /// version will be different than the version you compiled against. This + /// function returns the current version, while [`SDL_VERSION`] is the version you + /// compiled with. + /// + /// This function may be called safely at any time, even before [`SDL_Init()`]. + /// + /// ## Return value + /// Returns the version of the linked library. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRevision`] + pub safe fn SDL_GetVersion() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the code revision of the SDL library that is linked against your + /// program. + /// + /// This value is the revision of the code you are linking against and may be + /// different from the code you are compiling with, which is found in the + /// constant [`SDL_REVISION`] if you explicitly include SDL_revision.h + /// + /// The revision is an arbitrary string (a hash value) uniquely identifying the + /// exact revision of the SDL library in use, and is only useful in comparing + /// against other revisions. It is NOT an incrementing number. + /// + /// If SDL wasn't built from a git repository with the appropriate tools, this + /// will return an empty string. + /// + /// You shouldn't use this function for anything but logging it for debugging + /// purposes. The string is not intended to be reliable in any way. + /// + /// ## Return value + /// Returns an arbitrary string, uniquely identifying the exact revision of + /// the SDL library in use. + /// + /// ## Thread safety + /// It is safe to call this function from any thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetVersion`] + pub safe fn SDL_GetRevision() -> *const ::core::ffi::c_char; +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/video.rs b/vendor/sdl3-sys/src/generated/video.rs new file mode 100644 index 00000000..4c00b78d --- /dev/null +++ b/vendor/sdl3-sys/src/generated/video.rs @@ -0,0 +1,6297 @@ +//! SDL's video subsystem is largely interested in abstracting window +//! management from the underlying operating system. You can create windows, +//! manage them in various ways, set them fullscreen, and get events when +//! interesting things happen with them, such as the mouse or keyboard +//! interacting with a window. +//! +//! The video subsystem is also interested in abstracting away some +//! platform-specific differences in OpenGL: context creation, swapping +//! buffers, etc. This may be crucial to your app, but also you are not +//! required to use OpenGL at all. In fact, SDL can provide rendering to those +//! windows as well, either with an easy-to-use +//! [2D API](https://wiki.libsdl.org/SDL3/CategoryRender) +//! or with a more-powerful +//! [GPU API](https://wiki.libsdl.org/SDL3/CategoryGPU) +//! . Of course, it can simply get out of your way and give you the window +//! handles you need to use Vulkan, Direct3D, Metal, or whatever else you like +//! directly, too. +//! +//! The video subsystem covers a lot of functionality, out of necessity, so it +//! is worth perusing the list of functions just to see what's available, but +//! most apps can get by with simply creating a window and listening for +//! events, so start with [`SDL_CreateWindow()`] and [`SDL_PollEvent()`]. + +use super::stdinc::*; + +use super::error::*; + +use super::pixels::*; + +use super::properties::*; + +use super::rect::*; + +use super::surface::*; + +/// This is a unique ID for a display for the time it is connected to the +/// system, and is never reused for the lifetime of the application. +/// +/// If the display is disconnected and reconnected, it will get a new ID. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_DisplayID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_DisplayID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_DisplayID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_DisplayID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_DisplayID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_DisplayID { + /// Initialize a `SDL_DisplayID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_DisplayID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_DisplayID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_DisplayID; +} + +/// This is a unique ID for a window. +/// +/// The value 0 is an invalid ID. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_WindowID(pub Uint32); + +impl ::core::cmp::PartialEq for SDL_WindowID { + #[inline(always)] + fn eq(&self, other: &Uint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint32 { + #[inline(always)] + fn eq(&self, other: &SDL_WindowID) -> bool { + self == &other.0 + } +} + +impl From for Uint32 { + #[inline(always)] + fn from(value: SDL_WindowID) -> Self { + value.0 + } +} + +#[cfg(feature = "display-impls")] +impl ::core::fmt::Display for SDL_WindowID { + #[inline(always)] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::fmt(&self.0, f) + } +} + +impl SDL_WindowID { + /// Initialize a `SDL_WindowID` from a raw value. + #[inline(always)] + pub const fn new(value: Uint32) -> Self { + Self(value) + } +} + +impl SDL_WindowID { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_WindowID { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_WindowID; +} + +/// The pointer to the global `wl_display` object used by the Wayland video +/// backend. +/// +/// Can be set before the video subsystem is initialized to import an external +/// `wl_display` object from an application or toolkit for use in SDL, or read +/// after initialization to export the `wl_display` used by the Wayland video +/// backend. Setting this property after the video subsystem has been +/// initialized has no effect, and reading it when the video subsystem is +/// uninitialized will either return the user provided value, if one was set +/// prior to initialization, or NULL. See docs/README-wayland.md for more +/// information. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +pub const SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER: *const ::core::ffi::c_char = + c"SDL.video.wayland.wl_display".as_ptr(); + +/// System theme. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_SystemTheme::UNKNOWN) | [`SDL_SYSTEM_THEME_UNKNOWN`] | Unknown system theme | +/// | [`LIGHT`](SDL_SystemTheme::LIGHT) | [`SDL_SYSTEM_THEME_LIGHT`] | Light colored system theme | +/// | [`DARK`](SDL_SystemTheme::DARK) | [`SDL_SYSTEM_THEME_DARK`] | Dark colored system theme | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_SystemTheme(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_SystemTheme { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_SystemTheme) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_SystemTheme) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_SystemTheme { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_SYSTEM_THEME_UNKNOWN", + Self::LIGHT => "SDL_SYSTEM_THEME_LIGHT", + Self::DARK => "SDL_SYSTEM_THEME_DARK", + + _ => return write!(f, "SDL_SystemTheme({})", self.0), + }) + } +} + +impl SDL_SystemTheme { + /// Unknown system theme + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + /// Light colored system theme + pub const LIGHT: Self = Self((1 as ::core::ffi::c_int)); + /// Dark colored system theme + pub const DARK: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Unknown system theme +pub const SDL_SYSTEM_THEME_UNKNOWN: SDL_SystemTheme = SDL_SystemTheme::UNKNOWN; +/// Light colored system theme +pub const SDL_SYSTEM_THEME_LIGHT: SDL_SystemTheme = SDL_SystemTheme::LIGHT; +/// Dark colored system theme +pub const SDL_SYSTEM_THEME_DARK: SDL_SystemTheme = SDL_SystemTheme::DARK; + +impl SDL_SystemTheme { + /// Initialize a `SDL_SystemTheme` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_SystemTheme { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_SystemTheme { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_SystemTheme; +} + +/// The structure that defines a display mode. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetFullscreenDisplayModes`] +/// - [`SDL_GetDesktopDisplayMode`] +/// - [`SDL_GetCurrentDisplayMode`] +/// - [`SDL_SetWindowFullscreenMode`] +/// - [`SDL_GetWindowFullscreenMode`] +/// +/// ## Notes for `sdl3-sys` +/// This struct can't be created manually. Use the corresponding SDL functions. +#[repr(C)] +#[cfg_attr(feature = "debug-impls", derive(Debug))] +pub struct SDL_DisplayMode { + /// the display this mode is associated with + pub displayID: SDL_DisplayID, + /// pixel format + pub format: SDL_PixelFormat, + /// width + pub w: ::core::ffi::c_int, + /// height + pub h: ::core::ffi::c_int, + /// scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels) + pub pixel_density: ::core::ffi::c_float, + /// refresh rate (or 0.0f for unspecified) + pub refresh_rate: ::core::ffi::c_float, + /// precise refresh rate numerator (or 0 for unspecified) + pub refresh_rate_numerator: ::core::ffi::c_int, + /// precise refresh rate denominator + pub refresh_rate_denominator: ::core::ffi::c_int, + /// Private + pub internal: *mut SDL_DisplayModeData, + #[doc(hidden)] + __non_exhaustive: ::sdl3_sys::NonExhaustive, +} + +/// Display orientation values; the way a display is rotated. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`UNKNOWN`](SDL_DisplayOrientation::UNKNOWN) | [`SDL_ORIENTATION_UNKNOWN`] | The display orientation can't be determined | +/// | [`LANDSCAPE`](SDL_DisplayOrientation::LANDSCAPE) | [`SDL_ORIENTATION_LANDSCAPE`] | The display is in landscape mode, with the right side up, relative to portrait mode | +/// | [`LANDSCAPE_FLIPPED`](SDL_DisplayOrientation::LANDSCAPE_FLIPPED) | [`SDL_ORIENTATION_LANDSCAPE_FLIPPED`] | The display is in landscape mode, with the left side up, relative to portrait mode | +/// | [`PORTRAIT`](SDL_DisplayOrientation::PORTRAIT) | [`SDL_ORIENTATION_PORTRAIT`] | The display is in portrait mode | +/// | [`PORTRAIT_FLIPPED`](SDL_DisplayOrientation::PORTRAIT_FLIPPED) | [`SDL_ORIENTATION_PORTRAIT_FLIPPED`] | The display is in portrait mode, upside down | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_DisplayOrientation(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_DisplayOrientation { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_DisplayOrientation) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_DisplayOrientation) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_DisplayOrientation { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::UNKNOWN => "SDL_ORIENTATION_UNKNOWN", + Self::LANDSCAPE => "SDL_ORIENTATION_LANDSCAPE", + Self::LANDSCAPE_FLIPPED => "SDL_ORIENTATION_LANDSCAPE_FLIPPED", + Self::PORTRAIT => "SDL_ORIENTATION_PORTRAIT", + Self::PORTRAIT_FLIPPED => "SDL_ORIENTATION_PORTRAIT_FLIPPED", + + _ => return write!(f, "SDL_DisplayOrientation({})", self.0), + }) + } +} + +impl SDL_DisplayOrientation { + /// The display orientation can't be determined + pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int)); + /// The display is in landscape mode, with the right side up, relative to portrait mode + pub const LANDSCAPE: Self = Self((1 as ::core::ffi::c_int)); + /// The display is in landscape mode, with the left side up, relative to portrait mode + pub const LANDSCAPE_FLIPPED: Self = Self((2 as ::core::ffi::c_int)); + /// The display is in portrait mode + pub const PORTRAIT: Self = Self((3 as ::core::ffi::c_int)); + /// The display is in portrait mode, upside down + pub const PORTRAIT_FLIPPED: Self = Self((4 as ::core::ffi::c_int)); +} + +/// The display orientation can't be determined +pub const SDL_ORIENTATION_UNKNOWN: SDL_DisplayOrientation = SDL_DisplayOrientation::UNKNOWN; +/// The display is in landscape mode, with the right side up, relative to portrait mode +pub const SDL_ORIENTATION_LANDSCAPE: SDL_DisplayOrientation = SDL_DisplayOrientation::LANDSCAPE; +/// The display is in landscape mode, with the left side up, relative to portrait mode +pub const SDL_ORIENTATION_LANDSCAPE_FLIPPED: SDL_DisplayOrientation = + SDL_DisplayOrientation::LANDSCAPE_FLIPPED; +/// The display is in portrait mode +pub const SDL_ORIENTATION_PORTRAIT: SDL_DisplayOrientation = SDL_DisplayOrientation::PORTRAIT; +/// The display is in portrait mode, upside down +pub const SDL_ORIENTATION_PORTRAIT_FLIPPED: SDL_DisplayOrientation = + SDL_DisplayOrientation::PORTRAIT_FLIPPED; + +impl SDL_DisplayOrientation { + /// Initialize a `SDL_DisplayOrientation` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_DisplayOrientation { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_DisplayOrientation { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_DisplayOrientation; +} + +/// The flags on a window. +/// +/// These cover a lot of true/false, or on/off, window state. Some of it is +/// immutable after being set through [`SDL_CreateWindow()`], some of it can be +/// changed on existing windows by the app, and some of it might be altered by +/// the user or system outside of the app's control. +/// +/// When creating windows with [`SDL_WINDOW_RESIZABLE`], SDL will constrain +/// resizable windows to the dimensions recommended by the compositor to fit it +/// within the usable desktop space, although some compositors will do this +/// automatically without intervention as well. Use [`SDL_SetWindowResizable`] +/// after creation instead if you wish to create a window with a specific size. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetWindowFlags`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`FULLSCREEN`](SDL_WindowFlags::FULLSCREEN) | [`SDL_WINDOW_FULLSCREEN`] | window is in fullscreen mode | +/// | [`OPENGL`](SDL_WindowFlags::OPENGL) | [`SDL_WINDOW_OPENGL`] | window usable with OpenGL context | +/// | [`OCCLUDED`](SDL_WindowFlags::OCCLUDED) | [`SDL_WINDOW_OCCLUDED`] | window is occluded | +/// | [`HIDDEN`](SDL_WindowFlags::HIDDEN) | [`SDL_WINDOW_HIDDEN`] | window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible | +/// | [`BORDERLESS`](SDL_WindowFlags::BORDERLESS) | [`SDL_WINDOW_BORDERLESS`] | no window decoration | +/// | [`RESIZABLE`](SDL_WindowFlags::RESIZABLE) | [`SDL_WINDOW_RESIZABLE`] | window can be resized | +/// | [`MINIMIZED`](SDL_WindowFlags::MINIMIZED) | [`SDL_WINDOW_MINIMIZED`] | window is minimized | +/// | [`MAXIMIZED`](SDL_WindowFlags::MAXIMIZED) | [`SDL_WINDOW_MAXIMIZED`] | window is maximized | +/// | [`MOUSE_GRABBED`](SDL_WindowFlags::MOUSE_GRABBED) | [`SDL_WINDOW_MOUSE_GRABBED`] | window has grabbed mouse input | +/// | [`INPUT_FOCUS`](SDL_WindowFlags::INPUT_FOCUS) | [`SDL_WINDOW_INPUT_FOCUS`] | window has input focus | +/// | [`MOUSE_FOCUS`](SDL_WindowFlags::MOUSE_FOCUS) | [`SDL_WINDOW_MOUSE_FOCUS`] | window has mouse focus | +/// | [`EXTERNAL`](SDL_WindowFlags::EXTERNAL) | [`SDL_WINDOW_EXTERNAL`] | window not created by SDL | +/// | [`MODAL`](SDL_WindowFlags::MODAL) | [`SDL_WINDOW_MODAL`] | window is modal | +/// | [`HIGH_PIXEL_DENSITY`](SDL_WindowFlags::HIGH_PIXEL_DENSITY) | [`SDL_WINDOW_HIGH_PIXEL_DENSITY`] | window uses high pixel density back buffer if possible | +/// | [`MOUSE_CAPTURE`](SDL_WindowFlags::MOUSE_CAPTURE) | [`SDL_WINDOW_MOUSE_CAPTURE`] | window has mouse captured (unrelated to MOUSE_GRABBED) | +/// | [`MOUSE_RELATIVE_MODE`](SDL_WindowFlags::MOUSE_RELATIVE_MODE) | [`SDL_WINDOW_MOUSE_RELATIVE_MODE`] | window has relative mode enabled | +/// | [`ALWAYS_ON_TOP`](SDL_WindowFlags::ALWAYS_ON_TOP) | [`SDL_WINDOW_ALWAYS_ON_TOP`] | window should always be above others | +/// | [`UTILITY`](SDL_WindowFlags::UTILITY) | [`SDL_WINDOW_UTILITY`] | window should be treated as a utility window, not showing in the task bar and window list | +/// | [`TOOLTIP`](SDL_WindowFlags::TOOLTIP) | [`SDL_WINDOW_TOOLTIP`] | window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window | +/// | [`POPUP_MENU`](SDL_WindowFlags::POPUP_MENU) | [`SDL_WINDOW_POPUP_MENU`] | window should be treated as a popup menu, requires a parent window | +/// | [`KEYBOARD_GRABBED`](SDL_WindowFlags::KEYBOARD_GRABBED) | [`SDL_WINDOW_KEYBOARD_GRABBED`] | window has grabbed keyboard input | +/// | [`FILL_DOCUMENT`](SDL_WindowFlags::FILL_DOCUMENT) | [`SDL_WINDOW_FILL_DOCUMENT`] | window is in fill-document mode (Emscripten only), since SDL 3.4.0 | +/// | [`VULKAN`](SDL_WindowFlags::VULKAN) | [`SDL_WINDOW_VULKAN`] | window usable for Vulkan surface | +/// | [`METAL`](SDL_WindowFlags::METAL) | [`SDL_WINDOW_METAL`] | window usable for Metal view | +/// | [`TRANSPARENT`](SDL_WindowFlags::TRANSPARENT) | [`SDL_WINDOW_TRANSPARENT`] | window with transparent buffer | +/// | [`NOT_FOCUSABLE`](SDL_WindowFlags::NOT_FOCUSABLE) | [`SDL_WINDOW_NOT_FOCUSABLE`] | window should not be focusable | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_WindowFlags(pub Uint64); + +impl ::core::cmp::PartialEq for SDL_WindowFlags { + #[inline(always)] + fn eq(&self, other: &Uint64) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Uint64 { + #[inline(always)] + fn eq(&self, other: &SDL_WindowFlags) -> bool { + self == &other.0 + } +} + +impl From for Uint64 { + #[inline(always)] + fn from(value: SDL_WindowFlags) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_WindowFlags { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_WindowFlags(")?; + let all_bits = all_bits | Self::FULLSCREEN.0; + if (Self::FULLSCREEN != 0 || self.0 == 0) && *self & Self::FULLSCREEN == Self::FULLSCREEN { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "FULLSCREEN")?; + } + let all_bits = all_bits | Self::OPENGL.0; + if (Self::OPENGL != 0 || self.0 == 0) && *self & Self::OPENGL == Self::OPENGL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "OPENGL")?; + } + let all_bits = all_bits | Self::OCCLUDED.0; + if (Self::OCCLUDED != 0 || self.0 == 0) && *self & Self::OCCLUDED == Self::OCCLUDED { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "OCCLUDED")?; + } + let all_bits = all_bits | Self::HIDDEN.0; + if (Self::HIDDEN != 0 || self.0 == 0) && *self & Self::HIDDEN == Self::HIDDEN { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "HIDDEN")?; + } + let all_bits = all_bits | Self::BORDERLESS.0; + if (Self::BORDERLESS != 0 || self.0 == 0) && *self & Self::BORDERLESS == Self::BORDERLESS { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "BORDERLESS")?; + } + let all_bits = all_bits | Self::RESIZABLE.0; + if (Self::RESIZABLE != 0 || self.0 == 0) && *self & Self::RESIZABLE == Self::RESIZABLE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RESIZABLE")?; + } + let all_bits = all_bits | Self::MINIMIZED.0; + if (Self::MINIMIZED != 0 || self.0 == 0) && *self & Self::MINIMIZED == Self::MINIMIZED { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MINIMIZED")?; + } + let all_bits = all_bits | Self::MAXIMIZED.0; + if (Self::MAXIMIZED != 0 || self.0 == 0) && *self & Self::MAXIMIZED == Self::MAXIMIZED { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MAXIMIZED")?; + } + let all_bits = all_bits | Self::MOUSE_GRABBED.0; + if (Self::MOUSE_GRABBED != 0 || self.0 == 0) + && *self & Self::MOUSE_GRABBED == Self::MOUSE_GRABBED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MOUSE_GRABBED")?; + } + let all_bits = all_bits | Self::INPUT_FOCUS.0; + if (Self::INPUT_FOCUS != 0 || self.0 == 0) && *self & Self::INPUT_FOCUS == Self::INPUT_FOCUS + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "INPUT_FOCUS")?; + } + let all_bits = all_bits | Self::MOUSE_FOCUS.0; + if (Self::MOUSE_FOCUS != 0 || self.0 == 0) && *self & Self::MOUSE_FOCUS == Self::MOUSE_FOCUS + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MOUSE_FOCUS")?; + } + let all_bits = all_bits | Self::EXTERNAL.0; + if (Self::EXTERNAL != 0 || self.0 == 0) && *self & Self::EXTERNAL == Self::EXTERNAL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "EXTERNAL")?; + } + let all_bits = all_bits | Self::MODAL.0; + if (Self::MODAL != 0 || self.0 == 0) && *self & Self::MODAL == Self::MODAL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MODAL")?; + } + let all_bits = all_bits | Self::HIGH_PIXEL_DENSITY.0; + if (Self::HIGH_PIXEL_DENSITY != 0 || self.0 == 0) + && *self & Self::HIGH_PIXEL_DENSITY == Self::HIGH_PIXEL_DENSITY + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "HIGH_PIXEL_DENSITY")?; + } + let all_bits = all_bits | Self::MOUSE_CAPTURE.0; + if (Self::MOUSE_CAPTURE != 0 || self.0 == 0) + && *self & Self::MOUSE_CAPTURE == Self::MOUSE_CAPTURE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MOUSE_CAPTURE")?; + } + let all_bits = all_bits | Self::MOUSE_RELATIVE_MODE.0; + if (Self::MOUSE_RELATIVE_MODE != 0 || self.0 == 0) + && *self & Self::MOUSE_RELATIVE_MODE == Self::MOUSE_RELATIVE_MODE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "MOUSE_RELATIVE_MODE")?; + } + let all_bits = all_bits | Self::ALWAYS_ON_TOP.0; + if (Self::ALWAYS_ON_TOP != 0 || self.0 == 0) + && *self & Self::ALWAYS_ON_TOP == Self::ALWAYS_ON_TOP + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ALWAYS_ON_TOP")?; + } + let all_bits = all_bits | Self::UTILITY.0; + if (Self::UTILITY != 0 || self.0 == 0) && *self & Self::UTILITY == Self::UTILITY { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "UTILITY")?; + } + let all_bits = all_bits | Self::TOOLTIP.0; + if (Self::TOOLTIP != 0 || self.0 == 0) && *self & Self::TOOLTIP == Self::TOOLTIP { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "TOOLTIP")?; + } + let all_bits = all_bits | Self::POPUP_MENU.0; + if (Self::POPUP_MENU != 0 || self.0 == 0) && *self & Self::POPUP_MENU == Self::POPUP_MENU { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "POPUP_MENU")?; + } + let all_bits = all_bits | Self::KEYBOARD_GRABBED.0; + if (Self::KEYBOARD_GRABBED != 0 || self.0 == 0) + && *self & Self::KEYBOARD_GRABBED == Self::KEYBOARD_GRABBED + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "KEYBOARD_GRABBED")?; + } + let all_bits = all_bits | Self::FILL_DOCUMENT.0; + if (Self::FILL_DOCUMENT != 0 || self.0 == 0) + && *self & Self::FILL_DOCUMENT == Self::FILL_DOCUMENT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "FILL_DOCUMENT")?; + } + let all_bits = all_bits | Self::VULKAN.0; + if (Self::VULKAN != 0 || self.0 == 0) && *self & Self::VULKAN == Self::VULKAN { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "VULKAN")?; + } + let all_bits = all_bits | Self::METAL.0; + if (Self::METAL != 0 || self.0 == 0) && *self & Self::METAL == Self::METAL { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "METAL")?; + } + let all_bits = all_bits | Self::TRANSPARENT.0; + if (Self::TRANSPARENT != 0 || self.0 == 0) && *self & Self::TRANSPARENT == Self::TRANSPARENT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "TRANSPARENT")?; + } + let all_bits = all_bits | Self::NOT_FOCUSABLE.0; + if (Self::NOT_FOCUSABLE != 0 || self.0 == 0) + && *self & Self::NOT_FOCUSABLE == Self::NOT_FOCUSABLE + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NOT_FOCUSABLE")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_WindowFlags { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_WindowFlags { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_WindowFlags { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_WindowFlags { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_WindowFlags { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_WindowFlags { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_WindowFlags { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_WindowFlags { + /// window is in fullscreen mode + pub const FULLSCREEN: Self = Self((1_u64 as Uint64)); + /// window usable with OpenGL context + pub const OPENGL: Self = Self((2_u64 as Uint64)); + /// window is occluded + pub const OCCLUDED: Self = Self((4_u64 as Uint64)); + /// window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible + pub const HIDDEN: Self = Self((8_u64 as Uint64)); + /// no window decoration + pub const BORDERLESS: Self = Self((16_u64 as Uint64)); + /// window can be resized + pub const RESIZABLE: Self = Self((32_u64 as Uint64)); + /// window is minimized + pub const MINIMIZED: Self = Self((64_u64 as Uint64)); + /// window is maximized + pub const MAXIMIZED: Self = Self((128_u64 as Uint64)); + /// window has grabbed mouse input + pub const MOUSE_GRABBED: Self = Self((256_u64 as Uint64)); + /// window has input focus + pub const INPUT_FOCUS: Self = Self((512_u64 as Uint64)); + /// window has mouse focus + pub const MOUSE_FOCUS: Self = Self((1024_u64 as Uint64)); + /// window not created by SDL + pub const EXTERNAL: Self = Self((2048_u64 as Uint64)); + /// window is modal + pub const MODAL: Self = Self((4096_u64 as Uint64)); + /// window uses high pixel density back buffer if possible + pub const HIGH_PIXEL_DENSITY: Self = Self((8192_u64 as Uint64)); + /// window has mouse captured (unrelated to MOUSE_GRABBED) + pub const MOUSE_CAPTURE: Self = Self((16384_u64 as Uint64)); + /// window has relative mode enabled + pub const MOUSE_RELATIVE_MODE: Self = Self((32768_u64 as Uint64)); + /// window should always be above others + pub const ALWAYS_ON_TOP: Self = Self((65536_u64 as Uint64)); + /// window should be treated as a utility window, not showing in the task bar and window list + pub const UTILITY: Self = Self((131072_u64 as Uint64)); + /// window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window + pub const TOOLTIP: Self = Self((262144_u64 as Uint64)); + /// window should be treated as a popup menu, requires a parent window + pub const POPUP_MENU: Self = Self((524288_u64 as Uint64)); + /// window has grabbed keyboard input + pub const KEYBOARD_GRABBED: Self = Self((1048576_u64 as Uint64)); + /// window is in fill-document mode (Emscripten only), since SDL 3.4.0 + pub const FILL_DOCUMENT: Self = Self((2097152_u64 as Uint64)); + /// window usable for Vulkan surface + pub const VULKAN: Self = Self((268435456_u64 as Uint64)); + /// window usable for Metal view + pub const METAL: Self = Self((536870912_u64 as Uint64)); + /// window with transparent buffer + pub const TRANSPARENT: Self = Self((1073741824_u64 as Uint64)); + /// window should not be focusable + pub const NOT_FOCUSABLE: Self = Self((2147483648_u64 as Uint64)); +} + +/// window is in fullscreen mode +pub const SDL_WINDOW_FULLSCREEN: SDL_WindowFlags = SDL_WindowFlags::FULLSCREEN; +/// window usable with OpenGL context +pub const SDL_WINDOW_OPENGL: SDL_WindowFlags = SDL_WindowFlags::OPENGL; +/// window is occluded +pub const SDL_WINDOW_OCCLUDED: SDL_WindowFlags = SDL_WindowFlags::OCCLUDED; +/// window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible +pub const SDL_WINDOW_HIDDEN: SDL_WindowFlags = SDL_WindowFlags::HIDDEN; +/// no window decoration +pub const SDL_WINDOW_BORDERLESS: SDL_WindowFlags = SDL_WindowFlags::BORDERLESS; +/// window can be resized +pub const SDL_WINDOW_RESIZABLE: SDL_WindowFlags = SDL_WindowFlags::RESIZABLE; +/// window is minimized +pub const SDL_WINDOW_MINIMIZED: SDL_WindowFlags = SDL_WindowFlags::MINIMIZED; +/// window is maximized +pub const SDL_WINDOW_MAXIMIZED: SDL_WindowFlags = SDL_WindowFlags::MAXIMIZED; +/// window has grabbed mouse input +pub const SDL_WINDOW_MOUSE_GRABBED: SDL_WindowFlags = SDL_WindowFlags::MOUSE_GRABBED; +/// window has input focus +pub const SDL_WINDOW_INPUT_FOCUS: SDL_WindowFlags = SDL_WindowFlags::INPUT_FOCUS; +/// window has mouse focus +pub const SDL_WINDOW_MOUSE_FOCUS: SDL_WindowFlags = SDL_WindowFlags::MOUSE_FOCUS; +/// window not created by SDL +pub const SDL_WINDOW_EXTERNAL: SDL_WindowFlags = SDL_WindowFlags::EXTERNAL; +/// window is modal +pub const SDL_WINDOW_MODAL: SDL_WindowFlags = SDL_WindowFlags::MODAL; +/// window uses high pixel density back buffer if possible +pub const SDL_WINDOW_HIGH_PIXEL_DENSITY: SDL_WindowFlags = SDL_WindowFlags::HIGH_PIXEL_DENSITY; +/// window has mouse captured (unrelated to MOUSE_GRABBED) +pub const SDL_WINDOW_MOUSE_CAPTURE: SDL_WindowFlags = SDL_WindowFlags::MOUSE_CAPTURE; +/// window has relative mode enabled +pub const SDL_WINDOW_MOUSE_RELATIVE_MODE: SDL_WindowFlags = SDL_WindowFlags::MOUSE_RELATIVE_MODE; +/// window should always be above others +pub const SDL_WINDOW_ALWAYS_ON_TOP: SDL_WindowFlags = SDL_WindowFlags::ALWAYS_ON_TOP; +/// window should be treated as a utility window, not showing in the task bar and window list +pub const SDL_WINDOW_UTILITY: SDL_WindowFlags = SDL_WindowFlags::UTILITY; +/// window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window +pub const SDL_WINDOW_TOOLTIP: SDL_WindowFlags = SDL_WindowFlags::TOOLTIP; +/// window should be treated as a popup menu, requires a parent window +pub const SDL_WINDOW_POPUP_MENU: SDL_WindowFlags = SDL_WindowFlags::POPUP_MENU; +/// window has grabbed keyboard input +pub const SDL_WINDOW_KEYBOARD_GRABBED: SDL_WindowFlags = SDL_WindowFlags::KEYBOARD_GRABBED; +/// window is in fill-document mode (Emscripten only), since SDL 3.4.0 +pub const SDL_WINDOW_FILL_DOCUMENT: SDL_WindowFlags = SDL_WindowFlags::FILL_DOCUMENT; +/// window usable for Vulkan surface +pub const SDL_WINDOW_VULKAN: SDL_WindowFlags = SDL_WindowFlags::VULKAN; +/// window usable for Metal view +pub const SDL_WINDOW_METAL: SDL_WindowFlags = SDL_WindowFlags::METAL; +/// window with transparent buffer +pub const SDL_WINDOW_TRANSPARENT: SDL_WindowFlags = SDL_WindowFlags::TRANSPARENT; +/// window should not be focusable +pub const SDL_WINDOW_NOT_FOCUSABLE: SDL_WindowFlags = SDL_WindowFlags::NOT_FOCUSABLE; + +impl SDL_WindowFlags { + /// Initialize a `SDL_WindowFlags` from a raw value. + #[inline(always)] + pub const fn new(value: Uint64) -> Self { + Self(value) + } +} + +impl SDL_WindowFlags { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Uint64 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_WindowFlags { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_WindowFlags; +} + +/// A magic value used with [`SDL_WINDOWPOS_UNDEFINED`]. +/// +/// Generally this macro isn't used directly, but rather through +/// [`SDL_WINDOWPOS_UNDEFINED`] or [`SDL_WINDOWPOS_UNDEFINED_DISPLAY`]. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +pub const SDL_WINDOWPOS_UNDEFINED_MASK: ::core::primitive::u32 = 536805376_u32; + +/// Used to indicate that you don't care what the window position is. +/// +/// If you _really_ don't care, [`SDL_WINDOWPOS_UNDEFINED`] is the same, but always +/// uses the primary display instead of specifying one. +/// +/// ## Parameters +/// - `X`: the [`SDL_DisplayID`] of the display to use. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +#[inline(always)] +pub const fn SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: SDL_DisplayID) -> ::core::ffi::c_int { + ((SDL_WINDOWPOS_UNDEFINED_MASK | X.0) as ::core::ffi::c_int) +} + +/// Used to indicate that you don't care what the window position/display is. +/// +/// This always uses the primary display. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +pub const SDL_WINDOWPOS_UNDEFINED: ::core::ffi::c_int = + SDL_WINDOWPOS_UNDEFINED_DISPLAY(SDL_DisplayID((0 as Uint32))); + +/// A macro to test if the window position is marked as "undefined." +/// +/// ## Parameters +/// - `X`: the window position value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +#[inline(always)] +pub const fn SDL_WINDOWPOS_ISUNDEFINED(X: ::core::ffi::c_int) -> ::core::primitive::bool { + (((X as ::core::primitive::u32) & 4294901760_u32) == SDL_WINDOWPOS_UNDEFINED_MASK) +} + +/// A magic value used with [`SDL_WINDOWPOS_CENTERED`]. +/// +/// Generally this macro isn't used directly, but rather through +/// [`SDL_WINDOWPOS_CENTERED`] or [`SDL_WINDOWPOS_CENTERED_DISPLAY`]. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +pub const SDL_WINDOWPOS_CENTERED_MASK: ::core::primitive::u32 = 805240832_u32; + +/// Used to indicate that the window position should be centered. +/// +/// [`SDL_WINDOWPOS_CENTERED`] is the same, but always uses the primary display +/// instead of specifying one. +/// +/// ## Parameters +/// - `X`: the [`SDL_DisplayID`] of the display to use. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +#[inline(always)] +pub const fn SDL_WINDOWPOS_CENTERED_DISPLAY(X: SDL_DisplayID) -> ::core::ffi::c_int { + ((SDL_WINDOWPOS_CENTERED_MASK | X.0) as ::core::ffi::c_int) +} + +/// Used to indicate that the window position should be centered. +/// +/// This always uses the primary display. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_SetWindowPosition`] +pub const SDL_WINDOWPOS_CENTERED: ::core::ffi::c_int = + SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_DisplayID((0 as Uint32))); + +/// A macro to test if the window position is marked as "centered." +/// +/// ## Parameters +/// - `X`: the window position value. +/// +/// ## Availability +/// This macro is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GetWindowPosition`] +#[inline(always)] +pub const fn SDL_WINDOWPOS_ISCENTERED(X: ::core::ffi::c_int) -> ::core::primitive::bool { + (((X as ::core::primitive::u32) & 4294901760_u32) == SDL_WINDOWPOS_CENTERED_MASK) +} + +/// Window flash operation. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`CANCEL`](SDL_FlashOperation::CANCEL) | [`SDL_FLASH_CANCEL`] | Cancel any window flash state | +/// | [`BRIEFLY`](SDL_FlashOperation::BRIEFLY) | [`SDL_FLASH_BRIEFLY`] | Flash the window briefly to get attention | +/// | [`UNTIL_FOCUSED`](SDL_FlashOperation::UNTIL_FOCUSED) | [`SDL_FLASH_UNTIL_FOCUSED`] | Flash the window until it gets focus | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_FlashOperation(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_FlashOperation { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_FlashOperation) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_FlashOperation) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_FlashOperation { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::CANCEL => "SDL_FLASH_CANCEL", + Self::BRIEFLY => "SDL_FLASH_BRIEFLY", + Self::UNTIL_FOCUSED => "SDL_FLASH_UNTIL_FOCUSED", + + _ => return write!(f, "SDL_FlashOperation({})", self.0), + }) + } +} + +impl SDL_FlashOperation { + /// Cancel any window flash state + pub const CANCEL: Self = Self((0 as ::core::ffi::c_int)); + /// Flash the window briefly to get attention + pub const BRIEFLY: Self = Self((1 as ::core::ffi::c_int)); + /// Flash the window until it gets focus + pub const UNTIL_FOCUSED: Self = Self((2 as ::core::ffi::c_int)); +} + +/// Cancel any window flash state +pub const SDL_FLASH_CANCEL: SDL_FlashOperation = SDL_FlashOperation::CANCEL; +/// Flash the window briefly to get attention +pub const SDL_FLASH_BRIEFLY: SDL_FlashOperation = SDL_FlashOperation::BRIEFLY; +/// Flash the window until it gets focus +pub const SDL_FLASH_UNTIL_FOCUSED: SDL_FlashOperation = SDL_FlashOperation::UNTIL_FOCUSED; + +impl SDL_FlashOperation { + /// Initialize a `SDL_FlashOperation` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_FlashOperation { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_FlashOperation { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_FlashOperation; +} + +/// Window progress state +/// +/// ## Availability +/// This enum is available since SDL 3.2.8. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`INVALID`](SDL_ProgressState::INVALID) | [`SDL_PROGRESS_STATE_INVALID`] | An invalid progress state indicating an error; check [`SDL_GetError()`] | +/// | [`NONE`](SDL_ProgressState::NONE) | [`SDL_PROGRESS_STATE_NONE`] | No progress bar is shown | +/// | [`INDETERMINATE`](SDL_ProgressState::INDETERMINATE) | [`SDL_PROGRESS_STATE_INDETERMINATE`] | The progress bar is shown in a indeterminate state | +/// | [`NORMAL`](SDL_ProgressState::NORMAL) | [`SDL_PROGRESS_STATE_NORMAL`] | The progress bar is shown in a normal state | +/// | [`PAUSED`](SDL_ProgressState::PAUSED) | [`SDL_PROGRESS_STATE_PAUSED`] | The progress bar is shown in a paused state | +/// | [`ERROR`](SDL_ProgressState::ERROR) | [`SDL_PROGRESS_STATE_ERROR`] | The progress bar is shown in a state indicating the application had an error | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_ProgressState(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ProgressState { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_ProgressState) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_ProgressState) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_ProgressState { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::INVALID => "SDL_PROGRESS_STATE_INVALID", + Self::NONE => "SDL_PROGRESS_STATE_NONE", + Self::INDETERMINATE => "SDL_PROGRESS_STATE_INDETERMINATE", + Self::NORMAL => "SDL_PROGRESS_STATE_NORMAL", + Self::PAUSED => "SDL_PROGRESS_STATE_PAUSED", + Self::ERROR => "SDL_PROGRESS_STATE_ERROR", + + _ => return write!(f, "SDL_ProgressState({})", self.0), + }) + } +} + +impl SDL_ProgressState { + /// An invalid progress state indicating an error; check [`SDL_GetError()`] + pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int)); + /// No progress bar is shown + pub const NONE: Self = Self((0_i32 as ::core::ffi::c_int)); + /// The progress bar is shown in a indeterminate state + pub const INDETERMINATE: Self = Self((1_i32 as ::core::ffi::c_int)); + /// The progress bar is shown in a normal state + pub const NORMAL: Self = Self((2_i32 as ::core::ffi::c_int)); + /// The progress bar is shown in a paused state + pub const PAUSED: Self = Self((3_i32 as ::core::ffi::c_int)); + /// The progress bar is shown in a state indicating the application had an error + pub const ERROR: Self = Self((4_i32 as ::core::ffi::c_int)); +} + +/// An invalid progress state indicating an error; check [`SDL_GetError()`] +pub const SDL_PROGRESS_STATE_INVALID: SDL_ProgressState = SDL_ProgressState::INVALID; +/// No progress bar is shown +pub const SDL_PROGRESS_STATE_NONE: SDL_ProgressState = SDL_ProgressState::NONE; +/// The progress bar is shown in a indeterminate state +pub const SDL_PROGRESS_STATE_INDETERMINATE: SDL_ProgressState = SDL_ProgressState::INDETERMINATE; +/// The progress bar is shown in a normal state +pub const SDL_PROGRESS_STATE_NORMAL: SDL_ProgressState = SDL_ProgressState::NORMAL; +/// The progress bar is shown in a paused state +pub const SDL_PROGRESS_STATE_PAUSED: SDL_ProgressState = SDL_ProgressState::PAUSED; +/// The progress bar is shown in a state indicating the application had an error +pub const SDL_PROGRESS_STATE_ERROR: SDL_ProgressState = SDL_ProgressState::ERROR; + +impl SDL_ProgressState { + /// Initialize a `SDL_ProgressState` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_ProgressState { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_ProgressState { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_ProgressState; +} + +/// An opaque handle to an OpenGL context. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_GL_CreateContext`] +/// - [`SDL_GL_SetAttribute`] +/// - [`SDL_GL_MakeCurrent`] +/// - [`SDL_GL_DestroyContext`] +pub type SDL_GLContext = *mut SDL_GLContextState; + +/// Opaque type for an EGL display. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_EGLDisplay = *mut ::core::ffi::c_void; + +/// Opaque type for an EGL config. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_EGLConfig = *mut ::core::ffi::c_void; + +/// Opaque type for an EGL surface. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_EGLSurface = *mut ::core::ffi::c_void; + +/// An EGL attribute, used when creating an EGL context. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_EGLAttrib = ::core::primitive::isize; + +/// An EGL integer attribute, used when creating an EGL surface. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +pub type SDL_EGLint = ::core::ffi::c_int; + +/// EGL platform attribute initialization callback. +/// +/// This is called when SDL is attempting to create an EGL context, to let the +/// app add extra attributes to its eglGetPlatformDisplay() call. +/// +/// The callback should return a pointer to an EGL attribute array terminated +/// with `EGL_NONE`. If this function returns NULL, the [`SDL_CreateWindow`] +/// process will fail gracefully. +/// +/// The returned pointer should be allocated with [`SDL_malloc()`] and will be +/// passed to [`SDL_free()`]. +/// +/// The arrays returned by each callback will be appended to the existing +/// attribute arrays defined by SDL. +/// +/// ## Parameters +/// - `userdata`: an app-controlled pointer that is passed to the callback. +/// +/// ## Return value +/// Returns a newly-allocated array of attributes, terminated with `EGL_NONE`. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_EGL_SetAttributeCallbacks`] +pub type SDL_EGLAttribArrayCallback = ::core::option::Option< + unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> *mut SDL_EGLAttrib, +>; + +/// EGL surface/context attribute initialization callback types. +/// +/// This is called when SDL is attempting to create an EGL surface, to let the +/// app add extra attributes to its eglCreateWindowSurface() or +/// eglCreateContext calls. +/// +/// For convenience, the EGLDisplay and EGLConfig to use are provided to the +/// callback. +/// +/// The callback should return a pointer to an EGL attribute array terminated +/// with `EGL_NONE`. If this function returns NULL, the [`SDL_CreateWindow`] +/// process will fail gracefully. +/// +/// The returned pointer should be allocated with [`SDL_malloc()`] and will be +/// passed to [`SDL_free()`]. +/// +/// The arrays returned by each callback will be appended to the existing +/// attribute arrays defined by SDL. +/// +/// ## Parameters +/// - `userdata`: an app-controlled pointer that is passed to the callback. +/// - `display`: the EGL display to be used. +/// - `config`: the EGL config to be used. +/// +/// ## Return value +/// Returns a newly-allocated array of attributes, terminated with `EGL_NONE`. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_EGL_SetAttributeCallbacks`] +pub type SDL_EGLIntArrayCallback = ::core::option::Option< + unsafe extern "C" fn( + userdata: *mut ::core::ffi::c_void, + display: SDL_EGLDisplay, + config: SDL_EGLConfig, + ) -> *mut SDL_EGLint, +>; + +/// An enumeration of OpenGL configuration attributes. +/// +/// While you can set most OpenGL attributes normally, the attributes listed +/// above must be known before SDL creates the window that will be used with +/// the OpenGL context. These attributes are set and read with +/// [`SDL_GL_SetAttribute()`] and [`SDL_GL_GetAttribute()`]. +/// +/// In some cases, these attributes are minimum requests; the GL does not +/// promise to give you exactly what you asked for. It's possible to ask for a +/// 16-bit depth buffer and get a 24-bit one instead, for example, or to ask +/// for no stencil buffer and still have one available. Context creation should +/// fail if the GL can't provide your requested attributes at a minimum, but +/// you should check to see exactly what you got. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`RED_SIZE`](SDL_GLAttr::RED_SIZE) | [`SDL_GL_RED_SIZE`] | the minimum number of bits for the red channel of the color buffer; defaults to 8. | +/// | [`GREEN_SIZE`](SDL_GLAttr::GREEN_SIZE) | [`SDL_GL_GREEN_SIZE`] | the minimum number of bits for the green channel of the color buffer; defaults to 8. | +/// | [`BLUE_SIZE`](SDL_GLAttr::BLUE_SIZE) | [`SDL_GL_BLUE_SIZE`] | the minimum number of bits for the blue channel of the color buffer; defaults to 8. | +/// | [`ALPHA_SIZE`](SDL_GLAttr::ALPHA_SIZE) | [`SDL_GL_ALPHA_SIZE`] | the minimum number of bits for the alpha channel of the color buffer; defaults to 8. | +/// | [`BUFFER_SIZE`](SDL_GLAttr::BUFFER_SIZE) | [`SDL_GL_BUFFER_SIZE`] | the minimum number of bits for frame buffer size; defaults to 0. | +/// | [`DOUBLEBUFFER`](SDL_GLAttr::DOUBLEBUFFER) | [`SDL_GL_DOUBLEBUFFER`] | whether the output is single or double buffered; defaults to double buffering on. | +/// | [`DEPTH_SIZE`](SDL_GLAttr::DEPTH_SIZE) | [`SDL_GL_DEPTH_SIZE`] | the minimum number of bits in the depth buffer; defaults to 16. | +/// | [`STENCIL_SIZE`](SDL_GLAttr::STENCIL_SIZE) | [`SDL_GL_STENCIL_SIZE`] | the minimum number of bits in the stencil buffer; defaults to 0. | +/// | [`ACCUM_RED_SIZE`](SDL_GLAttr::ACCUM_RED_SIZE) | [`SDL_GL_ACCUM_RED_SIZE`] | the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. | +/// | [`ACCUM_GREEN_SIZE`](SDL_GLAttr::ACCUM_GREEN_SIZE) | [`SDL_GL_ACCUM_GREEN_SIZE`] | the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. | +/// | [`ACCUM_BLUE_SIZE`](SDL_GLAttr::ACCUM_BLUE_SIZE) | [`SDL_GL_ACCUM_BLUE_SIZE`] | the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. | +/// | [`ACCUM_ALPHA_SIZE`](SDL_GLAttr::ACCUM_ALPHA_SIZE) | [`SDL_GL_ACCUM_ALPHA_SIZE`] | the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. | +/// | [`STEREO`](SDL_GLAttr::STEREO) | [`SDL_GL_STEREO`] | whether the output is stereo 3D; defaults to off. | +/// | [`MULTISAMPLEBUFFERS`](SDL_GLAttr::MULTISAMPLEBUFFERS) | [`SDL_GL_MULTISAMPLEBUFFERS`] | the number of buffers used for multisample anti-aliasing; defaults to 0. | +/// | [`MULTISAMPLESAMPLES`](SDL_GLAttr::MULTISAMPLESAMPLES) | [`SDL_GL_MULTISAMPLESAMPLES`] | the number of samples used around the current pixel used for multisample anti-aliasing. | +/// | [`ACCELERATED_VISUAL`](SDL_GLAttr::ACCELERATED_VISUAL) | [`SDL_GL_ACCELERATED_VISUAL`] | set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. | +/// | [`RETAINED_BACKING`](SDL_GLAttr::RETAINED_BACKING) | [`SDL_GL_RETAINED_BACKING`] | not used (deprecated). | +/// | [`CONTEXT_MAJOR_VERSION`](SDL_GLAttr::CONTEXT_MAJOR_VERSION) | [`SDL_GL_CONTEXT_MAJOR_VERSION`] | OpenGL context major version. | +/// | [`CONTEXT_MINOR_VERSION`](SDL_GLAttr::CONTEXT_MINOR_VERSION) | [`SDL_GL_CONTEXT_MINOR_VERSION`] | OpenGL context minor version. | +/// | [`CONTEXT_FLAGS`](SDL_GLAttr::CONTEXT_FLAGS) | [`SDL_GL_CONTEXT_FLAGS`] | some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0. | +/// | [`CONTEXT_PROFILE_MASK`](SDL_GLAttr::CONTEXT_PROFILE_MASK) | [`SDL_GL_CONTEXT_PROFILE_MASK`] | type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform. | +/// | [`SHARE_WITH_CURRENT_CONTEXT`](SDL_GLAttr::SHARE_WITH_CURRENT_CONTEXT) | [`SDL_GL_SHARE_WITH_CURRENT_CONTEXT`] | OpenGL context sharing; defaults to 0. | +/// | [`FRAMEBUFFER_SRGB_CAPABLE`](SDL_GLAttr::FRAMEBUFFER_SRGB_CAPABLE) | [`SDL_GL_FRAMEBUFFER_SRGB_CAPABLE`] | requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply! | +/// | [`CONTEXT_RELEASE_BEHAVIOR`](SDL_GLAttr::CONTEXT_RELEASE_BEHAVIOR) | [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR`] | sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH. | +/// | [`CONTEXT_RESET_NOTIFICATION`](SDL_GLAttr::CONTEXT_RESET_NOTIFICATION) | [`SDL_GL_CONTEXT_RESET_NOTIFICATION`] | set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION. | +/// | [`CONTEXT_NO_ERROR`](SDL_GLAttr::CONTEXT_NO_ERROR) | [`SDL_GL_CONTEXT_NO_ERROR`] | | +/// | [`FLOATBUFFERS`](SDL_GLAttr::FLOATBUFFERS) | [`SDL_GL_FLOATBUFFERS`] | | +/// | [`EGL_PLATFORM`](SDL_GLAttr::EGL_PLATFORM) | [`SDL_GL_EGL_PLATFORM`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_GLAttr(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GLAttr { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_GLAttr) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_GLAttr) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GLAttr { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::RED_SIZE => "SDL_GL_RED_SIZE", + Self::GREEN_SIZE => "SDL_GL_GREEN_SIZE", + Self::BLUE_SIZE => "SDL_GL_BLUE_SIZE", + Self::ALPHA_SIZE => "SDL_GL_ALPHA_SIZE", + Self::BUFFER_SIZE => "SDL_GL_BUFFER_SIZE", + Self::DOUBLEBUFFER => "SDL_GL_DOUBLEBUFFER", + Self::DEPTH_SIZE => "SDL_GL_DEPTH_SIZE", + Self::STENCIL_SIZE => "SDL_GL_STENCIL_SIZE", + Self::ACCUM_RED_SIZE => "SDL_GL_ACCUM_RED_SIZE", + Self::ACCUM_GREEN_SIZE => "SDL_GL_ACCUM_GREEN_SIZE", + Self::ACCUM_BLUE_SIZE => "SDL_GL_ACCUM_BLUE_SIZE", + Self::ACCUM_ALPHA_SIZE => "SDL_GL_ACCUM_ALPHA_SIZE", + Self::STEREO => "SDL_GL_STEREO", + Self::MULTISAMPLEBUFFERS => "SDL_GL_MULTISAMPLEBUFFERS", + Self::MULTISAMPLESAMPLES => "SDL_GL_MULTISAMPLESAMPLES", + Self::ACCELERATED_VISUAL => "SDL_GL_ACCELERATED_VISUAL", + Self::RETAINED_BACKING => "SDL_GL_RETAINED_BACKING", + Self::CONTEXT_MAJOR_VERSION => "SDL_GL_CONTEXT_MAJOR_VERSION", + Self::CONTEXT_MINOR_VERSION => "SDL_GL_CONTEXT_MINOR_VERSION", + Self::CONTEXT_FLAGS => "SDL_GL_CONTEXT_FLAGS", + Self::CONTEXT_PROFILE_MASK => "SDL_GL_CONTEXT_PROFILE_MASK", + Self::SHARE_WITH_CURRENT_CONTEXT => "SDL_GL_SHARE_WITH_CURRENT_CONTEXT", + Self::FRAMEBUFFER_SRGB_CAPABLE => "SDL_GL_FRAMEBUFFER_SRGB_CAPABLE", + Self::CONTEXT_RELEASE_BEHAVIOR => "SDL_GL_CONTEXT_RELEASE_BEHAVIOR", + Self::CONTEXT_RESET_NOTIFICATION => "SDL_GL_CONTEXT_RESET_NOTIFICATION", + Self::CONTEXT_NO_ERROR => "SDL_GL_CONTEXT_NO_ERROR", + Self::FLOATBUFFERS => "SDL_GL_FLOATBUFFERS", + Self::EGL_PLATFORM => "SDL_GL_EGL_PLATFORM", + + _ => return write!(f, "SDL_GLAttr({})", self.0), + }) + } +} + +impl SDL_GLAttr { + /// the minimum number of bits for the red channel of the color buffer; defaults to 8. + pub const RED_SIZE: Self = Self((0 as ::core::ffi::c_int)); + /// the minimum number of bits for the green channel of the color buffer; defaults to 8. + pub const GREEN_SIZE: Self = Self((1 as ::core::ffi::c_int)); + /// the minimum number of bits for the blue channel of the color buffer; defaults to 8. + pub const BLUE_SIZE: Self = Self((2 as ::core::ffi::c_int)); + /// the minimum number of bits for the alpha channel of the color buffer; defaults to 8. + pub const ALPHA_SIZE: Self = Self((3 as ::core::ffi::c_int)); + /// the minimum number of bits for frame buffer size; defaults to 0. + pub const BUFFER_SIZE: Self = Self((4 as ::core::ffi::c_int)); + /// whether the output is single or double buffered; defaults to double buffering on. + pub const DOUBLEBUFFER: Self = Self((5 as ::core::ffi::c_int)); + /// the minimum number of bits in the depth buffer; defaults to 16. + pub const DEPTH_SIZE: Self = Self((6 as ::core::ffi::c_int)); + /// the minimum number of bits in the stencil buffer; defaults to 0. + pub const STENCIL_SIZE: Self = Self((7 as ::core::ffi::c_int)); + /// the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. + pub const ACCUM_RED_SIZE: Self = Self((8 as ::core::ffi::c_int)); + /// the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. + pub const ACCUM_GREEN_SIZE: Self = Self((9 as ::core::ffi::c_int)); + /// the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. + pub const ACCUM_BLUE_SIZE: Self = Self((10 as ::core::ffi::c_int)); + /// the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. + pub const ACCUM_ALPHA_SIZE: Self = Self((11 as ::core::ffi::c_int)); + /// whether the output is stereo 3D; defaults to off. + pub const STEREO: Self = Self((12 as ::core::ffi::c_int)); + /// the number of buffers used for multisample anti-aliasing; defaults to 0. + pub const MULTISAMPLEBUFFERS: Self = Self((13 as ::core::ffi::c_int)); + /// the number of samples used around the current pixel used for multisample anti-aliasing. + pub const MULTISAMPLESAMPLES: Self = Self((14 as ::core::ffi::c_int)); + /// set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. + pub const ACCELERATED_VISUAL: Self = Self((15 as ::core::ffi::c_int)); + /// not used (deprecated). + pub const RETAINED_BACKING: Self = Self((16 as ::core::ffi::c_int)); + /// OpenGL context major version. + pub const CONTEXT_MAJOR_VERSION: Self = Self((17 as ::core::ffi::c_int)); + /// OpenGL context minor version. + pub const CONTEXT_MINOR_VERSION: Self = Self((18 as ::core::ffi::c_int)); + /// some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0. + pub const CONTEXT_FLAGS: Self = Self((19 as ::core::ffi::c_int)); + /// type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform. + pub const CONTEXT_PROFILE_MASK: Self = Self((20 as ::core::ffi::c_int)); + /// OpenGL context sharing; defaults to 0. + pub const SHARE_WITH_CURRENT_CONTEXT: Self = Self((21 as ::core::ffi::c_int)); + /// requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply! + pub const FRAMEBUFFER_SRGB_CAPABLE: Self = Self((22 as ::core::ffi::c_int)); + /// sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH. + pub const CONTEXT_RELEASE_BEHAVIOR: Self = Self((23 as ::core::ffi::c_int)); + /// set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION. + pub const CONTEXT_RESET_NOTIFICATION: Self = Self((24 as ::core::ffi::c_int)); + pub const CONTEXT_NO_ERROR: Self = Self((25 as ::core::ffi::c_int)); + pub const FLOATBUFFERS: Self = Self((26 as ::core::ffi::c_int)); + pub const EGL_PLATFORM: Self = Self((27 as ::core::ffi::c_int)); +} + +/// the minimum number of bits for the red channel of the color buffer; defaults to 8. +pub const SDL_GL_RED_SIZE: SDL_GLAttr = SDL_GLAttr::RED_SIZE; +/// the minimum number of bits for the green channel of the color buffer; defaults to 8. +pub const SDL_GL_GREEN_SIZE: SDL_GLAttr = SDL_GLAttr::GREEN_SIZE; +/// the minimum number of bits for the blue channel of the color buffer; defaults to 8. +pub const SDL_GL_BLUE_SIZE: SDL_GLAttr = SDL_GLAttr::BLUE_SIZE; +/// the minimum number of bits for the alpha channel of the color buffer; defaults to 8. +pub const SDL_GL_ALPHA_SIZE: SDL_GLAttr = SDL_GLAttr::ALPHA_SIZE; +/// the minimum number of bits for frame buffer size; defaults to 0. +pub const SDL_GL_BUFFER_SIZE: SDL_GLAttr = SDL_GLAttr::BUFFER_SIZE; +/// whether the output is single or double buffered; defaults to double buffering on. +pub const SDL_GL_DOUBLEBUFFER: SDL_GLAttr = SDL_GLAttr::DOUBLEBUFFER; +/// the minimum number of bits in the depth buffer; defaults to 16. +pub const SDL_GL_DEPTH_SIZE: SDL_GLAttr = SDL_GLAttr::DEPTH_SIZE; +/// the minimum number of bits in the stencil buffer; defaults to 0. +pub const SDL_GL_STENCIL_SIZE: SDL_GLAttr = SDL_GLAttr::STENCIL_SIZE; +/// the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. +pub const SDL_GL_ACCUM_RED_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_RED_SIZE; +/// the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. +pub const SDL_GL_ACCUM_GREEN_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_GREEN_SIZE; +/// the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. +pub const SDL_GL_ACCUM_BLUE_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_BLUE_SIZE; +/// the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. +pub const SDL_GL_ACCUM_ALPHA_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_ALPHA_SIZE; +/// whether the output is stereo 3D; defaults to off. +pub const SDL_GL_STEREO: SDL_GLAttr = SDL_GLAttr::STEREO; +/// the number of buffers used for multisample anti-aliasing; defaults to 0. +pub const SDL_GL_MULTISAMPLEBUFFERS: SDL_GLAttr = SDL_GLAttr::MULTISAMPLEBUFFERS; +/// the number of samples used around the current pixel used for multisample anti-aliasing. +pub const SDL_GL_MULTISAMPLESAMPLES: SDL_GLAttr = SDL_GLAttr::MULTISAMPLESAMPLES; +/// set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. +pub const SDL_GL_ACCELERATED_VISUAL: SDL_GLAttr = SDL_GLAttr::ACCELERATED_VISUAL; +/// not used (deprecated). +pub const SDL_GL_RETAINED_BACKING: SDL_GLAttr = SDL_GLAttr::RETAINED_BACKING; +/// OpenGL context major version. +pub const SDL_GL_CONTEXT_MAJOR_VERSION: SDL_GLAttr = SDL_GLAttr::CONTEXT_MAJOR_VERSION; +/// OpenGL context minor version. +pub const SDL_GL_CONTEXT_MINOR_VERSION: SDL_GLAttr = SDL_GLAttr::CONTEXT_MINOR_VERSION; +/// some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0. +pub const SDL_GL_CONTEXT_FLAGS: SDL_GLAttr = SDL_GLAttr::CONTEXT_FLAGS; +/// type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform. +pub const SDL_GL_CONTEXT_PROFILE_MASK: SDL_GLAttr = SDL_GLAttr::CONTEXT_PROFILE_MASK; +/// OpenGL context sharing; defaults to 0. +pub const SDL_GL_SHARE_WITH_CURRENT_CONTEXT: SDL_GLAttr = SDL_GLAttr::SHARE_WITH_CURRENT_CONTEXT; +/// requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply! +pub const SDL_GL_FRAMEBUFFER_SRGB_CAPABLE: SDL_GLAttr = SDL_GLAttr::FRAMEBUFFER_SRGB_CAPABLE; +/// sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH. +pub const SDL_GL_CONTEXT_RELEASE_BEHAVIOR: SDL_GLAttr = SDL_GLAttr::CONTEXT_RELEASE_BEHAVIOR; +/// set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION. +pub const SDL_GL_CONTEXT_RESET_NOTIFICATION: SDL_GLAttr = SDL_GLAttr::CONTEXT_RESET_NOTIFICATION; +pub const SDL_GL_CONTEXT_NO_ERROR: SDL_GLAttr = SDL_GLAttr::CONTEXT_NO_ERROR; +pub const SDL_GL_FLOATBUFFERS: SDL_GLAttr = SDL_GLAttr::FLOATBUFFERS; +pub const SDL_GL_EGL_PLATFORM: SDL_GLAttr = SDL_GLAttr::EGL_PLATFORM; + +impl SDL_GLAttr { + /// Initialize a `SDL_GLAttr` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_GLAttr { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GLAttr { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_GLAttr; +} + +/// Possible values to be set for the [`SDL_GL_CONTEXT_PROFILE_MASK`] attribute. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`CORE`](SDL_GLProfile::CORE) | [`SDL_GL_CONTEXT_PROFILE_CORE`] | OpenGL Core Profile context | +/// | [`COMPATIBILITY`](SDL_GLProfile::COMPATIBILITY) | [`SDL_GL_CONTEXT_PROFILE_COMPATIBILITY`] | OpenGL Compatibility Profile context | +/// | [`ES`](SDL_GLProfile::ES) | [`SDL_GL_CONTEXT_PROFILE_ES`] | GLX_CONTEXT_ES2_PROFILE_BIT_EXT | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GLProfile(pub Sint32); + +impl ::core::cmp::PartialEq for SDL_GLProfile { + #[inline(always)] + fn eq(&self, other: &Sint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Sint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GLProfile) -> bool { + self == &other.0 + } +} + +impl From for Sint32 { + #[inline(always)] + fn from(value: SDL_GLProfile) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GLProfile { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GLProfile(")?; + let all_bits = all_bits | Self::CORE.0; + if (Self::CORE != 0 || self.0 == 0) && *self & Self::CORE == Self::CORE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "CORE")?; + } + let all_bits = all_bits | Self::COMPATIBILITY.0; + if (Self::COMPATIBILITY != 0 || self.0 == 0) + && *self & Self::COMPATIBILITY == Self::COMPATIBILITY + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "COMPATIBILITY")?; + } + let all_bits = all_bits | Self::ES.0; + if (Self::ES != 0 || self.0 == 0) && *self & Self::ES == Self::ES { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ES")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GLProfile { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GLProfile { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GLProfile { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GLProfile { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GLProfile { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GLProfile { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GLProfile { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GLProfile { + /// OpenGL Core Profile context + pub const CORE: Self = Self((0x0001 as Sint32)); + /// OpenGL Compatibility Profile context + pub const COMPATIBILITY: Self = Self((0x0002 as Sint32)); + /// GLX_CONTEXT_ES2_PROFILE_BIT_EXT + pub const ES: Self = Self((0x0004 as Sint32)); +} + +/// OpenGL Core Profile context +pub const SDL_GL_CONTEXT_PROFILE_CORE: SDL_GLProfile = SDL_GLProfile::CORE; +/// OpenGL Compatibility Profile context +pub const SDL_GL_CONTEXT_PROFILE_COMPATIBILITY: SDL_GLProfile = SDL_GLProfile::COMPATIBILITY; +/// GLX_CONTEXT_ES2_PROFILE_BIT_EXT +pub const SDL_GL_CONTEXT_PROFILE_ES: SDL_GLProfile = SDL_GLProfile::ES; + +impl SDL_GLProfile { + /// Initialize a `SDL_GLProfile` from a raw value. + #[inline(always)] + pub const fn new(value: Sint32) -> Self { + Self(value) + } +} + +impl SDL_GLProfile { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Sint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GLProfile { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_GLProfile; +} + +/// Possible flags to be set for the [`SDL_GL_CONTEXT_FLAGS`] attribute. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`DEBUG_FLAG`](SDL_GLContextFlag::DEBUG_FLAG) | [`SDL_GL_CONTEXT_DEBUG_FLAG`] | | +/// | [`FORWARD_COMPATIBLE_FLAG`](SDL_GLContextFlag::FORWARD_COMPATIBLE_FLAG) | [`SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG`] | | +/// | [`ROBUST_ACCESS_FLAG`](SDL_GLContextFlag::ROBUST_ACCESS_FLAG) | [`SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG`] | | +/// | [`RESET_ISOLATION_FLAG`](SDL_GLContextFlag::RESET_ISOLATION_FLAG) | [`SDL_GL_CONTEXT_RESET_ISOLATION_FLAG`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GLContextFlag(pub Sint32); + +impl ::core::cmp::PartialEq for SDL_GLContextFlag { + #[inline(always)] + fn eq(&self, other: &Sint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Sint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GLContextFlag) -> bool { + self == &other.0 + } +} + +impl From for Sint32 { + #[inline(always)] + fn from(value: SDL_GLContextFlag) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GLContextFlag { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GLContextFlag(")?; + let all_bits = all_bits | Self::DEBUG_FLAG.0; + if (Self::DEBUG_FLAG != 0 || self.0 == 0) && *self & Self::DEBUG_FLAG == Self::DEBUG_FLAG { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "DEBUG_FLAG")?; + } + let all_bits = all_bits | Self::FORWARD_COMPATIBLE_FLAG.0; + if (Self::FORWARD_COMPATIBLE_FLAG != 0 || self.0 == 0) + && *self & Self::FORWARD_COMPATIBLE_FLAG == Self::FORWARD_COMPATIBLE_FLAG + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "FORWARD_COMPATIBLE_FLAG")?; + } + let all_bits = all_bits | Self::ROBUST_ACCESS_FLAG.0; + if (Self::ROBUST_ACCESS_FLAG != 0 || self.0 == 0) + && *self & Self::ROBUST_ACCESS_FLAG == Self::ROBUST_ACCESS_FLAG + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "ROBUST_ACCESS_FLAG")?; + } + let all_bits = all_bits | Self::RESET_ISOLATION_FLAG.0; + if (Self::RESET_ISOLATION_FLAG != 0 || self.0 == 0) + && *self & Self::RESET_ISOLATION_FLAG == Self::RESET_ISOLATION_FLAG + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "RESET_ISOLATION_FLAG")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GLContextFlag { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GLContextFlag { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GLContextFlag { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GLContextFlag { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GLContextFlag { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GLContextFlag { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GLContextFlag { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GLContextFlag { + pub const DEBUG_FLAG: Self = Self((0x0001 as Sint32)); + pub const FORWARD_COMPATIBLE_FLAG: Self = Self((0x0002 as Sint32)); + pub const ROBUST_ACCESS_FLAG: Self = Self((0x0004 as Sint32)); + pub const RESET_ISOLATION_FLAG: Self = Self((0x0008 as Sint32)); +} + +pub const SDL_GL_CONTEXT_DEBUG_FLAG: SDL_GLContextFlag = SDL_GLContextFlag::DEBUG_FLAG; +pub const SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG: SDL_GLContextFlag = + SDL_GLContextFlag::FORWARD_COMPATIBLE_FLAG; +pub const SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG: SDL_GLContextFlag = + SDL_GLContextFlag::ROBUST_ACCESS_FLAG; +pub const SDL_GL_CONTEXT_RESET_ISOLATION_FLAG: SDL_GLContextFlag = + SDL_GLContextFlag::RESET_ISOLATION_FLAG; + +impl SDL_GLContextFlag { + /// Initialize a `SDL_GLContextFlag` from a raw value. + #[inline(always)] + pub const fn new(value: Sint32) -> Self { + Self(value) + } +} + +impl SDL_GLContextFlag { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Sint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GLContextFlag { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_GLContextFlag; +} + +/// Possible values to be set for the [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR`] +/// attribute. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NONE`](SDL_GLContextReleaseFlag::NONE) | [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE`] | | +/// | [`FLUSH`](SDL_GLContextReleaseFlag::FLUSH) | [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GLContextReleaseFlag(pub Sint32); + +impl ::core::cmp::PartialEq for SDL_GLContextReleaseFlag { + #[inline(always)] + fn eq(&self, other: &Sint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Sint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GLContextReleaseFlag) -> bool { + self == &other.0 + } +} + +impl From for Sint32 { + #[inline(always)] + fn from(value: SDL_GLContextReleaseFlag) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GLContextReleaseFlag { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GLContextReleaseFlag(")?; + let all_bits = all_bits | Self::NONE.0; + if (Self::NONE != 0 || self.0 == 0) && *self & Self::NONE == Self::NONE { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NONE")?; + } + let all_bits = all_bits | Self::FLUSH.0; + if (Self::FLUSH != 0 || self.0 == 0) && *self & Self::FLUSH == Self::FLUSH { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "FLUSH")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GLContextReleaseFlag { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GLContextReleaseFlag { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GLContextReleaseFlag { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GLContextReleaseFlag { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GLContextReleaseFlag { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GLContextReleaseFlag { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GLContextReleaseFlag { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GLContextReleaseFlag { + pub const NONE: Self = Self((0x0000 as Sint32)); + pub const FLUSH: Self = Self((0x0001 as Sint32)); +} + +pub const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE: SDL_GLContextReleaseFlag = + SDL_GLContextReleaseFlag::NONE; +pub const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH: SDL_GLContextReleaseFlag = + SDL_GLContextReleaseFlag::FLUSH; + +impl SDL_GLContextReleaseFlag { + /// Initialize a `SDL_GLContextReleaseFlag` from a raw value. + #[inline(always)] + pub const fn new(value: Sint32) -> Self { + Self(value) + } +} + +impl SDL_GLContextReleaseFlag { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Sint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GLContextReleaseFlag { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_GLContextReleaseFlag; +} + +/// Possible values to be set [`SDL_GL_CONTEXT_RESET_NOTIFICATION`] attribute. +/// +/// ## Availability +/// This datatype is available since SDL 3.2.0. +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NO_NOTIFICATION`](SDL_GLContextResetNotification::NO_NOTIFICATION) | [`SDL_GL_CONTEXT_RESET_NO_NOTIFICATION`] | | +/// | [`LOSE_CONTEXT`](SDL_GLContextResetNotification::LOSE_CONTEXT) | [`SDL_GL_CONTEXT_RESET_LOSE_CONTEXT`] | | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)] +pub struct SDL_GLContextResetNotification(pub Sint32); + +impl ::core::cmp::PartialEq for SDL_GLContextResetNotification { + #[inline(always)] + fn eq(&self, other: &Sint32) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for Sint32 { + #[inline(always)] + fn eq(&self, other: &SDL_GLContextResetNotification) -> bool { + self == &other.0 + } +} + +impl From for Sint32 { + #[inline(always)] + fn from(value: SDL_GLContextResetNotification) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_GLContextResetNotification { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut first = true; + let all_bits = 0; + write!(f, "SDL_GLContextResetNotification(")?; + let all_bits = all_bits | Self::NO_NOTIFICATION.0; + if (Self::NO_NOTIFICATION != 0 || self.0 == 0) + && *self & Self::NO_NOTIFICATION == Self::NO_NOTIFICATION + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "NO_NOTIFICATION")?; + } + let all_bits = all_bits | Self::LOSE_CONTEXT.0; + if (Self::LOSE_CONTEXT != 0 || self.0 == 0) + && *self & Self::LOSE_CONTEXT == Self::LOSE_CONTEXT + { + if !first { + write!(f, " | ")?; + } + first = false; + write!(f, "LOSE_CONTEXT")?; + } + + if self.0 & !all_bits != 0 { + if !first { + write!(f, " | ")?; + } + write!(f, "{:#x}", self.0)?; + } else if first { + write!(f, "0")?; + } + write!(f, ")") + } +} + +impl ::core::ops::BitAnd for SDL_GLContextResetNotification { + type Output = Self; + + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + Self(self.0 & rhs.0) + } +} + +impl ::core::ops::BitAndAssign for SDL_GLContextResetNotification { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + self.0 &= rhs.0; + } +} + +impl ::core::ops::BitOr for SDL_GLContextResetNotification { + type Output = Self; + + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + Self(self.0 | rhs.0) + } +} + +impl ::core::ops::BitOrAssign for SDL_GLContextResetNotification { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + self.0 |= rhs.0; + } +} + +impl ::core::ops::BitXor for SDL_GLContextResetNotification { + type Output = Self; + + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + Self(self.0 ^ rhs.0) + } +} + +impl ::core::ops::BitXorAssign for SDL_GLContextResetNotification { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + self.0 ^= rhs.0; + } +} + +impl ::core::ops::Not for SDL_GLContextResetNotification { + type Output = Self; + + #[inline(always)] + fn not(self) -> Self::Output { + Self(!self.0) + } +} + +impl SDL_GLContextResetNotification { + pub const NO_NOTIFICATION: Self = Self((0x0000 as Sint32)); + pub const LOSE_CONTEXT: Self = Self((0x0001 as Sint32)); +} + +pub const SDL_GL_CONTEXT_RESET_NO_NOTIFICATION: SDL_GLContextResetNotification = + SDL_GLContextResetNotification::NO_NOTIFICATION; +pub const SDL_GL_CONTEXT_RESET_LOSE_CONTEXT: SDL_GLContextResetNotification = + SDL_GLContextResetNotification::LOSE_CONTEXT; + +impl SDL_GLContextResetNotification { + /// Initialize a `SDL_GLContextResetNotification` from a raw value. + #[inline(always)] + pub const fn new(value: Sint32) -> Self { + Self(value) + } +} + +impl SDL_GLContextResetNotification { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> Sint32 { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_GLContextResetNotification { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_GLContextResetNotification; +} + +unsafe extern "C" { + /// Get the number of video drivers compiled into SDL. + /// + /// ## Return value + /// Returns the number of built in video drivers. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetVideoDriver`] + pub fn SDL_GetNumVideoDrivers() -> ::core::ffi::c_int; +} + +unsafe extern "C" { + /// Get the name of a built in video driver. + /// + /// The video drivers are presented in the order in which they are normally + /// checked during initialization. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "cocoa", + /// "x11" or "windows". These never have Unicode characters, and are not meant + /// to be proper names. + /// + /// ## Parameters + /// - `index`: the index of a video driver. + /// + /// ## Return value + /// Returns the name of the video driver with the given **index**, or NULL if + /// index is out of bounds. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumVideoDrivers`] + pub fn SDL_GetVideoDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the name of the currently initialized video driver. + /// + /// The names of drivers are all simple, low-ASCII identifiers, like "cocoa", + /// "x11" or "windows". These never have Unicode characters, and are not meant + /// to be proper names. + /// + /// ## Return value + /// Returns the name of the current video driver or NULL if no driver has been + /// initialized. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetNumVideoDrivers`] + /// - [`SDL_GetVideoDriver`] + pub fn SDL_GetCurrentVideoDriver() -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the current system theme. + /// + /// ## Return value + /// Returns the current system theme, light, dark, or unknown. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetSystemTheme() -> SDL_SystemTheme; +} + +unsafe extern "C" { + /// Get a list of currently connected displays. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of displays returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a 0 terminated array of display instance IDs or NULL on failure; + /// call [`SDL_GetError()`] for more information. This should be freed + /// with [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetDisplays(count: *mut ::core::ffi::c_int) -> *mut SDL_DisplayID; +} + +unsafe extern "C" { + /// Return the primary display. + /// + /// ## Return value + /// Returns the instance ID of the primary display on success or 0 on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplays`] + pub fn SDL_GetPrimaryDisplay() -> SDL_DisplayID; +} + +unsafe extern "C" { + /// Get the properties associated with a display. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN`]\: true if the display has HDR + /// headroom above the SDR white point. This is for informational and + /// diagnostic purposes only, as not all platforms provide this information + /// at the display level. + /// + /// On KMS/DRM: + /// + /// - [`SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER`]\: the "panel + /// orientation" property for the display in degrees of clockwise rotation. + /// Note that this is provided only as a hint, and the application is + /// responsible for any coordinate transformations needed to conform to the + /// requested display orientation. + /// + /// On Wayland: + /// + /// - [`SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER`]\: the wl_output associated + /// with the display + /// + /// On Windows: + /// + /// - [`SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER`]\: the monitor handle + /// (HMONITOR) associated with the display + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetDisplayProperties(displayID: SDL_DisplayID) -> SDL_PropertiesID; +} + +pub const SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.display.HDR_enabled".as_ptr(); + +pub const SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER: *const ::core::ffi::c_char = + c"SDL.display.KMSDRM.panel_orientation".as_ptr(); + +pub const SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER: *const ::core::ffi::c_char = + c"SDL.display.wayland.wl_output".as_ptr(); + +pub const SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER: *const ::core::ffi::c_char = + c"SDL.display.windows.hmonitor".as_ptr(); + +unsafe extern "C" { + /// Get the name of a display in UTF-8 encoding. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns the name of a display or NULL on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayName(displayID: SDL_DisplayID) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Get the desktop area represented by a display. + /// + /// The primary display is often located at (0,0), but may be placed at a + /// different location depending on monitor layout. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// - `rect`: the [`SDL_Rect`] structure filled in with the display bounds. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplayUsableBounds`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayBounds( + displayID: SDL_DisplayID, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the usable desktop area represented by a display, in screen + /// coordinates. + /// + /// This is the same area as [`SDL_GetDisplayBounds()`] reports, but with portions + /// reserved by the system removed. For example, on Apple's macOS, this + /// subtracts the area occupied by the menu bar and dock. + /// + /// Setting a window to be fullscreen generally bypasses these unusable areas, + /// so these are good guidelines for the maximum space available to a + /// non-fullscreen window. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// - `rect`: the [`SDL_Rect`] structure filled in with the display bounds. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplayBounds`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayUsableBounds( + displayID: SDL_DisplayID, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the orientation of a display when it is unrotated. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns the [`SDL_DisplayOrientation`] enum value of the display, or + /// [`SDL_ORIENTATION_UNKNOWN`] if it isn't available. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplays`] + pub fn SDL_GetNaturalDisplayOrientation(displayID: SDL_DisplayID) -> SDL_DisplayOrientation; +} + +unsafe extern "C" { + /// Get the orientation of a display. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns the [`SDL_DisplayOrientation`] enum value of the display, or + /// [`SDL_ORIENTATION_UNKNOWN`] if it isn't available. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplays`] + pub fn SDL_GetCurrentDisplayOrientation(displayID: SDL_DisplayID) -> SDL_DisplayOrientation; +} + +unsafe extern "C" { + /// Get the content scale of a display. + /// + /// The content scale is the expected scale for content based on the DPI + /// settings of the display. For example, a 4K display might have a 2.0 (200%) + /// display scale, which means that the user expects UI elements to be twice as + /// big on this display, to aid in readability. + /// + /// After window creation, [`SDL_GetWindowDisplayScale()`] should be used to query + /// the content scale factor for individual windows instead of querying the + /// display for a window and calling this function, as the per-window content + /// scale factor may differ from the base value of the display it is on, + /// particularly on high-DPI and/or multi-monitor desktop configurations. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns the content scale of the display, or 0.0f on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowDisplayScale`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayContentScale(displayID: SDL_DisplayID) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Get a list of fullscreen display modes available on a display. + /// + /// The display modes are sorted in this priority: + /// + /// - w -> largest to smallest + /// - h -> largest to smallest + /// - bits per pixel -> more colors to fewer colors + /// - packed pixel layout -> largest to smallest + /// - refresh rate -> highest to lowest + /// - pixel density -> lowest to highest + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// - `count`: a pointer filled in with the number of display modes returned, + /// may be NULL. + /// + /// ## Return value + /// Returns a NULL terminated array of display mode pointers or NULL on + /// failure; call [`SDL_GetError()`] for more information. This is a + /// single allocation that should be freed with [`SDL_free()`] when it is + /// no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplays`] + pub fn SDL_GetFullscreenDisplayModes( + displayID: SDL_DisplayID, + count: *mut ::core::ffi::c_int, + ) -> *mut *mut SDL_DisplayMode; +} + +unsafe extern "C" { + /// Get the closest match to the requested display mode. + /// + /// The available display modes are scanned and `closest` is filled in with the + /// closest mode matching the requested mode and returned. The mode format and + /// refresh rate default to the desktop mode if they are set to 0. The modes + /// are scanned with size being first priority, format being second priority, + /// and finally checking the refresh rate. If all the available modes are too + /// small, then false is returned. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// - `w`: the width in pixels of the desired display mode. + /// - `h`: the height in pixels of the desired display mode. + /// - `refresh_rate`: the refresh rate of the desired display mode, or 0.0f + /// for the desktop refresh rate. + /// - `include_high_density_modes`: boolean to include high density modes in + /// the search. + /// - `closest`: a pointer filled in with the closest display mode equal to + /// or larger than the desired mode. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplays`] + /// - [`SDL_GetFullscreenDisplayModes`] + pub fn SDL_GetClosestFullscreenDisplayMode( + displayID: SDL_DisplayID, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + refresh_rate: ::core::ffi::c_float, + include_high_density_modes: ::core::primitive::bool, + closest: *mut SDL_DisplayMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get information about the desktop's display mode. + /// + /// There's a difference between this function and [`SDL_GetCurrentDisplayMode()`] + /// when SDL runs fullscreen and has changed the resolution. In that case this + /// function will return the previous native display mode, and not the current + /// display mode. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns a pointer to the desktop display mode or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetCurrentDisplayMode`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDesktopDisplayMode(displayID: SDL_DisplayID) -> *const SDL_DisplayMode; +} + +unsafe extern "C" { + /// Get information about the current display mode. + /// + /// There's a difference between this function and [`SDL_GetDesktopDisplayMode()`] + /// when SDL runs fullscreen and has changed the resolution. In that case this + /// function will return the current display mode, and not the previous native + /// display mode. + /// + /// ## Parameters + /// - `displayID`: the instance ID of the display to query. + /// + /// ## Return value + /// Returns a pointer to the desktop display mode or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDesktopDisplayMode`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetCurrentDisplayMode(displayID: SDL_DisplayID) -> *const SDL_DisplayMode; +} + +unsafe extern "C" { + /// Get the display containing a point. + /// + /// ## Parameters + /// - `point`: the point to query. + /// + /// ## Return value + /// Returns the instance ID of the display containing the point or 0 on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplayBounds`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayForPoint(point: *const SDL_Point) -> SDL_DisplayID; +} + +unsafe extern "C" { + /// Get the display primarily containing a rect. + /// + /// ## Parameters + /// - `rect`: the rect to query. + /// + /// ## Return value + /// Returns the instance ID of the display entirely containing the rect or + /// closest to the center of the rect on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplayBounds`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayForRect(rect: *const SDL_Rect) -> SDL_DisplayID; +} + +unsafe extern "C" { + /// Get the display associated with a window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the instance ID of the display containing the center of the window + /// on success or 0 on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetDisplayBounds`] + /// - [`SDL_GetDisplays`] + pub fn SDL_GetDisplayForWindow(window: *mut SDL_Window) -> SDL_DisplayID; +} + +unsafe extern "C" { + /// Get the pixel density of a window. + /// + /// This is a ratio of pixel size to window size. For example, if the window is + /// 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it + /// would have a pixel density of 2.0. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the pixel density or 0.0f on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowDisplayScale`] + pub fn SDL_GetWindowPixelDensity(window: *mut SDL_Window) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Get the content display scale relative to a window's pixel size. + /// + /// This is a combination of the window pixel density and the display content + /// scale, and is the expected scale for displaying content in this window. For + /// example, if a 3840x2160 window had a display scale of 2.0, the user expects + /// the content to take twice as many pixels and be the same physical size as + /// if it were being displayed in a 1920x1080 window with a display scale of + /// 1.0. + /// + /// Conceptually this value corresponds to the scale display setting, and is + /// updated when that setting is changed, or the window moves to a display with + /// a different scale setting. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the display scale, or 0.0f on failure; call [`SDL_GetError()`] for + /// more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetWindowDisplayScale(window: *mut SDL_Window) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Set the display mode to use when a window is visible and fullscreen. + /// + /// This only affects the display mode used when the window is fullscreen. To + /// change the window size when the window is not fullscreen, use + /// [`SDL_SetWindowSize()`]. + /// + /// If the window is currently in the fullscreen state, this request is + /// asynchronous on some windowing systems and the new mode dimensions may not + /// be applied immediately upon the return of this function. If an immediate + /// change is required, call [`SDL_SyncWindow()`] to block until the changes have + /// taken effect. + /// + /// When the new mode takes effect, an [`SDL_EVENT_WINDOW_RESIZED`] and/or an + /// [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event will be emitted with the new mode + /// dimensions. + /// + /// ## Parameters + /// - `window`: the window to affect. + /// - `mode`: a pointer to the display mode to use, which can be NULL for + /// borderless fullscreen desktop mode, or one of the fullscreen + /// modes returned by [`SDL_GetFullscreenDisplayModes()`] to set an + /// exclusive fullscreen mode. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowFullscreenMode`] + /// - [`SDL_SetWindowFullscreen`] + /// - [`SDL_SyncWindow`] + pub fn SDL_SetWindowFullscreenMode( + window: *mut SDL_Window, + mode: *const SDL_DisplayMode, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Query the display mode to use when a window is visible at fullscreen. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns a pointer to the exclusive fullscreen mode to use or NULL for + /// borderless fullscreen desktop mode. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowFullscreenMode`] + /// - [`SDL_SetWindowFullscreen`] + pub fn SDL_GetWindowFullscreenMode(window: *mut SDL_Window) -> *const SDL_DisplayMode; +} + +unsafe extern "C" { + /// Get the raw ICC profile data for the screen the window is currently on. + /// + /// ## Parameters + /// - `window`: the window to query. + /// - `size`: the size of the ICC profile. + /// + /// ## Return value + /// Returns the raw ICC profile data on success or NULL on failure; call + /// [`SDL_GetError()`] for more information. This should be freed with + /// [`SDL_free()`] when it is no longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetWindowICCProfile( + window: *mut SDL_Window, + size: *mut ::core::primitive::usize, + ) -> *mut ::core::ffi::c_void; +} + +unsafe extern "C" { + /// Get the pixel format associated with the window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the pixel format of the window on success or + /// [`SDL_PIXELFORMAT_UNKNOWN`] on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetWindowPixelFormat(window: *mut SDL_Window) -> SDL_PixelFormat; +} + +unsafe extern "C" { + /// Get a list of valid windows. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of windows returned, may + /// be NULL. + /// + /// ## Return value + /// Returns a NULL terminated array of [`SDL_Window`] pointers or NULL on failure; + /// call [`SDL_GetError()`] for more information. This is a single + /// allocation that should be freed with [`SDL_free()`] when it is no + /// longer needed. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetWindows(count: *mut ::core::ffi::c_int) -> *mut *mut SDL_Window; +} + +unsafe extern "C" { + /// Create a window with the specified dimensions and flags. + /// + /// The window size is a request and may be different than expected based on + /// the desktop layout and window manager policies. Your application should be + /// prepared to handle a window of any size. + /// + /// `flags` may be any of the following OR'd together: + /// + /// - [`SDL_WINDOW_FULLSCREEN`]\: fullscreen window at desktop resolution + /// - [`SDL_WINDOW_OPENGL`]\: window usable with an OpenGL context + /// - [`SDL_WINDOW_HIDDEN`]\: window is not visible + /// - [`SDL_WINDOW_BORDERLESS`]\: no window decoration + /// - [`SDL_WINDOW_RESIZABLE`]\: window can be resized + /// - [`SDL_WINDOW_MINIMIZED`]\: window is minimized + /// - [`SDL_WINDOW_MAXIMIZED`]\: window is maximized + /// - [`SDL_WINDOW_MOUSE_GRABBED`]\: window has grabbed mouse focus + /// - [`SDL_WINDOW_INPUT_FOCUS`]\: window has input focus + /// - [`SDL_WINDOW_MOUSE_FOCUS`]\: window has mouse focus + /// - [`SDL_WINDOW_EXTERNAL`]\: window not created by SDL + /// - [`SDL_WINDOW_MODAL`]\: window is modal + /// - [`SDL_WINDOW_HIGH_PIXEL_DENSITY`]\: window uses high pixel density back + /// buffer if possible + /// - [`SDL_WINDOW_MOUSE_CAPTURE`]\: window has mouse captured (unrelated to + /// MOUSE_GRABBED) + /// - [`SDL_WINDOW_ALWAYS_ON_TOP`]\: window should always be above others + /// - [`SDL_WINDOW_UTILITY`]\: window should be treated as a utility window, not + /// showing in the task bar and window list + /// - [`SDL_WINDOW_TOOLTIP`]\: window should be treated as a tooltip and does not + /// get mouse or keyboard focus, requires a parent window + /// - [`SDL_WINDOW_POPUP_MENU`]\: window should be treated as a popup menu, + /// requires a parent window + /// - [`SDL_WINDOW_KEYBOARD_GRABBED`]\: window has grabbed keyboard input + /// - [`SDL_WINDOW_VULKAN`]\: window usable with a Vulkan instance + /// - [`SDL_WINDOW_METAL`]\: window usable with a Metal instance + /// - [`SDL_WINDOW_TRANSPARENT`]\: window with transparent buffer + /// - [`SDL_WINDOW_NOT_FOCUSABLE`]\: window should not be focusable + /// + /// The [`SDL_Window`] will be shown if [`SDL_WINDOW_HIDDEN`] is not set. If hidden at + /// creation time, [`SDL_ShowWindow()`] can be used to show it later. + /// + /// On Apple's macOS, you **must** set the NSHighResolutionCapable Info.plist + /// property to YES, otherwise you will not receive a High-DPI OpenGL canvas. + /// + /// The window pixel size may differ from its window coordinate size if the + /// window is on a high pixel density display. Use [`SDL_GetWindowSize()`] to query + /// the client area's size in window coordinates, and + /// [`SDL_GetWindowSizeInPixels()`] or [`SDL_GetRenderOutputSize()`] to query the + /// drawable size in pixels. Note that the drawable size can vary after the + /// window is created and should be queried again if you get an + /// [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event. + /// + /// If the window is created with any of the [`SDL_WINDOW_OPENGL`] or + /// [`SDL_WINDOW_VULKAN`] flags, then the corresponding LoadLibrary function + /// ([`SDL_GL_LoadLibrary`] or [`SDL_Vulkan_LoadLibrary`]) is called and the + /// corresponding UnloadLibrary function is called by [`SDL_DestroyWindow()`]. + /// + /// If [`SDL_WINDOW_VULKAN`] is specified and there isn't a working Vulkan driver, + /// [`SDL_CreateWindow()`] will fail, because [`SDL_Vulkan_LoadLibrary()`] will fail. + /// + /// If [`SDL_WINDOW_METAL`] is specified on an OS that does not support Metal, + /// [`SDL_CreateWindow()`] will fail. + /// + /// If you intend to use this window with an [`SDL_Renderer`], you should use + /// [`SDL_CreateWindowAndRenderer()`] instead of this function, to avoid window + /// flicker. + /// + /// On non-Apple devices, SDL requires you to either not link to the Vulkan + /// loader or link to a dynamic library version. This limitation may be removed + /// in a future version of SDL. + /// + /// ## Parameters + /// - `title`: the title of the window, in UTF-8 encoding. + /// - `w`: the width of the window. + /// - `h`: the height of the window. + /// - `flags`: 0, or one or more [`SDL_WindowFlags`] OR'd together. + /// + /// ## Return value + /// Returns the window that was created or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateWindowAndRenderer`] + /// - [`SDL_CreatePopupWindow`] + /// - [`SDL_CreateWindowWithProperties`] + /// - [`SDL_DestroyWindow`] + pub fn SDL_CreateWindow( + title: *const ::core::ffi::c_char, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + flags: SDL_WindowFlags, + ) -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Create a child popup window of the specified parent window. + /// + /// The window size is a request and may be different than expected based on + /// the desktop layout and window manager policies. Your application should be + /// prepared to handle a window of any size. + /// + /// The flags parameter **must** contain at least one of the following: + /// + /// - [`SDL_WINDOW_TOOLTIP`]\: The popup window is a tooltip and will not pass any + /// input events. + /// - [`SDL_WINDOW_POPUP_MENU`]\: The popup window is a popup menu. The topmost + /// popup menu will implicitly gain the keyboard focus. + /// + /// The following flags are not relevant to popup window creation and will be + /// ignored: + /// + /// - [`SDL_WINDOW_MINIMIZED`] + /// - [`SDL_WINDOW_MAXIMIZED`] + /// - [`SDL_WINDOW_FULLSCREEN`] + /// - [`SDL_WINDOW_BORDERLESS`] + /// + /// The following flags are incompatible with popup window creation and will + /// cause it to fail: + /// + /// - [`SDL_WINDOW_UTILITY`] + /// - [`SDL_WINDOW_MODAL`] + /// + /// The parent parameter **must** be non-null and a valid window. The parent of + /// a popup window can be either a regular, toplevel window, or another popup + /// window. + /// + /// Popup windows cannot be minimized, maximized, made fullscreen, raised, + /// flash, be made a modal window, be the parent of a toplevel window, or grab + /// the mouse and/or keyboard. Attempts to do so will fail. + /// + /// Popup windows implicitly do not have a border/decorations and do not appear + /// on the taskbar/dock or in lists of windows such as alt-tab menus. + /// + /// By default, popup window positions will automatically be constrained to + /// keep the entire window within display bounds. This can be overridden with + /// the [`SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN`] property. + /// + /// By default, popup menus will automatically grab keyboard focus from the + /// parent when shown. This behavior can be overridden by setting the + /// [`SDL_WINDOW_NOT_FOCUSABLE`] flag, setting the + /// [`SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`] property to false, or toggling + /// it after creation via the `SDL_SetWindowFocusable()` function. + /// + /// If a parent window is hidden or destroyed, any child popup windows will be + /// recursively hidden or destroyed as well. Child popup windows not explicitly + /// hidden will be restored when the parent is shown. + /// + /// ## Parameters + /// - `parent`: the parent of the window, must not be NULL. + /// - `offset_x`: the x position of the popup window relative to the origin + /// of the parent. + /// - `offset_y`: the y position of the popup window relative to the origin + /// of the parent window. + /// - `w`: the width of the window. + /// - `h`: the height of the window. + /// - `flags`: [`SDL_WINDOW_TOOLTIP`] or [`SDL_WINDOW_POPUP_MENU`], and zero or more + /// additional [`SDL_WindowFlags`] OR'd together. + /// + /// ## Return value + /// Returns the window that was created or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateWindow`] + /// - [`SDL_CreateWindowWithProperties`] + /// - [`SDL_DestroyWindow`] + /// - [`SDL_GetWindowParent`] + pub fn SDL_CreatePopupWindow( + parent: *mut SDL_Window, + offset_x: ::core::ffi::c_int, + offset_y: ::core::ffi::c_int, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + flags: SDL_WindowFlags, + ) -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Create a window with the specified properties. + /// + /// The window size is a request and may be different than expected based on + /// the desktop layout and window manager policies. Your application should be + /// prepared to handle a window of any size. + /// + /// These are the supported properties: + /// + /// - [`SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN`]\: true if the window should + /// be always on top + /// - [`SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN`]\: true if the window has no + /// window decoration + /// - [`SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN`]\: true if the "tooltip" + /// and "menu" window types should be automatically constrained to be + /// entirely within display bounds (default), false if no constraints on the + /// position are desired. + /// - [`SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN`]\: true if the + /// window will be used with an externally managed graphics context. + /// - [`SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`]\: true if the window should + /// accept keyboard input (defaults true) + /// - [`SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN`]\: true if the window should + /// start in fullscreen mode at desktop resolution + /// - [`SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER`]\: the height of the window + /// - [`SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN`]\: true if the window should start + /// hidden + /// - [`SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN`]\: true if the window + /// uses a high pixel density buffer if possible + /// - [`SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN`]\: true if the window should + /// start maximized + /// - [`SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN`]\: true if the window is a popup menu + /// - [`SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN`]\: true if the window will be used + /// with Metal rendering + /// - [`SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN`]\: true if the window should + /// start minimized + /// - [`SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN`]\: true if the window is modal to + /// its parent + /// - [`SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN`]\: true if the window starts + /// with grabbed mouse focus + /// - [`SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`]\: true if the window will be used + /// with OpenGL rendering + /// - [`SDL_PROP_WINDOW_CREATE_PARENT_POINTER`]\: an [`SDL_Window`] that will be the + /// parent of this window, required for windows with the "tooltip", "menu", + /// and "modal" properties + /// - [`SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN`]\: true if the window should be + /// resizable + /// - [`SDL_PROP_WINDOW_CREATE_TITLE_STRING`]\: the title of the window, in UTF-8 + /// encoding + /// - [`SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN`]\: true if the window show + /// transparent in the areas with alpha of 0 + /// - [`SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN`]\: true if the window is a tooltip + /// - [`SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN`]\: true if the window is a utility + /// window, not showing in the task bar and window list + /// - [`SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN`]\: true if the window will be used + /// with Vulkan rendering + /// - [`SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER`]\: the width of the window + /// - [`SDL_PROP_WINDOW_CREATE_X_NUMBER`]\: the x position of the window, or + /// [`SDL_WINDOWPOS_CENTERED`], defaults to [`SDL_WINDOWPOS_UNDEFINED`]. This is + /// relative to the parent for windows with the "tooltip" or "menu" property + /// set. + /// - [`SDL_PROP_WINDOW_CREATE_Y_NUMBER`]\: the y position of the window, or + /// [`SDL_WINDOWPOS_CENTERED`], defaults to [`SDL_WINDOWPOS_UNDEFINED`]. This is + /// relative to the parent for windows with the "tooltip" or "menu" property + /// set. + /// + /// These are additional supported properties on macOS: + /// + /// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]\: the + /// `(__unsafe_unretained)` NSWindow associated with the window, if you want + /// to wrap an existing window. + /// - [`SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`]\: the `(__unsafe_unretained)` + /// NSView associated with the window, defaults to `[window contentView]` + /// + /// These are additional supported properties on iOS, tvOS, and visionOS: + /// + /// - [`SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER`]\: the `(__unsafe_unretained)` + /// UIWindowScene associated with the window, defaults to the active window + /// scene. + /// + /// These are additional supported properties on Wayland: + /// + /// - [`SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN`] - true if + /// the application wants to use the Wayland surface for a custom role and + /// does not want it attached to an XDG toplevel window. See + /// [README-wayland](README-wayland) for more information on using custom + /// surfaces. + /// - [`SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN`] - true if the + /// application wants an associated `wl_egl_window` object to be created and + /// attached to the window, even if the window does not have the OpenGL + /// property or [`SDL_WINDOW_OPENGL`] flag set. + /// - [`SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER`] - the wl_surface + /// associated with the window, if you want to wrap an existing window. See + /// [README-wayland](README-wayland) for more information. + /// + /// These are additional supported properties on Windows: + /// + /// - [`SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER`]\: the HWND associated with the + /// window, if you want to wrap an existing window. + /// - [`SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER`]\: optional, + /// another window to share pixel format with, useful for OpenGL windows + /// + /// These are additional supported properties with X11: + /// + /// - [`SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER`]\: the X11 Window associated + /// with the window, if you want to wrap an existing window. + /// + /// The window is implicitly shown if the "hidden" property is not set. + /// + /// These are additional supported properties with Emscripten: + /// + /// - [`SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING`]\: the id given to the + /// canvas element. This should start with a '#' sign + /// - [`SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`]\: override the + /// binding element for keyboard inputs for this canvas. The variable can be + /// one of: + /// - "#window": the javascript window object (default) + /// - "#document": the javascript document object + /// - "#screen": the javascript window.screen object + /// - "#canvas": the WebGL canvas element + /// - "#none": Don't bind anything at all + /// - any other string without a leading # sign applies to the element on the + /// page with that ID. Windows with the "tooltip" and "menu" properties are + /// popup windows and have the behaviors and guidelines outlined in + /// [`SDL_CreatePopupWindow()`]. + /// + /// If this window is being created to be used with an [`SDL_Renderer`], you should + /// not add a graphics API specific property + /// ([`SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`], etc), as SDL will handle that + /// internally when it chooses a renderer. However, SDL might need to recreate + /// your window at that point, which may cause the window to appear briefly, + /// and then flicker as it is recreated. The correct approach to this is to + /// create the window with the [`SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN`] property + /// set to true, then create the renderer, then show the window with + /// [`SDL_ShowWindow()`]. + /// + /// ## Parameters + /// - `props`: the properties to use. + /// + /// ## Return value + /// Returns the window that was created or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateProperties`] + /// - [`SDL_CreateWindow`] + /// - [`SDL_DestroyWindow`] + pub fn SDL_CreateWindowWithProperties(props: SDL_PropertiesID) -> *mut SDL_Window; +} + +pub const SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.always_on_top".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.borderless".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.constrain_popup".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.focusable".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.external_graphics_context".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.create.flags".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.fullscreen".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.create.height".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.hidden".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.high_pixel_density".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.maximized".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.menu".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.metal".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.minimized".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.modal".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.mouse_grabbed".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.opengl".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_PARENT_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.parent".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.resizable".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_TITLE_STRING: *const ::core::ffi::c_char = + c"SDL.window.create.title".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.transparent".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.tooltip".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.utility".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.vulkan".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.create.width".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_X_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.create.x".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_Y_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.create.y".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.cocoa.window".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.cocoa.view".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.uikit.windowscene".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.wayland.surface_role_custom".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.create.wayland.create_egl_window".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.wayland.wl_surface".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.win32.hwnd".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER: *const ::core::ffi::c_char = + c"SDL.window.create.win32.pixel_format_hwnd".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.create.x11.window".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING: *const ::core::ffi::c_char = + c"SDL.window.create.emscripten.canvas_id".as_ptr(); + +pub const SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: *const ::core::ffi::c_char = + c"SDL.window.create.emscripten.keyboard_element".as_ptr(); + +unsafe extern "C" { + /// Get the numeric ID of a window. + /// + /// The numeric ID is what [`SDL_WindowEvent`] references, and is necessary to map + /// these events to specific [`SDL_Window`] objects. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the ID of the window on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowFromID`] + pub fn SDL_GetWindowID(window: *mut SDL_Window) -> SDL_WindowID; +} + +unsafe extern "C" { + /// Get a window from a stored ID. + /// + /// The numeric ID is what [`SDL_WindowEvent`] references, and is necessary to map + /// these events to specific [`SDL_Window`] objects. + /// + /// ## Parameters + /// - `id`: the ID of the window. + /// + /// ## Return value + /// Returns the window associated with `id` or NULL if it doesn't exist; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowID`] + pub fn SDL_GetWindowFromID(id: SDL_WindowID) -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Get parent of a window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the parent of the window on success or NULL if the window has no + /// parent. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreatePopupWindow`] + pub fn SDL_GetWindowParent(window: *mut SDL_Window) -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Get the properties associated with a window. + /// + /// The following read-only properties are provided by SDL: + /// + /// - [`SDL_PROP_WINDOW_SHAPE_POINTER`]\: the surface associated with a shaped + /// window + /// - [`SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN`]\: true if the window has HDR + /// headroom above the SDR white point. This property can change dynamically + /// when [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent. + /// - [`SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT`]\: the value of SDR white in the + /// [`SDL_COLORSPACE_SRGB_LINEAR`] colorspace. On Windows this corresponds to the + /// SDR white level in scRGB colorspace, and on Apple platforms this is + /// always 1.0 for EDR content. This property can change dynamically when + /// [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent. + /// - [`SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT`]\: the additional high dynamic range + /// that can be displayed, in terms of the SDR white point. When HDR is not + /// enabled, this will be 1.0. This property can change dynamically when + /// [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent. + /// + /// On Android: + /// + /// - [`SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER`]\: the ANativeWindow associated + /// with the window + /// - [`SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER`]\: the EGLSurface associated with + /// the window + /// + /// On iOS: + /// + /// - [`SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER`]\: the `(__unsafe_unretained)` + /// UIWindow associated with the window + /// - [`SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER`]\: the NSInteger tag + /// associated with metal views on the window + /// - [`SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER`]\: the OpenGL view's + /// framebuffer object. It must be bound when rendering to the screen using + /// OpenGL. + /// - [`SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER`]\: the OpenGL view's + /// renderbuffer object. It must be bound when [`SDL_GL_SwapWindow`] is called. + /// - [`SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER`]\: the OpenGL + /// view's resolve framebuffer, when MSAA is used. + /// + /// On KMS/DRM: + /// + /// - [`SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER`]\: the device index associated + /// with the window (e.g. the X in /dev/dri/cardX) + /// - [`SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER`]\: the DRM FD associated with the + /// window + /// - [`SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER`]\: the GBM device associated + /// with the window + /// + /// On macOS: + /// + /// - [`SDL_PROP_WINDOW_COCOA_WINDOW_POINTER`]\: the `(__unsafe_unretained)` + /// NSWindow associated with the window + /// - [`SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`]\: the NSInteger tag + /// associated with metal views on the window + /// + /// On OpenVR: + /// + /// - [`SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER`]\: the OpenVR Overlay Handle ID + /// for the associated overlay window. + /// + /// On Vivante: + /// + /// - [`SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER`]\: the EGLNativeDisplayType + /// associated with the window + /// - [`SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER`]\: the EGLNativeWindowType + /// associated with the window + /// - [`SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER`]\: the EGLSurface associated with + /// the window + /// + /// On Windows: + /// + /// - [`SDL_PROP_WINDOW_WIN32_HWND_POINTER`]\: the HWND associated with the window + /// - [`SDL_PROP_WINDOW_WIN32_HDC_POINTER`]\: the HDC associated with the window + /// - [`SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER`]\: the HINSTANCE associated with + /// the window + /// + /// On Wayland: + /// + /// Note: The `xdg_*` window objects do not internally persist across window + /// show/hide calls. They will be null if the window is hidden and must be + /// queried each time it is shown. + /// + /// - [`SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER`]\: the wl_display associated with + /// the window + /// - [`SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER`]\: the wl_surface associated with + /// the window + /// - [`SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER`]\: the wp_viewport associated + /// with the window + /// - [`SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER`]\: the wl_egl_window + /// associated with the window + /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER`]\: the xdg_surface associated + /// with the window + /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER`]\: the xdg_toplevel role + /// associated with the window + /// - 'SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING': the export + /// handle associated with the window + /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER`]\: the xdg_popup role + /// associated with the window + /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER`]\: the xdg_positioner + /// associated with the window, in popup mode + /// + /// On X11: + /// + /// - [`SDL_PROP_WINDOW_X11_DISPLAY_POINTER`]\: the X11 Display associated with + /// the window + /// - [`SDL_PROP_WINDOW_X11_SCREEN_NUMBER`]\: the screen number associated with + /// the window + /// - [`SDL_PROP_WINDOW_X11_WINDOW_NUMBER`]\: the X11 Window associated with the + /// window + /// + /// On Emscripten: + /// + /// - [`SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING`]\: the id the canvas element + /// will have + /// - [`SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`]\: the keyboard + /// element that associates keyboard events to this window + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns a valid property ID on success or 0 on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetWindowProperties(window: *mut SDL_Window) -> SDL_PropertiesID; +} + +pub const SDL_PROP_WINDOW_SHAPE_POINTER: *const ::core::ffi::c_char = c"SDL.window.shape".as_ptr(); + +pub const SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN: *const ::core::ffi::c_char = + c"SDL.window.HDR_enabled".as_ptr(); + +pub const SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT: *const ::core::ffi::c_char = + c"SDL.window.SDR_white_level".as_ptr(); + +pub const SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char = + c"SDL.window.HDR_headroom".as_ptr(); + +pub const SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.android.window".as_ptr(); + +pub const SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.android.surface".as_ptr(); + +pub const SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.uikit.window".as_ptr(); + +pub const SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.uikit.metal_view_tag".as_ptr(); + +pub const SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.uikit.opengl.framebuffer".as_ptr(); + +pub const SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.uikit.opengl.renderbuffer".as_ptr(); + +pub const SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.uikit.opengl.resolve_framebuffer".as_ptr(); + +pub const SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.kmsdrm.dev_index".as_ptr(); + +pub const SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.kmsdrm.drm_fd".as_ptr(); + +pub const SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.kmsdrm.gbm_dev".as_ptr(); + +pub const SDL_PROP_WINDOW_COCOA_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.cocoa.window".as_ptr(); + +pub const SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.cocoa.metal_view_tag".as_ptr(); + +pub const SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.openvr.overlay_id".as_ptr(); + +pub const SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER: *const ::core::ffi::c_char = + c"SDL.window.vivante.display".as_ptr(); + +pub const SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.vivante.window".as_ptr(); + +pub const SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.vivante.surface".as_ptr(); + +pub const SDL_PROP_WINDOW_WIN32_HWND_POINTER: *const ::core::ffi::c_char = + c"SDL.window.win32.hwnd".as_ptr(); + +pub const SDL_PROP_WINDOW_WIN32_HDC_POINTER: *const ::core::ffi::c_char = + c"SDL.window.win32.hdc".as_ptr(); + +pub const SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.win32.instance".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.display".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.surface".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.viewport".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.egl_window".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.xdg_surface".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.xdg_toplevel".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING: *const ::core::ffi::c_char = + c"SDL.window.wayland.xdg_toplevel_export_handle".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.xdg_popup".as_ptr(); + +pub const SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER: *const ::core::ffi::c_char = + c"SDL.window.wayland.xdg_positioner".as_ptr(); + +pub const SDL_PROP_WINDOW_X11_DISPLAY_POINTER: *const ::core::ffi::c_char = + c"SDL.window.x11.display".as_ptr(); + +pub const SDL_PROP_WINDOW_X11_SCREEN_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.x11.screen".as_ptr(); + +pub const SDL_PROP_WINDOW_X11_WINDOW_NUMBER: *const ::core::ffi::c_char = + c"SDL.window.x11.window".as_ptr(); + +pub const SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING: *const ::core::ffi::c_char = + c"SDL.window.emscripten.canvas_id".as_ptr(); + +pub const SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: *const ::core::ffi::c_char = + c"SDL.window.emscripten.keyboard_element".as_ptr(); + +unsafe extern "C" { + /// Get the window flags. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns a mask of the [`SDL_WindowFlags`] associated with `window`. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateWindow`] + /// - [`SDL_HideWindow`] + /// - [`SDL_MaximizeWindow`] + /// - [`SDL_MinimizeWindow`] + /// - [`SDL_SetWindowFullscreen`] + /// - [`SDL_SetWindowMouseGrab`] + /// - [`SDL_SetWindowFillDocument`] + /// - [`SDL_ShowWindow`] + pub fn SDL_GetWindowFlags(window: *mut SDL_Window) -> SDL_WindowFlags; +} + +unsafe extern "C" { + /// Set the title of a window. + /// + /// This string is expected to be in UTF-8 encoding. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `title`: the desired window title in UTF-8 format. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowTitle`] + pub fn SDL_SetWindowTitle( + window: *mut SDL_Window, + title: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the title of a window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the title of the window in UTF-8 format or "" if there is no + /// title. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowTitle`] + pub fn SDL_GetWindowTitle(window: *mut SDL_Window) -> *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Set the icon for a window. + /// + /// If this function is passed a surface with alternate representations added + /// using [`SDL_AddSurfaceAlternateImage()`], the surface will be interpreted as + /// the content to be used for 100% display scale, and the alternate + /// representations will be used for high DPI situations. For example, if the + /// original surface is 32x32, then on a 2x macOS display or 200% display scale + /// on Windows, a 64x64 version of the image will be used, if available. If a + /// matching version of the image isn't available, the closest larger size + /// image will be downscaled to the appropriate size and be used instead, if + /// available. Otherwise, the closest smaller image will be upscaled and be + /// used instead. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `icon`: an [`SDL_Surface`] structure containing the icon for the window. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_AddSurfaceAlternateImage`] + pub fn SDL_SetWindowIcon( + window: *mut SDL_Window, + icon: *mut SDL_Surface, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the window's position be set. + /// + /// If the window is in an exclusive fullscreen or maximized state, this + /// request has no effect. + /// + /// This can be used to reposition fullscreen-desktop windows onto a different + /// display, however, as exclusive fullscreen windows are locked to a specific + /// display, they can only be repositioned programmatically via + /// [`SDL_SetWindowFullscreenMode()`]. + /// + /// On some windowing systems this request is asynchronous and the new + /// coordinates may not have have been applied immediately upon the return of + /// this function. If an immediate change is required, call [`SDL_SyncWindow()`] to + /// block until the changes have taken effect. + /// + /// When the window position changes, an [`SDL_EVENT_WINDOW_MOVED`] event will be + /// emitted with the window's new coordinates. Note that the new coordinates + /// may not match the exact coordinates requested, as some windowing systems + /// can restrict the position of the window in certain scenarios (e.g. + /// constraining the position so the window is always within desktop bounds). + /// Additionally, as this is just a request, it can be denied by the windowing + /// system. + /// + /// ## Parameters + /// - `window`: the window to reposition. + /// - `x`: the x coordinate of the window, or [`SDL_WINDOWPOS_CENTERED`] or + /// [`SDL_WINDOWPOS_UNDEFINED`]. + /// - `y`: the y coordinate of the window, or [`SDL_WINDOWPOS_CENTERED`] or + /// [`SDL_WINDOWPOS_UNDEFINED`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowPosition`] + /// - [`SDL_SyncWindow`] + pub fn SDL_SetWindowPosition( + window: *mut SDL_Window, + x: ::core::ffi::c_int, + y: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the position of a window. + /// + /// This is the current position of the window as last reported by the + /// windowing system. + /// + /// If you do not need the value for one of the positions a NULL may be passed + /// in the `x` or `y` parameter. + /// + /// ## Parameters + /// - `window`: the window to query. + /// - `x`: a pointer filled in with the x position of the window, may be + /// NULL. + /// - `y`: a pointer filled in with the y position of the window, may be + /// NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowPosition`] + pub fn SDL_GetWindowPosition( + window: *mut SDL_Window, + x: *mut ::core::ffi::c_int, + y: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the size of a window's client area be set. + /// + /// If the window is in a fullscreen or maximized state, this request has no + /// effect. + /// + /// To change the exclusive fullscreen mode of a window, use + /// [`SDL_SetWindowFullscreenMode()`]. + /// + /// On some windowing systems, this request is asynchronous and the new window + /// size may not have have been applied immediately upon the return of this + /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to + /// block until the changes have taken effect. + /// + /// When the window size changes, an [`SDL_EVENT_WINDOW_RESIZED`] event will be + /// emitted with the new window dimensions. Note that the new dimensions may + /// not match the exact size requested, as some windowing systems can restrict + /// the window size in certain scenarios (e.g. constraining the size of the + /// content area to remain within the usable desktop bounds). Additionally, as + /// this is just a request, it can be denied by the windowing system. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `w`: the width of the window, must be > 0. + /// - `h`: the height of the window, must be > 0. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSize`] + /// - [`SDL_SetWindowFullscreenMode`] + /// - [`SDL_SyncWindow`] + pub fn SDL_SetWindowSize( + window: *mut SDL_Window, + w: ::core::ffi::c_int, + h: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the size of a window's client area. + /// + /// The window pixel size may differ from its window coordinate size if the + /// window is on a high pixel density display. Use [`SDL_GetWindowSizeInPixels()`] + /// or [`SDL_GetRenderOutputSize()`] to get the real client area size in pixels. + /// + /// ## Parameters + /// - `window`: the window to query the width and height from. + /// - `w`: a pointer filled in with the width of the window, may be NULL. + /// - `h`: a pointer filled in with the height of the window, may be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetRenderOutputSize`] + /// - [`SDL_GetWindowSizeInPixels`] + /// - [`SDL_SetWindowSize`] + /// - [`SDL_EVENT_WINDOW_RESIZED`] + pub fn SDL_GetWindowSize( + window: *mut SDL_Window, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the safe area for this window. + /// + /// Some devices have portions of the screen which are partially obscured or + /// not interactive, possibly due to on-screen controls, curved edges, camera + /// notches, TV overscan, etc. This function provides the area of the window + /// which is safe to have interactable content. You should continue rendering + /// into the rest of the window, but it should not contain visually important + /// or interactable content. + /// + /// ## Parameters + /// - `window`: the window to query. + /// - `rect`: a pointer filled in with the client area that is safe for + /// interactive content. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GetWindowSafeArea( + window: *mut SDL_Window, + rect: *mut SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the aspect ratio of a window's client area be set. + /// + /// The aspect ratio is the ratio of width divided by height, e.g. 2560x1600 + /// would be 1.6. Larger aspect ratios are wider and smaller aspect ratios are + /// narrower. + /// + /// If, at the time of this request, the window in a fixed-size state, such as + /// maximized or fullscreen, the request will be deferred until the window + /// exits this state and becomes resizable again. + /// + /// On some windowing systems, this request is asynchronous and the new window + /// aspect ratio may not have have been applied immediately upon the return of + /// this function. If an immediate change is required, call [`SDL_SyncWindow()`] to + /// block until the changes have taken effect. + /// + /// When the window size changes, an [`SDL_EVENT_WINDOW_RESIZED`] event will be + /// emitted with the new window dimensions. Note that the new dimensions may + /// not match the exact aspect ratio requested, as some windowing systems can + /// restrict the window size in certain scenarios (e.g. constraining the size + /// of the content area to remain within the usable desktop bounds). + /// Additionally, as this is just a request, it can be denied by the windowing + /// system. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `min_aspect`: the minimum aspect ratio of the window, or 0.0f for no + /// limit. + /// - `max_aspect`: the maximum aspect ratio of the window, or 0.0f for no + /// limit. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowAspectRatio`] + /// - [`SDL_SyncWindow`] + pub fn SDL_SetWindowAspectRatio( + window: *mut SDL_Window, + min_aspect: ::core::ffi::c_float, + max_aspect: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the aspect ratio of a window's client area. + /// + /// ## Parameters + /// - `window`: the window to query the width and height from. + /// - `min_aspect`: a pointer filled in with the minimum aspect ratio of the + /// window, may be NULL. + /// - `max_aspect`: a pointer filled in with the maximum aspect ratio of the + /// window, may be NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowAspectRatio`] + pub fn SDL_GetWindowAspectRatio( + window: *mut SDL_Window, + min_aspect: *mut ::core::ffi::c_float, + max_aspect: *mut ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the size of a window's borders (decorations) around the client area. + /// + /// Note: If this function fails (returns false), the size values will be + /// initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the + /// window in question was borderless. + /// + /// Note: This function may fail on systems where the window has not yet been + /// decorated by the display server (for example, immediately after calling + /// [`SDL_CreateWindow`]). It is recommended that you wait at least until the + /// window has been presented and composited, so that the window system has a + /// chance to decorate the window and provide the border dimensions to SDL. + /// + /// This function also returns false if getting the information is not + /// supported. + /// + /// ## Parameters + /// - `window`: the window to query the size values of the border + /// (decorations) from. + /// - `top`: pointer to variable for storing the size of the top border; NULL + /// is permitted. + /// - `left`: pointer to variable for storing the size of the left border; + /// NULL is permitted. + /// - `bottom`: pointer to variable for storing the size of the bottom + /// border; NULL is permitted. + /// - `right`: pointer to variable for storing the size of the right border; + /// NULL is permitted. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSize`] + pub fn SDL_GetWindowBordersSize( + window: *mut SDL_Window, + top: *mut ::core::ffi::c_int, + left: *mut ::core::ffi::c_int, + bottom: *mut ::core::ffi::c_int, + right: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the size of a window's client area, in pixels. + /// + /// ## Parameters + /// - `window`: the window from which the drawable size should be queried. + /// - `w`: a pointer to variable for storing the width in pixels, may be + /// NULL. + /// - `h`: a pointer to variable for storing the height in pixels, may be + /// NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreateWindow`] + /// - [`SDL_GetWindowSize`] + pub fn SDL_GetWindowSizeInPixels( + window: *mut SDL_Window, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the minimum size of a window's client area. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `min_w`: the minimum width of the window, or 0 for no limit. + /// - `min_h`: the minimum height of the window, or 0 for no limit. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMinimumSize`] + /// - [`SDL_SetWindowMaximumSize`] + pub fn SDL_SetWindowMinimumSize( + window: *mut SDL_Window, + min_w: ::core::ffi::c_int, + min_h: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the minimum size of a window's client area. + /// + /// ## Parameters + /// - `window`: the window to query. + /// - `w`: a pointer filled in with the minimum width of the window, may be + /// NULL. + /// - `h`: a pointer filled in with the minimum height of the window, may be + /// NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMaximumSize`] + /// - [`SDL_SetWindowMinimumSize`] + pub fn SDL_GetWindowMinimumSize( + window: *mut SDL_Window, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the maximum size of a window's client area. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `max_w`: the maximum width of the window, or 0 for no limit. + /// - `max_h`: the maximum height of the window, or 0 for no limit. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMaximumSize`] + /// - [`SDL_SetWindowMinimumSize`] + pub fn SDL_SetWindowMaximumSize( + window: *mut SDL_Window, + max_w: ::core::ffi::c_int, + max_h: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the maximum size of a window's client area. + /// + /// ## Parameters + /// - `window`: the window to query. + /// - `w`: a pointer filled in with the maximum width of the window, may be + /// NULL. + /// - `h`: a pointer filled in with the maximum height of the window, may be + /// NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMinimumSize`] + /// - [`SDL_SetWindowMaximumSize`] + pub fn SDL_GetWindowMaximumSize( + window: *mut SDL_Window, + w: *mut ::core::ffi::c_int, + h: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the border state of a window. + /// + /// This will add or remove the window's [`SDL_WINDOW_BORDERLESS`] flag and add + /// or remove the border from the actual window. This is a no-op if the + /// window's border already matches the requested state. + /// + /// You can't change the border state of a fullscreen window. + /// + /// ## Parameters + /// - `window`: the window of which to change the border state. + /// - `bordered`: false to remove border, true to add border. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowFlags`] + pub fn SDL_SetWindowBordered( + window: *mut SDL_Window, + bordered: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the user-resizable state of a window. + /// + /// This will add or remove the window's [`SDL_WINDOW_RESIZABLE`] flag and + /// allow/disallow user resizing of the window. This is a no-op if the window's + /// resizable state already matches the requested state. + /// + /// You can't change the resizable state of a fullscreen window. + /// + /// ## Parameters + /// - `window`: the window of which to change the resizable state. + /// - `resizable`: true to allow resizing, false to disallow. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowFlags`] + pub fn SDL_SetWindowResizable( + window: *mut SDL_Window, + resizable: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the window to always be above the others. + /// + /// This will add or remove the window's [`SDL_WINDOW_ALWAYS_ON_TOP`] flag. This + /// will bring the window to the front and keep the window above the rest. + /// + /// ## Parameters + /// - `window`: the window of which to change the always on top state. + /// - `on_top`: true to set the window always on top, false to disable. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowFlags`] + pub fn SDL_SetWindowAlwaysOnTop( + window: *mut SDL_Window, + on_top: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the window to fill the current document space (Emscripten only). + /// + /// This will add or remove the window's [`SDL_WINDOW_FILL_DOCUMENT`] flag. + /// + /// Currently this flag only applies to the Emscripten target. + /// + /// When enabled, the canvas element fills the entire document. Resize events + /// will be generated as the browser window is resized, as that will adjust the + /// canvas size as well. The canvas will cover anything else on the page, + /// including any controls provided by Emscripten in its generated HTML file + /// (in fact, any elements on the page that aren't the canvas will be moved + /// into a hidden `div` element). + /// + /// Often times this is desirable for a browser-based game, but it means + /// several things that we expect of an SDL window on other platforms might not + /// work as expected, such as minimum window sizes and aspect ratios. + /// + /// ## Parameters + /// - `window`: the window of which to change the fill-document state. + /// - `fill`: true to set the window to fill the document, false to disable. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + /// + /// ## See also + /// - [`SDL_GetWindowFlags`] + pub fn SDL_SetWindowFillDocument( + window: *mut SDL_Window, + fill: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Show a window. + /// + /// ## Parameters + /// - `window`: the window to show. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_HideWindow`] + /// - [`SDL_RaiseWindow`] + pub fn SDL_ShowWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Hide a window. + /// + /// ## Parameters + /// - `window`: the window to hide. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_ShowWindow`] + /// - [`SDL_WINDOW_HIDDEN`] + pub fn SDL_HideWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that a window be raised above other windows and gain the input + /// focus. + /// + /// The result of this request is subject to desktop window manager policy, + /// particularly if raising the requested window would result in stealing focus + /// from another application. If the window is successfully raised and gains + /// input focus, an [`SDL_EVENT_WINDOW_FOCUS_GAINED`] event will be emitted, and + /// the window will have the [`SDL_WINDOW_INPUT_FOCUS`] flag set. + /// + /// ## Parameters + /// - `window`: the window to raise. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_RaiseWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the window be made as large as possible. + /// + /// Non-resizable windows can't be maximized. The window must have the + /// [`SDL_WINDOW_RESIZABLE`] flag set, or this will have no effect. + /// + /// On some windowing systems this request is asynchronous and the new window + /// state may not have have been applied immediately upon the return of this + /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to + /// block until the changes have taken effect. + /// + /// When the window state changes, an [`SDL_EVENT_WINDOW_MAXIMIZED`] event will be + /// emitted. Note that, as this is just a request, the windowing system can + /// deny the state change. + /// + /// When maximizing a window, whether the constraints set via + /// [`SDL_SetWindowMaximumSize()`] are honored depends on the policy of the window + /// manager. Win32 and macOS enforce the constraints when maximizing, while X11 + /// and Wayland window managers may vary. + /// + /// ## Parameters + /// - `window`: the window to maximize. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MinimizeWindow`] + /// - [`SDL_RestoreWindow`] + /// - [`SDL_SyncWindow`] + pub fn SDL_MaximizeWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the window be minimized to an iconic representation. + /// + /// If the window is in a fullscreen state, this request has no direct effect. + /// It may alter the state the window is returned to when leaving fullscreen. + /// + /// On some windowing systems this request is asynchronous and the new window + /// state may not have been applied immediately upon the return of this + /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to + /// block until the changes have taken effect. + /// + /// When the window state changes, an [`SDL_EVENT_WINDOW_MINIMIZED`] event will be + /// emitted. Note that, as this is just a request, the windowing system can + /// deny the state change. + /// + /// ## Parameters + /// - `window`: the window to minimize. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MaximizeWindow`] + /// - [`SDL_RestoreWindow`] + /// - [`SDL_SyncWindow`] + pub fn SDL_MinimizeWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the size and position of a minimized or maximized window be + /// restored. + /// + /// If the window is in a fullscreen state, this request has no direct effect. + /// It may alter the state the window is returned to when leaving fullscreen. + /// + /// On some windowing systems this request is asynchronous and the new window + /// state may not have have been applied immediately upon the return of this + /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to + /// block until the changes have taken effect. + /// + /// When the window state changes, an [`SDL_EVENT_WINDOW_RESTORED`] event will be + /// emitted. Note that, as this is just a request, the windowing system can + /// deny the state change. + /// + /// ## Parameters + /// - `window`: the window to restore. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_MaximizeWindow`] + /// - [`SDL_MinimizeWindow`] + /// - [`SDL_SyncWindow`] + pub fn SDL_RestoreWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request that the window's fullscreen state be changed. + /// + /// By default a window in fullscreen state uses borderless fullscreen desktop + /// mode, but a specific exclusive display mode can be set using + /// [`SDL_SetWindowFullscreenMode()`]. + /// + /// On some windowing systems this request is asynchronous and the new + /// fullscreen state may not have have been applied immediately upon the return + /// of this function. If an immediate change is required, call [`SDL_SyncWindow()`] + /// to block until the changes have taken effect. + /// + /// When the window state changes, an [`SDL_EVENT_WINDOW_ENTER_FULLSCREEN`] or + /// [`SDL_EVENT_WINDOW_LEAVE_FULLSCREEN`] event will be emitted. Note that, as this + /// is just a request, it can be denied by the windowing system. + /// + /// ## Parameters + /// - `window`: the window to change. + /// - `fullscreen`: true for fullscreen mode, false for windowed mode. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowFullscreenMode`] + /// - [`SDL_SetWindowFullscreenMode`] + /// - [`SDL_SyncWindow`] + /// - [`SDL_WINDOW_FULLSCREEN`] + pub fn SDL_SetWindowFullscreen( + window: *mut SDL_Window, + fullscreen: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Block until any pending window state is finalized. + /// + /// On asynchronous windowing systems, this acts as a synchronization barrier + /// for pending window state. It will attempt to wait until any pending window + /// state has been applied and is guaranteed to return within finite time. Note + /// that for how long it can potentially block depends on the underlying window + /// system, as window state changes may involve somewhat lengthy animations + /// that must complete before the window is in its final requested state. + /// + /// On windowing systems where changes are immediate, this does nothing. + /// + /// ## Parameters + /// - `window`: the window for which to wait for the pending state to be + /// applied. + /// + /// ## Return value + /// Returns true on success or false if the operation timed out before the + /// window was in the requested state. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowSize`] + /// - [`SDL_SetWindowPosition`] + /// - [`SDL_SetWindowFullscreen`] + /// - [`SDL_MinimizeWindow`] + /// - [`SDL_MaximizeWindow`] + /// - [`SDL_RestoreWindow`] + /// - [`SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS`] + pub fn SDL_SyncWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Return whether the window has a surface associated with it. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns true if there is a surface associated with the window, or false + /// otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSurface`] + pub fn SDL_WindowHasSurface(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the SDL surface associated with the window. + /// + /// A new surface will be created with the optimal format for the window, if + /// necessary. This surface will be freed when the window is destroyed. Do not + /// free this surface. + /// + /// This surface will be invalidated if the window is resized. After resizing a + /// window this function must be called again to return a valid surface. + /// + /// You may not combine this with 3D or the rendering API on this window. + /// + /// This function is affected by [`SDL_HINT_FRAMEBUFFER_ACCELERATION`]. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the surface associated with the window, or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DestroyWindowSurface`] + /// - [`SDL_WindowHasSurface`] + /// - [`SDL_UpdateWindowSurface`] + /// - [`SDL_UpdateWindowSurfaceRects`] + pub fn SDL_GetWindowSurface(window: *mut SDL_Window) -> *mut SDL_Surface; +} + +unsafe extern "C" { + /// Toggle VSync for the window surface. + /// + /// When a window surface is created, vsync defaults to + /// [`SDL_WINDOW_SURFACE_VSYNC_DISABLED`]. + /// + /// The `vsync` parameter can be 1 to synchronize present with every vertical + /// refresh, 2 to synchronize present with every second vertical refresh, etc., + /// [`SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE`] for late swap tearing (adaptive vsync), + /// or [`SDL_WINDOW_SURFACE_VSYNC_DISABLED`] to disable. Not every value is + /// supported by every driver, so you should check the return value to see + /// whether the requested setting is supported. + /// + /// ## Parameters + /// - `window`: the window. + /// - `vsync`: the vertical refresh sync interval. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSurfaceVSync`] + pub fn SDL_SetWindowSurfaceVSync( + window: *mut SDL_Window, + vsync: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +pub const SDL_WINDOW_SURFACE_VSYNC_DISABLED: ::core::primitive::i32 = 0; + +pub const SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE: ::core::primitive::i32 = -1_i32; + +unsafe extern "C" { + /// Get VSync for the window surface. + /// + /// ## Parameters + /// - `window`: the window to query. + /// - `vsync`: an int filled with the current vertical refresh sync interval. + /// See [`SDL_SetWindowSurfaceVSync()`] for the meaning of the value. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowSurfaceVSync`] + pub fn SDL_GetWindowSurfaceVSync( + window: *mut SDL_Window, + vsync: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy the window surface to the screen. + /// + /// This is the function you use to reflect any changes to the surface on the + /// screen. + /// + /// This function is equivalent to the SDL 1.2 API SDL_Flip(). + /// + /// ## Parameters + /// - `window`: the window to update. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSurface`] + /// - [`SDL_UpdateWindowSurfaceRects`] + pub fn SDL_UpdateWindowSurface(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Copy areas of the window surface to the screen. + /// + /// This is the function you use to reflect changes to portions of the surface + /// on the screen. + /// + /// This function is equivalent to the SDL 1.2 API SDL_UpdateRects(). + /// + /// Note that this function will update _at least_ the rectangles specified, + /// but this is only intended as an optimization; in practice, this might + /// update more of the screen (or all of the screen!), depending on what method + /// SDL uses to send pixels to the system. + /// + /// ## Parameters + /// - `window`: the window to update. + /// - `rects`: an array of [`SDL_Rect`] structures representing areas of the + /// surface to copy, in pixels. + /// - `numrects`: the number of rectangles. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSurface`] + /// - [`SDL_UpdateWindowSurface`] + pub fn SDL_UpdateWindowSurfaceRects( + window: *mut SDL_Window, + rects: *const SDL_Rect, + numrects: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy the surface associated with the window. + /// + /// ## Parameters + /// - `window`: the window to update. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowSurface`] + /// - [`SDL_WindowHasSurface`] + pub fn SDL_DestroyWindowSurface(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a window's keyboard grab mode. + /// + /// Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or + /// the Meta/Super key. Note that not all system keyboard shortcuts can be + /// captured by applications (one example is Ctrl+Alt+Del on Windows). + /// + /// This is primarily intended for specialized applications such as VNC clients + /// or VM frontends. Normal games should not use keyboard grab. + /// + /// When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the + /// window is full-screen to ensure the user is not trapped in your + /// application. If you have a custom keyboard shortcut to exit fullscreen + /// mode, you may suppress this behavior with + /// [`SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`]. + /// + /// If the caller enables a grab while another window is currently grabbed, the + /// other window loses its grab in favor of the caller's window. + /// + /// ## Parameters + /// - `window`: the window for which the keyboard grab mode should be set. + /// - `grabbed`: this is true to grab keyboard, and false to release. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowKeyboardGrab`] + /// - [`SDL_SetWindowMouseGrab`] + pub fn SDL_SetWindowKeyboardGrab( + window: *mut SDL_Window, + grabbed: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set a window's mouse grab mode. + /// + /// Mouse grab confines the mouse cursor to the window. + /// + /// ## Parameters + /// - `window`: the window for which the mouse grab mode should be set. + /// - `grabbed`: this is true to grab mouse, and false to release. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMouseRect`] + /// - [`SDL_SetWindowMouseRect`] + /// - [`SDL_SetWindowKeyboardGrab`] + pub fn SDL_SetWindowMouseGrab( + window: *mut SDL_Window, + grabbed: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a window's keyboard grab mode. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns true if keyboard is grabbed, and false otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowKeyboardGrab`] + pub fn SDL_GetWindowKeyboardGrab(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get a window's mouse grab mode. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns true if mouse is grabbed, and false otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMouseRect`] + /// - [`SDL_SetWindowMouseRect`] + /// - [`SDL_SetWindowMouseGrab`] + /// - [`SDL_SetWindowKeyboardGrab`] + pub fn SDL_GetWindowMouseGrab(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the window that currently has an input grab enabled. + /// + /// ## Return value + /// Returns the window if input is grabbed or NULL otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowMouseGrab`] + /// - [`SDL_SetWindowKeyboardGrab`] + pub fn SDL_GetGrabbedWindow() -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Confines the cursor to the specified area of a window. + /// + /// Note that this does NOT grab the cursor, it only defines the area a cursor + /// is restricted to when the window has mouse focus. + /// + /// ## Parameters + /// - `window`: the window that will be associated with the barrier. + /// - `rect`: a rectangle area in window-relative coordinates. If NULL the + /// barrier for the specified window will be destroyed. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowMouseRect`] + /// - [`SDL_GetWindowMouseGrab`] + /// - [`SDL_SetWindowMouseGrab`] + pub fn SDL_SetWindowMouseRect( + window: *mut SDL_Window, + rect: *const SDL_Rect, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the mouse confinement rectangle of a window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns a pointer to the mouse confinement rectangle of a window, or NULL + /// if there isn't one. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowMouseRect`] + /// - [`SDL_GetWindowMouseGrab`] + /// - [`SDL_SetWindowMouseGrab`] + pub fn SDL_GetWindowMouseRect(window: *mut SDL_Window) -> *const SDL_Rect; +} + +unsafe extern "C" { + /// Set the opacity for a window. + /// + /// The parameter `opacity` will be clamped internally between 0.0f + /// (transparent) and 1.0f (opaque). + /// + /// This function also returns false if setting the opacity isn't supported. + /// + /// ## Parameters + /// - `window`: the window which will be made transparent or opaque. + /// - `opacity`: the opacity value (0.0f - transparent, 1.0f - opaque). + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GetWindowOpacity`] + pub fn SDL_SetWindowOpacity( + window: *mut SDL_Window, + opacity: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the opacity of a window. + /// + /// If transparency isn't supported on this platform, opacity will be returned + /// as 1.0f without error. + /// + /// ## Parameters + /// - `window`: the window to get the current opacity value from. + /// + /// ## Return value + /// Returns the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowOpacity`] + pub fn SDL_GetWindowOpacity(window: *mut SDL_Window) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Set the window as a child of a parent window. + /// + /// If the window is already the child of an existing window, it will be + /// reparented to the new owner. Setting the parent window to NULL unparents + /// the window and removes child window status. + /// + /// If a parent window is hidden or destroyed, the operation will be + /// recursively applied to child windows. Child windows hidden with the parent + /// that did not have their hidden status explicitly set will be restored when + /// the parent is shown. + /// + /// Attempting to set the parent of a window that is currently in the modal + /// state will fail. Use [`SDL_SetWindowModal()`] to cancel the modal status before + /// attempting to change the parent. + /// + /// Popup windows cannot change parents and attempts to do so will fail. + /// + /// Setting a parent window that is currently the sibling or descendent of the + /// child window results in undefined behavior. + /// + /// ## Parameters + /// - `window`: the window that should become the child of a parent. + /// - `parent`: the new parent window for the child window. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowModal`] + pub fn SDL_SetWindowParent( + window: *mut SDL_Window, + parent: *mut SDL_Window, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Toggle the state of the window as modal. + /// + /// To enable modal status on a window, the window must currently be the child + /// window of a parent, or toggling modal status on will fail. + /// + /// ## Parameters + /// - `window`: the window on which to set the modal state. + /// - `modal`: true to toggle modal status on, false to toggle it off. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_SetWindowParent`] + /// - [`SDL_WINDOW_MODAL`] + pub fn SDL_SetWindowModal( + window: *mut SDL_Window, + modal: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set whether the window may have input focus. + /// + /// ## Parameters + /// - `window`: the window to set focusable state. + /// - `focusable`: true to allow input focus, false to not allow input focus. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetWindowFocusable( + window: *mut SDL_Window, + focusable: ::core::primitive::bool, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Display the system-level window menu. + /// + /// This default window menu is provided by the system and on some platforms + /// provides functionality for setting or changing privileged state on the + /// window, such as moving it between workspaces or displays, or toggling the + /// always-on-top property. + /// + /// On platforms or desktops where this is unsupported, this function does + /// nothing. + /// + /// ## Parameters + /// - `window`: the window for which the menu will be displayed. + /// - `x`: the x coordinate of the menu, relative to the origin (top-left) of + /// the client area. + /// - `y`: the y coordinate of the menu, relative to the origin (top-left) of + /// the client area. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_ShowWindowSystemMenu( + window: *mut SDL_Window, + x: ::core::ffi::c_int, + y: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +/// Possible return values from the [`SDL_HitTest`] callback. +/// +/// ## Thread safety +/// This function should only be called on the main thread. +/// +/// ## Availability +/// This enum is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_HitTest`] +/// +/// ## Known values (`sdl3-sys`) +/// | Associated constant | Global constant | Description | +/// | ------------------- | --------------- | ----------- | +/// | [`NORMAL`](SDL_HitTestResult::NORMAL) | [`SDL_HITTEST_NORMAL`] | Region is normal. No special properties. | +/// | [`DRAGGABLE`](SDL_HitTestResult::DRAGGABLE) | [`SDL_HITTEST_DRAGGABLE`] | Region can drag entire window. | +/// | [`RESIZE_TOPLEFT`](SDL_HitTestResult::RESIZE_TOPLEFT) | [`SDL_HITTEST_RESIZE_TOPLEFT`] | Region is the resizable top-left corner border. | +/// | [`RESIZE_TOP`](SDL_HitTestResult::RESIZE_TOP) | [`SDL_HITTEST_RESIZE_TOP`] | Region is the resizable top border. | +/// | [`RESIZE_TOPRIGHT`](SDL_HitTestResult::RESIZE_TOPRIGHT) | [`SDL_HITTEST_RESIZE_TOPRIGHT`] | Region is the resizable top-right corner border. | +/// | [`RESIZE_RIGHT`](SDL_HitTestResult::RESIZE_RIGHT) | [`SDL_HITTEST_RESIZE_RIGHT`] | Region is the resizable right border. | +/// | [`RESIZE_BOTTOMRIGHT`](SDL_HitTestResult::RESIZE_BOTTOMRIGHT) | [`SDL_HITTEST_RESIZE_BOTTOMRIGHT`] | Region is the resizable bottom-right corner border. | +/// | [`RESIZE_BOTTOM`](SDL_HitTestResult::RESIZE_BOTTOM) | [`SDL_HITTEST_RESIZE_BOTTOM`] | Region is the resizable bottom border. | +/// | [`RESIZE_BOTTOMLEFT`](SDL_HitTestResult::RESIZE_BOTTOMLEFT) | [`SDL_HITTEST_RESIZE_BOTTOMLEFT`] | Region is the resizable bottom-left corner border. | +/// | [`RESIZE_LEFT`](SDL_HitTestResult::RESIZE_LEFT) | [`SDL_HITTEST_RESIZE_LEFT`] | Region is the resizable left border. | +#[repr(transparent)] +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SDL_HitTestResult(pub ::core::ffi::c_int); + +impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_HitTestResult { + #[inline(always)] + fn eq(&self, other: &::core::ffi::c_int) -> bool { + &self.0 == other + } +} + +impl ::core::cmp::PartialEq for ::core::ffi::c_int { + #[inline(always)] + fn eq(&self, other: &SDL_HitTestResult) -> bool { + self == &other.0 + } +} + +impl From for ::core::ffi::c_int { + #[inline(always)] + fn from(value: SDL_HitTestResult) -> Self { + value.0 + } +} + +#[cfg(feature = "debug-impls")] +impl ::core::fmt::Debug for SDL_HitTestResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + #[allow(unreachable_patterns)] + f.write_str(match *self { + Self::NORMAL => "SDL_HITTEST_NORMAL", + Self::DRAGGABLE => "SDL_HITTEST_DRAGGABLE", + Self::RESIZE_TOPLEFT => "SDL_HITTEST_RESIZE_TOPLEFT", + Self::RESIZE_TOP => "SDL_HITTEST_RESIZE_TOP", + Self::RESIZE_TOPRIGHT => "SDL_HITTEST_RESIZE_TOPRIGHT", + Self::RESIZE_RIGHT => "SDL_HITTEST_RESIZE_RIGHT", + Self::RESIZE_BOTTOMRIGHT => "SDL_HITTEST_RESIZE_BOTTOMRIGHT", + Self::RESIZE_BOTTOM => "SDL_HITTEST_RESIZE_BOTTOM", + Self::RESIZE_BOTTOMLEFT => "SDL_HITTEST_RESIZE_BOTTOMLEFT", + Self::RESIZE_LEFT => "SDL_HITTEST_RESIZE_LEFT", + + _ => return write!(f, "SDL_HitTestResult({})", self.0), + }) + } +} + +impl SDL_HitTestResult { + /// Region is normal. No special properties. + pub const NORMAL: Self = Self((0 as ::core::ffi::c_int)); + /// Region can drag entire window. + pub const DRAGGABLE: Self = Self((1 as ::core::ffi::c_int)); + /// Region is the resizable top-left corner border. + pub const RESIZE_TOPLEFT: Self = Self((2 as ::core::ffi::c_int)); + /// Region is the resizable top border. + pub const RESIZE_TOP: Self = Self((3 as ::core::ffi::c_int)); + /// Region is the resizable top-right corner border. + pub const RESIZE_TOPRIGHT: Self = Self((4 as ::core::ffi::c_int)); + /// Region is the resizable right border. + pub const RESIZE_RIGHT: Self = Self((5 as ::core::ffi::c_int)); + /// Region is the resizable bottom-right corner border. + pub const RESIZE_BOTTOMRIGHT: Self = Self((6 as ::core::ffi::c_int)); + /// Region is the resizable bottom border. + pub const RESIZE_BOTTOM: Self = Self((7 as ::core::ffi::c_int)); + /// Region is the resizable bottom-left corner border. + pub const RESIZE_BOTTOMLEFT: Self = Self((8 as ::core::ffi::c_int)); + /// Region is the resizable left border. + pub const RESIZE_LEFT: Self = Self((9 as ::core::ffi::c_int)); +} + +/// Region is normal. No special properties. +pub const SDL_HITTEST_NORMAL: SDL_HitTestResult = SDL_HitTestResult::NORMAL; +/// Region can drag entire window. +pub const SDL_HITTEST_DRAGGABLE: SDL_HitTestResult = SDL_HitTestResult::DRAGGABLE; +/// Region is the resizable top-left corner border. +pub const SDL_HITTEST_RESIZE_TOPLEFT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_TOPLEFT; +/// Region is the resizable top border. +pub const SDL_HITTEST_RESIZE_TOP: SDL_HitTestResult = SDL_HitTestResult::RESIZE_TOP; +/// Region is the resizable top-right corner border. +pub const SDL_HITTEST_RESIZE_TOPRIGHT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_TOPRIGHT; +/// Region is the resizable right border. +pub const SDL_HITTEST_RESIZE_RIGHT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_RIGHT; +/// Region is the resizable bottom-right corner border. +pub const SDL_HITTEST_RESIZE_BOTTOMRIGHT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_BOTTOMRIGHT; +/// Region is the resizable bottom border. +pub const SDL_HITTEST_RESIZE_BOTTOM: SDL_HitTestResult = SDL_HitTestResult::RESIZE_BOTTOM; +/// Region is the resizable bottom-left corner border. +pub const SDL_HITTEST_RESIZE_BOTTOMLEFT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_BOTTOMLEFT; +/// Region is the resizable left border. +pub const SDL_HITTEST_RESIZE_LEFT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_LEFT; + +impl SDL_HitTestResult { + /// Initialize a `SDL_HitTestResult` from a raw value. + #[inline(always)] + pub const fn new(value: ::core::ffi::c_int) -> Self { + Self(value) + } +} + +impl SDL_HitTestResult { + /// Get a copy of the inner raw value. + #[inline(always)] + pub const fn value(&self) -> ::core::ffi::c_int { + self.0 + } +} + +#[cfg(feature = "metadata")] +impl sdl3_sys::metadata::GroupMetadata for SDL_HitTestResult { + const GROUP_METADATA: &'static sdl3_sys::metadata::Group = + &crate::metadata::video::METADATA_SDL_HitTestResult; +} + +/// Callback used for hit-testing. +/// +/// ## Parameters +/// - `win`: the [`SDL_Window`] where hit-testing was set on. +/// - `area`: an [`SDL_Point`] which should be hit-tested. +/// - `data`: what was passed as `callback_data` to [`SDL_SetWindowHitTest()`]. +/// +/// ## Return value +/// Returns an [`SDL_HitTestResult`] value. +/// +/// ## See also +/// - [`SDL_SetWindowHitTest`] +pub type SDL_HitTest = ::core::option::Option< + unsafe extern "C" fn( + win: *mut SDL_Window, + area: *const SDL_Point, + data: *mut ::core::ffi::c_void, + ) -> SDL_HitTestResult, +>; + +unsafe extern "C" { + /// Provide a callback that decides if a window region has special properties. + /// + /// Normally windows are dragged and resized by decorations provided by the + /// system window manager (a title bar, borders, etc), but for some apps, it + /// makes sense to drag them from somewhere else inside the window itself; for + /// example, one might have a borderless window that wants to be draggable from + /// any part, or simulate its own title bar, etc. + /// + /// This function lets the app provide a callback that designates pieces of a + /// given window as special. This callback is run during event processing if we + /// need to tell the OS to treat a region of the window specially; the use of + /// this callback is known as "hit testing." + /// + /// Mouse input may not be delivered to your application if it is within a + /// special area; the OS will often apply that input to moving the window or + /// resizing the window and not deliver it to the application. + /// + /// Specifying NULL for a callback disables hit-testing. Hit-testing is + /// disabled by default. + /// + /// Platforms that don't support this functionality will return false + /// unconditionally, even if you're attempting to disable hit-testing. + /// + /// Your callback may fire at any time, and its firing does not indicate any + /// specific behavior (for example, on Windows, this certainly might fire when + /// the OS is deciding whether to drag your window, but it fires for lots of + /// other reasons, too, some unrelated to anything you probably care about _and + /// when the mouse isn't actually at the location it is testing_). Since this + /// can fire at any time, you should try to keep your callback efficient, + /// devoid of allocations, etc. + /// + /// ## Parameters + /// - `window`: the window to set hit-testing on. + /// - `callback`: the function to call when doing a hit-test. + /// - `callback_data`: an app-defined void pointer passed to **callback**. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetWindowHitTest( + window: *mut SDL_Window, + callback: SDL_HitTest, + callback_data: *mut ::core::ffi::c_void, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Set the shape of a transparent window. + /// + /// This sets the alpha channel of a transparent window and any fully + /// transparent areas are also transparent to mouse clicks. If you are using + /// something besides the SDL render API, then you are responsible for drawing + /// the alpha channel of the window to match the shape alpha channel to get + /// consistent cross-platform results. + /// + /// The shape is copied inside this function, so you can free it afterwards. If + /// your shape surface changes, you should call [`SDL_SetWindowShape()`] again to + /// update the window. This is an expensive operation, so should be done + /// sparingly. + /// + /// The window must have been created with the [`SDL_WINDOW_TRANSPARENT`] flag. + /// + /// ## Parameters + /// - `window`: the window. + /// - `shape`: the surface representing the shape of the window, or NULL to + /// remove any current shape. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_SetWindowShape( + window: *mut SDL_Window, + shape: *mut SDL_Surface, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Request a window to demand attention from the user. + /// + /// ## Parameters + /// - `window`: the window to be flashed. + /// - `operation`: the operation to perform. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_FlashWindow( + window: *mut SDL_Window, + operation: SDL_FlashOperation, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Sets the state of the progress bar for the given window’s taskbar icon. + /// + /// ## Parameters + /// - `window`: the window whose progress state is to be modified. + /// - `state`: the progress state. [`SDL_PROGRESS_STATE_NONE`] stops displaying + /// the progress bar. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_SetWindowProgressState( + window: *mut SDL_Window, + state: SDL_ProgressState, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the state of the progress bar for the given window’s taskbar icon. + /// + /// ## Parameters + /// - `window`: the window to get the current progress state from. + /// + /// ## Return value + /// Returns the progress state, or [`SDL_PROGRESS_STATE_INVALID`] on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetWindowProgressState(window: *mut SDL_Window) -> SDL_ProgressState; +} + +unsafe extern "C" { + /// Sets the value of the progress bar for the given window’s taskbar icon. + /// + /// ## Parameters + /// - `window`: the window whose progress value is to be modified. + /// - `value`: the progress value in the range of \[0.0f - 1.0f\]. If the value + /// is outside the valid range, it gets clamped. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_SetWindowProgressValue( + window: *mut SDL_Window, + value: ::core::ffi::c_float, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the value of the progress bar for the given window’s taskbar icon. + /// + /// ## Parameters + /// - `window`: the window to get the current progress value from. + /// + /// ## Return value + /// Returns the progress value in the range of \[0.0f - 1.0f\], or -1.0f on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.4.0. + pub fn SDL_GetWindowProgressValue(window: *mut SDL_Window) -> ::core::ffi::c_float; +} + +unsafe extern "C" { + /// Destroy a window. + /// + /// Any child windows owned by the window will be recursively destroyed as + /// well. + /// + /// Note that on some platforms, the visible window may not actually be removed + /// from the screen until the SDL event loop is pumped again, even though the + /// [`SDL_Window`] is no longer valid after this call. + /// + /// ## Parameters + /// - `window`: the window to destroy. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_CreatePopupWindow`] + /// - [`SDL_CreateWindow`] + /// - [`SDL_CreateWindowWithProperties`] + pub fn SDL_DestroyWindow(window: *mut SDL_Window); +} + +unsafe extern "C" { + /// Check whether the screensaver is currently enabled. + /// + /// The screensaver is disabled by default. + /// + /// The default can also be changed using [`SDL_HINT_VIDEO_ALLOW_SCREENSAVER`]. + /// + /// ## Return value + /// Returns true if the screensaver is enabled, false if it is disabled. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DisableScreenSaver`] + /// - [`SDL_EnableScreenSaver`] + pub fn SDL_ScreenSaverEnabled() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Allow the screen to be blanked by a screen saver. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_DisableScreenSaver`] + /// - [`SDL_ScreenSaverEnabled`] + pub fn SDL_EnableScreenSaver() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Prevent the screen from being blanked by a screen saver. + /// + /// If you disable the screensaver, it is automatically re-enabled when SDL + /// quits. + /// + /// The screensaver is disabled by default, but this may by changed by + /// [`SDL_HINT_VIDEO_ALLOW_SCREENSAVER`]. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_EnableScreenSaver`] + /// - [`SDL_ScreenSaverEnabled`] + pub fn SDL_DisableScreenSaver() -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Dynamically load an OpenGL library. + /// + /// This should be done after initializing the video driver, but before + /// creating any OpenGL windows. If no OpenGL library is loaded, the default + /// library will be loaded upon creation of the first OpenGL window. + /// + /// If you do this, you need to retrieve all of the GL functions used in your + /// program from the dynamic library using [`SDL_GL_GetProcAddress()`]. + /// + /// ## Parameters + /// - `path`: the platform dependent OpenGL library name, or NULL to open the + /// default OpenGL library. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_GetProcAddress`] + /// - [`SDL_GL_UnloadLibrary`] + pub fn SDL_GL_LoadLibrary(path: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get an OpenGL function by name. + /// + /// If the GL library is loaded at runtime with [`SDL_GL_LoadLibrary()`], then all + /// GL functions must be retrieved this way. Usually this is used to retrieve + /// function pointers to OpenGL extensions. + /// + /// There are some quirks to looking up OpenGL functions that require some + /// extra care from the application. If you code carefully, you can handle + /// these quirks without any platform-specific code, though: + /// + /// - On Windows, function pointers are specific to the current GL context; + /// this means you need to have created a GL context and made it current + /// before calling [`SDL_GL_GetProcAddress()`]. If you recreate your context or + /// create a second context, you should assume that any existing function + /// pointers aren't valid to use with it. This is (currently) a + /// Windows-specific limitation, and in practice lots of drivers don't suffer + /// this limitation, but it is still the way the wgl API is documented to + /// work and you should expect crashes if you don't respect it. Store a copy + /// of the function pointers that comes and goes with context lifespan. + /// - On X11, function pointers returned by this function are valid for any + /// context, and can even be looked up before a context is created at all. + /// This means that, for at least some common OpenGL implementations, if you + /// look up a function that doesn't exist, you'll get a non-NULL result that + /// is _NOT_ safe to call. You must always make sure the function is actually + /// available for a given GL context before calling it, by checking for the + /// existence of the appropriate extension with [`SDL_GL_ExtensionSupported()`], + /// or verifying that the version of OpenGL you're using offers the function + /// as core functionality. + /// - Some OpenGL drivers, on all platforms, *will* return NULL if a function + /// isn't supported, but you can't count on this behavior. Check for + /// extensions you use, and if you get a NULL anyway, act as if that + /// extension wasn't available. This is probably a bug in the driver, but you + /// can code defensively for this scenario anyhow. + /// - Just because you're on Linux/Unix, don't assume you'll be using X11. + /// Next-gen display servers are waiting to replace it, and may or may not + /// make the same promises about function pointers. + /// - OpenGL function pointers must be declared `APIENTRY` as in the example + /// code. This will ensure the proper calling convention is followed on + /// platforms where this matters (Win32) thereby avoiding stack corruption. + /// + /// ## Parameters + /// - `proc`: the name of an OpenGL function. + /// + /// ## Return value + /// Returns a pointer to the named OpenGL function. The returned pointer + /// should be cast to the appropriate function signature. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_ExtensionSupported`] + /// - [`SDL_GL_LoadLibrary`] + /// - [`SDL_GL_UnloadLibrary`] + pub fn SDL_GL_GetProcAddress(proc: *const ::core::ffi::c_char) -> SDL_FunctionPointer; +} + +unsafe extern "C" { + /// Get an EGL library function by name. + /// + /// If an EGL library is loaded, this function allows applications to get entry + /// points for EGL functions. This is useful to provide to an EGL API and + /// extension loader. + /// + /// ## Parameters + /// - `proc`: the name of an EGL function. + /// + /// ## Return value + /// Returns a pointer to the named EGL function. The returned pointer should + /// be cast to the appropriate function signature. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_EGL_GetCurrentDisplay`] + pub fn SDL_EGL_GetProcAddress(proc: *const ::core::ffi::c_char) -> SDL_FunctionPointer; +} + +unsafe extern "C" { + /// Unload the OpenGL library previously loaded by [`SDL_GL_LoadLibrary()`]. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_LoadLibrary`] + pub fn SDL_GL_UnloadLibrary(); +} + +unsafe extern "C" { + /// Check if an OpenGL extension is supported for the current context. + /// + /// This function operates on the current GL context; you must have created a + /// context and it must be current before calling this function. Do not assume + /// that all contexts you create will have the same set of extensions + /// available, or that recreating an existing context will offer the same + /// extensions again. + /// + /// While it's probably not a massive overhead, this function is not an O(1) + /// operation. Check the extensions you care about after creating the GL + /// context and save that information somewhere instead of calling the function + /// every time you need to know. + /// + /// ## Parameters + /// - `extension`: the name of the extension to check. + /// + /// ## Return value + /// Returns true if the extension is supported, false otherwise. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GL_ExtensionSupported( + extension: *const ::core::ffi::c_char, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Reset all previously set OpenGL context attributes to their default values. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_GetAttribute`] + /// - [`SDL_GL_SetAttribute`] + pub fn SDL_GL_ResetAttributes(); +} + +unsafe extern "C" { + /// Set an OpenGL window attribute before window creation. + /// + /// This function sets the OpenGL attribute `attr` to `value`. The requested + /// attributes should be set before creating an OpenGL window. You should use + /// [`SDL_GL_GetAttribute()`] to check the values after creating the OpenGL + /// context, since the values obtained can differ from the requested ones. + /// + /// ## Parameters + /// - `attr`: an enum value specifying the OpenGL attribute to set. + /// - `value`: the desired value for the attribute. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_CreateContext`] + /// - [`SDL_GL_GetAttribute`] + /// - [`SDL_GL_ResetAttributes`] + pub fn SDL_GL_SetAttribute( + attr: SDL_GLAttr, + value: ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the actual value for an attribute from the current context. + /// + /// ## Parameters + /// - `attr`: an [`SDL_GLAttr`] enum value specifying the OpenGL attribute to + /// get. + /// - `value`: a pointer filled in with the current value of `attr`. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_ResetAttributes`] + /// - [`SDL_GL_SetAttribute`] + pub fn SDL_GL_GetAttribute( + attr: SDL_GLAttr, + value: *mut ::core::ffi::c_int, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Create an OpenGL context for an OpenGL window, and make it current. + /// + /// The OpenGL context will be created with the current states set through + /// [`SDL_GL_SetAttribute()`]. + /// + /// The [`SDL_Window`] specified must have been created with the [`SDL_WINDOW_OPENGL`] + /// flag, or context creation will fail. + /// + /// Windows users new to OpenGL should note that, for historical reasons, GL + /// functions added after OpenGL version 1.1 are not available by default. + /// Those functions must be loaded at run-time, either with an OpenGL + /// extension-handling library or with [`SDL_GL_GetProcAddress()`] and its related + /// functions. + /// + /// [`SDL_GLContext`] is opaque to the application. + /// + /// ## Parameters + /// - `window`: the window to associate with the context. + /// + /// ## Return value + /// Returns the OpenGL context associated with `window` or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_DestroyContext`] + /// - [`SDL_GL_MakeCurrent`] + pub fn SDL_GL_CreateContext(window: *mut SDL_Window) -> SDL_GLContext; +} + +unsafe extern "C" { + /// Set up an OpenGL context for rendering into an OpenGL window. + /// + /// The context must have been created with a compatible window. + /// + /// ## Parameters + /// - `window`: the window to associate with the context. + /// - `context`: the OpenGL context to associate with the window. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_CreateContext`] + pub fn SDL_GL_MakeCurrent( + window: *mut SDL_Window, + context: SDL_GLContext, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the currently active OpenGL window. + /// + /// ## Return value + /// Returns the currently active OpenGL window on success or NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GL_GetCurrentWindow() -> *mut SDL_Window; +} + +unsafe extern "C" { + /// Get the currently active OpenGL context. + /// + /// ## Return value + /// Returns the currently active OpenGL context or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_MakeCurrent`] + pub fn SDL_GL_GetCurrentContext() -> SDL_GLContext; +} + +unsafe extern "C" { + /// Get the currently active EGL display. + /// + /// ## Return value + /// Returns the currently active EGL display or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EGL_GetCurrentDisplay() -> SDL_EGLDisplay; +} + +unsafe extern "C" { + /// Get the currently active EGL config. + /// + /// ## Return value + /// Returns the currently active EGL config or NULL on failure; call + /// [`SDL_GetError()`] for more information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EGL_GetCurrentConfig() -> SDL_EGLConfig; +} + +unsafe extern "C" { + /// Get the EGL surface associated with the window. + /// + /// ## Parameters + /// - `window`: the window to query. + /// + /// ## Return value + /// Returns the EGLSurface pointer associated with the window, or NULL on + /// failure. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EGL_GetWindowSurface(window: *mut SDL_Window) -> SDL_EGLSurface; +} + +unsafe extern "C" { + /// Sets the callbacks for defining custom EGLAttrib arrays for EGL + /// initialization. + /// + /// Callbacks that aren't needed can be set to NULL. + /// + /// NOTE: These callback pointers will be reset after [`SDL_GL_ResetAttributes`]. + /// + /// ## Parameters + /// - `platformAttribCallback`: callback for attributes to pass to + /// eglGetPlatformDisplay. May be NULL. + /// - `surfaceAttribCallback`: callback for attributes to pass to + /// eglCreateSurface. May be NULL. + /// - `contextAttribCallback`: callback for attributes to pass to + /// eglCreateContext. May be NULL. + /// - `userdata`: a pointer that is passed to the callbacks. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_EGL_SetAttributeCallbacks( + platformAttribCallback: SDL_EGLAttribArrayCallback, + surfaceAttribCallback: SDL_EGLIntArrayCallback, + contextAttribCallback: SDL_EGLIntArrayCallback, + userdata: *mut ::core::ffi::c_void, + ); +} + +unsafe extern "C" { + /// Set the swap interval for the current OpenGL context. + /// + /// Some systems allow specifying -1 for the interval, to enable adaptive + /// vsync. Adaptive vsync works the same as vsync, but if you've already missed + /// the vertical retrace for a given frame, it swaps buffers immediately, which + /// might be less jarring for the user during occasional framerate drops. If an + /// application requests adaptive vsync and the system does not support it, + /// this function will fail and return false. In such a case, you should + /// probably retry the call with 1 for the interval. + /// + /// Adaptive vsync is implemented for some glX drivers with + /// GLX_EXT_swap_control_tear, and for some Windows drivers with + /// WGL_EXT_swap_control_tear. + /// + /// Read more on the Khronos wiki: + /// + /// + /// ## Parameters + /// - `interval`: 0 for immediate updates, 1 for updates synchronized with + /// the vertical retrace, -1 for adaptive vsync. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_GetSwapInterval`] + pub fn SDL_GL_SetSwapInterval(interval: ::core::ffi::c_int) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the swap interval for the current OpenGL context. + /// + /// If the system can't determine the swap interval, or there isn't a valid + /// current context, this function will set *interval to 0 as a safe default. + /// + /// ## Parameters + /// - `interval`: output interval value. 0 if there is no vertical retrace + /// synchronization, 1 if the buffer swap is synchronized with + /// the vertical retrace, and -1 if late swaps happen + /// immediately instead of waiting for the next retrace. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_SetSwapInterval`] + pub fn SDL_GL_GetSwapInterval(interval: *mut ::core::ffi::c_int) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Update a window with OpenGL rendering. + /// + /// This is used with double-buffered OpenGL contexts, which are the default. + /// + /// On macOS, make sure you bind 0 to the draw framebuffer before swapping the + /// window, otherwise nothing will happen. If you aren't using + /// glBindFramebuffer(), this is the default and you won't have to do anything + /// extra. + /// + /// ## Parameters + /// - `window`: the window to change. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + pub fn SDL_GL_SwapWindow(window: *mut SDL_Window) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Delete an OpenGL context. + /// + /// ## Parameters + /// - `context`: the OpenGL context to be deleted. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function should only be called on the main thread. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_GL_CreateContext`] + pub fn SDL_GL_DestroyContext(context: SDL_GLContext) -> ::core::primitive::bool; +} + +/// Internal display mode data. +/// +/// This lives as a field in [`SDL_DisplayMode`], as opaque data. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_DisplayMode`] +#[repr(C)] +pub struct SDL_DisplayModeData { + _opaque: [::core::primitive::u8; 0], +} + +#[repr(C)] +pub struct SDL_GLContextState { + _opaque: [::core::primitive::u8; 0], +} + +/// The struct used as an opaque handle to a window. +/// +/// ## Availability +/// This struct is available since SDL 3.2.0. +/// +/// ## See also +/// - [`SDL_CreateWindow`] +#[repr(C)] +pub struct SDL_Window { + _opaque: [::core::primitive::u8; 0], +} + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/generated/vulkan.rs b/vendor/sdl3-sys/src/generated/vulkan.rs new file mode 100644 index 00000000..39191937 --- /dev/null +++ b/vendor/sdl3-sys/src/generated/vulkan.rs @@ -0,0 +1,344 @@ +//! Functions for creating Vulkan surfaces on SDL windows. +//! +//! For the most part, Vulkan operates independent of SDL, but it benefits from +//! a little support during setup. +//! +//! Use [`SDL_Vulkan_GetInstanceExtensions()`] to get platform-specific bits for +//! creating a VkInstance, then [`SDL_Vulkan_GetVkGetInstanceProcAddr()`] to get +//! the appropriate function for querying Vulkan entry points. Then +//! [`SDL_Vulkan_CreateSurface()`] will get you the final pieces you need to +//! prepare for rendering into an [`SDL_Window`] with Vulkan. +//! +//! Unlike OpenGL, most of the details of "context" creation and window buffer +//! swapping are handled by the Vulkan API directly, so SDL doesn't provide +//! Vulkan equivalents of [`SDL_GL_SwapWindow()`], etc; they aren't necessary. + +use super::stdinc::*; + +use super::error::*; + +use super::video::*; + +apply_cfg!(#[cfg(any(all(not(target_pointer_width = "32"), target_arch = "x86_64"), all(target_arch = "riscv64", any(target_arch = "riscv32", target_arch = "riscv64")), any(/* always disabled: _M_IA64 */), target_arch = "x86_64", all(windows, target_pointer_width = "64"), all(not(windows), target_pointer_width = "64"), target_arch = "aarch64", any(/* always disabled: __ia64 */), target_arch = "powerpc64"))] => { +}); + +apply_cfg!(#[cfg(not(any(all(not(target_pointer_width = "32"), target_arch = "x86_64"), all(target_arch = "riscv64", any(target_arch = "riscv32", target_arch = "riscv64")), any(/* always disabled: _M_IA64 */), target_arch = "x86_64", all(windows, target_pointer_width = "64"), all(not(windows), target_pointer_width = "64"), target_arch = "aarch64", any(/* always disabled: __ia64 */), target_arch = "powerpc64")))] => { +}); + +apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::Instance` from the `ash` crate. Otherwise it's a pointer to an opaque struct. + pub type VkInstance = ::ash_v0_38::vk::Instance; +}); + +apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::Instance` from the `ash` crate. Otherwise it's a pointer to an opaque struct. + pub type VkInstance = *mut __VkInstance; + + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + #[doc(hidden)] + #[repr(C)] + pub struct __VkInstance { _opaque: [::core::primitive::u8; 0] } +}); + +apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::PhysicalDevice` from the `ash` crate. Otherwise it's a pointer to an opaque struct. + pub type VkPhysicalDevice = ::ash_v0_38::vk::PhysicalDevice; +}); + +apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::PhysicalDevice` from the `ash` crate. Otherwise it's a pointer to an opaque struct. + pub type VkPhysicalDevice = *mut __VkPhysicalDevice; + + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + #[doc(hidden)] + #[repr(C)] + pub struct __VkPhysicalDevice { _opaque: [::core::primitive::u8; 0] } +}); + +apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::SurfaceKHR` from the `ash` crate. Otherwise it's a target dependent opaque type. + pub type VkSurfaceKHR = ::ash_v0_38::vk::SurfaceKHR; +}); + +apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => { + #[cfg(target_pointer_width = "64")] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + pub type VkSurfaceKHR = *mut __VkSurfaceKHR; + + #[cfg(target_pointer_width = "64")] + #[doc(hidden)] + #[repr(C)] + pub struct __VkSurfaceKHR { _opaque: [::core::primitive::u8; 0] } + + #[cfg(not(target_pointer_width = "64"))] + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::SurfaceKHR` from the `ash` crate. Otherwise it's a target dependent opaque type. + pub type VkSurfaceKHR = ::core::primitive::u64; +}); + +unsafe extern "C" { + /// Dynamically load the Vulkan loader library. + /// + /// This should be called after initializing the video driver, but before + /// creating any Vulkan windows. If no Vulkan loader library is loaded, the + /// default library will be loaded upon creation of the first Vulkan window. + /// + /// SDL keeps a counter of how many times this function has been successfully + /// called, so it is safe to call this function multiple times, so long as it + /// is eventually paired with an equivalent number of calls to + /// [`SDL_Vulkan_UnloadLibrary`]. The `path` argument is ignored unless there is no + /// library currently loaded, and and the library isn't actually unloaded until + /// there have been an equivalent number of calls to [`SDL_Vulkan_UnloadLibrary`]. + /// + /// It is fairly common for Vulkan applications to link with libvulkan instead + /// of explicitly loading it at run time. This will work with SDL provided the + /// application links to a dynamic library and both it and SDL use the same + /// search path. + /// + /// If you specify a non-NULL `path`, an application should retrieve all of the + /// Vulkan functions it uses from the dynamic library using + /// [`SDL_Vulkan_GetVkGetInstanceProcAddr`] unless you can guarantee `path` points + /// to the same vulkan loader library the application linked to. + /// + /// On Apple devices, if `path` is NULL, SDL will attempt to find the + /// `vkGetInstanceProcAddr` address within all the Mach-O images of the current + /// process. This is because it is fairly common for Vulkan applications to + /// link with libvulkan (and historically MoltenVK was provided as a static + /// library). If it is not found, on macOS, SDL will attempt to load + /// `vulkan.framework/vulkan`, `libvulkan.1.dylib`, + /// `MoltenVK.framework/MoltenVK`, and `libMoltenVK.dylib`, in that order. On + /// iOS, SDL will attempt to load `libMoltenVK.dylib`. Applications using a + /// dynamic framework or .dylib must ensure it is included in its application + /// bundle. + /// + /// On non-Apple devices, application linking with a static libvulkan is not + /// supported. Either do not link to the Vulkan loader or link to a dynamic + /// library version. + /// + /// ## Parameters + /// - `path`: the platform dependent Vulkan loader library name or NULL. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Vulkan_GetVkGetInstanceProcAddr`] + /// - [`SDL_Vulkan_UnloadLibrary`] + pub fn SDL_Vulkan_LoadLibrary(path: *const ::core::ffi::c_char) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Get the address of the `vkGetInstanceProcAddr` function. + /// + /// This should be called after either calling [`SDL_Vulkan_LoadLibrary()`] or + /// creating an [`SDL_Window`] with the [`SDL_WINDOW_VULKAN`] flag. + /// + /// The actual type of the returned function pointer is + /// PFN_vkGetInstanceProcAddr, but that isn't available because the Vulkan + /// headers are not included here. You should cast the return value of this + /// function to that type, e.g. + /// + /// `vkGetInstanceProcAddr = + /// (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();` + /// + /// ## Return value + /// Returns the function pointer for `vkGetInstanceProcAddr` or NULL on + /// failure; call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## Notes for `sdl3-sys` + /// As of `sdl3-sys` 0.6, the return type is correct for known targets, so you don't have + /// to cast it before use. It's compatible with the `ash` crate if you enable an integration + /// feature for that, but note that the type alias this function returns is an Option. + /// + pub fn SDL_Vulkan_GetVkGetInstanceProcAddr() -> VkGetInstanceProcAddr; +} + +/// (`sdl3-sys`) The definition of the `VkInstance` argument type can change based on enabled features. See [`VkInstance`]. +pub type VkGetInstanceProcAddr = + Option VkVoidFunction>; + +/// (`sdl3-sys`) Generic Vulkan void function. Cast to the appropriate type before use. +pub type VkVoidFunction = Option; + +unsafe extern "C" { + /// Unload the Vulkan library previously loaded by [`SDL_Vulkan_LoadLibrary()`]. + /// + /// SDL keeps a counter of how many times this function has been called, so it + /// is safe to call this function multiple times, so long as it is paired with + /// an equivalent number of calls to [`SDL_Vulkan_LoadLibrary`]. The library isn't + /// actually unloaded until there have been an equivalent number of calls to + /// [`SDL_Vulkan_UnloadLibrary`]. + /// + /// Once the library has actually been unloaded, if any Vulkan instances + /// remain, they will likely crash the program. Clean up any existing Vulkan + /// resources, and destroy appropriate windows, renderers and GPU devices + /// before calling this function. + /// + /// ## Thread safety + /// This function is not thread safe. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Vulkan_LoadLibrary`] + pub fn SDL_Vulkan_UnloadLibrary(); +} + +unsafe extern "C" { + /// Get the Vulkan instance extensions needed for vkCreateInstance. + /// + /// This should be called after either calling [`SDL_Vulkan_LoadLibrary()`] or + /// creating an [`SDL_Window`] with the [`SDL_WINDOW_VULKAN`] flag. + /// + /// On return, the variable pointed to by `count` will be set to the number of + /// elements returned, suitable for using with + /// VkInstanceCreateInfo::enabledExtensionCount, and the returned array can be + /// used with VkInstanceCreateInfo::ppEnabledExtensionNames, for calling + /// Vulkan's vkCreateInstance API. + /// + /// You should not free the returned array; it is owned by SDL. + /// + /// ## Parameters + /// - `count`: a pointer filled in with the number of extensions returned. + /// + /// ## Return value + /// Returns an array of extension name strings on success, NULL on failure; + /// call [`SDL_GetError()`] for more information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Vulkan_CreateSurface`] + pub fn SDL_Vulkan_GetInstanceExtensions( + count: *mut Uint32, + ) -> *const *const ::core::ffi::c_char; +} + +unsafe extern "C" { + /// Create a Vulkan rendering surface for a window. + /// + /// The `window` must have been created with the [`SDL_WINDOW_VULKAN`] flag and + /// `instance` must have been created with extensions returned by + /// [`SDL_Vulkan_GetInstanceExtensions()`] enabled. + /// + /// If `allocator` is NULL, Vulkan will use the system default allocator. This + /// argument is passed directly to Vulkan and isn't used by SDL itself. + /// + /// ## Parameters + /// - `window`: the window to which to attach the Vulkan surface. + /// - `instance`: the Vulkan instance handle. + /// - `allocator`: a VkAllocationCallbacks struct, which lets the app set the + /// allocator that creates the surface. Can be NULL. + /// - `surface`: a pointer to a VkSurfaceKHR handle to output the newly + /// created surface. + /// + /// ## Return value + /// Returns true on success or false on failure; call [`SDL_GetError()`] for more + /// information. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Vulkan_GetInstanceExtensions`] + /// - [`SDL_Vulkan_DestroySurface`] + pub fn SDL_Vulkan_CreateSurface( + window: *mut SDL_Window, + instance: VkInstance, + allocator: *const VkAllocationCallbacks, + surface: *mut VkSurfaceKHR, + ) -> ::core::primitive::bool; +} + +unsafe extern "C" { + /// Destroy the Vulkan rendering surface of a window. + /// + /// This should be called before [`SDL_DestroyWindow`], if [`SDL_Vulkan_CreateSurface`] + /// was called after [`SDL_CreateWindow`]. + /// + /// The `instance` must have been created with extensions returned by + /// [`SDL_Vulkan_GetInstanceExtensions()`] enabled and `surface` must have been + /// created successfully by an [`SDL_Vulkan_CreateSurface()`] call. + /// + /// If `allocator` is NULL, Vulkan will use the system default allocator. This + /// argument is passed directly to Vulkan and isn't used by SDL itself. + /// + /// ## Parameters + /// - `instance`: the Vulkan instance handle. + /// - `surface`: vkSurfaceKHR handle to destroy. + /// - `allocator`: a VkAllocationCallbacks struct, which lets the app set the + /// allocator that destroys the surface. Can be NULL. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Vulkan_GetInstanceExtensions`] + /// - [`SDL_Vulkan_CreateSurface`] + pub fn SDL_Vulkan_DestroySurface( + instance: VkInstance, + surface: VkSurfaceKHR, + allocator: *const VkAllocationCallbacks, + ); +} + +unsafe extern "C" { + /// Query support for presentation via a given physical device and queue + /// family. + /// + /// The `instance` must have been created with extensions returned by + /// [`SDL_Vulkan_GetInstanceExtensions()`] enabled. + /// + /// ## Parameters + /// - `instance`: the Vulkan instance handle. + /// - `physicalDevice`: a valid Vulkan physical device handle. + /// - `queueFamilyIndex`: a valid queue family index for the given physical + /// device. + /// + /// ## Return value + /// Returns true if supported, false if unsupported or an error occurred. + /// + /// ## Availability + /// This function is available since SDL 3.2.0. + /// + /// ## See also + /// - [`SDL_Vulkan_GetInstanceExtensions`] + pub fn SDL_Vulkan_GetPresentationSupport( + instance: VkInstance, + physicalDevice: VkPhysicalDevice, + queueFamilyIndex: Uint32, + ) -> ::core::primitive::bool; +} + +apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::AllocationCallbacks::<'static>` from the `ash` crate. Otherwise it's an opaque type.
The `'static` lifetime is too long. `ash` requires a lifetime for this, but as it's a C ffi type there's no way for `sdl3-sys` to set the correct lifetime.
+ pub type VkAllocationCallbacks = ::ash_v0_38::vk::AllocationCallbacks::<'static>; +}); + +apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => { + #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))] + /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::AllocationCallbacks::<'static>` from the `ash` crate. Otherwise it's an opaque type.
The `'static` lifetime is too long. `ash` requires a lifetime for this, but as it's a C ffi type there's no way for `sdl3-sys` to set the correct lifetime.
+ #[repr(C)] + pub struct VkAllocationCallbacks { _opaque: [::core::primitive::u8; 0] } +}); + +#[cfg(doc)] +use crate::everything::*; diff --git a/vendor/sdl3-sys/src/lib.rs b/vendor/sdl3-sys/src/lib.rs new file mode 100644 index 00000000..7622da5f --- /dev/null +++ b/vendor/sdl3-sys/src/lib.rs @@ -0,0 +1,120 @@ +#![no_std] +#![allow(non_camel_case_types)] +#![cfg_attr(feature = "nightly", feature(breakpoint))] // https://github.com/rust-lang/rust/issues/133724 +#![cfg_attr(feature = "nightly", feature(c_variadic))] // https://github.com/rust-lang/rust/issues/44930 +#![cfg_attr(all(feature = "nightly", doc), feature(doc_cfg))] // https://github.com/rust-lang/rust/issues/43781 +#![doc = include_str!("../README.md")] + +extern crate self as sdl3_sys; + +// This macro is used to apply a cfg attribute to multiple items +// e.g. `apply_cfg!(#[cfg(feature = "nightly")] => { type VaList = ::core::ffi::VaList; })` +macro_rules! apply_cfg { + (#[cfg $cfg:tt] => { $($item:item)* }) => { $( #[cfg $cfg] $item )* }; +} + +// Get the size of a field of a struct or union +macro_rules! size_of_field { + ($struct:ty, $field:ident) => { + $crate::size_of_return_value(&|s: $struct| unsafe { + // safety: this is never evaluated + #[allow(deprecated)] + s.$field + }) + }; +} + +pub(crate) use size_of_field; + +#[allow(unused)] // incorrectly detected as unused +const fn size_of_return_value(_: &impl FnOnce(T) -> R) -> usize { + size_of::() +} + +#[doc(hidden)] // for internal use only +#[macro_export] +macro_rules! __const_c_str { + ($cstr:ident = $str:expr) => { + const $cstr: [::core::ffi::c_char; $str.len() + 1] = { + const BYTES: &[::core::primitive::u8] = $str.as_bytes(); + let mut cstr = [0 as ::core::ffi::c_char; BYTES.len() + 1]; + let mut i = 0; + while i < BYTES.len() { + assert!(BYTES[i] != 0, "zero byte in string"); + cstr[i] = BYTES[i] as ::core::ffi::c_char; + i += 1; + } + cstr + }; + }; +} + +#[doc(hidden)] +#[repr(C)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +// This type intentionally doesn't derive Default. Use () for default-constructible non-exhaustives. +pub struct NonExhaustive(()); + +#[cfg(feature = "debug-impls")] +impl core::fmt::Debug for NonExhaustive { + #[inline(always)] + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { + Ok(()) + } +} + +const _: () = assert!(size_of::() == 0); + +mod generated; +pub use generated::*; + +/// You can set a breakpoint on this function to break into the debugger when asserts +/// want to trigger a breakpoint. +/// +/// If the `nightly` feature is enabled, this calls [`core::arch::breakpoint()`], +/// so you don't have to set a breakpoint manually in that case. +#[cold] +#[inline(never)] +pub fn breakpoint() { + #[cfg(feature = "nightly")] + core::arch::breakpoint(); + + #[cfg(not(feature = "nightly"))] + { + // raise a double panic to abort (this is no-std so we can't use std::process::abort) + struct Abort; + impl Drop for Abort { + fn drop(&mut self) { + panic!("breakpoint"); + } + } + let _abort = Abort; + panic!("breakpoint"); + } +} + +/// Extra ffi types for `sdl3-sys` +pub mod ffi { + #[cfg(doc)] + /// Equivalent to C's `wchar_t` type. This is `u16` on Windows and `u32` otherwise. + /// Enable a `use-libc-*` feature to make this an alias of `libc::wchar_t`. + pub type c_wchar_t = u32; + #[cfg(all(not(doc), feature = "use-libc-v0-2"))] + pub type c_wchar_t = ::libc_v0_2::wchar_t; + #[cfg(all(not(any(doc, feature = "use-libc-v0-2")), windows))] + pub type c_wchar_t = u16; + #[cfg(all(not(any(doc, feature = "use-libc-v0-2")), not(windows)))] + pub type c_wchar_t = u32; + + #[cfg(doc)] + /// Equivalent to C's `va_list` type. Enable the `nightly` feature and compile with + /// the nightly compiler to make this an alias of [`core::ffi::VaList`]. Otherwise, + /// this type can't be instantiated. + pub enum VaList {} + #[cfg(all(not(doc), feature = "nightly"))] + pub use core::ffi::VaList; + #[cfg(all(not(doc), not(feature = "nightly")))] + pub enum VaList {} +} + +pub mod metadata; diff --git a/vendor/sdl3-sys/src/metadata.rs b/vendor/sdl3-sys/src/metadata.rs new file mode 100644 index 00000000..d0ff4391 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata.rs @@ -0,0 +1,133 @@ +//! Metadata for SDL types and constants + +use core::ffi::{CStr, c_char, c_int}; + +pub use crate::properties::SDL_PropertyType as PropertyType; + +/// Metadata for hint constants +#[derive(Clone, Copy)] +pub struct Hint { + pub module: &'static str, + pub name: &'static str, + pub short_name: &'static str, + pub value: *const c_char, + pub doc: Option<&'static str>, + pub available_since: Option, +} + +unsafe impl Send for Hint {} +unsafe impl Sync for Hint {} + +impl Hint { + #[inline(always)] + pub const fn value_cstr(&self) -> &'static CStr { + unsafe { CStr::from_ptr(self.value) } + } + + #[inline(always)] + pub const fn value_str(&self) -> &'static str { + match self.value_cstr().to_str() { + Ok(str) => str, + Err(_) => unreachable!(), + } + } +} + +/// Metadata for property constants +#[derive(Clone, Copy)] +pub struct Property { + pub module: &'static str, + pub name: &'static str, + pub short_name: &'static str, + pub value: *const c_char, + pub ty: PropertyType, + pub doc: Option<&'static str>, + pub available_since: Option, +} + +unsafe impl Send for Property {} +unsafe impl Sync for Property {} + +impl Property { + #[inline(always)] + pub const fn value_cstr(&self) -> &'static CStr { + unsafe { CStr::from_ptr(self.value) } + } + + #[inline(always)] + pub const fn value_str(&self) -> &'static str { + match self.value_cstr().to_str() { + Ok(str) => str, + Err(_) => unreachable!(), + } + } +} + +/// Access metadata for typed groups of constants (c enums, flags, etc) +pub trait GroupMetadata: 'static + Sized { + /// Metadata for this group + const GROUP_METADATA: &'static Group; +} + +#[non_exhaustive] +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum GroupKind { + Enum, + Flags, + Id, + Lock, +} + +/// Metadata for typed groups of constants (c enums, flags, etc) +#[derive(Clone, Copy)] +pub struct Group { + pub kind: GroupKind, + pub module: &'static str, + pub name: &'static str, + pub short_name: &'static str, + pub doc: Option<&'static str>, + pub values: &'static [GroupValue], + pub available_since: Option, +} + +/// Metadata for a single value in a group of constants +#[derive(Clone, Copy)] +pub struct GroupValue { + pub name: &'static str, + pub short_name: &'static str, + pub doc: Option<&'static str>, + pub available_since: Option, +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum StructKind { + Struct, + Union, +} + +/// Metadata for structs and unions +#[derive(Clone, Copy)] +pub struct Struct { + pub kind: StructKind, + pub module: &'static str, + pub name: &'static str, + pub doc: Option<&'static str>, + pub available_since: Option, + pub fields: &'static [Field], +} + +/// Metadata for fields of structs and unions +#[derive(Clone, Copy)] +pub struct Field { + pub name: &'static str, + pub doc: Option<&'static str>, + pub available_since: Option, + pub ty: &'static str, +} + +#[cfg(feature = "metadata")] +mod generated; + +#[cfg(feature = "metadata")] +#[allow(unused_imports)] // false positive +pub use generated::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/assert.rs b/vendor/sdl3-sys/src/metadata/generated/assert.rs new file mode 100644 index 00000000..e7de4f62 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/assert.rs @@ -0,0 +1,99 @@ +//! Metadata for items in the `crate::assert` module + +use super::*; + +pub const METADATA_SDL_AssertState: Group = Group { + module: "assert", + kind: GroupKind::Enum, + name: "SDL_AssertState", + short_name: "AssertState", + doc: Some( + "Possible outcomes from a triggered assertion.\n\nWhen an enabled assertion triggers, it may call the assertion handler\n(possibly one provided by the app via [`SDL_SetAssertionHandler`]), which will\nreturn one of these values, possibly after asking the user.\n\nThen SDL will respond based on this outcome (loop around to retry the\ncondition, try to break in a debugger, kill the program, or ignore the\nproblem).\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ASSERTION_RETRY", + short_name: "RETRY", + doc: Some("Retry the assert immediately.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASSERTION_BREAK", + short_name: "BREAK", + doc: Some("Make the debugger trigger a breakpoint.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASSERTION_ABORT", + short_name: "ABORT", + doc: Some("Terminate the program.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASSERTION_IGNORE", + short_name: "IGNORE", + doc: Some("Ignore the assert.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASSERTION_ALWAYS_IGNORE", + short_name: "ALWAYS_IGNORE", + doc: Some("Ignore the assert from now on.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_AssertData: Struct = Struct { + module: "assert", + kind: StructKind::Struct, + name: "SDL_AssertData", + doc: Some( + "Information about an assertion failure.\n\nThis structure is filled in with information about a triggered assertion,\nused by the assertion handler, then added to the assertion report. This is\nreturned as a linked list from [`SDL_GetAssertionReport()`].\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "always_ignore", + doc: Some("true if app should always continue when assertion is triggered.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "trigger_count", + doc: Some("Number of times this assertion has been triggered.\n"), + available_since: None, + ty: "::core::ffi::c_uint", + }, + Field { + name: "condition", + doc: Some("A string of this assert's test code.\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "filename", + doc: Some("The source file where this assert lives.\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "linenum", + doc: Some("The line in `filename` where this assert lives.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "function", + doc: Some("The name of the function where this assert lives.\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "next", + doc: Some("next item in the linked list.\n"), + available_since: None, + ty: "*const SDL_AssertData", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/asyncio.rs b/vendor/sdl3-sys/src/metadata/generated/asyncio.rs new file mode 100644 index 00000000..cac44caa --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/asyncio.rs @@ -0,0 +1,123 @@ +//! Metadata for items in the `crate::asyncio` module + +use super::*; + +pub const METADATA_SDL_AsyncIOTaskType: Group = Group { + module: "asyncio", + kind: GroupKind::Enum, + name: "SDL_AsyncIOTaskType", + short_name: "AsyncIOTaskType", + doc: Some( + "Types of asynchronous I/O tasks.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ASYNCIO_TASK_READ", + short_name: "READ", + doc: Some("A read operation.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASYNCIO_TASK_WRITE", + short_name: "WRITE", + doc: Some("A write operation.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASYNCIO_TASK_CLOSE", + short_name: "CLOSE", + doc: Some("A close operation.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_AsyncIOResult: Group = Group { + module: "asyncio", + kind: GroupKind::Enum, + name: "SDL_AsyncIOResult", + short_name: "AsyncIOResult", + doc: Some( + "Possible outcomes of an asynchronous I/O task.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ASYNCIO_COMPLETE", + short_name: "COMPLETE", + doc: Some("request was completed without error\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASYNCIO_FAILURE", + short_name: "FAILURE", + doc: Some("request failed for some reason; check [`SDL_GetError()`]!\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ASYNCIO_CANCELED", + short_name: "CANCELED", + doc: Some("request was canceled before completing.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_AsyncIOOutcome: Struct = Struct { + module: "asyncio", + kind: StructKind::Struct, + name: "SDL_AsyncIOOutcome", + doc: Some( + "Information about a completed asynchronous I/O request.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "asyncio", + doc: Some("what generated this task. This pointer will be invalid if it was closed!\n"), + available_since: None, + ty: "*mut SDL_AsyncIO", + }, + Field { + name: "r#type", + doc: Some("What sort of task was this? Read, write, etc?\n"), + available_since: None, + ty: "SDL_AsyncIOTaskType", + }, + Field { + name: "result", + doc: Some("the result of the work (success, failure, cancellation).\n"), + available_since: None, + ty: "SDL_AsyncIOResult", + }, + Field { + name: "buffer", + doc: Some("buffer where data was read/written.\n"), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + Field { + name: "offset", + doc: Some("offset in the [`SDL_AsyncIO`] where data was read/written.\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "bytes_requested", + doc: Some("number of bytes the task was to read/write.\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "bytes_transferred", + doc: Some("actual number of bytes that were read/written.\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "userdata", + doc: Some("pointer provided by the app when starting the task\n"), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/atomic.rs b/vendor/sdl3-sys/src/metadata/generated/atomic.rs new file mode 100644 index 00000000..9b28f979 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/atomic.rs @@ -0,0 +1,45 @@ +//! Metadata for items in the `crate::atomic` module + +use super::*; + +pub const METADATA_SDL_SpinLock: Group = Group { + module: "atomic", + kind: GroupKind::Lock, + name: "SDL_SpinLock", + short_name: "SpinLock", + doc: Some( + "An atomic spinlock.\n\nThe atomic locks are efficient spinlocks using CPU instructions, but are\nvulnerable to starvation and can spin forever if a thread holding a lock\nhas been terminated. For this reason you should minimize the code executed\ninside an atomic lock and never do expensive things like API or system\ncalls while holding them.\n\nThey are also vulnerable to starvation if the thread holding the lock is\nlower priority than other threads and doesn't get scheduled. In general you\nshould use mutexes instead, since they have better performance and\ncontention behavior.\n\nThe atomic locks are not safe to lock recursively.\n\nPorting Note: The spin lock functions and type are required and can not be\nemulated because they are used in the atomic emulation code.\n", + ), + available_since: None, + values: &[], +}; +pub const METADATA_SDL_AtomicInt: Struct = Struct { + module: "atomic", + kind: StructKind::Struct, + name: "SDL_AtomicInt", + doc: Some( + "A type representing an atomic integer value.\n\nThis can be used to manage a value that is synchronized across multiple\nCPUs without a race condition; when an app sets a value with\n[`SDL_SetAtomicInt`] all other threads, regardless of the CPU it is running on,\nwill see that value when retrieved with [`SDL_GetAtomicInt`], regardless of CPU\ncaches, etc.\n\nThis is also useful for atomic compare-and-swap operations: a thread can\nchange the value as long as its current value matches expectations. When\ndone in a loop, one can guarantee data consistency across threads without a\nlock (but the usual warnings apply: if you don't know what you're doing, or\nyou don't do it carefully, you can confidently cause any number of\ndisasters with this, so in most cases, you _should_ use a mutex instead of\nthis!).\n\nThis is a struct so people don't accidentally use numeric operations on it\ndirectly. You have to use SDL atomic functions.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CompareAndSwapAtomicInt`]\n- [`SDL_GetAtomicInt`]\n- [`SDL_SetAtomicInt`]\n- [`SDL_AddAtomicInt`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[Field { + name: "value", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }], +}; +pub const METADATA_SDL_AtomicU32: Struct = Struct { + module: "atomic", + kind: StructKind::Struct, + name: "SDL_AtomicU32", + doc: Some( + "A type representing an atomic unsigned 32-bit value.\n\nThis can be used to manage a value that is synchronized across multiple\nCPUs without a race condition; when an app sets a value with\n[`SDL_SetAtomicU32`] all other threads, regardless of the CPU it is running on,\nwill see that value when retrieved with [`SDL_GetAtomicU32`], regardless of CPU\ncaches, etc.\n\nThis is also useful for atomic compare-and-swap operations: a thread can\nchange the value as long as its current value matches expectations. When\ndone in a loop, one can guarantee data consistency across threads without a\nlock (but the usual warnings apply: if you don't know what you're doing, or\nyou don't do it carefully, you can confidently cause any number of\ndisasters with this, so in most cases, you _should_ use a mutex instead of\nthis!).\n\nThis is a struct so people don't accidentally use numeric operations on it\ndirectly. You have to use SDL atomic functions.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CompareAndSwapAtomicU32`]\n- [`SDL_GetAtomicU32`]\n- [`SDL_SetAtomicU32`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[Field { + name: "value", + doc: None, + available_since: None, + ty: "Uint32", + }], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/audio.rs b/vendor/sdl3-sys/src/metadata/generated/audio.rs new file mode 100644 index 00000000..5d5cb79b --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/audio.rs @@ -0,0 +1,172 @@ +//! Metadata for items in the `crate::audio` module + +use super::*; + +pub const METADATA_SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN: Property = Property { + module: "audio", + name: "SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN", + short_name: "AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN", + value: crate::audio::SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_AudioFormat: Group = Group { + module: "audio", + kind: GroupKind::Enum, + name: "SDL_AudioFormat", + short_name: "AudioFormat", + doc: Some( + "Audio format.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_AUDIO_BITSIZE`]\n- [`SDL_AUDIO_BYTESIZE`]\n- [`SDL_AUDIO_ISINT`]\n- [`SDL_AUDIO_ISFLOAT`]\n- [`SDL_AUDIO_ISBIGENDIAN`]\n- [`SDL_AUDIO_ISLITTLEENDIAN`]\n- [`SDL_AUDIO_ISSIGNED`]\n- [`SDL_AUDIO_ISUNSIGNED`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_AUDIO_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("Unspecified audio format\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_U8", + short_name: "U8", + doc: Some("Unsigned 8-bit samples\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S8", + short_name: "S8", + doc: Some("Signed 8-bit samples\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S16LE", + short_name: "S16LE", + doc: Some("Signed 16-bit samples\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S16BE", + short_name: "S16BE", + doc: Some("As above, but big-endian byte order\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S32LE", + short_name: "S32LE", + doc: Some("32-bit integer samples\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S32BE", + short_name: "S32BE", + doc: Some("As above, but big-endian byte order\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_F32LE", + short_name: "F32LE", + doc: Some("32-bit floating point samples\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_F32BE", + short_name: "F32BE", + doc: Some("As above, but big-endian byte order\n"), + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S16", + short_name: "S16", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S32", + short_name: "S32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_F32", + short_name: "F32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S16", + short_name: "S16", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_S32", + short_name: "S32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_AUDIO_F32", + short_name: "F32", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_AudioDeviceID: Group = Group { + module: "audio", + kind: GroupKind::Id, + name: "SDL_AudioDeviceID", + short_name: "AudioDeviceID", + doc: Some( + "SDL Audio Device instance IDs.\n\nZero is used to signify an invalid/null device.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK", + short_name: "DEFAULT_PLAYBACK", + doc: Some( + "A value used to request a default playback audio device.\n\nSeveral functions that require an [`SDL_AudioDeviceID`] will accept this value\nto signify the app just wants the system to choose a default device instead\nof the app providing a specific one.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_AUDIO_DEVICE_DEFAULT_RECORDING", + short_name: "DEFAULT_RECORDING", + doc: Some( + "A value used to request a default recording audio device.\n\nSeveral functions that require an [`SDL_AudioDeviceID`] will accept this value\nto signify the app just wants the system to choose a default device instead\nof the app providing a specific one.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + ], +}; +pub const METADATA_SDL_AudioSpec: Struct = Struct { + module: "audio", + kind: StructKind::Struct, + name: "SDL_AudioSpec", + doc: Some( + "Format specifier for audio data.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_AudioFormat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "format", + doc: Some("Audio data format\n"), + available_since: None, + ty: "SDL_AudioFormat", + }, + Field { + name: "channels", + doc: Some("Number of channels: 1 mono, 2 stereo, etc\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "freq", + doc: Some("sample rate: sample frames per second\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/bits.rs b/vendor/sdl3-sys/src/metadata/generated/bits.rs new file mode 100644 index 00000000..dd4e72d5 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/bits.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::bits` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/blendmode.rs b/vendor/sdl3-sys/src/metadata/generated/blendmode.rs new file mode 100644 index 00000000..296438d5 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/blendmode.rs @@ -0,0 +1,182 @@ +//! Metadata for items in the `crate::blendmode` module + +use super::*; + +pub const METADATA_SDL_BlendMode: Group = Group { + module: "blendmode", + kind: GroupKind::Flags, + name: "SDL_BlendMode", + short_name: "BlendMode", + doc: Some( + "A set of blend modes used in drawing operations.\n\nThese predefined blend modes are supported everywhere.\n\nAdditional values may be obtained from [`SDL_ComposeCustomBlendMode`].\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_ComposeCustomBlendMode`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_BLENDMODE_NONE", + short_name: "NONE", + doc: Some("no blending: dstRGBA = srcRGBA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_BLEND", + short_name: "BLEND", + doc: Some( + "alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA))\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_BLEND_PREMULTIPLIED", + short_name: "BLEND_PREMULTIPLIED", + doc: Some("pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA))\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_ADD", + short_name: "ADD", + doc: Some("additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_ADD_PREMULTIPLIED", + short_name: "ADD_PREMULTIPLIED", + doc: Some("pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_MOD", + short_name: "MOD", + doc: Some("color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_MUL", + short_name: "MUL", + doc: Some( + "color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDMODE_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_BlendOperation: Group = Group { + module: "blendmode", + kind: GroupKind::Enum, + name: "SDL_BlendOperation", + short_name: "BlendOperation", + doc: Some( + "The blend operation used when combining source and destination pixel\ncomponents.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_BLENDOPERATION_ADD", + short_name: "ADD", + doc: Some("dst + src: supported by all renderers\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDOPERATION_SUBTRACT", + short_name: "SUBTRACT", + doc: Some("src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDOPERATION_REV_SUBTRACT", + short_name: "REV_SUBTRACT", + doc: Some("dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDOPERATION_MINIMUM", + short_name: "MINIMUM", + doc: Some("min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDOPERATION_MAXIMUM", + short_name: "MAXIMUM", + doc: Some("max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_BlendFactor: Group = Group { + module: "blendmode", + kind: GroupKind::Enum, + name: "SDL_BlendFactor", + short_name: "BlendFactor", + doc: Some( + "The normalized factor used to multiply pixel components.\n\nThe blend factors are multiplied with the pixels from a drawing operation\n(src) and the pixels from the render target (dst) before the blend\noperation. The comma-separated factors listed above are always applied in\nthe component order red, green, blue, and alpha.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_BLENDFACTOR_ZERO", + short_name: "ZERO", + doc: Some("0, 0, 0, 0\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_ONE", + short_name: "ONE", + doc: Some("1, 1, 1, 1\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_SRC_COLOR", + short_name: "SRC_COLOR", + doc: Some("srcR, srcG, srcB, srcA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR", + short_name: "ONE_MINUS_SRC_COLOR", + doc: Some("1-srcR, 1-srcG, 1-srcB, 1-srcA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_SRC_ALPHA", + short_name: "SRC_ALPHA", + doc: Some("srcA, srcA, srcA, srcA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA", + short_name: "ONE_MINUS_SRC_ALPHA", + doc: Some("1-srcA, 1-srcA, 1-srcA, 1-srcA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_DST_COLOR", + short_name: "DST_COLOR", + doc: Some("dstR, dstG, dstB, dstA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR", + short_name: "ONE_MINUS_DST_COLOR", + doc: Some("1-dstR, 1-dstG, 1-dstB, 1-dstA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_DST_ALPHA", + short_name: "DST_ALPHA", + doc: Some("dstA, dstA, dstA, dstA\n"), + available_since: None, + }, + GroupValue { + name: "SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA", + short_name: "ONE_MINUS_DST_ALPHA", + doc: Some("1-dstA, 1-dstA, 1-dstA, 1-dstA\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/camera.rs b/vendor/sdl3-sys/src/metadata/generated/camera.rs new file mode 100644 index 00000000..ab30af7b --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/camera.rs @@ -0,0 +1,126 @@ +//! Metadata for items in the `crate::camera` module + +use super::*; + +pub const METADATA_SDL_CameraID: Group = Group { + module: "camera", + kind: GroupKind::Id, + name: "SDL_CameraID", + short_name: "CameraID", + doc: Some( + "This is a unique ID for a camera device for the time it is connected to the\nsystem, and is never reused for the lifetime of the application.\n\nIf the device is disconnected and reconnected, it will get a new ID.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetCameras`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_CameraPosition: Group = Group { + module: "camera", + kind: GroupKind::Enum, + name: "SDL_CameraPosition", + short_name: "CameraPosition", + doc: Some( + "The position of camera in relation to system device.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetCameraPosition`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_CAMERA_POSITION_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_CAMERA_POSITION_FRONT_FACING", + short_name: "FRONT_FACING", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_CAMERA_POSITION_BACK_FACING", + short_name: "BACK_FACING", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_CameraPermissionState: Group = Group { + module: "camera", + kind: GroupKind::Enum, + name: "SDL_CameraPermissionState", + short_name: "CameraPermissionState", + doc: Some( + "The current state of a request for camera access.\n\n## Availability\nThis enum is available since SDL 3.4.0.\n\n## See also\n- [`SDL_GetCameraPermissionState`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), + values: &[ + GroupValue { + name: "SDL_CAMERA_PERMISSION_STATE_DENIED", + short_name: "DENIED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_CAMERA_PERMISSION_STATE_PENDING", + short_name: "PENDING", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_CAMERA_PERMISSION_STATE_APPROVED", + short_name: "APPROVED", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_CameraSpec: Struct = Struct { + module: "camera", + kind: StructKind::Struct, + name: "SDL_CameraSpec", + doc: Some( + "The details of an output format for a camera device.\n\nCameras often support multiple formats; each one will be encapsulated in\nthis struct.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetCameraSupportedFormats`]\n- [`SDL_GetCameraFormat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "format", + doc: Some("Frame format\n"), + available_since: None, + ty: "SDL_PixelFormat", + }, + Field { + name: "colorspace", + doc: Some("Frame colorspace\n"), + available_since: None, + ty: "SDL_Colorspace", + }, + Field { + name: "width", + doc: Some("Frame width\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "height", + doc: Some("Frame height\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "framerate_numerator", + doc: Some( + "Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds)\n", + ), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "framerate_denominator", + doc: Some( + "Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds)\n", + ), + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/clipboard.rs b/vendor/sdl3-sys/src/metadata/generated/clipboard.rs new file mode 100644 index 00000000..ca596cd4 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/clipboard.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::clipboard` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/cpuinfo.rs b/vendor/sdl3-sys/src/metadata/generated/cpuinfo.rs new file mode 100644 index 00000000..a25bf57f --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/cpuinfo.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::cpuinfo` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/dialog.rs b/vendor/sdl3-sys/src/metadata/generated/dialog.rs new file mode 100644 index 00000000..524dea5b --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/dialog.rs @@ -0,0 +1,129 @@ +//! Metadata for items in the `crate::dialog` module + +use super::*; + +pub const METADATA_SDL_PROP_FILE_DIALOG_FILTERS_POINTER: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_FILTERS_POINTER", + short_name: "FILE_DIALOG_FILTERS_POINTER", + value: crate::dialog::SDL_PROP_FILE_DIALOG_FILTERS_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER", + short_name: "FILE_DIALOG_NFILTERS_NUMBER", + value: crate::dialog::SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_WINDOW_POINTER: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_WINDOW_POINTER", + short_name: "FILE_DIALOG_WINDOW_POINTER", + value: crate::dialog::SDL_PROP_FILE_DIALOG_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_LOCATION_STRING: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_LOCATION_STRING", + short_name: "FILE_DIALOG_LOCATION_STRING", + value: crate::dialog::SDL_PROP_FILE_DIALOG_LOCATION_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_MANY_BOOLEAN: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_MANY_BOOLEAN", + short_name: "FILE_DIALOG_MANY_BOOLEAN", + value: crate::dialog::SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_TITLE_STRING: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_TITLE_STRING", + short_name: "FILE_DIALOG_TITLE_STRING", + value: crate::dialog::SDL_PROP_FILE_DIALOG_TITLE_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_ACCEPT_STRING: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_ACCEPT_STRING", + short_name: "FILE_DIALOG_ACCEPT_STRING", + value: crate::dialog::SDL_PROP_FILE_DIALOG_ACCEPT_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_FILE_DIALOG_CANCEL_STRING: Property = Property { + module: "dialog", + name: "SDL_PROP_FILE_DIALOG_CANCEL_STRING", + short_name: "FILE_DIALOG_CANCEL_STRING", + value: crate::dialog::SDL_PROP_FILE_DIALOG_CANCEL_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_FileDialogType: Group = Group { + module: "dialog", + kind: GroupKind::Enum, + name: "SDL_FileDialogType", + short_name: "FileDialogType", + doc: Some( + "Various types of file dialogs.\n\nThis is used by [`SDL_ShowFileDialogWithProperties()`] to decide what kind of\ndialog to present to the user.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_ShowFileDialogWithProperties`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_FILEDIALOG_OPENFILE", + short_name: "OPENFILE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_FILEDIALOG_SAVEFILE", + short_name: "SAVEFILE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_FILEDIALOG_OPENFOLDER", + short_name: "OPENFOLDER", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_DialogFileFilter: Struct = Struct { + module: "dialog", + kind: StructKind::Struct, + name: "SDL_DialogFileFilter", + doc: Some( + "An entry for filters for file dialogs.\n\n`name` is a user-readable label for the filter (for example, \"Office\ndocument\").\n\n`pattern` is a semicolon-separated list of file extensions (for example,\n\"doc;docx\"). File extensions may only contain alphanumeric characters,\nhyphens, underscores and periods. Alternatively, the whole string can be a\nsingle asterisk (\"*\"), which serves as an \"All files\" filter.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_DialogFileCallback`]\n- [`SDL_ShowOpenFileDialog`]\n- [`SDL_ShowSaveFileDialog`]\n- [`SDL_ShowOpenFolderDialog`]\n- [`SDL_ShowFileDialogWithProperties`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "name", + doc: None, + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "pattern", + doc: None, + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/error.rs b/vendor/sdl3-sys/src/metadata/generated/error.rs new file mode 100644 index 00000000..0d1e2c33 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/error.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::error` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/events.rs b/vendor/sdl3-sys/src/metadata/generated/events.rs new file mode 100644 index 00000000..e23fc0f4 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/events.rs @@ -0,0 +1,3211 @@ +//! Metadata for items in the `crate::events` module + +use super::*; + +pub const METADATA_SDL_EventType: Group = Group { + module: "events", + kind: GroupKind::Enum, + name: "SDL_EventType", + short_name: "EventType", + doc: Some( + "The types of events that can be delivered.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_EVENT_FIRST", + short_name: "FIRST", + doc: Some("Unused (do not remove)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_QUIT", + short_name: "QUIT", + doc: Some("User-requested quit\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_TERMINATING", + short_name: "TERMINATING", + doc: Some( + "The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`].\nCalled on iOS in applicationWillTerminate()\nCalled on Android in onDestroy()\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_LOW_MEMORY", + short_name: "LOW_MEMORY", + doc: Some( + "The application is low on memory, free memory if possible. This event must be handled in a callback set with [`SDL_AddEventWatch()`].\nCalled on iOS in applicationDidReceiveMemoryWarning()\nCalled on Android in onTrimMemory()\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WILL_ENTER_BACKGROUND", + short_name: "WILL_ENTER_BACKGROUND", + doc: Some( + "The application is about to enter the background. This event must be handled in a callback set with [`SDL_AddEventWatch()`].\nCalled on iOS in applicationWillResignActive()\nCalled on Android in onPause()\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DID_ENTER_BACKGROUND", + short_name: "DID_ENTER_BACKGROUND", + doc: Some( + "The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with [`SDL_AddEventWatch()`].\nCalled on iOS in applicationDidEnterBackground()\nCalled on Android in onPause()\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WILL_ENTER_FOREGROUND", + short_name: "WILL_ENTER_FOREGROUND", + doc: Some( + "The application is about to enter the foreground. This event must be handled in a callback set with [`SDL_AddEventWatch()`].\nCalled on iOS in applicationWillEnterForeground()\nCalled on Android in onResume()\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DID_ENTER_FOREGROUND", + short_name: "DID_ENTER_FOREGROUND", + doc: Some( + "The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`].\nCalled on iOS in applicationDidBecomeActive()\nCalled on Android in onResume()\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_LOCALE_CHANGED", + short_name: "LOCALE_CHANGED", + doc: Some("The user's locale preferences have changed.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_SYSTEM_THEME_CHANGED", + short_name: "SYSTEM_THEME_CHANGED", + doc: Some("The system theme changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_ORIENTATION", + short_name: "DISPLAY_ORIENTATION", + doc: Some("Display orientation has changed to data1\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_ADDED", + short_name: "DISPLAY_ADDED", + doc: Some("Display has been added to the system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_REMOVED", + short_name: "DISPLAY_REMOVED", + doc: Some("Display has been removed from the system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_MOVED", + short_name: "DISPLAY_MOVED", + doc: Some("Display has changed position\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED", + short_name: "DISPLAY_DESKTOP_MODE_CHANGED", + doc: Some("Display has changed desktop mode\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED", + short_name: "DISPLAY_CURRENT_MODE_CHANGED", + doc: Some("Display has changed current mode\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED", + short_name: "DISPLAY_CONTENT_SCALE_CHANGED", + doc: Some("Display has changed content scale\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED", + short_name: "DISPLAY_USABLE_BOUNDS_CHANGED", + doc: Some("Display has changed usable bounds\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_FIRST", + short_name: "DISPLAY_FIRST", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DISPLAY_LAST", + short_name: "DISPLAY_LAST", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_SHOWN", + short_name: "WINDOW_SHOWN", + doc: Some("Window has been shown\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_HIDDEN", + short_name: "WINDOW_HIDDEN", + doc: Some("Window has been hidden\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_EXPOSED", + short_name: "WINDOW_EXPOSED", + doc: Some( + "Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.\ndata1 is 1 for live-resize expose events, 0 otherwise.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_MOVED", + short_name: "WINDOW_MOVED", + doc: Some("Window has been moved to data1, data2\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_RESIZED", + short_name: "WINDOW_RESIZED", + doc: Some("Window has been resized to data1xdata2\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED", + short_name: "WINDOW_PIXEL_SIZE_CHANGED", + doc: Some("The pixel size of the window has changed to data1xdata2\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_METAL_VIEW_RESIZED", + short_name: "WINDOW_METAL_VIEW_RESIZED", + doc: Some("The pixel size of a Metal view associated with the window has changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_MINIMIZED", + short_name: "WINDOW_MINIMIZED", + doc: Some("Window has been minimized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_MAXIMIZED", + short_name: "WINDOW_MAXIMIZED", + doc: Some("Window has been maximized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_RESTORED", + short_name: "WINDOW_RESTORED", + doc: Some("Window has been restored to normal size and position\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_MOUSE_ENTER", + short_name: "WINDOW_MOUSE_ENTER", + doc: Some("Window has gained mouse focus\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_MOUSE_LEAVE", + short_name: "WINDOW_MOUSE_LEAVE", + doc: Some("Window has lost mouse focus\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_FOCUS_GAINED", + short_name: "WINDOW_FOCUS_GAINED", + doc: Some("Window has gained keyboard focus\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_FOCUS_LOST", + short_name: "WINDOW_FOCUS_LOST", + doc: Some("Window has lost keyboard focus\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_CLOSE_REQUESTED", + short_name: "WINDOW_CLOSE_REQUESTED", + doc: Some("The window manager requests that the window be closed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_HIT_TEST", + short_name: "WINDOW_HIT_TEST", + doc: Some("Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_ICCPROF_CHANGED", + short_name: "WINDOW_ICCPROF_CHANGED", + doc: Some("The ICC profile of the window's display has changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_DISPLAY_CHANGED", + short_name: "WINDOW_DISPLAY_CHANGED", + doc: Some("Window has been moved to display data1\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED", + short_name: "WINDOW_DISPLAY_SCALE_CHANGED", + doc: Some("Window display scale has been changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_SAFE_AREA_CHANGED", + short_name: "WINDOW_SAFE_AREA_CHANGED", + doc: Some("The window safe area has been changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_OCCLUDED", + short_name: "WINDOW_OCCLUDED", + doc: Some("The window has been occluded\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_ENTER_FULLSCREEN", + short_name: "WINDOW_ENTER_FULLSCREEN", + doc: Some("The window has entered fullscreen mode\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_LEAVE_FULLSCREEN", + short_name: "WINDOW_LEAVE_FULLSCREEN", + doc: Some("The window has left fullscreen mode\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_DESTROYED", + short_name: "WINDOW_DESTROYED", + doc: Some( + "The window with the associated ID is being or has been destroyed. If this message is being handled\nin an event watcher, the window handle is still valid and can still be used to retrieve any properties\nassociated with the window. Otherwise, the handle has already been destroyed and all resources\nassociated with it are invalid\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_HDR_STATE_CHANGED", + short_name: "WINDOW_HDR_STATE_CHANGED", + doc: Some("Window HDR properties have changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_FIRST", + short_name: "WINDOW_FIRST", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_WINDOW_LAST", + short_name: "WINDOW_LAST", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_KEY_DOWN", + short_name: "KEY_DOWN", + doc: Some("Key pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_KEY_UP", + short_name: "KEY_UP", + doc: Some("Key released\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_TEXT_EDITING", + short_name: "TEXT_EDITING", + doc: Some("Keyboard text editing (composition)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_TEXT_INPUT", + short_name: "TEXT_INPUT", + doc: Some("Keyboard text input\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_KEYMAP_CHANGED", + short_name: "KEYMAP_CHANGED", + doc: Some( + "Keymap changed due to a system event such as an\ninput language or keyboard layout change.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_KEYBOARD_ADDED", + short_name: "KEYBOARD_ADDED", + doc: Some("A new keyboard has been inserted into the system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_KEYBOARD_REMOVED", + short_name: "KEYBOARD_REMOVED", + doc: Some("A keyboard has been removed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_TEXT_EDITING_CANDIDATES", + short_name: "TEXT_EDITING_CANDIDATES", + doc: Some("Keyboard text editing candidates\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_SCREEN_KEYBOARD_SHOWN", + short_name: "SCREEN_KEYBOARD_SHOWN", + doc: Some("The on-screen keyboard has been shown\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_SCREEN_KEYBOARD_HIDDEN", + short_name: "SCREEN_KEYBOARD_HIDDEN", + doc: Some("The on-screen keyboard has been hidden\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_MOUSE_MOTION", + short_name: "MOUSE_MOTION", + doc: Some("Mouse moved\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_MOUSE_BUTTON_DOWN", + short_name: "MOUSE_BUTTON_DOWN", + doc: Some("Mouse button pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_MOUSE_BUTTON_UP", + short_name: "MOUSE_BUTTON_UP", + doc: Some("Mouse button released\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_MOUSE_WHEEL", + short_name: "MOUSE_WHEEL", + doc: Some("Mouse wheel motion\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_MOUSE_ADDED", + short_name: "MOUSE_ADDED", + doc: Some("A new mouse has been inserted into the system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_MOUSE_REMOVED", + short_name: "MOUSE_REMOVED", + doc: Some("A mouse has been removed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_AXIS_MOTION", + short_name: "JOYSTICK_AXIS_MOTION", + doc: Some("Joystick axis motion\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_BALL_MOTION", + short_name: "JOYSTICK_BALL_MOTION", + doc: Some("Joystick trackball motion\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_HAT_MOTION", + short_name: "JOYSTICK_HAT_MOTION", + doc: Some("Joystick hat position change\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_BUTTON_DOWN", + short_name: "JOYSTICK_BUTTON_DOWN", + doc: Some("Joystick button pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_BUTTON_UP", + short_name: "JOYSTICK_BUTTON_UP", + doc: Some("Joystick button released\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_ADDED", + short_name: "JOYSTICK_ADDED", + doc: Some("A new joystick has been inserted into the system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_REMOVED", + short_name: "JOYSTICK_REMOVED", + doc: Some("An opened joystick has been removed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_BATTERY_UPDATED", + short_name: "JOYSTICK_BATTERY_UPDATED", + doc: Some("Joystick battery level change\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_JOYSTICK_UPDATE_COMPLETE", + short_name: "JOYSTICK_UPDATE_COMPLETE", + doc: Some("Joystick update is complete\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_AXIS_MOTION", + short_name: "GAMEPAD_AXIS_MOTION", + doc: Some("Gamepad axis motion\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_BUTTON_DOWN", + short_name: "GAMEPAD_BUTTON_DOWN", + doc: Some("Gamepad button pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_BUTTON_UP", + short_name: "GAMEPAD_BUTTON_UP", + doc: Some("Gamepad button released\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_ADDED", + short_name: "GAMEPAD_ADDED", + doc: Some("A new gamepad has been inserted into the system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_REMOVED", + short_name: "GAMEPAD_REMOVED", + doc: Some("A gamepad has been removed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_REMAPPED", + short_name: "GAMEPAD_REMAPPED", + doc: Some("The gamepad mapping was updated\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN", + short_name: "GAMEPAD_TOUCHPAD_DOWN", + doc: Some("Gamepad touchpad was touched\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION", + short_name: "GAMEPAD_TOUCHPAD_MOTION", + doc: Some("Gamepad touchpad finger was moved\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_TOUCHPAD_UP", + short_name: "GAMEPAD_TOUCHPAD_UP", + doc: Some("Gamepad touchpad finger was lifted\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_SENSOR_UPDATE", + short_name: "GAMEPAD_SENSOR_UPDATE", + doc: Some("Gamepad sensor was updated\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_UPDATE_COMPLETE", + short_name: "GAMEPAD_UPDATE_COMPLETE", + doc: Some("Gamepad update is complete\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED", + short_name: "GAMEPAD_STEAM_HANDLE_UPDATED", + doc: Some("Gamepad Steam handle has changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_FINGER_DOWN", + short_name: "FINGER_DOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_FINGER_UP", + short_name: "FINGER_UP", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_FINGER_MOTION", + short_name: "FINGER_MOTION", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_FINGER_CANCELED", + short_name: "FINGER_CANCELED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PINCH_BEGIN", + short_name: "PINCH_BEGIN", + doc: Some("Pinch gesture started\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PINCH_UPDATE", + short_name: "PINCH_UPDATE", + doc: Some("Pinch gesture updated\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PINCH_END", + short_name: "PINCH_END", + doc: Some("Pinch gesture ended\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_CLIPBOARD_UPDATE", + short_name: "CLIPBOARD_UPDATE", + doc: Some("The clipboard changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DROP_FILE", + short_name: "DROP_FILE", + doc: Some("The system requests a file open\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DROP_TEXT", + short_name: "DROP_TEXT", + doc: Some("text/plain drag-and-drop event\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DROP_BEGIN", + short_name: "DROP_BEGIN", + doc: Some("A new set of drops is beginning (NULL filename)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DROP_COMPLETE", + short_name: "DROP_COMPLETE", + doc: Some("Current set of drops is now complete (NULL filename)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_DROP_POSITION", + short_name: "DROP_POSITION", + doc: Some("Position while moving over the window\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_AUDIO_DEVICE_ADDED", + short_name: "AUDIO_DEVICE_ADDED", + doc: Some("A new audio device is available\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_AUDIO_DEVICE_REMOVED", + short_name: "AUDIO_DEVICE_REMOVED", + doc: Some("An audio device has been removed.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED", + short_name: "AUDIO_DEVICE_FORMAT_CHANGED", + doc: Some("An audio device's format has been changed by the system.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_SENSOR_UPDATE", + short_name: "SENSOR_UPDATE", + doc: Some("A sensor was updated\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_PROXIMITY_IN", + short_name: "PEN_PROXIMITY_IN", + doc: Some("Pressure-sensitive pen has become available\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_PROXIMITY_OUT", + short_name: "PEN_PROXIMITY_OUT", + doc: Some("Pressure-sensitive pen has become unavailable\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_DOWN", + short_name: "PEN_DOWN", + doc: Some("Pressure-sensitive pen touched drawing surface\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_UP", + short_name: "PEN_UP", + doc: Some("Pressure-sensitive pen stopped touching drawing surface\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_BUTTON_DOWN", + short_name: "PEN_BUTTON_DOWN", + doc: Some("Pressure-sensitive pen button pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_BUTTON_UP", + short_name: "PEN_BUTTON_UP", + doc: Some("Pressure-sensitive pen button released\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_MOTION", + short_name: "PEN_MOTION", + doc: Some("Pressure-sensitive pen is moving on the tablet\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PEN_AXIS", + short_name: "PEN_AXIS", + doc: Some("Pressure-sensitive pen angle/pressure/etc changed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_CAMERA_DEVICE_ADDED", + short_name: "CAMERA_DEVICE_ADDED", + doc: Some("A new camera device is available\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_CAMERA_DEVICE_REMOVED", + short_name: "CAMERA_DEVICE_REMOVED", + doc: Some("A camera device has been removed.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_CAMERA_DEVICE_APPROVED", + short_name: "CAMERA_DEVICE_APPROVED", + doc: Some("A camera device has been approved for use by the user.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_CAMERA_DEVICE_DENIED", + short_name: "CAMERA_DEVICE_DENIED", + doc: Some("A camera device has been denied for use by the user.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_RENDER_TARGETS_RESET", + short_name: "RENDER_TARGETS_RESET", + doc: Some("The render targets have been reset and their contents need to be updated\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_RENDER_DEVICE_RESET", + short_name: "RENDER_DEVICE_RESET", + doc: Some("The device has been reset and all textures need to be recreated\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_RENDER_DEVICE_LOST", + short_name: "RENDER_DEVICE_LOST", + doc: Some("The device has been lost and can't be recovered.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PRIVATE0", + short_name: "PRIVATE0", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PRIVATE1", + short_name: "PRIVATE1", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PRIVATE2", + short_name: "PRIVATE2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_PRIVATE3", + short_name: "PRIVATE3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_POLL_SENTINEL", + short_name: "POLL_SENTINEL", + doc: Some("Signals the end of an event poll cycle\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_USER", + short_name: "USER", + doc: Some( + "Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use,\nand should be allocated with [`SDL_RegisterEvents()`]\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_LAST", + short_name: "LAST", + doc: Some("* This last event is only for bounding internal arrays\n"), + available_since: None, + }, + GroupValue { + name: "SDL_EVENT_ENUM_PADDING", + short_name: "ENUM_PADDING", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_EventAction: Group = Group { + module: "events", + kind: GroupKind::Enum, + name: "SDL_EventAction", + short_name: "EventAction", + doc: Some( + "The type of action to request from [`SDL_PeepEvents()`].\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ADDEVENT", + short_name: "ADDEVENT", + doc: Some("Add events to the back of the queue.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEEKEVENT", + short_name: "PEEKEVENT", + doc: Some("Check but don't remove events from the queue front.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GETEVENT", + short_name: "GETEVENT", + doc: Some("Retrieve/remove events from the front of the queue.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_CommonEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_CommonEvent", + doc: Some( + "Fields shared by every event\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "Event type, shared with all events, Uint32 to cover user events which are not in the [`SDL_EventType`] enumeration\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + ], +}; +pub const METADATA_SDL_DisplayEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_DisplayEvent", + doc: Some( + "Display state change event data (event.display.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("SDL_EVENT_DISPLAY_*\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "displayID", + doc: Some("The associated display\n"), + available_since: None, + ty: "SDL_DisplayID", + }, + Field { + name: "data1", + doc: Some("event dependent data\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "data2", + doc: Some("event dependent data\n"), + available_since: None, + ty: "Sint32", + }, + ], +}; +pub const METADATA_SDL_WindowEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_WindowEvent", + doc: Some( + "Window state change event data (event.window.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("SDL_EVENT_WINDOW_*\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The associated window\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "data1", + doc: Some("event dependent data\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "data2", + doc: Some("event dependent data\n"), + available_since: None, + ty: "Sint32", + }, + ], +}; +pub const METADATA_SDL_KeyboardDeviceEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_KeyboardDeviceEvent", + doc: Some( + "Keyboard device event structure (event.kdevice.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_KEYBOARD_ADDED`] or [`SDL_EVENT_KEYBOARD_REMOVED`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The keyboard instance id\n"), + available_since: None, + ty: "SDL_KeyboardID", + }, + ], +}; +pub const METADATA_SDL_KeyboardEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_KeyboardEvent", + doc: Some( + "Keyboard button event structure (event.key.*)\n\nThe `key` is the base [`SDL_Keycode`] generated by pressing the `scancode`\nusing the current keyboard layout, applying any options specified in\n[`SDL_HINT_KEYCODE_OPTIONS`]. You can get the [`SDL_Keycode`] corresponding to the\nevent scancode and modifiers directly from the keyboard layout, bypassing\n[`SDL_HINT_KEYCODE_OPTIONS`], by calling [`SDL_GetKeyFromScancode()`].\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetKeyFromScancode`]\n- [`SDL_HINT_KEYCODE_OPTIONS`]\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_KEY_DOWN`] or [`SDL_EVENT_KEY_UP`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with keyboard focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The keyboard instance id, or 0 if unknown or virtual\n"), + available_since: None, + ty: "SDL_KeyboardID", + }, + Field { + name: "scancode", + doc: Some("SDL physical key code\n"), + available_since: None, + ty: "SDL_Scancode", + }, + Field { + name: "key", + doc: Some("SDL virtual key code\n"), + available_since: None, + ty: "SDL_Keycode", + }, + Field { + name: "r#mod", + doc: Some("current key modifiers\n"), + available_since: None, + ty: "SDL_Keymod", + }, + Field { + name: "raw", + doc: Some("The platform dependent scancode for this event\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "down", + doc: Some("true if the key is pressed\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "repeat", + doc: Some("true if this is a key repeat\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + ], +}; +pub const METADATA_SDL_TextEditingEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_TextEditingEvent", + doc: Some( + "Keyboard text editing event structure (event.edit.*)\n\nThe start cursor is the position, in UTF-8 characters, where new typing\nwill be inserted into the editing text. The length is the number of UTF-8\ncharacters that will be replaced by new typing.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_TEXT_EDITING`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with keyboard focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "text", + doc: Some("The editing text\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "start", + doc: Some("The start cursor of selected editing text, or -1 if not set\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "length", + doc: Some("The length of selected editing text, or -1 if not set\n"), + available_since: None, + ty: "Sint32", + }, + ], +}; +pub const METADATA_SDL_TextEditingCandidatesEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_TextEditingCandidatesEvent", + doc: Some( + "Keyboard IME candidates event structure (event.edit_candidates.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_TEXT_EDITING_CANDIDATES`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with keyboard focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "candidates", + doc: Some("The list of candidates, or NULL if there are no candidates available\n"), + available_since: None, + ty: "*const *const ::core::ffi::c_char", + }, + Field { + name: "num_candidates", + doc: Some("The number of strings in `candidates`\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "selected_candidate", + doc: Some("The index of the selected candidate, or -1 if no candidate is selected\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "horizontal", + doc: Some("true if the list is horizontal, false if it's vertical\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_TextInputEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_TextInputEvent", + doc: Some( + "Keyboard text input event structure (event.text.*)\n\nThis event will never be delivered unless text input is enabled by calling\n[`SDL_StartTextInput()`]. Text input is disabled by default!\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_StartTextInput`]\n- [`SDL_StopTextInput`]\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_TEXT_INPUT`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with keyboard focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "text", + doc: Some("The input text, UTF-8 encoded\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + ], +}; +pub const METADATA_SDL_MouseDeviceEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_MouseDeviceEvent", + doc: Some( + "Mouse device event structure (event.mdevice.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_MOUSE_ADDED`] or [`SDL_EVENT_MOUSE_REMOVED`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The mouse instance id\n"), + available_since: None, + ty: "SDL_MouseID", + }, + ], +}; +pub const METADATA_SDL_MouseMotionEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_MouseMotionEvent", + doc: Some( + "Mouse motion event structure (event.motion.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_MOUSE_MOTION`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with mouse focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some( + "The mouse instance id in relative mode, [`SDL_TOUCH_MOUSEID`] for touch events, [`SDL_PEN_MOUSEID`] for pen events, or 0\n", + ), + available_since: None, + ty: "SDL_MouseID", + }, + Field { + name: "state", + doc: Some("The current button state\n"), + available_since: None, + ty: "SDL_MouseButtonFlags", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "xrel", + doc: Some("The relative motion in the X direction\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "yrel", + doc: Some("The relative motion in the Y direction\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_MouseButtonEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_MouseButtonEvent", + doc: Some( + "Mouse button event structure (event.button.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_MOUSE_BUTTON_DOWN`] or [`SDL_EVENT_MOUSE_BUTTON_UP`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with mouse focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some( + "The mouse instance id in relative mode, [`SDL_TOUCH_MOUSEID`] for touch events, or 0\n", + ), + available_since: None, + ty: "SDL_MouseID", + }, + Field { + name: "button", + doc: Some("The mouse button index\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "down", + doc: Some("true if the button is pressed\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "clicks", + doc: Some("1 for single-click, 2 for double-click, etc.\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_MouseWheelEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_MouseWheelEvent", + doc: Some( + "Mouse wheel event structure (event.wheel.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_MOUSE_WHEEL`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with mouse focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The mouse instance id in relative mode or 0\n"), + available_since: None, + ty: "SDL_MouseID", + }, + Field { + name: "x", + doc: Some( + "The amount scrolled horizontally, positive to the right and negative to the left\n", + ), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some( + "The amount scrolled vertically, positive away from the user and negative toward the user\n", + ), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "direction", + doc: Some( + "Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back\n", + ), + available_since: None, + ty: "SDL_MouseWheelDirection", + }, + Field { + name: "mouse_x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "mouse_y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "integer_x", + doc: Some( + "The amount scrolled horizontally, accumulated to whole scroll \"ticks\" (added in 3.2.12)\n", + ), + available_since: None, + ty: "Sint32", + }, + Field { + name: "integer_y", + doc: Some( + "The amount scrolled vertically, accumulated to whole scroll \"ticks\" (added in 3.2.12)\n", + ), + available_since: None, + ty: "Sint32", + }, + ], +}; +pub const METADATA_SDL_JoyAxisEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_JoyAxisEvent", + doc: Some( + "Joystick axis motion event structure (event.jaxis.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_JOYSTICK_AXIS_MOTION`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "axis", + doc: Some("The joystick axis index\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "value", + doc: Some("The axis value (range: -32768 to 32767)\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "padding4", + doc: None, + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_JoyBallEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_JoyBallEvent", + doc: Some( + "Joystick trackball motion event structure (event.jball.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_JOYSTICK_BALL_MOTION`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "ball", + doc: Some("The joystick trackball index\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "xrel", + doc: Some("The relative motion in the X direction\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "yrel", + doc: Some("The relative motion in the Y direction\n"), + available_since: None, + ty: "Sint16", + }, + ], +}; +pub const METADATA_SDL_JoyHatEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_JoyHatEvent", + doc: Some( + "Joystick hat position change event structure (event.jhat.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_JOYSTICK_HAT_MOTION`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "hat", + doc: Some("The joystick hat index\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "value", + doc: Some( + "The hat position value.\n## See also\n- [`SDL_HAT_LEFTUP`] [`SDL_HAT_UP`] [`SDL_HAT_RIGHTUP`]\n- [`SDL_HAT_LEFT`] [`SDL_HAT_CENTERED`] [`SDL_HAT_RIGHT`]\n- [`SDL_HAT_LEFTDOWN`] [`SDL_HAT_DOWN`] [`SDL_HAT_RIGHTDOWN`]\n\nNote that zero means the POV is centered.\n", + ), + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_JoyButtonEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_JoyButtonEvent", + doc: Some( + "Joystick button event structure (event.jbutton.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_JOYSTICK_BUTTON_DOWN`] or [`SDL_EVENT_JOYSTICK_BUTTON_UP`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "button", + doc: Some("The joystick button index\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "down", + doc: Some("true if the button is pressed\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_JoyDeviceEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_JoyDeviceEvent", + doc: Some( + "Joystick device event structure (event.jdevice.*)\n\nSDL will send JOYSTICK_ADDED events for devices that are already plugged in\nduring [`SDL_Init`].\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GamepadDeviceEvent`]\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_JOYSTICK_ADDED`] or [`SDL_EVENT_JOYSTICK_REMOVED`] or [`SDL_EVENT_JOYSTICK_UPDATE_COMPLETE`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + ], +}; +pub const METADATA_SDL_JoyBatteryEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_JoyBatteryEvent", + doc: Some( + "Joystick battery level change event structure (event.jbattery.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_JOYSTICK_BATTERY_UPDATED`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "state", + doc: Some("The joystick battery state\n"), + available_since: None, + ty: "SDL_PowerState", + }, + Field { + name: "percent", + doc: Some("The joystick battery percent charge remaining\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_GamepadAxisEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_GamepadAxisEvent", + doc: Some( + "Gamepad axis motion event structure (event.gaxis.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_GAMEPAD_AXIS_MOTION`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "axis", + doc: Some("The gamepad axis ([`SDL_GamepadAxis`])\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "value", + doc: Some("The axis value (range: -32768 to 32767)\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "padding4", + doc: None, + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_GamepadButtonEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_GamepadButtonEvent", + doc: Some( + "Gamepad button event structure (event.gbutton.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_GAMEPAD_BUTTON_DOWN`] or [`SDL_EVENT_GAMEPAD_BUTTON_UP`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "button", + doc: Some("The gamepad button ([`SDL_GamepadButton`])\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "down", + doc: Some("true if the button is pressed\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GamepadDeviceEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_GamepadDeviceEvent", + doc: Some( + "Gamepad device event structure (event.gdevice.*)\n\nJoysticks that are supported gamepads receive both an [`SDL_JoyDeviceEvent`]\nand an [`SDL_GamepadDeviceEvent`].\n\nSDL will send GAMEPAD_ADDED events for joysticks that are already plugged\nin during [`SDL_Init()`] and are recognized as gamepads. It will also send\nevents for joysticks that get gamepad mappings at runtime.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_JoyDeviceEvent`]\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_GAMEPAD_ADDED`], [`SDL_EVENT_GAMEPAD_REMOVED`], or [`SDL_EVENT_GAMEPAD_REMAPPED`], [`SDL_EVENT_GAMEPAD_UPDATE_COMPLETE`] or [`SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + ], +}; +pub const METADATA_SDL_GamepadTouchpadEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_GamepadTouchpadEvent", + doc: Some( + "Gamepad touchpad event structure (event.gtouchpad.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN`] or [`SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION`] or [`SDL_EVENT_GAMEPAD_TOUCHPAD_UP`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "touchpad", + doc: Some("The index of the touchpad\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "finger", + doc: Some("The index of the finger on the touchpad\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "x", + doc: Some("Normalized in the range 0...1 with 0 being on the left\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Normalized in the range 0...1 with 0 being at the top\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "pressure", + doc: Some("Normalized in the range 0...1\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_GamepadSensorEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_GamepadSensorEvent", + doc: Some( + "Gamepad sensor event structure (event.gsensor.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_GAMEPAD_SENSOR_UPDATE`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The joystick instance id\n"), + available_since: None, + ty: "SDL_JoystickID", + }, + Field { + name: "sensor", + doc: Some("The type of the sensor, one of the values of [`SDL_SensorType`]\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "data", + doc: Some("Up to 3 values from the sensor, as defined in SDL_sensor.h\n"), + available_since: None, + ty: "[::core::ffi::c_float; 3]", + }, + Field { + name: "sensor_timestamp", + doc: Some( + "The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock\n", + ), + available_since: None, + ty: "Uint64", + }, + ], +}; +pub const METADATA_SDL_AudioDeviceEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_AudioDeviceEvent", + doc: Some( + "Audio device event structure (event.adevice.*)\n\nNote that SDL will send a [`SDL_EVENT_AUDIO_DEVICE_ADDED`] event for every\ndevice it discovers during initialization. After that, this event will only\narrive when a device is hotplugged during the program's run.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_AUDIO_DEVICE_ADDED`], or [`SDL_EVENT_AUDIO_DEVICE_REMOVED`], or [`SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("[`SDL_AudioDeviceID`] for the device being added or removed or changing\n"), + available_since: None, + ty: "SDL_AudioDeviceID", + }, + Field { + name: "recording", + doc: Some("false if a playback device, true if a recording device.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_CameraDeviceEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_CameraDeviceEvent", + doc: Some( + "Camera device event structure (event.cdevice.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_CAMERA_DEVICE_ADDED`], [`SDL_EVENT_CAMERA_DEVICE_REMOVED`], [`SDL_EVENT_CAMERA_DEVICE_APPROVED`], [`SDL_EVENT_CAMERA_DEVICE_DENIED`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("[`SDL_CameraID`] for the device being added or removed or changing\n"), + available_since: None, + ty: "SDL_CameraID", + }, + ], +}; +pub const METADATA_SDL_RenderEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_RenderEvent", + doc: Some( + "Renderer event structure (event.render.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_RENDER_TARGETS_RESET`], [`SDL_EVENT_RENDER_DEVICE_RESET`], [`SDL_EVENT_RENDER_DEVICE_LOST`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window containing the renderer in question.\n"), + available_since: None, + ty: "SDL_WindowID", + }, + ], +}; +pub const METADATA_SDL_TouchFingerEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_TouchFingerEvent", + doc: Some( + "Touch finger event structure (event.tfinger.*)\n\nCoordinates in this event are normalized. `x` and `y` are normalized to a\nrange between 0.0f and 1.0f, relative to the window, so (0,0) is the top\nleft and (1,1) is the bottom right. Delta coordinates `dx` and `dy` are\nnormalized in the ranges of -1.0f (traversed all the way from the bottom or\nright to all the way up or left) to 1.0f (traversed all the way from the\ntop or left to all the way down or right).\n\nNote that while the coordinates are _normalized_, they are not _clamped_,\nwhich means in some circumstances you can get a value outside of this\nrange. For example, a renderer using logical presentation might give a\nnegative value when the touch is in the letterboxing. Some platforms might\nreport a touch outside of the window, which will also be outside of the\nrange.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_FINGER_DOWN`], [`SDL_EVENT_FINGER_UP`], [`SDL_EVENT_FINGER_MOTION`], or [`SDL_EVENT_FINGER_CANCELED`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "touchID", + doc: Some("The touch device id\n"), + available_since: None, + ty: "SDL_TouchID", + }, + Field { + name: "fingerID", + doc: None, + available_since: None, + ty: "SDL_FingerID", + }, + Field { + name: "x", + doc: Some("Normalized in the range 0...1\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Normalized in the range 0...1\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "dx", + doc: Some("Normalized in the range -1...1\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "dy", + doc: Some("Normalized in the range -1...1\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "pressure", + doc: Some("Normalized in the range 0...1\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "windowID", + doc: Some("The window underneath the finger, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + ], +}; +pub const METADATA_SDL_PinchFingerEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_PinchFingerEvent", + doc: Some( + "* Pinch event structure (event.pinch.*)\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: None, + fields: &[ + Field { + name: "r#type", + doc: Some( + "::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "scale", + doc: Some( + "The scale change since the last [`SDL_EVENT_PINCH_UPDATE`]. Scale < 1 is \"zoom out\". Scale > 1 is \"zoom in\".\n", + ), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "windowID", + doc: Some("The window underneath the finger, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + ], +}; +pub const METADATA_SDL_PenProximityEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_PenProximityEvent", + doc: Some( + "Pressure-sensitive pen proximity event structure (event.pproximity.*)\n\nWhen a pen becomes visible to the system (it is close enough to a tablet,\netc), SDL will send an [`SDL_EVENT_PEN_PROXIMITY_IN`] event with the new pen's\nID. This ID is valid until the pen leaves proximity again (has been removed\nfrom the tablet's area, the tablet has been unplugged, etc). If the same\npen reenters proximity again, it will be given a new ID.\n\nNote that \"proximity\" means \"close enough for the tablet to know the tool\nis there.\" The pen touching and lifting off from the tablet while not\nleaving the area are handled by [`SDL_EVENT_PEN_DOWN`] and [`SDL_EVENT_PEN_UP`].\n\nNot all platforms have a window associated with the pen during proximity\nevents. Some wait until motion/button/etc events to offer this info.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_PEN_PROXIMITY_IN`] or [`SDL_EVENT_PEN_PROXIMITY_OUT`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with pen focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The pen instance id\n"), + available_since: None, + ty: "SDL_PenID", + }, + Field { + name: "pen_state", + doc: Some("Complete pen input state at time of event (added in 3.4.16).\n"), + available_since: None, + ty: "SDL_PenInputFlags", + }, + ], +}; +pub const METADATA_SDL_PenMotionEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_PenMotionEvent", + doc: Some( + "Pressure-sensitive pen motion event structure (event.pmotion.*)\n\nDepending on the hardware, you may get motion events when the pen is not\ntouching a tablet, for tracking a pen even when it isn't drawing. You\nshould listen for [`SDL_EVENT_PEN_DOWN`] and [`SDL_EVENT_PEN_UP`] events, or check\n`pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is \"drawing\" when\ndealing with pen motion.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_PEN_MOTION`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with pen focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The pen instance id\n"), + available_since: None, + ty: "SDL_PenID", + }, + Field { + name: "pen_state", + doc: Some("Complete pen input state at time of event\n"), + available_since: None, + ty: "SDL_PenInputFlags", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_PenTouchEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_PenTouchEvent", + doc: Some( + "Pressure-sensitive pen touched event structure (event.ptouch.*)\n\nThese events come when a pen touches a surface (a tablet, etc), or lifts\noff from one.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_PEN_DOWN`] or [`SDL_EVENT_PEN_UP`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with pen focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The pen instance id\n"), + available_since: None, + ty: "SDL_PenID", + }, + Field { + name: "pen_state", + doc: Some("Complete pen input state at time of event\n"), + available_since: None, + ty: "SDL_PenInputFlags", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "eraser", + doc: Some("true if eraser end is used (not all pens support this).\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "down", + doc: Some("true if the pen is touching or false if the pen is lifted off\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + ], +}; +pub const METADATA_SDL_PenButtonEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_PenButtonEvent", + doc: Some( + "Pressure-sensitive pen button event structure (event.pbutton.*)\n\nThis is for buttons on the pen itself that the user might click. The pen\nitself pressing down to draw triggers a [`SDL_EVENT_PEN_DOWN`] event instead.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_PEN_BUTTON_DOWN`] or [`SDL_EVENT_PEN_BUTTON_UP`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with mouse focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The pen instance id\n"), + available_since: None, + ty: "SDL_PenID", + }, + Field { + name: "pen_state", + doc: Some("Complete pen input state at time of event\n"), + available_since: None, + ty: "SDL_PenInputFlags", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "button", + doc: Some("The pen button index (first button is 1).\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "down", + doc: Some("true if the button is pressed\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + ], +}; +pub const METADATA_SDL_PenAxisEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_PenAxisEvent", + doc: Some( + "Pressure-sensitive pen pressure / angle event structure (event.paxis.*)\n\nYou might get some of these events even if the pen isn't touching the\ntablet.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_PEN_AXIS`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window with pen focus, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "which", + doc: Some("The pen instance id\n"), + available_since: None, + ty: "SDL_PenID", + }, + Field { + name: "pen_state", + doc: Some("Complete pen input state at time of event\n"), + available_since: None, + ty: "SDL_PenInputFlags", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "axis", + doc: Some("Axis that has changed\n"), + available_since: None, + ty: "SDL_PenAxis", + }, + Field { + name: "value", + doc: Some("New value of axis\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_DropEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_DropEvent", + doc: Some( + "An event used to drop text or request a file open by the system\n(event.drop.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_DROP_BEGIN`] or [`SDL_EVENT_DROP_FILE`] or [`SDL_EVENT_DROP_TEXT`] or [`SDL_EVENT_DROP_COMPLETE`] or [`SDL_EVENT_DROP_POSITION`]\n", + ), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The window that was dropped on, if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "x", + doc: Some("X coordinate, relative to window (not on begin)\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("Y coordinate, relative to window (not on begin)\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "source", + doc: Some( + "The source app that sent this drop event, or NULL if that isn't available\n", + ), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "data", + doc: Some( + "The text for [`SDL_EVENT_DROP_TEXT`] and the file name for [`SDL_EVENT_DROP_FILE`], NULL for other events\n", + ), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + ], +}; +pub const METADATA_SDL_ClipboardEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_ClipboardEvent", + doc: Some( + "An event triggered when the clipboard contents have changed\n(event.clipboard.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_CLIPBOARD_UPDATE`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "owner", + doc: Some("are we owning the clipboard (internal update)\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "num_mime_types", + doc: Some("number of mime types\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "mime_types", + doc: Some("current mime types\n"), + available_since: None, + ty: "*mut *const ::core::ffi::c_char", + }, + ], +}; +pub const METADATA_SDL_SensorEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_SensorEvent", + doc: Some( + "Sensor event structure (event.sensor.*)\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_SENSOR_UPDATE`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "which", + doc: Some("The instance ID of the sensor\n"), + available_since: None, + ty: "SDL_SensorID", + }, + Field { + name: "data", + doc: Some( + "Up to 6 values from the sensor - additional values can be queried using [`SDL_GetSensorData()`]\n", + ), + available_since: None, + ty: "[::core::ffi::c_float; 6]", + }, + Field { + name: "sensor_timestamp", + doc: Some( + "The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock\n", + ), + available_since: None, + ty: "Uint64", + }, + ], +}; +pub const METADATA_SDL_QuitEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_QuitEvent", + doc: Some( + "The \"quit requested\" event\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_EVENT_QUIT`]\n"), + available_since: None, + ty: "SDL_EventType", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + ], +}; +pub const METADATA_SDL_UserEvent: Struct = Struct { + module: "events", + kind: StructKind::Struct, + name: "SDL_UserEvent", + doc: Some( + "A user-defined event type (event.user.*)\n\nThis event is unique; it is never created by SDL, but only by the\napplication. The event can be pushed onto the event queue using\n[`SDL_PushEvent()`]. The contents of the structure members are completely up to\nthe programmer; the only requirement is that '''type''' is a value obtained\nfrom [`SDL_RegisterEvents()`].\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`], Uint32 because these are not in the [`SDL_EventType`] enumeration\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "timestamp", + doc: Some("In nanoseconds, populated using [`SDL_GetTicksNS()`]\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "windowID", + doc: Some("The associated window if any\n"), + available_since: None, + ty: "SDL_WindowID", + }, + Field { + name: "code", + doc: Some("User defined event code\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "data1", + doc: Some("User defined data pointer\n"), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + Field { + name: "data2", + doc: Some("User defined data pointer\n"), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + ], +}; +pub const METADATA_SDL_Event: Struct = Struct { + module: "events", + kind: StructKind::Union, + name: "SDL_Event", + doc: Some( + "The structure for all events in SDL.\n\nThe [`SDL_Event`] structure is the core of all event handling in SDL. [`SDL_Event`]\nis a union of all event structures used in SDL.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct is non-exhaustive. If created manually, it must be initialized with `default()` or equivalent.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "Event type, shared with all events, Uint32 to cover user events which are not in the [`SDL_EventType`] enumeration\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "common", + doc: Some("Common event data\n"), + available_since: None, + ty: "SDL_CommonEvent", + }, + Field { + name: "display", + doc: Some("Display event data\n"), + available_since: None, + ty: "SDL_DisplayEvent", + }, + Field { + name: "window", + doc: Some("Window event data\n"), + available_since: None, + ty: "SDL_WindowEvent", + }, + Field { + name: "kdevice", + doc: Some("Keyboard device change event data\n"), + available_since: None, + ty: "SDL_KeyboardDeviceEvent", + }, + Field { + name: "key", + doc: Some("Keyboard event data\n"), + available_since: None, + ty: "SDL_KeyboardEvent", + }, + Field { + name: "edit", + doc: Some("Text editing event data\n"), + available_since: None, + ty: "SDL_TextEditingEvent", + }, + Field { + name: "edit_candidates", + doc: Some("Text editing candidates event data\n"), + available_since: None, + ty: "SDL_TextEditingCandidatesEvent", + }, + Field { + name: "text", + doc: Some("Text input event data\n"), + available_since: None, + ty: "SDL_TextInputEvent", + }, + Field { + name: "mdevice", + doc: Some("Mouse device change event data\n"), + available_since: None, + ty: "SDL_MouseDeviceEvent", + }, + Field { + name: "motion", + doc: Some("Mouse motion event data\n"), + available_since: None, + ty: "SDL_MouseMotionEvent", + }, + Field { + name: "button", + doc: Some("Mouse button event data\n"), + available_since: None, + ty: "SDL_MouseButtonEvent", + }, + Field { + name: "wheel", + doc: Some("Mouse wheel event data\n"), + available_since: None, + ty: "SDL_MouseWheelEvent", + }, + Field { + name: "jdevice", + doc: Some("Joystick device change event data\n"), + available_since: None, + ty: "SDL_JoyDeviceEvent", + }, + Field { + name: "jaxis", + doc: Some("Joystick axis event data\n"), + available_since: None, + ty: "SDL_JoyAxisEvent", + }, + Field { + name: "jball", + doc: Some("Joystick ball event data\n"), + available_since: None, + ty: "SDL_JoyBallEvent", + }, + Field { + name: "jhat", + doc: Some("Joystick hat event data\n"), + available_since: None, + ty: "SDL_JoyHatEvent", + }, + Field { + name: "jbutton", + doc: Some("Joystick button event data\n"), + available_since: None, + ty: "SDL_JoyButtonEvent", + }, + Field { + name: "jbattery", + doc: Some("Joystick battery event data\n"), + available_since: None, + ty: "SDL_JoyBatteryEvent", + }, + Field { + name: "gdevice", + doc: Some("Gamepad device event data\n"), + available_since: None, + ty: "SDL_GamepadDeviceEvent", + }, + Field { + name: "gaxis", + doc: Some("Gamepad axis event data\n"), + available_since: None, + ty: "SDL_GamepadAxisEvent", + }, + Field { + name: "gbutton", + doc: Some("Gamepad button event data\n"), + available_since: None, + ty: "SDL_GamepadButtonEvent", + }, + Field { + name: "gtouchpad", + doc: Some("Gamepad touchpad event data\n"), + available_since: None, + ty: "SDL_GamepadTouchpadEvent", + }, + Field { + name: "gsensor", + doc: Some("Gamepad sensor event data\n"), + available_since: None, + ty: "SDL_GamepadSensorEvent", + }, + Field { + name: "adevice", + doc: Some("Audio device event data\n"), + available_since: None, + ty: "SDL_AudioDeviceEvent", + }, + Field { + name: "cdevice", + doc: Some("Camera device event data\n"), + available_since: None, + ty: "SDL_CameraDeviceEvent", + }, + Field { + name: "sensor", + doc: Some("Sensor event data\n"), + available_since: None, + ty: "SDL_SensorEvent", + }, + Field { + name: "quit", + doc: Some("Quit request event data\n"), + available_since: None, + ty: "SDL_QuitEvent", + }, + Field { + name: "user", + doc: Some("Custom event data\n"), + available_since: None, + ty: "SDL_UserEvent", + }, + Field { + name: "tfinger", + doc: Some("Touch finger event data\n"), + available_since: None, + ty: "SDL_TouchFingerEvent", + }, + Field { + name: "pinch", + doc: Some("Pinch event data\n"), + available_since: None, + ty: "SDL_PinchFingerEvent", + }, + Field { + name: "pproximity", + doc: Some("Pen proximity event data\n"), + available_since: None, + ty: "SDL_PenProximityEvent", + }, + Field { + name: "ptouch", + doc: Some("Pen tip touching event data\n"), + available_since: None, + ty: "SDL_PenTouchEvent", + }, + Field { + name: "pmotion", + doc: Some("Pen motion event data\n"), + available_since: None, + ty: "SDL_PenMotionEvent", + }, + Field { + name: "pbutton", + doc: Some("Pen button event data\n"), + available_since: None, + ty: "SDL_PenButtonEvent", + }, + Field { + name: "paxis", + doc: Some("Pen axis event data\n"), + available_since: None, + ty: "SDL_PenAxisEvent", + }, + Field { + name: "render", + doc: Some("Render event data\n"), + available_since: None, + ty: "SDL_RenderEvent", + }, + Field { + name: "drop", + doc: Some("Drag and drop event data\n"), + available_since: None, + ty: "SDL_DropEvent", + }, + Field { + name: "clipboard", + doc: Some("Clipboard event data\n"), + available_since: None, + ty: "SDL_ClipboardEvent", + }, + Field { + name: "padding", + doc: None, + available_since: None, + ty: "[Uint8; 128]", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/filesystem.rs b/vendor/sdl3-sys/src/metadata/generated/filesystem.rs new file mode 100644 index 00000000..1a0888f3 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/filesystem.rs @@ -0,0 +1,225 @@ +//! Metadata for items in the `crate::filesystem` module + +use super::*; + +pub const METADATA_SDL_Folder: Group = Group { + module: "filesystem", + kind: GroupKind::Enum, + name: "SDL_Folder", + short_name: "Folder", + doc: Some( + "The type of the OS-provided default folder for a specific purpose.\n\nNote that the Trash folder isn't included here, because trashing files\nusually involves extra OS-specific functionality to remember the file's\noriginal location.\n\nThe folders supported per platform are:\n\n| | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten |\n| ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- |\n| HOME | X | X | | X | X | X |\n| DESKTOP | X | X | | X | X | |\n| DOCUMENTS | X | X | | X | | |\n| DOWNLOADS | Vista+ | X | | X | | |\n| MUSIC | X | X | | X | | |\n| PICTURES | X | X | | X | | |\n| PUBLICSHARE | | X | | X | | |\n| SAVEDGAMES | Vista+ | | | | | |\n| SCREENSHOTS | Vista+ | | | | | |\n| TEMPLATES | X | X | | X | | |\n| VIDEOS | X | X* | | X | | |\n\nNote that on macOS/iOS, the Videos folder is called \"Movies\".\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetUserFolder`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_FOLDER_HOME", + short_name: "HOME", + doc: Some( + "The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_DESKTOP", + short_name: "DESKTOP", + doc: Some( + "The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_DOCUMENTS", + short_name: "DOCUMENTS", + doc: Some( + "User document files, possibly application-specific. This is a good place to save a user's projects.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_DOWNLOADS", + short_name: "DOWNLOADS", + doc: Some("Standard folder for user files downloaded from the internet.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_MUSIC", + short_name: "MUSIC", + doc: Some( + "Music files that can be played using a standard music player (mp3, ogg...).\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_PICTURES", + short_name: "PICTURES", + doc: Some("Image files that can be displayed using a standard viewer (png, jpg...).\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_PUBLICSHARE", + short_name: "PUBLICSHARE", + doc: Some("Files that are meant to be shared with other users on the same computer.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_SAVEDGAMES", + short_name: "SAVEDGAMES", + doc: Some("Save files for games.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_SCREENSHOTS", + short_name: "SCREENSHOTS", + doc: Some("Application screenshots.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_TEMPLATES", + short_name: "TEMPLATES", + doc: Some( + "Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as \"New Text File.txt\". Any file in the Templates folder can be used as a starting point for a new file.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_VIDEOS", + short_name: "VIDEOS", + doc: Some( + "Video files that can be played using a standard video player (mp4, webm...).\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_FOLDER_COUNT", + short_name: "COUNT", + doc: Some("Total number of types in this enum, not a folder type by itself.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PathType: Group = Group { + module: "filesystem", + kind: GroupKind::Enum, + name: "SDL_PathType", + short_name: "PathType", + doc: Some( + "Types of filesystem entries.\n\nNote that there may be other sorts of items on a filesystem: devices, named\npipes, etc. They are currently reported as [`SDL_PATHTYPE_OTHER`].\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_PathInfo`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PATHTYPE_NONE", + short_name: "NONE", + doc: Some("path does not exist\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PATHTYPE_FILE", + short_name: "FILE", + doc: Some("a normal file\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PATHTYPE_DIRECTORY", + short_name: "DIRECTORY", + doc: Some("a directory\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PATHTYPE_OTHER", + short_name: "OTHER", + doc: Some( + "something completely different like a device node (not a symlink, those are always followed)\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GlobFlags: Group = Group { + module: "filesystem", + kind: GroupKind::Flags, + name: "SDL_GlobFlags", + short_name: "GlobFlags", + doc: Some( + "Flags for path matching.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GlobDirectory`]\n- [`SDL_GlobStorageDirectory`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[GroupValue { + name: "SDL_GLOB_CASEINSENSITIVE", + short_name: "CASEINSENSITIVE", + doc: None, + available_since: None, + }], +}; +pub const METADATA_SDL_EnumerationResult: Group = Group { + module: "filesystem", + kind: GroupKind::Enum, + name: "SDL_EnumerationResult", + short_name: "EnumerationResult", + doc: Some( + "Possible results from an enumeration callback.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_EnumerateDirectoryCallback`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ENUM_CONTINUE", + short_name: "CONTINUE", + doc: Some("Value that requests that enumeration continue.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ENUM_SUCCESS", + short_name: "SUCCESS", + doc: Some("Value that requests that enumeration stop, successfully.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ENUM_FAILURE", + short_name: "FAILURE", + doc: Some("Value that requests that enumeration stop, as a failure.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PathInfo: Struct = Struct { + module: "filesystem", + kind: StructKind::Struct, + name: "SDL_PathInfo", + doc: Some( + "Information about a path on the filesystem.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetPathInfo`]\n- [`SDL_GetStoragePathInfo`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("the path type\n"), + available_since: None, + ty: "SDL_PathType", + }, + Field { + name: "size", + doc: Some("the file size in bytes\n"), + available_since: None, + ty: "Uint64", + }, + Field { + name: "create_time", + doc: Some("the time when the path was created\n"), + available_since: None, + ty: "SDL_Time", + }, + Field { + name: "modify_time", + doc: Some("the last time the path was modified\n"), + available_since: None, + ty: "SDL_Time", + }, + Field { + name: "access_time", + doc: Some("the last time the path was read\n"), + available_since: None, + ty: "SDL_Time", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/gamepad.rs b/vendor/sdl3-sys/src/metadata/generated/gamepad.rs new file mode 100644 index 00000000..e5df5ee6 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/gamepad.rs @@ -0,0 +1,649 @@ +//! Metadata for items in the `crate::gamepad` module + +use super::*; + +pub const METADATA_SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN: Property = Property { + module: "gamepad", + name: "SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN", + short_name: "GAMEPAD_CAP_MONO_LED_BOOLEAN", + value: crate::gamepad::SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN: Property = Property { + module: "gamepad", + name: "SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN", + short_name: "GAMEPAD_CAP_RGB_LED_BOOLEAN", + value: crate::gamepad::SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN: Property = Property { + module: "gamepad", + name: "SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN", + short_name: "GAMEPAD_CAP_PLAYER_LED_BOOLEAN", + value: crate::gamepad::SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN: Property = Property { + module: "gamepad", + name: "SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN", + short_name: "GAMEPAD_CAP_RUMBLE_BOOLEAN", + value: crate::gamepad::SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN: Property = Property { + module: "gamepad", + name: "SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN", + short_name: "GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN", + value: crate::gamepad::SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_GamepadType: Group = Group { + module: "gamepad", + kind: GroupKind::Enum, + name: "SDL_GamepadType", + short_name: "GamepadType", + doc: Some( + "Standard gamepad types.\n\nThis type does not necessarily map to first-party controllers from\nMicrosoft/Sony/Nintendo; in many cases, third-party controllers can report\nas these, either because they were designed for a specific console, or they\nsimply most closely match that console's controllers (does it have A/B/X/Y\nbuttons or X/O/Square/Triangle? Does it have a touchpad? etc).\n", + ), + available_since: None, + values: &[ + GroupValue { + name: "SDL_GAMEPAD_TYPE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_STANDARD", + short_name: "STANDARD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_XBOX360", + short_name: "XBOX360", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_XBOXONE", + short_name: "XBOXONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_PS3", + short_name: "PS3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_PS4", + short_name: "PS4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_PS5", + short_name: "PS5", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO", + short_name: "NINTENDO_SWITCH_PRO", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT", + short_name: "NINTENDO_SWITCH_JOYCON_LEFT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT", + short_name: "NINTENDO_SWITCH_JOYCON_RIGHT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR", + short_name: "NINTENDO_SWITCH_JOYCON_PAIR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_GAMECUBE", + short_name: "GAMECUBE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_TYPE_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GamepadButton: Group = Group { + module: "gamepad", + kind: GroupKind::Enum, + name: "SDL_GamepadButton", + short_name: "GamepadButton", + doc: Some( + "The list of buttons available on a gamepad\n\nFor controllers that use a diamond pattern for the face buttons, the\nsouth/east/west/north buttons below correspond to the locations in the\ndiamond pattern. For Xbox controllers, this would be A/B/X/Y, for Nintendo\nSwitch controllers, this would be B/A/Y/X, for GameCube controllers this\nwould be A/X/B/Y, for PlayStation controllers this would be\nCross/Circle/Square/Triangle.\n\nFor controllers that don't use a diamond pattern for the face buttons, the\nsouth/east/west/north buttons indicate the buttons labeled A, B, C, D, or\n1, 2, 3, 4, or for controllers that aren't labeled, they are the primary,\nsecondary, etc. buttons.\n\nThe activate action is often the south button and the cancel action is\noften the east button, but in some regions this is reversed, so your game\nshould allow remapping actions based on user preferences.\n\nYou can query the labels for the face buttons using\n[`SDL_GetGamepadButtonLabel()`]\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GAMEPAD_BUTTON_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_SOUTH", + short_name: "SOUTH", + doc: Some("Bottom face button (e.g. Xbox A button)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_EAST", + short_name: "EAST", + doc: Some("Right face button (e.g. Xbox B button)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_WEST", + short_name: "WEST", + doc: Some("Left face button (e.g. Xbox X button)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_NORTH", + short_name: "NORTH", + doc: Some("Top face button (e.g. Xbox Y button)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_BACK", + short_name: "BACK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_GUIDE", + short_name: "GUIDE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_START", + short_name: "START", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LEFT_STICK", + short_name: "LEFT_STICK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_RIGHT_STICK", + short_name: "RIGHT_STICK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LEFT_SHOULDER", + short_name: "LEFT_SHOULDER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER", + short_name: "RIGHT_SHOULDER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_DPAD_UP", + short_name: "DPAD_UP", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_DPAD_DOWN", + short_name: "DPAD_DOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_DPAD_LEFT", + short_name: "DPAD_LEFT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_DPAD_RIGHT", + short_name: "DPAD_RIGHT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_MISC1", + short_name: "MISC1", + doc: Some( + "Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Steam Controller QAM button, Amazon Luna microphone button, Google Stadia capture button)\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1", + short_name: "RIGHT_PADDLE1", + doc: Some( + "Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button, Steam Controller R4 button)\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LEFT_PADDLE1", + short_name: "LEFT_PADDLE1", + doc: Some( + "Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button, Steam Controller L4 button)\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2", + short_name: "RIGHT_PADDLE2", + doc: Some( + "Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button, Steam Controller R5 button)\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LEFT_PADDLE2", + short_name: "LEFT_PADDLE2", + doc: Some( + "Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button, Steam Controller L5 button)\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_TOUCHPAD", + short_name: "TOUCHPAD", + doc: Some("PS4/PS5 touchpad button\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_MISC2", + short_name: "MISC2", + doc: Some("Additional button\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_MISC3", + short_name: "MISC3", + doc: Some("Additional button (e.g. Nintendo GameCube left trigger click)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_MISC4", + short_name: "MISC4", + doc: Some("Additional button (e.g. Nintendo GameCube right trigger click)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_MISC5", + short_name: "MISC5", + doc: Some("Additional button\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_MISC6", + short_name: "MISC6", + doc: Some("Additional button\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GamepadButtonLabel: Group = Group { + module: "gamepad", + kind: GroupKind::Enum, + name: "SDL_GamepadButtonLabel", + short_name: "GamepadButtonLabel", + doc: Some( + "The set of gamepad button labels\n\nThis isn't a complete set, just the face buttons to make it easy to show\nbutton prompts.\n\nFor a complete set, you should look at the button and gamepad type and have\na set of symbols that work well with your art style.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_A", + short_name: "A", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_B", + short_name: "B", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_X", + short_name: "X", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_Y", + short_name: "Y", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_CROSS", + short_name: "CROSS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_CIRCLE", + short_name: "CIRCLE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_SQUARE", + short_name: "SQUARE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE", + short_name: "TRIANGLE", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GamepadAxis: Group = Group { + module: "gamepad", + kind: GroupKind::Enum, + name: "SDL_GamepadAxis", + short_name: "GamepadAxis", + doc: Some( + "The list of axes available on a gamepad\n\nThumbstick axis values range from [`SDL_JOYSTICK_AXIS_MIN`] to\n[`SDL_JOYSTICK_AXIS_MAX`], and are centered within ~8000 of zero, though\nadvanced UI will allow users to set or autodetect the dead zone, which\nvaries between gamepads.\n\nTrigger axis values range from 0 (released) to [`SDL_JOYSTICK_AXIS_MAX`] (fully\npressed) when reported by [`SDL_GetGamepadAxis()`]. Note that this is not the\nsame range that will be reported by the lower-level [`SDL_GetJoystickAxis()`].\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GAMEPAD_AXIS_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_LEFTX", + short_name: "LEFTX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_LEFTY", + short_name: "LEFTY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_RIGHTX", + short_name: "RIGHTX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_RIGHTY", + short_name: "RIGHTY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_LEFT_TRIGGER", + short_name: "LEFT_TRIGGER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_RIGHT_TRIGGER", + short_name: "RIGHT_TRIGGER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_AXIS_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GamepadBindingType: Group = Group { + module: "gamepad", + kind: GroupKind::Enum, + name: "SDL_GamepadBindingType", + short_name: "GamepadBindingType", + doc: Some( + "Types of gamepad control bindings.\n\nA gamepad is a collection of bindings that map arbitrary joystick buttons,\naxes and hat switches to specific positions on a generic console-style\ngamepad. This enum is used as part of [`SDL_GamepadBinding`] to specify those\nmappings.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GAMEPAD_BINDTYPE_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BINDTYPE_BUTTON", + short_name: "BUTTON", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BINDTYPE_AXIS", + short_name: "AXIS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GAMEPAD_BINDTYPE_HAT", + short_name: "HAT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GamepadBinding__AnonUnion1__AnonStruct1: Struct = Struct { + module: "gamepad", + kind: StructKind::Struct, + name: "SDL_GamepadBinding__AnonUnion1__AnonStruct1", + doc: None, + available_since: None, + fields: &[ + Field { + name: "axis", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "axis_min", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "axis_max", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_GamepadBinding__AnonUnion1__AnonStruct2: Struct = Struct { + module: "gamepad", + kind: StructKind::Struct, + name: "SDL_GamepadBinding__AnonUnion1__AnonStruct2", + doc: None, + available_since: None, + fields: &[ + Field { + name: "hat", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "hat_mask", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_GamepadBinding__AnonUnion1: Struct = Struct { + module: "gamepad", + kind: StructKind::Union, + name: "SDL_GamepadBinding__AnonUnion1", + doc: None, + available_since: None, + fields: &[ + Field { + name: "button", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "axis", + doc: None, + available_since: None, + ty: "SDL_GamepadBinding__AnonUnion1__AnonStruct1", + }, + Field { + name: "hat", + doc: None, + available_since: None, + ty: "SDL_GamepadBinding__AnonUnion1__AnonStruct2", + }, + ], +}; +pub const METADATA_SDL_GamepadBinding__AnonUnion2__AnonStruct1: Struct = Struct { + module: "gamepad", + kind: StructKind::Struct, + name: "SDL_GamepadBinding__AnonUnion2__AnonStruct1", + doc: None, + available_since: None, + fields: &[ + Field { + name: "axis", + doc: None, + available_since: None, + ty: "SDL_GamepadAxis", + }, + Field { + name: "axis_min", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "axis_max", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_GamepadBinding__AnonUnion2: Struct = Struct { + module: "gamepad", + kind: StructKind::Union, + name: "SDL_GamepadBinding__AnonUnion2", + doc: None, + available_since: None, + fields: &[ + Field { + name: "button", + doc: None, + available_since: None, + ty: "SDL_GamepadButton", + }, + Field { + name: "axis", + doc: None, + available_since: None, + ty: "SDL_GamepadBinding__AnonUnion2__AnonStruct1", + }, + ], +}; +pub const METADATA_SDL_GamepadBinding: Struct = Struct { + module: "gamepad", + kind: StructKind::Struct, + name: "SDL_GamepadBinding", + doc: Some( + "A mapping between one joystick input to a gamepad control.\n\nA gamepad has a collection of several bindings, to say, for example, when\njoystick button number 5 is pressed, that should be treated like the\ngamepad's \"start\" button.\n\nSDL has these bindings built-in for many popular controllers, and can add\nmore with a simple text string. Those strings are parsed into a collection\nof these structs to make it easier to operate on the data.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetGamepadBindings`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "input_type", + doc: None, + available_since: None, + ty: "SDL_GamepadBindingType", + }, + Field { + name: "input", + doc: None, + available_since: None, + ty: "SDL_GamepadBinding__AnonUnion1", + }, + Field { + name: "output_type", + doc: None, + available_since: None, + ty: "SDL_GamepadBindingType", + }, + Field { + name: "output", + doc: None, + available_since: None, + ty: "SDL_GamepadBinding__AnonUnion2", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/gpu.rs b/vendor/sdl3-sys/src/metadata/generated/gpu.rs new file mode 100644 index 00000000..42e46728 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/gpu.rs @@ -0,0 +1,4102 @@ +//! Metadata for items in the `crate::gpu` module + +use super::*; + +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_VERBOSE_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING", + short_name: "GPU_DEVICE_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN: + Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN: Property = + Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING", + short_name: "GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER: Property = + Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER", + short_name: "GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING", + short_name: "GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN: + Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER", + short_name: "GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN", + short_name: "GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN", + value: crate::gpu::SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_NAME_STRING", + short_name: "GPU_DEVICE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING", + short_name: "GPU_DEVICE_DRIVER_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING", + short_name: "GPU_DEVICE_DRIVER_VERSION_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING", + short_name: "GPU_DEVICE_DRIVER_INFO_STRING", + value: crate::gpu::SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING", + short_name: "GPU_COMPUTEPIPELINE_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING", + short_name: "GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING", + short_name: "GPU_SAMPLER_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_SHADER_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_SHADER_CREATE_NAME_STRING", + short_name: "GPU_SHADER_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_SHADER_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT", + short_name: "GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT", + short_name: "GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT", + short_name: "GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT", + short_name: "GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT", + short_name: "GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER", + short_name: "GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING", + short_name: "GPU_TEXTURE_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING", + short_name: "GPU_BUFFER_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING: Property = Property { + module: "gpu", + name: "SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING", + short_name: "GPU_TRANSFERBUFFER_CREATE_NAME_STRING", + value: crate::gpu::SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_GPUPrimitiveType: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUPrimitiveType", + short_name: "GPUPrimitiveType", + doc: Some( + "Specifies the primitive topology of a graphics pipeline.\n\nIf you are using POINTLIST you must include a point size output in the\nvertex shader.\n\n- For HLSL compiling to SPIRV you must decorate a float output with\n\\[\\[vk::builtin(\"PointSize\")\\]\\].\n- For GLSL you must set the gl_PointSize builtin.\n- For MSL you must include a float output with the \\[\\[point_size\\]\\]\ndecorator.\n\nNote that sized point topology is totally unsupported on D3D12. Any size\nother than 1 will be ignored. In general, you should avoid using point\ntopology for both compatibility and performance reasons. You WILL regret\nusing it.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_PRIMITIVETYPE_TRIANGLELIST", + short_name: "TRIANGLELIST", + doc: Some("A series of separate triangles.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP", + short_name: "TRIANGLESTRIP", + doc: Some("A series of connected triangles.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_PRIMITIVETYPE_LINELIST", + short_name: "LINELIST", + doc: Some("A series of separate lines.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_PRIMITIVETYPE_LINESTRIP", + short_name: "LINESTRIP", + doc: Some("A series of connected lines.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_PRIMITIVETYPE_POINTLIST", + short_name: "POINTLIST", + doc: Some("A series of separate points.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPULoadOp: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPULoadOp", + short_name: "GPULoadOp", + doc: Some( + "Specifies how the contents of a texture attached to a render pass are\ntreated at the beginning of the render pass.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BeginGPURenderPass`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_LOADOP_LOAD", + short_name: "LOAD", + doc: Some("The previous contents of the texture will be preserved.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_LOADOP_CLEAR", + short_name: "CLEAR", + doc: Some("The contents of the texture will be cleared to a color.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_LOADOP_DONT_CARE", + short_name: "DONT_CARE", + doc: Some( + "The previous contents of the texture need not be preserved. The contents will be undefined.\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUStoreOp: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUStoreOp", + short_name: "GPUStoreOp", + doc: Some( + "Specifies how the contents of a texture attached to a render pass are\ntreated at the end of the render pass.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BeginGPURenderPass`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_STOREOP_STORE", + short_name: "STORE", + doc: Some("The contents generated during the render pass will be written to memory.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STOREOP_DONT_CARE", + short_name: "DONT_CARE", + doc: Some( + "The contents generated during the render pass are not needed and may be discarded. The contents will be undefined.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STOREOP_RESOLVE", + short_name: "RESOLVE", + doc: Some( + "The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STOREOP_RESOLVE_AND_STORE", + short_name: "RESOLVE_AND_STORE", + doc: Some( + "The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory.\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUIndexElementSize: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUIndexElementSize", + short_name: "GPUIndexElementSize", + doc: Some( + "Specifies the size of elements in an index buffer.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_INDEXELEMENTSIZE_16BIT", + short_name: "_16BIT", + doc: Some("The index elements are 16-bit.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_INDEXELEMENTSIZE_32BIT", + short_name: "_32BIT", + doc: Some("The index elements are 32-bit.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUTextureFormat: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUTextureFormat", + short_name: "GPUTextureFormat", + doc: Some( + "Specifies the pixel format of a texture.\n\nTexture format support varies depending on driver, hardware, and usage\nflags. In general, you should use [`SDL_GPUTextureSupportsFormat`] to query if\na format is supported before using it. However, there are a few guaranteed\nformats.\n\nFIXME: Check universal support for 32-bit component formats FIXME: Check\nuniversal support for SIMULTANEOUS_READ_WRITE\n\nFor SAMPLER usage, the following formats are universally supported:\n\n- R8G8B8A8_UNORM\n- B8G8R8A8_UNORM\n- R8_UNORM\n- R8_SNORM\n- R8G8_UNORM\n- R8G8_SNORM\n- R8G8B8A8_SNORM\n- R16_FLOAT\n- R16G16_FLOAT\n- R16G16B16A16_FLOAT\n- R32_FLOAT\n- R32G32_FLOAT\n- R32G32B32A32_FLOAT\n- R11G11B10_UFLOAT\n- R8G8B8A8_UNORM_SRGB\n- B8G8R8A8_UNORM_SRGB\n- D16_UNORM\n\nFor COLOR_TARGET usage, the following formats are universally supported:\n\n- R8G8B8A8_UNORM\n- B8G8R8A8_UNORM\n- R8_UNORM\n- R16_FLOAT\n- R16G16_FLOAT\n- R16G16B16A16_FLOAT\n- R32_FLOAT\n- R32G32_FLOAT\n- R32G32B32A32_FLOAT\n- R8_UINT\n- R8G8_UINT\n- R8G8B8A8_UINT\n- R16_UINT\n- R16G16_UINT\n- R16G16B16A16_UINT\n- R8_INT\n- R8G8_INT\n- R8G8B8A8_INT\n- R16_INT\n- R16G16_INT\n- R16G16B16A16_INT\n- R8G8B8A8_UNORM_SRGB\n- B8G8R8A8_UNORM_SRGB\n\nFor STORAGE usages, the following formats are universally supported:\n\n- R8G8B8A8_UNORM\n- R8G8B8A8_SNORM\n- R16G16B16A16_FLOAT\n- R32_FLOAT\n- R32G32_FLOAT\n- R32G32B32A32_FLOAT\n- R8G8B8A8_UINT\n- R16G16B16A16_UINT\n- R8G8B8A8_INT\n- R16G16B16A16_INT\n\nFor DEPTH_STENCIL_TARGET usage, the following formats are universally\nsupported:\n\n- D16_UNORM\n- Either (but not necessarily both!) D24_UNORM or D32_FLOAT\n- Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT\n\nUnless D16_UNORM is sufficient for your purposes, always check which of\nD24/D32 is supported before creating a depth-stencil texture!\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTexture`]\n- [`SDL_GPUTextureSupportsFormat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_A8_UNORM", + short_name: "A8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8_UNORM", + short_name: "R8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8_UNORM", + short_name: "R8G8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM", + short_name: "R8G8B8A8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16_UNORM", + short_name: "R16_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16_UNORM", + short_name: "R16G16_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM", + short_name: "R16G16B16A16_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM", + short_name: "R10G10B10A2_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM", + short_name: "B5G6R5_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM", + short_name: "B5G5R5A1_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM", + short_name: "B4G4R4A4_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM", + short_name: "B8G8R8A8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM", + short_name: "BC1_RGBA_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM", + short_name: "BC2_RGBA_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM", + short_name: "BC3_RGBA_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM", + short_name: "BC4_R_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM", + short_name: "BC5_RG_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM", + short_name: "BC7_RGBA_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT", + short_name: "BC6H_RGB_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT", + short_name: "BC6H_RGB_UFLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8_SNORM", + short_name: "R8_SNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8_SNORM", + short_name: "R8G8_SNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM", + short_name: "R8G8B8A8_SNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16_SNORM", + short_name: "R16_SNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16_SNORM", + short_name: "R16G16_SNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM", + short_name: "R16G16B16A16_SNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16_FLOAT", + short_name: "R16_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT", + short_name: "R16G16_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT", + short_name: "R16G16B16A16_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32_FLOAT", + short_name: "R32_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT", + short_name: "R32G32_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT", + short_name: "R32G32B32A32_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT", + short_name: "R11G11B10_UFLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8_UINT", + short_name: "R8_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8_UINT", + short_name: "R8G8_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT", + short_name: "R8G8B8A8_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16_UINT", + short_name: "R16_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16_UINT", + short_name: "R16G16_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT", + short_name: "R16G16B16A16_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32_UINT", + short_name: "R32_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32G32_UINT", + short_name: "R32G32_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT", + short_name: "R32G32B32A32_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8_INT", + short_name: "R8_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8_INT", + short_name: "R8G8_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT", + short_name: "R8G8B8A8_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16_INT", + short_name: "R16_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16_INT", + short_name: "R16G16_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT", + short_name: "R16G16B16A16_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32_INT", + short_name: "R32_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32G32_INT", + short_name: "R32G32_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT", + short_name: "R32G32B32A32_INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB", + short_name: "R8G8B8A8_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB", + short_name: "B8G8R8A8_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB", + short_name: "BC1_RGBA_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB", + short_name: "BC2_RGBA_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB", + short_name: "BC3_RGBA_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB", + short_name: "BC7_RGBA_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_D16_UNORM", + short_name: "D16_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_D24_UNORM", + short_name: "D24_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_D32_FLOAT", + short_name: "D32_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT", + short_name: "D24_UNORM_S8_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT", + short_name: "D32_FLOAT_S8_UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM", + short_name: "ASTC_4x4_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM", + short_name: "ASTC_5x4_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM", + short_name: "ASTC_5x5_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM", + short_name: "ASTC_6x5_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM", + short_name: "ASTC_6x6_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM", + short_name: "ASTC_8x5_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM", + short_name: "ASTC_8x6_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM", + short_name: "ASTC_8x8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM", + short_name: "ASTC_10x5_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM", + short_name: "ASTC_10x6_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM", + short_name: "ASTC_10x8_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM", + short_name: "ASTC_10x10_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM", + short_name: "ASTC_12x10_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM", + short_name: "ASTC_12x12_UNORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB", + short_name: "ASTC_4x4_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB", + short_name: "ASTC_5x4_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB", + short_name: "ASTC_5x5_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB", + short_name: "ASTC_6x5_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB", + short_name: "ASTC_6x6_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB", + short_name: "ASTC_8x5_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB", + short_name: "ASTC_8x6_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB", + short_name: "ASTC_8x8_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB", + short_name: "ASTC_10x5_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB", + short_name: "ASTC_10x6_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB", + short_name: "ASTC_10x8_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB", + short_name: "ASTC_10x10_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB", + short_name: "ASTC_12x10_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB", + short_name: "ASTC_12x12_UNORM_SRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT", + short_name: "ASTC_4x4_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT", + short_name: "ASTC_5x4_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT", + short_name: "ASTC_5x5_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT", + short_name: "ASTC_6x5_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT", + short_name: "ASTC_6x6_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT", + short_name: "ASTC_8x5_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT", + short_name: "ASTC_8x6_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT", + short_name: "ASTC_8x8_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT", + short_name: "ASTC_10x5_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT", + short_name: "ASTC_10x6_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT", + short_name: "ASTC_10x8_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT", + short_name: "ASTC_10x10_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT", + short_name: "ASTC_12x10_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT", + short_name: "ASTC_12x12_FLOAT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUTextureUsageFlags: Group = Group { + module: "gpu", + kind: GroupKind::Flags, + name: "SDL_GPUTextureUsageFlags", + short_name: "GPUTextureUsageFlags", + doc: Some( + "Specifies how a texture is intended to be used by the client.\n\nA texture must have at least one usage flag.\nNote that combining SAMPLER with STORAGE_READ flags is invalid.\n\nWith regards to compute storage usage, READ | WRITE means that you can have\nshader A that only writes into the texture and shader B that only reads\nfrom the texture and bind the same texture to either shader respectively.\nSIMULTANEOUS means that you can do reads and writes within the same shader\nor compute pass. It also implies that atomic ops can be used, since those\nare read-modify-write operations. If you use SIMULTANEOUS, you are\nresponsible for avoiding data races, as there is no data synchronization\nwithin a compute pass. Note that SIMULTANEOUS usage is only supported by a\nlimited number of texture formats.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_SAMPLER", + short_name: "SAMPLER", + doc: Some("Texture supports sampling.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_COLOR_TARGET", + short_name: "COLOR_TARGET", + doc: Some("Texture is a color render target.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET", + short_name: "DEPTH_STENCIL_TARGET", + doc: Some("Texture is a depth stencil target.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ", + short_name: "GRAPHICS_STORAGE_READ", + doc: Some("Texture supports storage reads in graphics stages.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ", + short_name: "COMPUTE_STORAGE_READ", + doc: Some("Texture supports storage reads in the compute stage.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE", + short_name: "COMPUTE_STORAGE_WRITE", + doc: Some("Texture supports storage writes in the compute stage.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE", + short_name: "COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE", + doc: Some( + "Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUTextureType: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUTextureType", + short_name: "GPUTextureType", + doc: Some( + "Specifies the type of a texture.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_TEXTURETYPE_2D", + short_name: "_2D", + doc: Some("The texture is a 2-dimensional image.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTURETYPE_2D_ARRAY", + short_name: "_2D_ARRAY", + doc: Some("The texture is a 2-dimensional array image.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTURETYPE_3D", + short_name: "_3D", + doc: Some("The texture is a 3-dimensional image.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTURETYPE_CUBE", + short_name: "CUBE", + doc: Some("The texture is a cube image.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TEXTURETYPE_CUBE_ARRAY", + short_name: "CUBE_ARRAY", + doc: Some("The texture is a cube array image.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUSampleCount: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUSampleCount", + short_name: "GPUSampleCount", + doc: Some( + "Specifies the sample count of a texture.\n\nUsed in multisampling. Note that this value only applies when the texture\nis used as a render target.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTexture`]\n- [`SDL_GPUTextureSupportsSampleCount`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_SAMPLECOUNT_1", + short_name: "_1", + doc: Some("No multisampling.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SAMPLECOUNT_2", + short_name: "_2", + doc: Some("MSAA 2x\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SAMPLECOUNT_4", + short_name: "_4", + doc: Some("MSAA 4x\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SAMPLECOUNT_8", + short_name: "_8", + doc: Some("MSAA 8x\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUCubeMapFace: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUCubeMapFace", + short_name: "GPUCubeMapFace", + doc: Some( + "Specifies the face of a cube map.\n\nCan be passed in as the layer field in texture-related structs.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_CUBEMAPFACE_POSITIVEX", + short_name: "POSITIVEX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CUBEMAPFACE_NEGATIVEX", + short_name: "NEGATIVEX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CUBEMAPFACE_POSITIVEY", + short_name: "POSITIVEY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CUBEMAPFACE_NEGATIVEY", + short_name: "NEGATIVEY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CUBEMAPFACE_POSITIVEZ", + short_name: "POSITIVEZ", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CUBEMAPFACE_NEGATIVEZ", + short_name: "NEGATIVEZ", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUBufferUsageFlags: Group = Group { + module: "gpu", + kind: GroupKind::Flags, + name: "SDL_GPUBufferUsageFlags", + short_name: "GPUBufferUsageFlags", + doc: Some( + "Specifies how a buffer is intended to be used by the client.\n\nA buffer must have at least one usage flag.\n\nIf a buffer has multiple read usages, this may lead to a performance penalty\ndue to more conservative memory barriers, but it also may not necessarily affect the performance.\n\nUnlike textures, READ | WRITE can be used for simultaneous read-write\nusage. The same data synchronization concerns as textures apply.\n\nIf you use a STORAGE flag, the data in the buffer must respect std140\nlayout conventions. In practical terms this means you must ensure that vec3\nand vec4 fields are 16-byte aligned.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_BUFFERUSAGE_VERTEX", + short_name: "VERTEX", + doc: Some("Buffer is a vertex buffer.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BUFFERUSAGE_INDEX", + short_name: "INDEX", + doc: Some("Buffer is an index buffer.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BUFFERUSAGE_INDIRECT", + short_name: "INDIRECT", + doc: Some("Buffer is an indirect buffer.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ", + short_name: "GRAPHICS_STORAGE_READ", + doc: Some("Buffer supports storage reads in graphics stages.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ", + short_name: "COMPUTE_STORAGE_READ", + doc: Some("Buffer supports storage reads in the compute stage.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE", + short_name: "COMPUTE_STORAGE_WRITE", + doc: Some("Buffer supports storage writes in the compute stage.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUTransferBufferUsage: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUTransferBufferUsage", + short_name: "GPUTransferBufferUsage", + doc: Some( + "Specifies how a transfer buffer is intended to be used by the client.\n\nNote that mapping and copying FROM an upload transfer buffer or TO a\ndownload transfer buffer is undefined behavior.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTransferBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD", + short_name: "UPLOAD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD", + short_name: "DOWNLOAD", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUShaderStage: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUShaderStage", + short_name: "GPUShaderStage", + doc: Some( + "Specifies which stage a shader program corresponds to.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUShader`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_SHADERSTAGE_VERTEX", + short_name: "VERTEX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERSTAGE_FRAGMENT", + short_name: "FRAGMENT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUShaderFormat: Group = Group { + module: "gpu", + kind: GroupKind::Flags, + name: "SDL_GPUShaderFormat", + short_name: "GPUShaderFormat", + doc: Some( + "Specifies the format of shader code.\n\nEach format corresponds to a specific backend that accepts it.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUShader`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_SHADERFORMAT_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERFORMAT_PRIVATE", + short_name: "PRIVATE", + doc: Some("Shaders for NDA'd platforms.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERFORMAT_SPIRV", + short_name: "SPIRV", + doc: Some("SPIR-V shaders for Vulkan.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERFORMAT_DXBC", + short_name: "DXBC", + doc: Some("DXBC SM5_1 shaders for D3D12.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERFORMAT_DXIL", + short_name: "DXIL", + doc: Some("DXIL SM6_0 shaders for D3D12.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERFORMAT_MSL", + short_name: "MSL", + doc: Some("MSL shaders for Metal.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SHADERFORMAT_METALLIB", + short_name: "METALLIB", + doc: Some("Precompiled metallib shaders for Metal.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUVertexElementFormat: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUVertexElementFormat", + short_name: "GPUVertexElementFormat", + doc: Some( + "Specifies the format of a vertex attribute.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_INT", + short_name: "INT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_INT2", + short_name: "INT2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_INT3", + short_name: "INT3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_INT4", + short_name: "INT4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UINT", + short_name: "UINT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UINT2", + short_name: "UINT2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UINT3", + short_name: "UINT3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UINT4", + short_name: "UINT4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT", + short_name: "FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2", + short_name: "FLOAT2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3", + short_name: "FLOAT3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4", + short_name: "FLOAT4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_BYTE2", + short_name: "BYTE2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_BYTE4", + short_name: "BYTE4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2", + short_name: "UBYTE2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4", + short_name: "UBYTE4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM", + short_name: "BYTE2_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM", + short_name: "BYTE4_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM", + short_name: "UBYTE2_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM", + short_name: "UBYTE4_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_SHORT2", + short_name: "SHORT2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_SHORT4", + short_name: "SHORT4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_USHORT2", + short_name: "USHORT2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_USHORT4", + short_name: "USHORT4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM", + short_name: "SHORT2_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM", + short_name: "SHORT4_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM", + short_name: "USHORT2_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM", + short_name: "USHORT4_NORM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_HALF2", + short_name: "HALF2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXELEMENTFORMAT_HALF4", + short_name: "HALF4", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUVertexInputRate: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUVertexInputRate", + short_name: "GPUVertexInputRate", + doc: Some( + "Specifies the rate at which vertex attributes are pulled from buffers.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_VERTEXINPUTRATE_VERTEX", + short_name: "VERTEX", + doc: Some("Attribute addressing is a function of the vertex index.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_VERTEXINPUTRATE_INSTANCE", + short_name: "INSTANCE", + doc: Some("Attribute addressing is a function of the instance index.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUFillMode: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUFillMode", + short_name: "GPUFillMode", + doc: Some( + "Specifies the fill mode of the graphics pipeline.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_FILLMODE_FILL", + short_name: "FILL", + doc: Some("Polygons will be rendered via rasterization.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_FILLMODE_LINE", + short_name: "LINE", + doc: Some("Polygon edges will be drawn as line segments.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUCullMode: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUCullMode", + short_name: "GPUCullMode", + doc: Some( + "Specifies the facing direction in which triangle faces will be culled.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_CULLMODE_NONE", + short_name: "NONE", + doc: Some("No triangles are culled.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CULLMODE_FRONT", + short_name: "FRONT", + doc: Some("Front-facing triangles are culled.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_CULLMODE_BACK", + short_name: "BACK", + doc: Some("Back-facing triangles are culled.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUFrontFace: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUFrontFace", + short_name: "GPUFrontFace", + doc: Some( + "Specifies the vertex winding that will cause a triangle to be determined to\nbe front-facing.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE", + short_name: "COUNTER_CLOCKWISE", + doc: Some( + "A triangle with counter-clockwise vertex winding will be considered front-facing.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_FRONTFACE_CLOCKWISE", + short_name: "CLOCKWISE", + doc: Some( + "A triangle with clockwise vertex winding will be considered front-facing.\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUCompareOp: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUCompareOp", + short_name: "GPUCompareOp", + doc: Some( + "Specifies a comparison operator for depth, stencil and sampler operations.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_COMPAREOP_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_NEVER", + short_name: "NEVER", + doc: Some("The comparison always evaluates false.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_LESS", + short_name: "LESS", + doc: Some("The comparison evaluates reference < test.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_EQUAL", + short_name: "EQUAL", + doc: Some("The comparison evaluates reference == test.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_LESS_OR_EQUAL", + short_name: "LESS_OR_EQUAL", + doc: Some("The comparison evaluates reference <= test.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_GREATER", + short_name: "GREATER", + doc: Some("The comparison evaluates reference > test.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_NOT_EQUAL", + short_name: "NOT_EQUAL", + doc: Some("The comparison evaluates reference != test.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_GREATER_OR_EQUAL", + short_name: "GREATER_OR_EQUAL", + doc: Some("The comparison evaluates reference >= test.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COMPAREOP_ALWAYS", + short_name: "ALWAYS", + doc: Some("The comparison always evaluates true.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUStencilOp: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUStencilOp", + short_name: "GPUStencilOp", + doc: Some( + "Specifies what happens to a stored stencil value if stencil tests fail or\npass.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_STENCILOP_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_KEEP", + short_name: "KEEP", + doc: Some("Keeps the current value.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_ZERO", + short_name: "ZERO", + doc: Some("Sets the value to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_REPLACE", + short_name: "REPLACE", + doc: Some("Sets the value to reference.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP", + short_name: "INCREMENT_AND_CLAMP", + doc: Some("Increments the current value and clamps to the maximum value.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP", + short_name: "DECREMENT_AND_CLAMP", + doc: Some("Decrements the current value and clamps to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_INVERT", + short_name: "INVERT", + doc: Some("Bitwise-inverts the current value.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_INCREMENT_AND_WRAP", + short_name: "INCREMENT_AND_WRAP", + doc: Some("Increments the current value and wraps back to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_STENCILOP_DECREMENT_AND_WRAP", + short_name: "DECREMENT_AND_WRAP", + doc: Some("Decrements the current value and wraps to the maximum value.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUBlendOp: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUBlendOp", + short_name: "GPUBlendOp", + doc: Some( + "Specifies the operator to be used when pixels in a render target are\nblended with existing pixels in the texture.\n\nThe source color is the value written by the fragment shader. The\ndestination color is the value currently existing in the texture.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_BLENDOP_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDOP_ADD", + short_name: "ADD", + doc: Some("(source * source_factor) + (destination * destination_factor)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDOP_SUBTRACT", + short_name: "SUBTRACT", + doc: Some("(source * source_factor) - (destination * destination_factor)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDOP_REVERSE_SUBTRACT", + short_name: "REVERSE_SUBTRACT", + doc: Some("(destination * destination_factor) - (source * source_factor)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDOP_MIN", + short_name: "MIN", + doc: Some("min(source, destination)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDOP_MAX", + short_name: "MAX", + doc: Some("max(source, destination)\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUBlendFactor: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUBlendFactor", + short_name: "GPUBlendFactor", + doc: Some( + "Specifies a blending factor to be used when pixels in a render target are\nblended with existing pixels in the texture.\n\nThe source color is the value written by the fragment shader. The\ndestination color is the value currently existing in the texture.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_BLENDFACTOR_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ZERO", + short_name: "ZERO", + doc: Some("0\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ONE", + short_name: "ONE", + doc: Some("1\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_SRC_COLOR", + short_name: "SRC_COLOR", + doc: Some("source color\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR", + short_name: "ONE_MINUS_SRC_COLOR", + doc: Some("1 - source color\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_DST_COLOR", + short_name: "DST_COLOR", + doc: Some("destination color\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR", + short_name: "ONE_MINUS_DST_COLOR", + doc: Some("1 - destination color\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_SRC_ALPHA", + short_name: "SRC_ALPHA", + doc: Some("source alpha\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA", + short_name: "ONE_MINUS_SRC_ALPHA", + doc: Some("1 - source alpha\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_DST_ALPHA", + short_name: "DST_ALPHA", + doc: Some("destination alpha\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA", + short_name: "ONE_MINUS_DST_ALPHA", + doc: Some("1 - destination alpha\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_CONSTANT_COLOR", + short_name: "CONSTANT_COLOR", + doc: Some("blend constant\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR", + short_name: "ONE_MINUS_CONSTANT_COLOR", + doc: Some("1 - blend constant\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE", + short_name: "SRC_ALPHA_SATURATE", + doc: Some("min(source alpha, 1 - destination alpha)\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUColorComponentFlags: Group = Group { + module: "gpu", + kind: GroupKind::Flags, + name: "SDL_GPUColorComponentFlags", + short_name: "GPUColorComponentFlags", + doc: Some( + "Specifies which color components are written in a graphics pipeline.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_COLORCOMPONENT_R", + short_name: "R", + doc: Some("the red component\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COLORCOMPONENT_G", + short_name: "G", + doc: Some("the green component\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COLORCOMPONENT_B", + short_name: "B", + doc: Some("the blue component\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_COLORCOMPONENT_A", + short_name: "A", + doc: Some("the alpha component\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUFilter: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUFilter", + short_name: "GPUFilter", + doc: Some( + "Specifies a filter operation used by a sampler.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUSampler`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_FILTER_NEAREST", + short_name: "NEAREST", + doc: Some("Point filtering.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_FILTER_LINEAR", + short_name: "LINEAR", + doc: Some("Linear filtering.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUSamplerMipmapMode: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUSamplerMipmapMode", + short_name: "GPUSamplerMipmapMode", + doc: Some( + "Specifies a mipmap mode used by a sampler.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUSampler`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_SAMPLERMIPMAPMODE_NEAREST", + short_name: "NEAREST", + doc: Some("Point filtering.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SAMPLERMIPMAPMODE_LINEAR", + short_name: "LINEAR", + doc: Some("Linear filtering.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUSamplerAddressMode: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUSamplerAddressMode", + short_name: "GPUSamplerAddressMode", + doc: Some( + "Specifies behavior of texture sampling when the coordinates exceed the 0-1\nrange.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUSampler`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_SAMPLERADDRESSMODE_REPEAT", + short_name: "REPEAT", + doc: Some("Specifies that the coordinates will wrap around.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT", + short_name: "MIRRORED_REPEAT", + doc: Some("Specifies that the coordinates will wrap around mirrored.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE", + short_name: "CLAMP_TO_EDGE", + doc: Some("Specifies that the coordinates will clamp to the 0-1 range.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUPresentMode: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUPresentMode", + short_name: "GPUPresentMode", + doc: Some( + "Specifies the timing that will be used to present swapchain textures to the\nOS.\n\nVSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be\nsupported on certain systems.\n\nIt is recommended to query [`SDL_WindowSupportsGPUPresentMode`] after claiming\nthe window if you wish to change the present mode to IMMEDIATE or MAILBOX.\n\n- VSYNC: Waits for vblank before presenting. No tearing is possible. If\nthere is a pending image to present, the new image is enqueued for\npresentation. Disallows tearing at the cost of visual latency.\n- IMMEDIATE: Immediately presents. Lowest latency option, but tearing may\noccur.\n- MAILBOX: Waits for vblank before presenting. No tearing is possible. If\nthere is a pending image to present, the pending image is replaced by the\nnew image. Similar to VSYNC, but with reduced visual latency.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetGPUSwapchainParameters`]\n- [`SDL_WindowSupportsGPUPresentMode`]\n- [`SDL_WaitAndAcquireGPUSwapchainTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_PRESENTMODE_VSYNC", + short_name: "VSYNC", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_PRESENTMODE_IMMEDIATE", + short_name: "IMMEDIATE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_PRESENTMODE_MAILBOX", + short_name: "MAILBOX", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUSwapchainComposition: Group = Group { + module: "gpu", + kind: GroupKind::Enum, + name: "SDL_GPUSwapchainComposition", + short_name: "GPUSwapchainComposition", + doc: Some( + "Specifies the texture format and colorspace of the swapchain textures.\n\nSDR will always be supported. Other compositions may not be supported on\ncertain systems.\n\nIt is recommended to query [`SDL_WindowSupportsGPUSwapchainComposition`] after\nclaiming the window if you wish to change the swapchain composition from\nSDR.\n\n- SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in sRGB encoding.\n- SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are\nstored in memory in sRGB encoding but accessed in shaders in \"linear\nsRGB\" encoding which is sRGB but with a linear transfer function.\n- HDR_EXTENDED_LINEAR: R16G16B16A16_FLOAT swapchain. Pixel values are in\nextended linear sRGB encoding and permits values outside of the \\[0, 1\\]\nrange.\n- HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in\nBT.2020 ST2084 (PQ) encoding.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetGPUSwapchainParameters`]\n- [`SDL_WindowSupportsGPUSwapchainComposition`]\n- [`SDL_WaitAndAcquireGPUSwapchainTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GPU_SWAPCHAINCOMPOSITION_SDR", + short_name: "SDR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR", + short_name: "SDR_LINEAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR", + short_name: "HDR_EXTENDED_LINEAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084", + short_name: "HDR10_ST2084", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GPUViewport: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUViewport", + doc: Some( + "A structure specifying a viewport.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetGPUViewport`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "x", + doc: Some("The left offset of the viewport.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("The top offset of the viewport.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "w", + doc: Some("The width of the viewport.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "h", + doc: Some("The height of the viewport.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "min_depth", + doc: Some("The minimum depth of the viewport.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "max_depth", + doc: Some("The maximum depth of the viewport.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_GPUTextureTransferInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTextureTransferInfo", + doc: Some( + "A structure specifying parameters related to transferring data to or from a\ntexture.\n\nIf either of `pixels_per_row` or `rows_per_layer` is zero, then width and\nheight of passed [`SDL_GPUTextureRegion`] to [`SDL_UploadToGPUTexture`] or\n[`SDL_DownloadFromGPUTexture`] are used as default values respectively and data\nis considered to be tightly packed.\n\n**WARNING**: On some older/integrated hardware, Direct3D 12 requires\ntexture data row pitch to be 256 byte aligned, and offsets to be aligned to\n512 bytes. If they are not, SDL will make a temporary copy of the data that\nis properly aligned, but this adds overhead to the transfer process. Apps\ncan avoid this by aligning their data appropriately, or using a different\nGPU backend than Direct3D 12.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_UploadToGPUTexture`]\n- [`SDL_DownloadFromGPUTexture`]\n- [`SDL_GPUTransferBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "transfer_buffer", + doc: Some("The transfer buffer used in the transfer operation.\n"), + available_since: None, + ty: "*mut SDL_GPUTransferBuffer", + }, + Field { + name: "offset", + doc: Some("The starting byte of the image data in the transfer buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "pixels_per_row", + doc: Some("The number of pixels from one row to the next.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "rows_per_layer", + doc: Some("The number of rows from one layer/depth-slice to the next.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUTransferBufferLocation: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTransferBufferLocation", + doc: Some( + "A structure specifying a location in a transfer buffer.\n\nUsed when transferring buffer data to or from a transfer buffer.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_UploadToGPUBuffer`]\n- [`SDL_DownloadFromGPUBuffer`]\n- [`SDL_GPUTransferBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "transfer_buffer", + doc: Some("The transfer buffer used in the transfer operation.\n"), + available_since: None, + ty: "*mut SDL_GPUTransferBuffer", + }, + Field { + name: "offset", + doc: Some("The starting byte of the buffer data in the transfer buffer.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUTextureLocation: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTextureLocation", + doc: Some( + "A structure specifying a location in a texture.\n\nUsed when copying data from one texture to another.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CopyGPUTextureToTexture`]\n- [`SDL_GPUTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some("The texture used in the copy operation.\n"), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "mip_level", + doc: Some("The mip level index of the location.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "layer", + doc: Some("The layer index of the location.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "x", + doc: Some("The left offset of the location.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "y", + doc: Some("The top offset of the location.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "z", + doc: Some("The front offset of the location.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUTextureRegion: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTextureRegion", + doc: Some( + "A structure specifying a region of a texture.\n\nUsed when transferring data to or from a texture.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_UploadToGPUTexture`]\n- [`SDL_DownloadFromGPUTexture`]\n- [`SDL_CreateGPUTexture`]\n- [`SDL_GPUTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some("The texture used in the copy operation.\n"), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "mip_level", + doc: Some("The mip level index to transfer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "layer", + doc: Some("The layer index to transfer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "x", + doc: Some("The left offset of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "y", + doc: Some("The top offset of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "z", + doc: Some("The front offset of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "w", + doc: Some("The width of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "h", + doc: Some("The height of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "d", + doc: Some("The depth of the region.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUBlitRegion: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUBlitRegion", + doc: Some( + "A structure specifying a region of a texture used in the blit operation.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BlitGPUTexture`]\n- [`SDL_GPUTexture`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some("The texture.\n"), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "mip_level", + doc: Some("The mip level index of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "layer_or_depth_plane", + doc: Some( + "The layer index or depth plane of the region. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "x", + doc: Some("The left offset of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "y", + doc: Some("The top offset of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "w", + doc: Some("The width of the region.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "h", + doc: Some("The height of the region.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUBufferLocation: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUBufferLocation", + doc: Some( + "A structure specifying a location in a buffer.\n\nUsed when copying data between buffers.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CopyGPUBufferToBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "buffer", + doc: Some("The buffer.\n"), + available_since: None, + ty: "*mut SDL_GPUBuffer", + }, + Field { + name: "offset", + doc: Some("The starting byte within the buffer.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUBufferRegion: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUBufferRegion", + doc: Some( + "A structure specifying a region of a buffer.\n\nUsed when transferring data to or from buffers.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_UploadToGPUBuffer`]\n- [`SDL_DownloadFromGPUBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "buffer", + doc: Some("The buffer.\n"), + available_since: None, + ty: "*mut SDL_GPUBuffer", + }, + Field { + name: "offset", + doc: Some("The starting byte within the buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "size", + doc: Some("The size in bytes of the region.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUIndirectDrawCommand: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUIndirectDrawCommand", + doc: Some( + "A structure specifying the parameters of an indirect draw command.\n\nNote that the `first_vertex` and `first_instance` parameters are NOT\ncompatible with built-in vertex/instance ID variables in shaders (for\nexample, SV_VertexID); GPU APIs and shader languages do not define these\nbuilt-in variables consistently, so if your shader depends on them, the\nonly way to keep behavior consistent and portable is to always pass 0 for\nthe correlating parameter in the draw calls.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_DrawGPUPrimitivesIndirect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "num_vertices", + doc: Some("The number of vertices to draw.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_instances", + doc: Some("The number of instances to draw.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "first_vertex", + doc: Some("The index of the first vertex to draw.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "first_instance", + doc: Some("The ID of the first instance to draw.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUIndexedIndirectDrawCommand: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUIndexedIndirectDrawCommand", + doc: Some( + "A structure specifying the parameters of an indexed indirect draw command.\n\nNote that the `first_vertex` and `first_instance` parameters are NOT\ncompatible with built-in vertex/instance ID variables in shaders (for\nexample, SV_VertexID); GPU APIs and shader languages do not define these\nbuilt-in variables consistently, so if your shader depends on them, the\nonly way to keep behavior consistent and portable is to always pass 0 for\nthe correlating parameter in the draw calls.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_DrawGPUIndexedPrimitivesIndirect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "num_indices", + doc: Some("The number of indices to draw per instance.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_instances", + doc: Some("The number of instances to draw.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "first_index", + doc: Some("The base index within the index buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "vertex_offset", + doc: Some( + "The value added to the vertex index before indexing into the vertex buffer.\n", + ), + available_since: None, + ty: "Sint32", + }, + Field { + name: "first_instance", + doc: Some("The ID of the first instance to draw.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUIndirectDispatchCommand: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUIndirectDispatchCommand", + doc: Some( + "A structure specifying the parameters of an indexed dispatch command.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_DispatchGPUComputeIndirect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "groupcount_x", + doc: Some("The number of local workgroups to dispatch in the X dimension.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "groupcount_y", + doc: Some("The number of local workgroups to dispatch in the Y dimension.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "groupcount_z", + doc: Some("The number of local workgroups to dispatch in the Z dimension.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUSamplerCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUSamplerCreateInfo", + doc: Some( + "A structure specifying the parameters of a sampler.\n\nNote that mip_lod_bias is a no-op for the Metal driver. For Metal, LOD bias\nmust be applied via shader instead.\n\n## Availability\nThis function is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUSampler`]\n- [`SDL_GPUFilter`]\n- [`SDL_GPUSamplerMipmapMode`]\n- [`SDL_GPUSamplerAddressMode`]\n- [`SDL_GPUCompareOp`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "min_filter", + doc: Some("The minification filter to apply to lookups.\n"), + available_since: None, + ty: "SDL_GPUFilter", + }, + Field { + name: "mag_filter", + doc: Some("The magnification filter to apply to lookups.\n"), + available_since: None, + ty: "SDL_GPUFilter", + }, + Field { + name: "mipmap_mode", + doc: Some("The mipmap filter to apply to lookups.\n"), + available_since: None, + ty: "SDL_GPUSamplerMipmapMode", + }, + Field { + name: "address_mode_u", + doc: Some("The addressing mode for U coordinates outside [0, 1).\n"), + available_since: None, + ty: "SDL_GPUSamplerAddressMode", + }, + Field { + name: "address_mode_v", + doc: Some("The addressing mode for V coordinates outside [0, 1).\n"), + available_since: None, + ty: "SDL_GPUSamplerAddressMode", + }, + Field { + name: "address_mode_w", + doc: Some("The addressing mode for W coordinates outside [0, 1).\n"), + available_since: None, + ty: "SDL_GPUSamplerAddressMode", + }, + Field { + name: "mip_lod_bias", + doc: Some("The bias to be added to mipmap LOD calculation.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "max_anisotropy", + doc: Some( + "The anisotropy value clamp used by the sampler. If enable_anisotropy is false, this is ignored.\n", + ), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "compare_op", + doc: Some("The comparison operator to apply to fetched data before filtering.\n"), + available_since: None, + ty: "SDL_GPUCompareOp", + }, + Field { + name: "min_lod", + doc: Some("Clamps the minimum of the computed LOD value.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "max_lod", + doc: Some("Clamps the maximum of the computed LOD value.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "enable_anisotropy", + doc: Some("true to enable anisotropic filtering.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "enable_compare", + doc: Some("true to enable comparison against a reference value during lookups.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPUVertexBufferDescription: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUVertexBufferDescription", + doc: Some( + "A structure specifying the parameters of vertex buffers used in a graphics\npipeline.\n\nWhen you call [`SDL_BindGPUVertexBuffers`], you specify the binding slots of\nthe vertex buffers. For example if you called [`SDL_BindGPUVertexBuffers`] with\na first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be\nused by the vertex buffers you pass in.\n\nVertex attributes are linked to buffers via the buffer_slot field of\n[`SDL_GPUVertexAttribute`]. For example, if an attribute has a buffer_slot of\n0, then that attribute belongs to the vertex buffer bound at slot 0.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUVertexAttribute`]\n- [`SDL_GPUVertexInputRate`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "slot", + doc: Some("The binding slot of the vertex buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "pitch", + doc: Some("The size of a single element + the offset between elements.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "input_rate", + doc: Some( + "Whether attribute addressing is a function of the vertex index or instance index.\n", + ), + available_since: None, + ty: "SDL_GPUVertexInputRate", + }, + Field { + name: "instance_step_rate", + doc: Some("Reserved for future use. Must be set to 0.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUVertexAttribute: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUVertexAttribute", + doc: Some( + "A structure specifying a vertex attribute.\n\nAll vertex attribute locations provided to an [`SDL_GPUVertexInputState`] must\nbe unique.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUVertexBufferDescription`]\n- [`SDL_GPUVertexInputState`]\n- [`SDL_GPUVertexElementFormat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "location", + doc: Some("The shader input location index.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "buffer_slot", + doc: Some("The binding slot of the associated vertex buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "format", + doc: Some("The size and type of the attribute data.\n"), + available_since: None, + ty: "SDL_GPUVertexElementFormat", + }, + Field { + name: "offset", + doc: Some( + "The byte offset of this attribute relative to the start of the vertex element.\n", + ), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUVertexInputState: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUVertexInputState", + doc: Some( + "A structure specifying the parameters of a graphics pipeline vertex input\nstate.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUGraphicsPipelineCreateInfo`]\n- [`SDL_GPUVertexBufferDescription`]\n- [`SDL_GPUVertexAttribute`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "vertex_buffer_descriptions", + doc: Some("A pointer to an array of vertex buffer descriptions.\n"), + available_since: None, + ty: "*const SDL_GPUVertexBufferDescription", + }, + Field { + name: "num_vertex_buffers", + doc: Some("The number of vertex buffer descriptions in the above array.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "vertex_attributes", + doc: Some("A pointer to an array of vertex attribute descriptions.\n"), + available_since: None, + ty: "*const SDL_GPUVertexAttribute", + }, + Field { + name: "num_vertex_attributes", + doc: Some("The number of vertex attribute descriptions in the above array.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUStencilOpState: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUStencilOpState", + doc: Some( + "A structure specifying the stencil operation state of a graphics pipeline.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUDepthStencilState`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "fail_op", + doc: Some("The action performed on samples that fail the stencil test.\n"), + available_since: None, + ty: "SDL_GPUStencilOp", + }, + Field { + name: "pass_op", + doc: Some("The action performed on samples that pass the depth and stencil tests.\n"), + available_since: None, + ty: "SDL_GPUStencilOp", + }, + Field { + name: "depth_fail_op", + doc: Some( + "The action performed on samples that pass the stencil test and fail the depth test.\n", + ), + available_since: None, + ty: "SDL_GPUStencilOp", + }, + Field { + name: "compare_op", + doc: Some("The comparison operator used in the stencil test.\n"), + available_since: None, + ty: "SDL_GPUCompareOp", + }, + ], +}; +pub const METADATA_SDL_GPUColorTargetBlendState: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUColorTargetBlendState", + doc: Some( + "A structure specifying the blend state of a color target.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetGPUBlendConstants`]\n- [`SDL_GPUColorTargetDescription`]\n- [`SDL_GPUBlendFactor`]\n- [`SDL_GPUBlendOp`]\n- [`SDL_GPUColorComponentFlags`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "src_color_blendfactor", + doc: Some("The value to be multiplied by the source RGB value.\n"), + available_since: None, + ty: "SDL_GPUBlendFactor", + }, + Field { + name: "dst_color_blendfactor", + doc: Some("The value to be multiplied by the destination RGB value.\n"), + available_since: None, + ty: "SDL_GPUBlendFactor", + }, + Field { + name: "color_blend_op", + doc: Some("The blend operation for the RGB components.\n"), + available_since: None, + ty: "SDL_GPUBlendOp", + }, + Field { + name: "src_alpha_blendfactor", + doc: Some("The value to be multiplied by the source alpha.\n"), + available_since: None, + ty: "SDL_GPUBlendFactor", + }, + Field { + name: "dst_alpha_blendfactor", + doc: Some("The value to be multiplied by the destination alpha.\n"), + available_since: None, + ty: "SDL_GPUBlendFactor", + }, + Field { + name: "alpha_blend_op", + doc: Some("The blend operation for the alpha component.\n"), + available_since: None, + ty: "SDL_GPUBlendOp", + }, + Field { + name: "color_write_mask", + doc: Some( + "A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false.\n", + ), + available_since: None, + ty: "SDL_GPUColorComponentFlags", + }, + Field { + name: "enable_blend", + doc: Some("Whether blending is enabled for the color target.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "enable_color_write_mask", + doc: Some("Whether the color write mask is enabled.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUShaderCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUShaderCreateInfo", + doc: Some( + "A structure specifying code and metadata for creating a shader object.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUShader`]\n- [`SDL_GPUShaderFormat`]\n- [`SDL_GPUShaderStage`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "code_size", + doc: Some("The size in bytes of the code pointed to.\n"), + available_since: None, + ty: "::core::primitive::usize", + }, + Field { + name: "code", + doc: Some("A pointer to shader code.\n"), + available_since: None, + ty: "*const Uint8", + }, + Field { + name: "entrypoint", + doc: Some( + "A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader.\n", + ), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "format", + doc: Some("The format of the shader code.\n"), + available_since: None, + ty: "SDL_GPUShaderFormat", + }, + Field { + name: "stage", + doc: Some("The stage the shader program corresponds to.\n"), + available_since: None, + ty: "SDL_GPUShaderStage", + }, + Field { + name: "num_samplers", + doc: Some("The number of samplers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_storage_textures", + doc: Some("The number of storage textures defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_storage_buffers", + doc: Some("The number of storage buffers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_uniform_buffers", + doc: Some("The number of uniform buffers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPUTextureCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTextureCreateInfo", + doc: Some( + "A structure specifying the parameters of a texture.\n\nUsage flags can be bitwise OR'd together for combinations of usages. Note\nthat certain usage combinations are invalid, for example SAMPLER and\nGRAPHICS_STORAGE.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTexture`]\n- [`SDL_GPUTextureType`]\n- [`SDL_GPUTextureFormat`]\n- [`SDL_GPUTextureUsageFlags`]\n- [`SDL_GPUSampleCount`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("The base dimensionality of the texture.\n"), + available_since: None, + ty: "SDL_GPUTextureType", + }, + Field { + name: "format", + doc: Some("The pixel format of the texture.\n"), + available_since: None, + ty: "SDL_GPUTextureFormat", + }, + Field { + name: "usage", + doc: Some("How the texture is intended to be used by the client.\n"), + available_since: None, + ty: "SDL_GPUTextureUsageFlags", + }, + Field { + name: "width", + doc: Some("The width of the texture.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "height", + doc: Some("The height of the texture.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "layer_count_or_depth", + doc: Some( + "The layer count or depth of the texture. This value is treated as a layer count on 2D array textures, and as a depth value on 3D textures.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_levels", + doc: Some("The number of mip levels in the texture.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "sample_count", + doc: Some( + "The number of samples per texel. Only applies if the texture is used as a render target.\n", + ), + available_since: None, + ty: "SDL_GPUSampleCount", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPUBufferCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUBufferCreateInfo", + doc: Some( + "A structure specifying the parameters of a buffer.\n\nUsage flags can be bitwise OR'd together for combinations of usages. Note\nthat certain combinations are invalid, for example VERTEX and INDEX.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUBuffer`]\n- [`SDL_GPUBufferUsageFlags`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "usage", + doc: Some("How the buffer is intended to be used by the client.\n"), + available_since: None, + ty: "SDL_GPUBufferUsageFlags", + }, + Field { + name: "size", + doc: Some("The size in bytes of the buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPUTransferBufferCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTransferBufferCreateInfo", + doc: Some( + "A structure specifying the parameters of a transfer buffer.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUTransferBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "usage", + doc: Some("How the transfer buffer is intended to be used by the client.\n"), + available_since: None, + ty: "SDL_GPUTransferBufferUsage", + }, + Field { + name: "size", + doc: Some("The size in bytes of the transfer buffer.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPURasterizerState: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPURasterizerState", + doc: Some( + "A structure specifying the parameters of the graphics pipeline rasterizer\nstate.\n\nNote that [`SDL_GPU_FILLMODE_LINE`] is not supported on many Android devices.\nFor those devices, the fill mode will automatically fall back to FILL.\n\nAlso note that the D3D12 driver will enable depth clamping even if\nenable_depth_clip is true. If you need this clamp+clip behavior, consider\nenabling depth clip and then manually clamping depth in your fragment\nshaders on Metal and Vulkan.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUGraphicsPipelineCreateInfo`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "fill_mode", + doc: Some("Whether polygons will be filled in or drawn as lines.\n"), + available_since: None, + ty: "SDL_GPUFillMode", + }, + Field { + name: "cull_mode", + doc: Some("The facing direction in which triangles will be culled.\n"), + available_since: None, + ty: "SDL_GPUCullMode", + }, + Field { + name: "front_face", + doc: Some( + "The vertex winding that will cause a triangle to be determined as front-facing.\n", + ), + available_since: None, + ty: "SDL_GPUFrontFace", + }, + Field { + name: "depth_bias_constant_factor", + doc: Some("A scalar factor controlling the depth value added to each fragment.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "depth_bias_clamp", + doc: Some("The maximum depth bias of a fragment.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "depth_bias_slope_factor", + doc: Some("A scalar factor applied to a fragment's slope in depth calculations.\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "enable_depth_bias", + doc: Some("true to bias fragment depth values.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "enable_depth_clip", + doc: Some("true to enable depth clip, false to enable depth clamp.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUMultisampleState: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUMultisampleState", + doc: Some( + "A structure specifying the parameters of the graphics pipeline multisample\nstate.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUGraphicsPipelineCreateInfo`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "sample_count", + doc: Some("The number of samples to be used in rasterization.\n"), + available_since: None, + ty: "SDL_GPUSampleCount", + }, + Field { + name: "sample_mask", + doc: Some("Reserved for future use. Must be set to 0.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "enable_mask", + doc: Some("Reserved for future use. Must be set to false.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "enable_alpha_to_coverage", + doc: Some("true enables the alpha-to-coverage feature.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUDepthStencilState: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUDepthStencilState", + doc: Some( + "A structure specifying the parameters of the graphics pipeline depth\nstencil state.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUGraphicsPipelineCreateInfo`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "compare_op", + doc: Some("The comparison operator used for depth testing.\n"), + available_since: None, + ty: "SDL_GPUCompareOp", + }, + Field { + name: "back_stencil_state", + doc: Some("The stencil op state for back-facing triangles.\n"), + available_since: None, + ty: "SDL_GPUStencilOpState", + }, + Field { + name: "front_stencil_state", + doc: Some("The stencil op state for front-facing triangles.\n"), + available_since: None, + ty: "SDL_GPUStencilOpState", + }, + Field { + name: "compare_mask", + doc: Some( + "Selects the bits of the stencil values participating in the stencil test.\n", + ), + available_since: None, + ty: "Uint8", + }, + Field { + name: "write_mask", + doc: Some("Selects the bits of the stencil values updated by the stencil test.\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "enable_depth_test", + doc: Some("true enables the depth test.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "enable_depth_write", + doc: Some( + "true enables depth writes. Depth writes are always disabled when enable_depth_test is false.\n", + ), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "enable_stencil_test", + doc: Some("true enables the stencil test.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUColorTargetDescription: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUColorTargetDescription", + doc: Some( + "A structure specifying the parameters of color targets used in a graphics\npipeline.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUGraphicsPipelineTargetInfo`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "format", + doc: Some("The pixel format of the texture to be used as a color target.\n"), + available_since: None, + ty: "SDL_GPUTextureFormat", + }, + Field { + name: "blend_state", + doc: Some("The blend state to be used for the color target.\n"), + available_since: None, + ty: "SDL_GPUColorTargetBlendState", + }, + ], +}; +pub const METADATA_SDL_GPUGraphicsPipelineTargetInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUGraphicsPipelineTargetInfo", + doc: Some( + "A structure specifying the descriptions of render targets used in a\ngraphics pipeline.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GPUGraphicsPipelineCreateInfo`]\n- [`SDL_GPUColorTargetDescription`]\n- [`SDL_GPUTextureFormat`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "color_target_descriptions", + doc: Some("A pointer to an array of color target descriptions.\n"), + available_since: None, + ty: "*const SDL_GPUColorTargetDescription", + }, + Field { + name: "num_color_targets", + doc: Some("The number of color target descriptions in the above array.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "depth_stencil_format", + doc: Some( + "The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.\n", + ), + available_since: None, + ty: "SDL_GPUTextureFormat", + }, + Field { + name: "has_depth_stencil_target", + doc: Some("true specifies that the pipeline uses a depth-stencil target.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUGraphicsPipelineCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUGraphicsPipelineCreateInfo", + doc: Some( + "A structure specifying the parameters of a graphics pipeline state.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUGraphicsPipeline`]\n- [`SDL_GPUShader`]\n- [`SDL_GPUVertexInputState`]\n- [`SDL_GPUPrimitiveType`]\n- [`SDL_GPURasterizerState`]\n- [`SDL_GPUMultisampleState`]\n- [`SDL_GPUDepthStencilState`]\n- [`SDL_GPUGraphicsPipelineTargetInfo`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "vertex_shader", + doc: Some("The vertex shader used by the graphics pipeline.\n"), + available_since: None, + ty: "*mut SDL_GPUShader", + }, + Field { + name: "fragment_shader", + doc: Some("The fragment shader used by the graphics pipeline.\n"), + available_since: None, + ty: "*mut SDL_GPUShader", + }, + Field { + name: "vertex_input_state", + doc: Some("The vertex layout of the graphics pipeline.\n"), + available_since: None, + ty: "SDL_GPUVertexInputState", + }, + Field { + name: "primitive_type", + doc: Some("The primitive topology of the graphics pipeline.\n"), + available_since: None, + ty: "SDL_GPUPrimitiveType", + }, + Field { + name: "rasterizer_state", + doc: Some("The rasterizer state of the graphics pipeline.\n"), + available_since: None, + ty: "SDL_GPURasterizerState", + }, + Field { + name: "multisample_state", + doc: Some("The multisample state of the graphics pipeline.\n"), + available_since: None, + ty: "SDL_GPUMultisampleState", + }, + Field { + name: "depth_stencil_state", + doc: Some("The depth-stencil state of the graphics pipeline.\n"), + available_since: None, + ty: "SDL_GPUDepthStencilState", + }, + Field { + name: "target_info", + doc: Some("Formats and blend modes for the render targets of the graphics pipeline.\n"), + available_since: None, + ty: "SDL_GPUGraphicsPipelineTargetInfo", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPUComputePipelineCreateInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUComputePipelineCreateInfo", + doc: Some( + "A structure specifying the parameters of a compute pipeline state.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateGPUComputePipeline`]\n- [`SDL_GPUShaderFormat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "code_size", + doc: Some("The size in bytes of the compute shader code pointed to.\n"), + available_since: None, + ty: "::core::primitive::usize", + }, + Field { + name: "code", + doc: Some("A pointer to compute shader code.\n"), + available_since: None, + ty: "*const Uint8", + }, + Field { + name: "entrypoint", + doc: Some( + "A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader.\n", + ), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "format", + doc: Some("The format of the compute shader code.\n"), + available_since: None, + ty: "SDL_GPUShaderFormat", + }, + Field { + name: "num_samplers", + doc: Some("The number of samplers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_readonly_storage_textures", + doc: Some("The number of readonly storage textures defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_readonly_storage_buffers", + doc: Some("The number of readonly storage buffers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_readwrite_storage_textures", + doc: Some("The number of read-write storage textures defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_readwrite_storage_buffers", + doc: Some("The number of read-write storage buffers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "num_uniform_buffers", + doc: Some("The number of uniform buffers defined in the shader.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "threadcount_x", + doc: Some( + "The number of threads in the X dimension. This should match the value in the shader.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "threadcount_y", + doc: Some( + "The number of threads in the Y dimension. This should match the value in the shader.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "threadcount_z", + doc: Some( + "The number of threads in the Z dimension. This should match the value in the shader.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; +pub const METADATA_SDL_GPUColorTargetInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUColorTargetInfo", + doc: Some( + "A structure specifying the parameters of a color target used by a render\npass.\n\nThe load_op field determines what is done with the texture at the beginning\nof the render pass.\n\n- LOAD: Loads the data currently in the texture. Not recommended for\nmultisample textures as it requires significant memory bandwidth.\n- CLEAR: Clears the texture to a single color.\n- DONT_CARE: The driver will do whatever it wants with the texture memory.\nThis is a good option if you know that every single pixel will be touched\nin the render pass.\n\nThe store_op field determines what is done with the color results of the\nrender pass.\n\n- STORE: Stores the results of the render pass in the texture. Not\nrecommended for multisample textures as it requires significant memory\nbandwidth.\n- DONT_CARE: The driver will do whatever it wants with the texture memory.\nThis is often a good option for depth/stencil textures.\n- RESOLVE: Resolves a multisample texture into resolve_texture, which must\nhave a sample count of 1. Then the driver may discard the multisample\ntexture memory. This is the most performant method of resolving a\nmultisample target.\n- RESOLVE_AND_STORE: Resolves a multisample texture into the\nresolve_texture, which must have a sample count of 1. Then the driver\nstores the multisample texture's contents. Not recommended as it requires\nsignificant memory bandwidth.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BeginGPURenderPass`]\n- [`SDL_FColor`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some("The texture that will be used as a color target by a render pass.\n"), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "mip_level", + doc: Some("The mip level to use as a color target.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "layer_or_depth_plane", + doc: Some( + "The layer index or depth plane to use as a color target. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "clear_color", + doc: Some( + "The color to clear the color target to at the start of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used.\n", + ), + available_since: None, + ty: "SDL_FColor", + }, + Field { + name: "load_op", + doc: Some( + "What is done with the contents of the color target at the beginning of the render pass.\n", + ), + available_since: None, + ty: "SDL_GPULoadOp", + }, + Field { + name: "store_op", + doc: Some("What is done with the results of the render pass.\n"), + available_since: None, + ty: "SDL_GPUStoreOp", + }, + Field { + name: "resolve_texture", + doc: Some( + "The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used.\n", + ), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "resolve_mip_level", + doc: Some( + "The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "resolve_layer", + doc: Some( + "The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "cycle", + doc: Some("true cycles the texture if the texture is bound and load_op is not LOAD\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "cycle_resolve_texture", + doc: Some( + "true cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used.\n", + ), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUDepthStencilTargetInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUDepthStencilTargetInfo", + doc: Some( + "A structure specifying the parameters of a depth-stencil target used by a\nrender pass.\n\nThe load_op field determines what is done with the depth contents of the\ntexture at the beginning of the render pass.\n\n- LOAD: Loads the depth values currently in the texture.\n- CLEAR: Clears the texture to a single depth.\n- DONT_CARE: The driver will do whatever it wants with the memory. This is\na good option if you know that every single pixel will be touched in the\nrender pass.\n\nThe store_op field determines what is done with the depth results of the\nrender pass.\n\n- STORE: Stores the depth results in the texture.\n- DONT_CARE: The driver will do whatever it wants with the depth results.\nThis is often a good option for depth/stencil textures that don't need to\nbe reused again.\n\nThe stencil_load_op field determines what is done with the stencil contents\nof the texture at the beginning of the render pass.\n\n- LOAD: Loads the stencil values currently in the texture.\n- CLEAR: Clears the stencil values to a single value.\n- DONT_CARE: The driver will do whatever it wants with the memory. This is\na good option if you know that every single pixel will be touched in the\nrender pass.\n\nThe stencil_store_op field determines what is done with the stencil results\nof the render pass.\n\n- STORE: Stores the stencil results in the texture.\n- DONT_CARE: The driver will do whatever it wants with the stencil results.\nThis is often a good option for depth/stencil textures that don't need to\nbe reused again.\n\nNote that depth/stencil targets do not support multisample resolves.\n\nDue to ABI limitations, depth textures with more than 255 layers are not\nsupported.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BeginGPURenderPass`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some( + "The texture that will be used as the depth stencil target by the render pass.\n", + ), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "clear_depth", + doc: Some( + "The value to clear the depth component to at the beginning of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used.\n", + ), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "load_op", + doc: Some( + "What is done with the depth contents at the beginning of the render pass.\n", + ), + available_since: None, + ty: "SDL_GPULoadOp", + }, + Field { + name: "store_op", + doc: Some("What is done with the depth results of the render pass.\n"), + available_since: None, + ty: "SDL_GPUStoreOp", + }, + Field { + name: "stencil_load_op", + doc: Some( + "What is done with the stencil contents at the beginning of the render pass.\n", + ), + available_since: None, + ty: "SDL_GPULoadOp", + }, + Field { + name: "stencil_store_op", + doc: Some("What is done with the stencil results of the render pass.\n"), + available_since: None, + ty: "SDL_GPUStoreOp", + }, + Field { + name: "cycle", + doc: Some( + "true cycles the texture if the texture is bound and any load ops are not LOAD\n", + ), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "clear_stencil", + doc: Some( + "The value to clear the stencil component to at the beginning of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used.\n", + ), + available_since: None, + ty: "Uint8", + }, + Field { + name: "mip_level", + doc: Some("The mip level to use as the depth stencil target.\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "layer", + doc: Some("The layer index to use as the depth stencil target.\n"), + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUBlitInfo: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUBlitInfo", + doc: Some( + "A structure containing parameters for a blit command.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BlitGPUTexture`]\n- [`SDL_GPUBlitRegion`]\n- [`SDL_GPULoadOp`]\n- [`SDL_FColor`]\n- [`SDL_FlipMode`]\n- [`SDL_GPUFilter`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "source", + doc: Some("The source region for the blit.\n"), + available_since: None, + ty: "SDL_GPUBlitRegion", + }, + Field { + name: "destination", + doc: Some("The destination region for the blit.\n"), + available_since: None, + ty: "SDL_GPUBlitRegion", + }, + Field { + name: "load_op", + doc: Some("What is done with the contents of the destination before the blit.\n"), + available_since: None, + ty: "SDL_GPULoadOp", + }, + Field { + name: "clear_color", + doc: Some( + "The color to clear the destination region to before the blit. Ignored if load_op is not [`SDL_GPU_LOADOP_CLEAR`].\n", + ), + available_since: None, + ty: "SDL_FColor", + }, + Field { + name: "flip_mode", + doc: Some("The flip mode for the source region.\n"), + available_since: None, + ty: "SDL_FlipMode", + }, + Field { + name: "filter", + doc: Some("The filter mode used when blitting.\n"), + available_since: None, + ty: "SDL_GPUFilter", + }, + Field { + name: "cycle", + doc: Some("true cycles the destination texture if it is already bound.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUBufferBinding: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUBufferBinding", + doc: Some( + "A structure specifying parameters in a buffer binding call.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BindGPUVertexBuffers`]\n- [`SDL_BindGPUIndexBuffer`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "buffer", + doc: Some( + "The buffer to bind. Must have been created with [`SDL_GPU_BUFFERUSAGE_VERTEX`] for [`SDL_BindGPUVertexBuffers`], or [`SDL_GPU_BUFFERUSAGE_INDEX`] for [`SDL_BindGPUIndexBuffer`].\n", + ), + available_since: None, + ty: "*mut SDL_GPUBuffer", + }, + Field { + name: "offset", + doc: Some("The starting byte of the data to bind in the buffer.\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; +pub const METADATA_SDL_GPUTextureSamplerBinding: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUTextureSamplerBinding", + doc: Some( + "A structure specifying parameters in a sampler binding call.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BindGPUVertexSamplers`]\n- [`SDL_BindGPUFragmentSamplers`]\n- [`SDL_GPUTexture`]\n- [`SDL_GPUSampler`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some( + "The texture to bind. Must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`].\n", + ), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "sampler", + doc: Some("The sampler to bind.\n"), + available_since: None, + ty: "*mut SDL_GPUSampler", + }, + ], +}; +pub const METADATA_SDL_GPUStorageBufferReadWriteBinding: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUStorageBufferReadWriteBinding", + doc: Some( + "A structure specifying parameters related to binding buffers in a compute\npass.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BeginGPUComputePass`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "buffer", + doc: Some( + "The buffer to bind. Must have been created with [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE`].\n", + ), + available_since: None, + ty: "*mut SDL_GPUBuffer", + }, + Field { + name: "cycle", + doc: Some("true cycles the buffer if it is already bound.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUStorageTextureReadWriteBinding: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUStorageTextureReadWriteBinding", + doc: Some( + "A structure specifying parameters related to binding textures in a compute\npass.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_BeginGPUComputePass`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "texture", + doc: Some( + "The texture to bind. Must have been created with [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE`] or [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`].\n", + ), + available_since: None, + ty: "*mut SDL_GPUTexture", + }, + Field { + name: "mip_level", + doc: Some("The mip level index to bind.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "layer", + doc: Some("The layer index to bind.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "cycle", + doc: Some("true cycles the texture if it is already bound.\n"), + available_since: None, + ty: "::core::primitive::bool", + }, + Field { + name: "padding1", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding2", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding3", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_GPUVulkanOptions: Struct = Struct { + module: "gpu", + kind: StructKind::Struct, + name: "SDL_GPUVulkanOptions", + doc: Some( + "A structure specifying additional options when using Vulkan.\n\nWhen no such structure is provided, SDL will use Vulkan API version 1.0 and\na minimal set of features. The requested API version influences how the\nfeature_list is processed by SDL. When requesting API version 1.0, the\nfeature_list is ignored. Only the vulkan_10_physical_device_features and\nthe extension lists are used. When requesting API version 1.1, the\nfeature_list is scanned for feature structures introduced in Vulkan 1.1.\nWhen requesting Vulkan 1.2 or higher, the feature_list is additionally\nscanned for compound feature structs such as\nVkPhysicalDeviceVulkan11Features. The device and instance extension lists,\nas well as vulkan_10_physical_device_features, are always processed.\n\n## Availability\nThis struct is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), + fields: &[ + Field { + name: "vulkan_api_version", + doc: Some( + "The Vulkan API version to request for the instance. Use Vulkan's VK_MAKE_VERSION or VK_MAKE_API_VERSION.\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "feature_list", + doc: Some( + "Pointer to the first element of a chain of Vulkan feature structs. (Requires API version 1.1 or higher.)\n", + ), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + Field { + name: "vulkan_10_physical_device_features", + doc: Some( + "Pointer to a VkPhysicalDeviceFeatures struct to enable additional Vulkan 1.0 features.\n", + ), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + Field { + name: "device_extension_count", + doc: Some("Number of additional device extensions to require.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "device_extension_names", + doc: Some("Pointer to a list of additional device extensions to require.\n"), + available_since: None, + ty: "*mut *const ::core::ffi::c_char", + }, + Field { + name: "instance_extension_count", + doc: Some("Number of additional instance extensions to require.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "instance_extension_names", + doc: Some("Pointer to a list of additional instance extensions to require.\n"), + available_since: None, + ty: "*mut *const ::core::ffi::c_char", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/guid.rs b/vendor/sdl3-sys/src/metadata/generated/guid.rs new file mode 100644 index 00000000..b4297335 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/guid.rs @@ -0,0 +1,19 @@ +//! Metadata for items in the `crate::guid` module + +use super::*; + +pub const METADATA_SDL_GUID: Struct = Struct { + module: "guid", + kind: StructKind::Struct, + name: "SDL_GUID", + doc: Some( + "An [`SDL_GUID`] is a 128-bit identifier for an input device that identifies\nthat device across runs of SDL programs on the same platform.\n\nIf the device is detached and then re-attached to a different port, or if\nthe base system is rebooted, the device should still report the same GUID.\n\nGUIDs are as precise as possible but are not guaranteed to distinguish\nphysically distinct but equivalent devices. For example, two game\ncontrollers from the same vendor with the same product ID and revision may\nhave the same GUID.\n\nGUIDs may be platform-dependent (i.e., the same device may report different\nGUIDs on different operating systems).\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[Field { + name: "data", + doc: None, + available_since: None, + ty: "[Uint8; 16]", + }], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/haptic.rs b/vendor/sdl3-sys/src/metadata/generated/haptic.rs new file mode 100644 index 00000000..bc65eac0 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/haptic.rs @@ -0,0 +1,786 @@ +//! Metadata for items in the `crate::haptic` module + +use super::*; + +pub const METADATA_SDL_HapticEffectType: Group = Group { + module: "haptic", + kind: GroupKind::Flags, + name: "SDL_HapticEffectType", + short_name: "HapticEffectType", + doc: Some("* Type of haptic effect.\n"), + available_since: None, + values: &[ + GroupValue { + name: "SDL_HAPTIC_CONSTANT", + short_name: "CONSTANT", + doc: Some( + "Constant effect supported.\n\nConstant haptic effect.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticCondition`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_SINE", + short_name: "SINE", + doc: Some( + "Sine wave effect supported.\n\nPeriodic haptic effect that simulates sine waves.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticPeriodic`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_SQUARE", + short_name: "SQUARE", + doc: Some( + "Square wave effect supported.\n\nPeriodic haptic effect that simulates square waves.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticPeriodic`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_TRIANGLE", + short_name: "TRIANGLE", + doc: Some( + "Triangle wave effect supported.\n\nPeriodic haptic effect that simulates triangular waves.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticPeriodic`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_SAWTOOTHUP", + short_name: "SAWTOOTHUP", + doc: Some( + "Sawtoothup wave effect supported.\n\nPeriodic haptic effect that simulates saw tooth up waves.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticPeriodic`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_SAWTOOTHDOWN", + short_name: "SAWTOOTHDOWN", + doc: Some( + "Sawtoothdown wave effect supported.\n\nPeriodic haptic effect that simulates saw tooth down waves.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticPeriodic`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_RAMP", + short_name: "RAMP", + doc: Some( + "Ramp effect supported.\n\nRamp haptic effect.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticRamp`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_SPRING", + short_name: "SPRING", + doc: Some( + "Spring effect supported - uses axes position.\n\nCondition haptic effect that simulates a spring. Effect is based on the\naxes position.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticCondition`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_DAMPER", + short_name: "DAMPER", + doc: Some( + "Damper effect supported - uses axes velocity.\n\nCondition haptic effect that simulates dampening. Effect is based on the\naxes velocity.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticCondition`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_INERTIA", + short_name: "INERTIA", + doc: Some( + "Inertia effect supported - uses axes acceleration.\n\nCondition haptic effect that simulates inertia. Effect is based on the axes\nacceleration.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticCondition`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_FRICTION", + short_name: "FRICTION", + doc: Some( + "Friction effect supported - uses axes movement.\n\nCondition haptic effect that simulates friction. Effect is based on the\naxes movement.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticCondition`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_LEFTRIGHT", + short_name: "LEFTRIGHT", + doc: Some( + "Left/Right effect supported.\n\nHaptic effect for direct control over high/low frequency motors.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticLeftRight`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_RESERVED1", + short_name: "RESERVED1", + doc: Some( + "Reserved for future use.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_RESERVED2", + short_name: "RESERVED2", + doc: Some( + "Reserved for future use.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_RESERVED3", + short_name: "RESERVED3", + doc: Some( + "Reserved for future use.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_CUSTOM", + short_name: "CUSTOM", + doc: Some( + "Custom effect is supported.\n\nUser defined custom haptic effect.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_GAIN", + short_name: "GAIN", + doc: Some( + "Device can set global gain.\n\nDevice supports setting the global gain.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetHapticGain`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_AUTOCENTER", + short_name: "AUTOCENTER", + doc: Some( + "Device can set autocenter.\n\nDevice supports setting autocenter.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetHapticAutocenter`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_STATUS", + short_name: "STATUS", + doc: Some( + "Device can be queried for effect status.\n\nDevice supports querying effect status.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetHapticEffectStatus`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_PAUSE", + short_name: "PAUSE", + doc: Some( + "Device can be paused.\n\nDevices supports being paused.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_PauseHaptic`]\n- [`SDL_ResumeHaptic`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + ], +}; +pub const METADATA_SDL_HapticDirectionType: Group = Group { + module: "haptic", + kind: GroupKind::Enum, + name: "SDL_HapticDirectionType", + short_name: "HapticDirectionType", + doc: Some("* Type of coordinates used for haptic direction.\n"), + available_since: None, + values: &[ + GroupValue { + name: "SDL_HAPTIC_POLAR", + short_name: "POLAR", + doc: Some( + "Uses polar coordinates for the direction.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticDirection`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_CARTESIAN", + short_name: "CARTESIAN", + doc: Some( + "Uses cartesian coordinates for the direction.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticDirection`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_SPHERICAL", + short_name: "SPHERICAL", + doc: Some( + "Uses spherical coordinates for the direction.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticDirection`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + GroupValue { + name: "SDL_HAPTIC_STEERING_AXIS", + short_name: "STEERING_AXIS", + doc: Some( + "Use this value to play an effect on the steering wheel axis.\n\nThis provides better compatibility across platforms and devices as SDL will\nguess the correct axis.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticDirection`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + }, + ], +}; +pub const METADATA_SDL_HapticEffectID: Group = Group { + module: "haptic", + kind: GroupKind::Id, + name: "SDL_HapticEffectID", + short_name: "HapticEffectID", + doc: Some( + "ID for haptic effects.\n\nThis is -1 if the ID is invalid.\n\n## See also\n- [`SDL_CreateHapticEffect`]\n", + ), + available_since: None, + values: &[], +}; +pub const METADATA_SDL_HapticID: Group = Group { + module: "haptic", + kind: GroupKind::Id, + name: "SDL_HapticID", + short_name: "HapticID", + doc: Some( + "This is a unique ID for a haptic device for the time it is connected to the\nsystem, and is never reused for the lifetime of the application.\n\nIf the haptic device is disconnected and reconnected, it will get a new ID.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_HapticDirection: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticDirection", + doc: Some( + "Structure that represents a haptic direction.\n\nThis is the direction where the force comes from, instead of the direction\nin which the force is exerted.\n\nDirections can be specified by:\n\n- [`SDL_HAPTIC_POLAR`] : Specified by polar coordinates.\n- [`SDL_HAPTIC_CARTESIAN`] : Specified by cartesian coordinates.\n- [`SDL_HAPTIC_SPHERICAL`] : Specified by spherical coordinates.\n\nCardinal directions of the haptic device are relative to the positioning of\nthe device. North is considered to be away from the user.\n\nThe following diagram represents the cardinal directions:\n\n```text\n.--.\n|__| .-------.\n|=.| |.-----.|\n|--| || ||\n| | |'-----'|\n|__|~')_____('\n[ COMPUTER ]\n\n\nNorth (0,-1)\n^\n|\n|\n(-1,0) West <----[ HAPTIC ]----> East (1,0)\n|\n|\nv\nSouth (0,1)\n\n\n[ USER ]\n\\|||/\n(o o)\n---ooO-(_)-Ooo---\n```\n\nIf type is [`SDL_HAPTIC_POLAR`], direction is encoded by hundredths of a degree\nstarting north and turning clockwise. [`SDL_HAPTIC_POLAR`] only uses the first\n`dir` parameter. The cardinal directions would be:\n\n- North: 0 (0 degrees)\n- East: 9000 (90 degrees)\n- South: 18000 (180 degrees)\n- West: 27000 (270 degrees)\n\nIf type is [`SDL_HAPTIC_CARTESIAN`], direction is encoded by three positions (X\naxis, Y axis and Z axis (with 3 axes)). [`SDL_HAPTIC_CARTESIAN`] uses the first\nthree `dir` parameters. The cardinal directions would be:\n\n- North: 0,-1, 0\n- East: 1, 0, 0\n- South: 0, 1, 0\n- West: -1, 0, 0\n\nThe Z axis represents the height of the effect if supported, otherwise it's\nunused. In cartesian encoding (1, 2) would be the same as (2, 4), you can\nuse any multiple you want, only the direction matters.\n\nIf type is [`SDL_HAPTIC_SPHERICAL`], direction is encoded by two rotations. The\nfirst two `dir` parameters are used. The `dir` parameters are as follows\n(all values are in hundredths of degrees):\n\n- Degrees from (1, 0) rotated towards (0, 1).\n- Degrees towards (0, 0, 1) (device needs at least 3 axes).\n\nExample of force coming from the south with all encodings (force coming\nfrom the south means the user will have to pull the stick to counteract):\n\n```c\nSDL_HapticDirection direction;\n\n// Cartesian directions\ndirection.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.\ndirection.dir[0] = 0; // X position\ndirection.dir[1] = 1; // Y position\n// Assuming the device has 2 axes, we don't need to specify third parameter.\n\n// Polar directions\ndirection.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.\ndirection.dir[0] = 18000; // Polar only uses first parameter\n\n// Spherical coordinates\ndirection.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding\ndirection.dir[0] = 9000; // Since we only have two axes we don't need more parameters.\n```\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HAPTIC_POLAR`]\n- [`SDL_HAPTIC_CARTESIAN`]\n- [`SDL_HAPTIC_SPHERICAL`]\n- [`SDL_HAPTIC_STEERING_AXIS`]\n- [`SDL_HapticEffect`]\n- [`SDL_GetNumHapticAxes`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("The type of encoding.\n"), + available_since: None, + ty: "SDL_HapticDirectionType", + }, + Field { + name: "dir", + doc: Some("The encoded direction.\n"), + available_since: None, + ty: "[Sint32; 3]", + }, + ], +}; +pub const METADATA_SDL_HapticConstant: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticConstant", + doc: Some( + "A structure containing a template for a Constant effect.\n\nThis struct is exclusively for the [`SDL_HAPTIC_CONSTANT`] effect.\n\nA constant effect applies a constant force in the specified direction to\nthe joystick.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HAPTIC_CONSTANT`]\n- [`SDL_HapticEffect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_HAPTIC_CONSTANT`]\n"), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "direction", + doc: Some("Direction of the effect.\n"), + available_since: None, + ty: "SDL_HapticDirection", + }, + Field { + name: "length", + doc: Some("Duration of the effect.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "delay", + doc: Some("Delay before starting the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "button", + doc: Some("Button that triggers the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "interval", + doc: Some("How soon it can be triggered again after button.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "level", + doc: Some("Strength of the constant effect.\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "attack_length", + doc: Some("Duration of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "attack_level", + doc: Some("Level at the start of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_length", + doc: Some("Duration of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_level", + doc: Some("Level at the end of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_HapticPeriodic: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticPeriodic", + doc: Some( + "A structure containing a template for a Periodic effect.\n\nThe struct handles the following effects:\n\n- [`SDL_HAPTIC_SINE`]\n- [`SDL_HAPTIC_SQUARE`]\n- [`SDL_HAPTIC_TRIANGLE`]\n- [`SDL_HAPTIC_SAWTOOTHUP`]\n- [`SDL_HAPTIC_SAWTOOTHDOWN`]\n\nA periodic effect consists in a wave-shaped effect that repeats itself over\ntime. The type determines the shape of the wave and the parameters\ndetermine the dimensions of the wave.\n\nPhase is given by hundredth of a degree meaning that giving the phase a\nvalue of 9000 will displace it 25% of its period. Here are sample values:\n\n- 0: No phase displacement.\n- 9000: Displaced 25% of its period.\n- 18000: Displaced 50% of its period.\n- 27000: Displaced 75% of its period.\n- 36000: Displaced 100% of its period, same as 0, but 0 is preferred.\n\nExamples:\n\n```text\nSDL_HAPTIC_SINE\n__ __ __ __\n/ \\ / \\ / \\ /\n/ \\__/ \\__/ \\__/\n\nSDL_HAPTIC_SQUARE\n__ __ __ __ __\n| | | | | | | | | |\n| |__| |__| |__| |__| |\n\nSDL_HAPTIC_TRIANGLE\n/\\ /\\ /\\ /\\ /\\\n/ \\ / \\ / \\ / \\ /\n/ \\/ \\/ \\/ \\/\n\nSDL_HAPTIC_SAWTOOTHUP\n/| /| /| /| /| /| /|\n/ | / | / | / | / | / | / |\n/ |/ |/ |/ |/ |/ |/ |\n\nSDL_HAPTIC_SAWTOOTHDOWN\n\\ |\\ |\\ |\\ |\\ |\\ |\\ |\n\\ | \\ | \\ | \\ | \\ | \\ | \\ |\n\\| \\| \\| \\| \\| \\| \\|\n```\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HAPTIC_SINE`]\n- [`SDL_HAPTIC_SQUARE`]\n- [`SDL_HAPTIC_TRIANGLE`]\n- [`SDL_HAPTIC_SAWTOOTHUP`]\n- [`SDL_HAPTIC_SAWTOOTHDOWN`]\n- [`SDL_HapticEffect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_HAPTIC_SINE`], [`SDL_HAPTIC_SQUARE`]\n[`SDL_HAPTIC_TRIANGLE`], [`SDL_HAPTIC_SAWTOOTHUP`] or\n[`SDL_HAPTIC_SAWTOOTHDOWN`]\n", + ), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "direction", + doc: Some("Direction of the effect.\n"), + available_since: None, + ty: "SDL_HapticDirection", + }, + Field { + name: "length", + doc: Some("Duration of the effect.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "delay", + doc: Some("Delay before starting the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "button", + doc: Some("Button that triggers the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "interval", + doc: Some("How soon it can be triggered again after button.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "period", + doc: Some("Period of the wave.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "magnitude", + doc: Some("Peak value; if negative, equivalent to 180 degrees extra phase shift.\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "offset", + doc: Some("Mean value of the wave.\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "phase", + doc: Some("Positive phase shift given by hundredth of a degree.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "attack_length", + doc: Some("Duration of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "attack_level", + doc: Some("Level at the start of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_length", + doc: Some("Duration of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_level", + doc: Some("Level at the end of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_HapticCondition: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticCondition", + doc: Some( + "A structure containing a template for a Condition effect.\n\nThe struct handles the following effects:\n\n- [`SDL_HAPTIC_SPRING`]\\: Effect based on axes position.\n- [`SDL_HAPTIC_DAMPER`]\\: Effect based on axes velocity.\n- [`SDL_HAPTIC_INERTIA`]\\: Effect based on axes acceleration.\n- [`SDL_HAPTIC_FRICTION`]\\: Effect based on axes movement.\n\nDirection is handled by condition internals instead of a direction member.\nThe condition effect specific members have three parameters. The first\nrefers to the X axis, the second refers to the Y axis and the third refers\nto the Z axis. The right terms refer to the positive side of the axis and\nthe left terms refer to the negative side of the axis. Please refer to the\n[`SDL_HapticDirection`] diagram for which side is positive and which is\nnegative.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticDirection`]\n- [`SDL_HAPTIC_SPRING`]\n- [`SDL_HAPTIC_DAMPER`]\n- [`SDL_HAPTIC_INERTIA`]\n- [`SDL_HAPTIC_FRICTION`]\n- [`SDL_HapticEffect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some( + "[`SDL_HAPTIC_SPRING`], [`SDL_HAPTIC_DAMPER`],\n[`SDL_HAPTIC_INERTIA`] or [`SDL_HAPTIC_FRICTION`]\n", + ), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "direction", + doc: Some("Direction of the effect.\n"), + available_since: None, + ty: "SDL_HapticDirection", + }, + Field { + name: "length", + doc: Some("Duration of the effect.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "delay", + doc: Some("Delay before starting the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "button", + doc: Some("Button that triggers the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "interval", + doc: Some("How soon it can be triggered again after button.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "right_sat", + doc: Some("Level when joystick is to the positive side; max 0xFFFF.\n"), + available_since: None, + ty: "[Uint16; 3]", + }, + Field { + name: "left_sat", + doc: Some("Level when joystick is to the negative side; max 0xFFFF.\n"), + available_since: None, + ty: "[Uint16; 3]", + }, + Field { + name: "right_coeff", + doc: Some("How fast to increase the force towards the positive side.\n"), + available_since: None, + ty: "[Sint16; 3]", + }, + Field { + name: "left_coeff", + doc: Some("How fast to increase the force towards the negative side.\n"), + available_since: None, + ty: "[Sint16; 3]", + }, + Field { + name: "deadband", + doc: Some("Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered.\n"), + available_since: None, + ty: "[Uint16; 3]", + }, + Field { + name: "center", + doc: Some("Position of the dead zone.\n"), + available_since: None, + ty: "[Sint16; 3]", + }, + ], +}; +pub const METADATA_SDL_HapticRamp: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticRamp", + doc: Some( + "A structure containing a template for a Ramp effect.\n\nThis struct is exclusively for the [`SDL_HAPTIC_RAMP`] effect.\n\nThe ramp effect starts at start strength and ends at end strength. It\naugments in linear fashion. If you use attack and fade with a ramp the\neffects get added to the ramp effect making the effect become quadratic\ninstead of linear.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HAPTIC_RAMP`]\n- [`SDL_HapticEffect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_HAPTIC_RAMP`]\n"), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "direction", + doc: Some("Direction of the effect.\n"), + available_since: None, + ty: "SDL_HapticDirection", + }, + Field { + name: "length", + doc: Some("Duration of the effect.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "delay", + doc: Some("Delay before starting the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "button", + doc: Some("Button that triggers the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "interval", + doc: Some("How soon it can be triggered again after button.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "start", + doc: Some("Beginning strength level.\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "end", + doc: Some("Ending strength level.\n"), + available_since: None, + ty: "Sint16", + }, + Field { + name: "attack_length", + doc: Some("Duration of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "attack_level", + doc: Some("Level at the start of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_length", + doc: Some("Duration of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_level", + doc: Some("Level at the end of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_HapticLeftRight: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticLeftRight", + doc: Some( + "A structure containing a template for a Left/Right effect.\n\nThis struct is exclusively for the [`SDL_HAPTIC_LEFTRIGHT`] effect.\n\nThe Left/Right effect is used to explicitly control the large and small\nmotors, commonly found in modern game controllers. The small (right) motor\nis high frequency, and the large (left) motor is low frequency.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HAPTIC_LEFTRIGHT`]\n- [`SDL_HapticEffect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_HAPTIC_LEFTRIGHT`]\n"), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "length", + doc: Some("Duration of the effect in milliseconds.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "large_magnitude", + doc: Some("Control of the large controller motor.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "small_magnitude", + doc: Some("Control of the small controller motor.\n"), + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_HapticCustom: Struct = Struct { + module: "haptic", + kind: StructKind::Struct, + name: "SDL_HapticCustom", + doc: Some( + "A structure containing a template for the [`SDL_HAPTIC_CUSTOM`] effect.\n\nThis struct is exclusively for the [`SDL_HAPTIC_CUSTOM`] effect.\n\nA custom force feedback effect is much like a periodic effect, where the\napplication can define its exact shape. You will have to allocate the data\nyourself. Data should consist of channels * samples Uint16 samples.\n\nIf channels is one, the effect is rotated using the defined direction.\nOtherwise it uses the samples in data for the different axes.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HAPTIC_CUSTOM`]\n- [`SDL_HapticEffect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("[`SDL_HAPTIC_CUSTOM`]\n"), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "direction", + doc: Some("Direction of the effect.\n"), + available_since: None, + ty: "SDL_HapticDirection", + }, + Field { + name: "length", + doc: Some("Duration of the effect.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "delay", + doc: Some("Delay before starting the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "button", + doc: Some("Button that triggers the effect.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "interval", + doc: Some("How soon it can be triggered again after button.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "channels", + doc: Some("Axes to use, minimum of one.\n"), + available_since: None, + ty: "Uint8", + }, + Field { + name: "period", + doc: Some("Sample periods.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "samples", + doc: Some("Amount of samples.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "data", + doc: Some("Should contain channels*samples items.\n"), + available_since: None, + ty: "*mut Uint16", + }, + Field { + name: "attack_length", + doc: Some("Duration of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "attack_level", + doc: Some("Level at the start of the attack.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_length", + doc: Some("Duration of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "fade_level", + doc: Some("Level at the end of the fade.\n"), + available_since: None, + ty: "Uint16", + }, + ], +}; +pub const METADATA_SDL_HapticEffect: Struct = Struct { + module: "haptic", + kind: StructKind::Union, + name: "SDL_HapticEffect", + doc: Some( + "The generic template for any haptic effect.\n\nAll values max at 32767 (0x7FFF). Signed values also can be negative. Time\nvalues unless specified otherwise are in milliseconds.\n\nYou can also pass [`SDL_HAPTIC_INFINITY`] to length instead of a 0-32767 value.\nNeither delay, interval, attack_length nor fade_length support\n[`SDL_HAPTIC_INFINITY`]. Fade will also not be used since effect never ends.\n\nAdditionally, the [`SDL_HAPTIC_RAMP`] effect does not support a duration of\n[`SDL_HAPTIC_INFINITY`].\n\nButton triggers may not be supported on all devices, it is advised to not\nuse them if possible. Buttons start at index 1 instead of index 0 like the\njoystick.\n\nIf both attack_length and fade_level are 0, the envelope is not used,\notherwise both values are used.\n\nCommon parts:\n\n```c\n// Replay - All effects have this\nUint32 length; // Duration of effect (ms).\nUint16 delay; // Delay before starting effect.\n\n// Trigger - All effects have this\nUint16 button; // Button that triggers effect.\nUint16 interval; // How soon before effect can be triggered again.\n\n// Envelope - All effects except condition effects have this\nUint16 attack_length; // Duration of the attack (ms).\nUint16 attack_level; // Level at the start of the attack.\nUint16 fade_length; // Duration of the fade out (ms).\nUint16 fade_level; // Level at the end of the fade.\n```\n\nHere we have an example of a constant effect evolution in time:\n\n```text\nStrength\n^\n|\n| effect level --> _________________\n| / \\\n| / \\\n| / \\\n| / \\\n| attack_level --> | \\\n| | | <--- fade_level\n|\n+--------------------------------------------------> Time\n[--] [---]\nattack_length fade_length\n\n[------------------][-----------------------]\ndelay length\n```\n\nNote either the attack_level or the fade_level may be above the actual\neffect level.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HapticConstant`]\n- [`SDL_HapticPeriodic`]\n- [`SDL_HapticCondition`]\n- [`SDL_HapticRamp`]\n- [`SDL_HapticLeftRight`]\n- [`SDL_HapticCustom`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("Effect type.\n"), + available_since: None, + ty: "SDL_HapticEffectType", + }, + Field { + name: "constant", + doc: Some("Constant effect.\n"), + available_since: None, + ty: "SDL_HapticConstant", + }, + Field { + name: "periodic", + doc: Some("Periodic effect.\n"), + available_since: None, + ty: "SDL_HapticPeriodic", + }, + Field { + name: "condition", + doc: Some("Condition effect.\n"), + available_since: None, + ty: "SDL_HapticCondition", + }, + Field { + name: "ramp", + doc: Some("Ramp effect.\n"), + available_since: None, + ty: "SDL_HapticRamp", + }, + Field { + name: "leftright", + doc: Some("Left/Right effect.\n"), + available_since: None, + ty: "SDL_HapticLeftRight", + }, + Field { + name: "custom", + doc: Some("Custom effect.\n"), + available_since: None, + ty: "SDL_HapticCustom", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/hidapi.rs b/vendor/sdl3-sys/src/metadata/generated/hidapi.rs new file mode 100644 index 00000000..47d0cc90 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/hidapi.rs @@ -0,0 +1,168 @@ +//! Metadata for items in the `crate::hidapi` module + +use super::*; + +pub const METADATA_SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER: Property = Property { + module: "hidapi", + name: "SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER", + short_name: "HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER", + value: crate::hidapi::SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_hid_bus_type: Group = Group { + module: "hidapi", + kind: GroupKind::Enum, + name: "SDL_hid_bus_type", + short_name: "hid_bus_type", + doc: Some( + "HID underlying bus types.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_HID_API_BUS_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("Unknown bus type\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HID_API_BUS_USB", + short_name: "USB", + doc: Some("USB bus\nSpecifications:\n\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HID_API_BUS_BLUETOOTH", + short_name: "BLUETOOTH", + doc: Some( + "Bluetooth or Bluetooth LE bus\nSpecifications:\n\n\n\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_HID_API_BUS_I2C", + short_name: "I2C", + doc: Some( + "I2C bus\nSpecifications:\n\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_HID_API_BUS_SPI", + short_name: "SPI", + doc: Some( + "SPI bus\nSpecifications:\n\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_hid_device_info: Struct = Struct { + module: "hidapi", + kind: StructKind::Struct, + name: "SDL_hid_device_info", + doc: Some( + "Information about a connected HID device\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "path", + doc: Some("Platform-specific device path\n"), + available_since: None, + ty: "*mut ::core::ffi::c_char", + }, + Field { + name: "vendor_id", + doc: Some("Device Vendor ID\n"), + available_since: None, + ty: "::core::ffi::c_ushort", + }, + Field { + name: "product_id", + doc: Some("Device Product ID\n"), + available_since: None, + ty: "::core::ffi::c_ushort", + }, + Field { + name: "serial_number", + doc: Some("Serial Number\n"), + available_since: None, + ty: "*mut crate::ffi::c_wchar_t", + }, + Field { + name: "release_number", + doc: Some( + "Device Release Number in binary-coded decimal,\nalso known as Device Version Number\n", + ), + available_since: None, + ty: "::core::ffi::c_ushort", + }, + Field { + name: "manufacturer_string", + doc: Some("Manufacturer String\n"), + available_since: None, + ty: "*mut crate::ffi::c_wchar_t", + }, + Field { + name: "product_string", + doc: Some("Product string\n"), + available_since: None, + ty: "*mut crate::ffi::c_wchar_t", + }, + Field { + name: "usage_page", + doc: Some("Usage Page for this Device/Interface\n(Windows/Mac/hidraw only)\n"), + available_since: None, + ty: "::core::ffi::c_ushort", + }, + Field { + name: "usage", + doc: Some("Usage for this Device/Interface\n(Windows/Mac/hidraw only)\n"), + available_since: None, + ty: "::core::ffi::c_ushort", + }, + Field { + name: "interface_number", + doc: Some( + "The USB interface which this logical device\nrepresents.\n\nValid only if the device is a USB HID device.\nSet to -1 in all other cases.\n", + ), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "interface_class", + doc: Some( + "Additional information about the USB interface.\nValid on libusb and Android implementations.\n", + ), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "interface_subclass", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "interface_protocol", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "bus_type", + doc: Some("Underlying bus type\n"), + available_since: None, + ty: "SDL_hid_bus_type", + }, + Field { + name: "next", + doc: Some("Pointer to the next device\n"), + available_since: None, + ty: "*mut SDL_hid_device_info", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/hints.rs b/vendor/sdl3-sys/src/metadata/generated/hints.rs new file mode 100644 index 00000000..bef63911 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/hints.rs @@ -0,0 +1,2694 @@ +//! Metadata for items in the `crate::hints` module + +use super::*; + +pub const METADATA_SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED: Hint = Hint { + module: "hints", + name: "SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED", + short_name: "ALLOW_ALT_TAB_WHILE_GRABBED", + value: crate::hints::SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, + doc: Some( + "Specify the behavior of Alt+Tab while the keyboard is grabbed.\n\nBy default, SDL emulates Alt+Tab functionality while the keyboard is\ngrabbed and your window is full-screen. This prevents the user from getting\nstuck in your application if you've enabled keyboard grab.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will not handle Alt+Tab. Your application is responsible for\nhandling Alt+Tab while the keyboard is grabbed.\n- \"1\": SDL will minimize your window when Alt+Tab is pressed (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY: Hint = Hint { + module: "hints", + name: "SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY", + short_name: "ANDROID_ALLOW_RECREATE_ACTIVITY", + value: crate::hints::SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, + doc: Some( + "A variable to control whether the SDL activity is allowed to be re-created.\n\nIf this hint is true, the activity can be recreated on demand by the OS,\nand Java static data and C++ static data remain with their current values.\nIf this hint is false, then SDL will call exit() when you return from your\nmain function and the application will be terminated and then started fresh\neach time.\n\nThe variable can be set to the following values:\n\n- \"0\": The application starts fresh at each launch. (default)\n- \"1\": The application activity can be recreated by the OS.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ANDROID_BLOCK_ON_PAUSE: Hint = Hint { + module: "hints", + name: "SDL_HINT_ANDROID_BLOCK_ON_PAUSE", + short_name: "ANDROID_BLOCK_ON_PAUSE", + value: crate::hints::SDL_HINT_ANDROID_BLOCK_ON_PAUSE, + doc: Some( + "A variable to control whether the event loop will block itself when the app\nis paused.\n\nThe variable can be set to the following values:\n\n- \"0\": Non blocking.\n- \"1\": Blocking. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ANDROID_LOW_LATENCY_AUDIO: Hint = Hint { + module: "hints", + name: "SDL_HINT_ANDROID_LOW_LATENCY_AUDIO", + short_name: "ANDROID_LOW_LATENCY_AUDIO", + value: crate::hints::SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, + doc: Some( + "A variable to control whether low latency audio should be enabled.\n\nSome devices have poor quality output when this is enabled, but this is\nusually an improvement in audio latency.\n\nThe variable can be set to the following values:\n\n- \"0\": Low latency audio is not enabled.\n- \"1\": Low latency audio is enabled. (default)\n\nThis hint should be set before SDL audio is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ANDROID_AAUDIO_INPUT_PRESET: Hint = Hint { + module: "hints", + name: "SDL_HINT_ANDROID_AAUDIO_INPUT_PRESET", + short_name: "ANDROID_AAUDIO_INPUT_PRESET", + value: crate::hints::SDL_HINT_ANDROID_AAUDIO_INPUT_PRESET, + doc: Some( + "A variable to control Android's AAudio input preset.\n\nThis hint only applies to SDL's \"aaudio\" backend on Android 9+ devices.\n\nSome devices choose the wrong microphone by default (between the one meant\nto be spoken in when the phone is held to the user's ear for a phone call,\nor an external microphone that's meant to be used when recording video),\nor have DSP effects applied to the recorded audio, and changing the input\npreset can help control this.\n\nThis can be any number that maps to an `AAUDIO_INPUT_PRESET_*` enum from\nthe Android NDK headers. The most reasonable choices are 5 (\"camcorder\",\nfor external microphones) and 7 (\"voice communication\", for speaking\ndirectly into the device like a mobile phone). 6 (\"voice recognition\")\nmight also be a useful choice.\n\nIf unset (the default), SDL will not specify an input preset at all, which\nlets the system choose. This is usually the correct thing to do unless\nyour app is having problems.\n\nThis hint should be set before a recording audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.4.16.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 16)), +}; +pub const METADATA_SDL_HINT_ANDROID_TRAP_BACK_BUTTON: Hint = Hint { + module: "hints", + name: "SDL_HINT_ANDROID_TRAP_BACK_BUTTON", + short_name: "ANDROID_TRAP_BACK_BUTTON", + value: crate::hints::SDL_HINT_ANDROID_TRAP_BACK_BUTTON, + doc: Some( + "A variable to control whether we trap the Android back button to handle it\nmanually.\n\nThis is necessary for the right mouse button to work on some Android\ndevices, or to be able to trap the back button for use in your code\nreliably. If this hint is true, the back button will show up as an\n[`SDL_EVENT_KEY_DOWN`] / [`SDL_EVENT_KEY_UP`] pair with a keycode of\n[`SDL_SCANCODE_AC_BACK`].\n\nThe variable can be set to the following values:\n\n- \"0\": Back button will be handled as usual for system. (default)\n- \"1\": Back button will be trapped, allowing you to handle the key press\nmanually. (This will also let right mouse click work on systems where the\nright mouse button functions as back.)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_APP_ID: Hint = Hint { + module: "hints", + name: "SDL_HINT_APP_ID", + short_name: "APP_ID", + value: crate::hints::SDL_HINT_APP_ID, + doc: Some( + "A variable setting the app ID string.\n\nThis string is used by desktop compositors to identify and group windows\ntogether, as well as match applications with associated desktop settings\nand icons.\n\nThis will override [`SDL_PROP_APP_METADATA_IDENTIFIER_STRING`], if set by the\napplication.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_APP_NAME: Hint = Hint { + module: "hints", + name: "SDL_HINT_APP_NAME", + short_name: "APP_NAME", + value: crate::hints::SDL_HINT_APP_NAME, + doc: Some( + "A variable setting the application name.\n\nThis hint lets you specify the application name sent to the OS when\nrequired. For example, this will often appear in volume control applets for\naudio streams, and in lists of applications which are inhibiting the\nscreensaver. You should use a string that describes your program (\"My Game\n2: The Revenge\")\n\nThis will override [`SDL_PROP_APP_METADATA_NAME_STRING`], if set by the\napplication.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS", + short_name: "APPLE_TV_CONTROLLER_UI_EVENTS", + value: crate::hints::SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, + doc: Some( + "A variable controlling whether controllers used with the Apple TV generate\nUI events.\n\nWhen UI events are generated by controller input, the app will be\nbackgrounded when the Apple TV remote's menu button is pressed, and when\nthe pause or B buttons on gamepads are pressed.\n\nMore information about properly making use of controllers for the Apple TV\ncan be found here:\n\n\nThe variable can be set to the following values:\n\n- \"0\": Controller input does not generate UI events. (default)\n- \"1\": Controller input generates UI events.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION: Hint = Hint { + module: "hints", + name: "SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION", + short_name: "APPLE_TV_REMOTE_ALLOW_ROTATION", + value: crate::hints::SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, + doc: Some( + "A variable controlling whether the Apple TV remote's joystick axes will\nautomatically match the rotation of the remote.\n\nThe variable can be set to the following values:\n\n- \"0\": Remote orientation does not affect joystick axes. (default)\n- \"1\": Joystick axes are based on the orientation of the remote.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE", + short_name: "AUDIO_ALSA_DEFAULT_DEVICE", + value: crate::hints::SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE, + doc: Some( + "Specify the default ALSA audio device name.\n\nThis variable is a specific audio device to open when the \"default\" audio\ndevice is used.\n\nThis hint will be ignored when opening the default playback device if\n[`SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE`] is set, or when opening the\ndefault recording device if [`SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE`] is\nset.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE`]\n- [`SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE", + short_name: "AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE", + value: crate::hints::SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE, + doc: Some( + "Specify the default ALSA audio playback device name.\n\nThis variable is a specific audio device to open for playback, when the\n\"default\" audio device is used.\n\nIf this hint isn't set, SDL will check [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`]\nbefore choosing a reasonable default.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE`]\n- [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE", + short_name: "AUDIO_ALSA_DEFAULT_RECORDING_DEVICE", + value: crate::hints::SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE, + doc: Some( + "Specify the default ALSA audio recording device name.\n\nThis variable is a specific audio device to open for recording, when the\n\"default\" audio device is used.\n\nIf this hint isn't set, SDL will check [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`]\nbefore choosing a reasonable default.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE`]\n- [`SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_CATEGORY: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_CATEGORY", + short_name: "AUDIO_CATEGORY", + value: crate::hints::SDL_HINT_AUDIO_CATEGORY, + doc: Some( + "A variable controlling the audio category on iOS and macOS.\n\nThe variable can be set to the following values:\n\n- \"ambient\": Use the AVAudioSessionCategoryAmbient audio category, will be\nmuted by the phone mute switch (default)\n- \"playback\": Use the AVAudioSessionCategoryPlayback category.\n\nFor more information, see Apple's documentation:\n\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_CHANNELS: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_CHANNELS", + short_name: "AUDIO_CHANNELS", + value: crate::hints::SDL_HINT_AUDIO_CHANNELS, + doc: Some( + "A variable controlling the default audio channel count.\n\nIf the application doesn't specify the audio channel count when opening the\ndevice, this hint can be used to specify a default channel count that will\nbe used. This defaults to \"1\" for recording and \"2\" for playback devices.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME", + short_name: "AUDIO_DEVICE_APP_ICON_NAME", + value: crate::hints::SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME, + doc: Some( + "Specify an application icon name for an audio device.\n\nSome audio backends (such as Pulseaudio and Pipewire) allow you to set an\nXDG icon name for your application. Among other things, this icon might\nshow up in a system control panel that lets the user adjust the volume on\nspecific audio streams instead of using one giant master volume slider.\nNote that this is unrelated to the icon used by the windowing system, which\nmay be set with [`SDL_SetWindowIcon`] (or via desktop file on Wayland).\n\nSetting this to \"\" or leaving it unset will have SDL use a reasonable\ndefault, \"applications-games\", which is likely to be installed. See\n\nand\n\nfor the relevant XDG icon specs.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES", + short_name: "AUDIO_DEVICE_SAMPLE_FRAMES", + value: crate::hints::SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES, + doc: Some( + "A variable controlling device buffer size.\n\nThis hint is an integer > 0, that represents the size of the device's\nbuffer in sample frames (stereo audio data in 16-bit format is 4 bytes per\nsample frame, for example).\n\nSDL3 generally decides this value on behalf of the app, but if for some\nreason the app needs to dictate this (because they want either lower\nlatency or higher throughput AND ARE WILLING TO DEAL WITH what that might\nrequire of the app), they can specify it.\n\nSDL will try to accommodate this value, but there is no promise you'll get\nthe buffer size requested. Many platforms won't honor this request at all,\nor might adjust it.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DEVICE_STREAM_NAME: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DEVICE_STREAM_NAME", + short_name: "AUDIO_DEVICE_STREAM_NAME", + value: crate::hints::SDL_HINT_AUDIO_DEVICE_STREAM_NAME, + doc: Some( + "Specify an audio stream name for an audio device.\n\nSome audio backends (such as PulseAudio) allow you to describe your audio\nstream. Among other things, this description might show up in a system\ncontrol panel that lets the user adjust the volume on specific audio\nstreams instead of using one giant master volume slider.\n\nThis hints lets you transmit that information to the OS. The contents of\nthis hint are used while opening an audio device. You should use a string\nthat describes your what your program is playing (\"audio stream\" is\nprobably sufficient in many cases, but this could be useful for something\nlike \"team chat\" if you have a headset playing VoIP audio separately).\n\nSetting this to \"\" or leaving it unset will have SDL use a reasonable\ndefault: \"audio stream\" or something similar.\n\nNote that while this talks about audio streams, this is an OS-level\nconcept, so it applies to a physical audio device in this case, and not an\n[`SDL_AudioStream`], nor an SDL logical audio device.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DEVICE_STREAM_ROLE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DEVICE_STREAM_ROLE", + short_name: "AUDIO_DEVICE_STREAM_ROLE", + value: crate::hints::SDL_HINT_AUDIO_DEVICE_STREAM_ROLE, + doc: Some( + "Specify an application role for an audio device.\n\nSome audio backends (such as Pipewire) allow you to describe the role of\nyour audio stream. Among other things, this description might show up in a\nsystem control panel or software for displaying and manipulating media\nplayback/recording graphs.\n\nThis hints lets you transmit that information to the OS. The contents of\nthis hint are used while opening an audio device. You should use a string\nthat describes your what your program is playing (Game, Music, Movie,\netc...).\n\nSetting this to \"\" or leaving it unset will have SDL use a reasonable\ndefault: \"Game\" or something similar.\n\nNote that while this talks about audio streams, this is an OS-level\nconcept, so it applies to a physical audio device in this case, and not an\n[`SDL_AudioStream`], nor an SDL logical audio device.\n\nFor Windows WASAPI audio, the following roles are supported, and map to\n`AUDIO_STREAM_CATEGORY`:\n\n- \"Other\" (default)\n- \"Communications\" - Real-time communications, such as VOIP or chat\n- \"Game\" - Game audio\n- \"GameChat\" - Game chat audio, similar to \"Communications\" except that\nthis will not attenuate other audio streams\n- \"Movie\" - Music or sound with dialog\n- \"Media\" - Music or sound without dialog\n\nAndroid's AAudio target supports this hint as of SDL 3.4.4. Android does\nnot support the exact same options as WASAPI, but for portability, will\nattempt to map these same strings to the `aaudio_usage_t` constants. For\nexample, \"Movie\" and \"Media\" will both map to `AAUDIO_USAGE_MEDIA`, etc.\n\nIf your application applies its own echo cancellation, gain control, and\nnoise reduction it should also set [`SDL_HINT_AUDIO_DEVICE_RAW_STREAM`].\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DEVICE_RAW_STREAM: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DEVICE_RAW_STREAM", + short_name: "AUDIO_DEVICE_RAW_STREAM", + value: crate::hints::SDL_HINT_AUDIO_DEVICE_RAW_STREAM, + doc: Some( + "Specify whether this audio device should do audio processing.\n\nSome operating systems perform echo cancellation, gain control, and noise\nreduction as needed. If your application already handles these, you can set\nthis hint to prevent the OS from doing additional audio processing.\n\nThis corresponds to the WASAPI audio option `AUDCLNT_STREAMOPTIONS_RAW`.\n\nThe variable can be set to the following values:\n\n- \"0\": audio processing can be done by the OS. (default)\n- \"1\": audio processing is done by the application.\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DISK_INPUT_FILE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DISK_INPUT_FILE", + short_name: "AUDIO_DISK_INPUT_FILE", + value: crate::hints::SDL_HINT_AUDIO_DISK_INPUT_FILE, + doc: Some( + "Specify the input file when recording audio using the disk audio driver.\n\nThis defaults to \"sdlaudio-in.raw\"\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DISK_OUTPUT_FILE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DISK_OUTPUT_FILE", + short_name: "AUDIO_DISK_OUTPUT_FILE", + value: crate::hints::SDL_HINT_AUDIO_DISK_OUTPUT_FILE, + doc: Some( + "Specify the output file when playing audio using the disk audio driver.\n\nThis defaults to \"sdlaudio.raw\"\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DISK_TIMESCALE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DISK_TIMESCALE", + short_name: "AUDIO_DISK_TIMESCALE", + value: crate::hints::SDL_HINT_AUDIO_DISK_TIMESCALE, + doc: Some( + "A variable controlling the audio rate when using the disk audio driver.\n\nThe disk audio driver normally simulates real-time for the audio rate that\nwas specified, but you can use this variable to adjust this rate higher or\nlower down to 0. The default value is \"1.0\".\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DRIVER", + short_name: "AUDIO_DRIVER", + value: crate::hints::SDL_HINT_AUDIO_DRIVER, + doc: Some( + "A variable that specifies an audio backend to use.\n\nBy default, SDL will try all available audio backends in a reasonable order\nuntil it finds one that can work, but this hint allows the app or user to\nforce a specific driver, such as \"pipewire\" if, say, you are on PulseAudio\nbut want to try talking to the lower level instead.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_DUMMY_TIMESCALE: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_DUMMY_TIMESCALE", + short_name: "AUDIO_DUMMY_TIMESCALE", + value: crate::hints::SDL_HINT_AUDIO_DUMMY_TIMESCALE, + doc: Some( + "A variable controlling the audio rate when using the dummy audio driver.\n\nThe dummy audio driver normally simulates real-time for the audio rate that\nwas specified, but you can use this variable to adjust this rate higher or\nlower down to 0. The default value is \"1.0\".\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_FORMAT: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_FORMAT", + short_name: "AUDIO_FORMAT", + value: crate::hints::SDL_HINT_AUDIO_FORMAT, + doc: Some( + "A variable controlling the default audio format.\n\nIf the application doesn't specify the audio format when opening the\ndevice, this hint can be used to specify a default format that will be\nused.\n\nThe variable can be set to the following values:\n\n- \"U8\": Unsigned 8-bit audio\n- \"S8\": Signed 8-bit audio\n- \"S16LE\": Signed 16-bit little-endian audio\n- \"S16BE\": Signed 16-bit big-endian audio\n- \"S16\": Signed 16-bit native-endian audio (default)\n- \"S32LE\": Signed 32-bit little-endian audio\n- \"S32BE\": Signed 32-bit big-endian audio\n- \"S32\": Signed 32-bit native-endian audio\n- \"F32LE\": Floating point little-endian audio\n- \"F32BE\": Floating point big-endian audio\n- \"F32\": Floating point native-endian audio\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_FREQUENCY: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_FREQUENCY", + short_name: "AUDIO_FREQUENCY", + value: crate::hints::SDL_HINT_AUDIO_FREQUENCY, + doc: Some( + "A variable controlling the default audio frequency.\n\nIf the application doesn't specify the audio frequency when opening the\ndevice, this hint can be used to specify a default frequency that will be\nused. This defaults to \"44100\".\n\nThis hint should be set before an audio device is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUDIO_INCLUDE_MONITORS: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUDIO_INCLUDE_MONITORS", + short_name: "AUDIO_INCLUDE_MONITORS", + value: crate::hints::SDL_HINT_AUDIO_INCLUDE_MONITORS, + doc: Some( + "A variable that causes SDL to not ignore audio \"monitors\".\n\nThis is currently only used by the PulseAudio driver.\n\nBy default, SDL ignores audio devices that aren't associated with physical\nhardware. Changing this hint to \"1\" will expose anything SDL sees that\nappears to be an audio source or sink. This will add \"devices\" to the list\nthat the user probably doesn't want or need, but it can be useful in\nscenarios where you want to hook up SDL to some sort of virtual device,\netc.\n\nThe variable can be set to the following values:\n\n- \"0\": Audio monitor devices will be ignored. (default)\n- \"1\": Audio monitor devices will show up in the device list.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUTO_UPDATE_JOYSTICKS: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUTO_UPDATE_JOYSTICKS", + short_name: "AUTO_UPDATE_JOYSTICKS", + value: crate::hints::SDL_HINT_AUTO_UPDATE_JOYSTICKS, + doc: Some( + "A variable controlling whether SDL updates joystick state when getting\ninput events.\n\nThe variable can be set to the following values:\n\n- \"0\": You'll call [`SDL_UpdateJoysticks()`] manually.\n- \"1\": SDL will automatically call [`SDL_UpdateJoysticks()`]. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_AUTO_UPDATE_SENSORS: Hint = Hint { + module: "hints", + name: "SDL_HINT_AUTO_UPDATE_SENSORS", + short_name: "AUTO_UPDATE_SENSORS", + value: crate::hints::SDL_HINT_AUTO_UPDATE_SENSORS, + doc: Some( + "A variable controlling whether SDL updates sensor state when getting input\nevents.\n\nThe variable can be set to the following values:\n\n- \"0\": You'll call [`SDL_UpdateSensors()`] manually.\n- \"1\": SDL will automatically call [`SDL_UpdateSensors()`]. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_BMP_SAVE_LEGACY_FORMAT: Hint = Hint { + module: "hints", + name: "SDL_HINT_BMP_SAVE_LEGACY_FORMAT", + short_name: "BMP_SAVE_LEGACY_FORMAT", + value: crate::hints::SDL_HINT_BMP_SAVE_LEGACY_FORMAT, + doc: Some( + "Prevent SDL from using version 4 of the bitmap header when saving BMPs.\n\nThe bitmap header version 4 is required for proper alpha channel support\nand SDL will use it when required. Should this not be desired, this hint\ncan force the use of the 40 byte header version which is supported\neverywhere.\n\nThe variable can be set to the following values:\n\n- \"0\": Surfaces with a colorkey or an alpha channel are saved to a 32-bit\nBMP file with an alpha mask. SDL will use the bitmap header version 4 and\nset the alpha mask accordingly. (default)\n- \"1\": Surfaces with a colorkey or an alpha channel are saved to a 32-bit\nBMP file without an alpha mask. The alpha channel data will be in the\nfile, but applications are going to ignore it.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_CAMERA_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_CAMERA_DRIVER", + short_name: "CAMERA_DRIVER", + value: crate::hints::SDL_HINT_CAMERA_DRIVER, + doc: Some( + "A variable that decides what camera backend to use.\n\nBy default, SDL will try all available camera backends in a reasonable\norder until it finds one that can work, but this hint allows the app or\nuser to force a specific target, such as \"directshow\" if, say, you are on\nWindows Media Foundations but want to try DirectShow instead.\n\nThe default value is unset, in which case SDL will try to figure out the\nbest camera backend on your behalf. This hint needs to be set before\n[`SDL_Init()`] is called to be useful.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_CPU_FEATURE_MASK: Hint = Hint { + module: "hints", + name: "SDL_HINT_CPU_FEATURE_MASK", + short_name: "CPU_FEATURE_MASK", + value: crate::hints::SDL_HINT_CPU_FEATURE_MASK, + doc: Some( + "A variable that limits what CPU features are available.\n\nBy default, SDL marks all features the current CPU supports as available.\nThis hint allows the enabled features to be limited to a subset.\n\nWhen the hint is unset, or empty, SDL will enable all detected CPU\nfeatures.\n\nThe variable can be set to a comma separated list containing the following\nitems:\n\n- \"all\"\n- \"altivec\"\n- \"sse\"\n- \"sse2\"\n- \"sse3\"\n- \"sse41\"\n- \"sse42\"\n- \"avx\"\n- \"avx2\"\n- \"avx512f\"\n- \"arm-simd\"\n- \"neon\"\n- \"lsx\"\n- \"lasx\"\n\nThe items can be prefixed by '+'/'-' to add/remove features.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_DIRECTINPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_DIRECTINPUT", + short_name: "JOYSTICK_DIRECTINPUT", + value: crate::hints::SDL_HINT_JOYSTICK_DIRECTINPUT, + doc: Some( + "A variable controlling whether DirectInput should be used for controllers.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable DirectInput detection.\n- \"1\": Enable DirectInput detection. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_FILE_DIALOG_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_FILE_DIALOG_DRIVER", + short_name: "FILE_DIALOG_DRIVER", + value: crate::hints::SDL_HINT_FILE_DIALOG_DRIVER, + doc: Some( + "A variable that specifies a dialog backend to use.\n\nBy default, SDL will try all available dialog backends in a reasonable\norder until it finds one that can work, but this hint allows the app or\nuser to force a specific target.\n\nIf the specified target does not exist or is not available, the\ndialog-related function calls will fail.\n\nThis hint currently only applies to platforms using the generic \"Unix\"\ndialog implementation, but may be extended to more platforms in the future.\nNote that some Unix and Unix-like platforms have their own implementation,\nsuch as macOS and Haiku.\n\nThe variable can be set to the following values:\n\n- NULL: Select automatically (default, all platforms)\n- \"portal\": Use XDG Portals through DBus (Unix only)\n- \"zenity\": Use the Zenity program (Unix only)\n\nMore options may be added in the future.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_DISPLAY_USABLE_BOUNDS: Hint = Hint { + module: "hints", + name: "SDL_HINT_DISPLAY_USABLE_BOUNDS", + short_name: "DISPLAY_USABLE_BOUNDS", + value: crate::hints::SDL_HINT_DISPLAY_USABLE_BOUNDS, + doc: Some( + "Override for [`SDL_GetDisplayUsableBounds()`].\n\nIf set, this hint will override the expected results for\n[`SDL_GetDisplayUsableBounds()`] for display index 0. Generally you don't want\nto do this, but this allows an embedded system to request that some of the\nscreen be reserved for other uses when paired with a well-behaved\napplication.\n\nThe contents of this hint must be 4 comma-separated integers, the first is\nthe bounds x, then y, width and height, in that order.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_INVALID_PARAM_CHECKS: Hint = Hint { + module: "hints", + name: "SDL_HINT_INVALID_PARAM_CHECKS", + short_name: "INVALID_PARAM_CHECKS", + value: crate::hints::SDL_HINT_INVALID_PARAM_CHECKS, + doc: Some( + "Set the level of checking for invalid parameters passed to SDL functions.\n\nThe variable can be set to the following values:\n\n- \"1\": Enable fast parameter error checking, e.g. quick NULL checks, etc.\n- \"2\": Enable full parameter error checking, e.g. validating objects are\nthe correct type, etc. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_EMSCRIPTEN_ASYNCIFY: Hint = Hint { + module: "hints", + name: "SDL_HINT_EMSCRIPTEN_ASYNCIFY", + short_name: "EMSCRIPTEN_ASYNCIFY", + value: crate::hints::SDL_HINT_EMSCRIPTEN_ASYNCIFY, + doc: Some( + "Disable giving back control to the browser automatically when running with\nasyncify.\n\nWith -s ASYNCIFY, SDL calls emscripten_sleep during operations such as\nrefreshing the screen or polling events.\n\nThis hint only applies to the emscripten platform.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable emscripten_sleep calls (if you give back browser control\nmanually or use asyncify for other purposes).\n- \"1\": Enable emscripten_sleep calls. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR", + short_name: "EMSCRIPTEN_CANVAS_SELECTOR", + value: crate::hints::SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR, + doc: Some( + "Specify the CSS selector used for the \"default\" window/canvas.\n\nThis hint only applies to the emscripten platform.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT: Hint = Hint { + module: "hints", + name: "SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT", + short_name: "EMSCRIPTEN_KEYBOARD_ELEMENT", + value: crate::hints::SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, + doc: Some( + "Override the binding element for keyboard inputs for Emscripten builds.\n\nThis hint only applies to the emscripten platform.\n\nThe variable can be one of:\n\n- \"#window\": the javascript window object\n- \"#document\": the javascript document object\n- \"#screen\": the javascript window.screen object\n- \"#canvas\": the WebGL canvas element\n- \"#none\": Don't bind anything at all\n- any other string without a leading # sign applies to the element on the\npage with that ID.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ENABLE_SCREEN_KEYBOARD: Hint = Hint { + module: "hints", + name: "SDL_HINT_ENABLE_SCREEN_KEYBOARD", + short_name: "ENABLE_SCREEN_KEYBOARD", + value: crate::hints::SDL_HINT_ENABLE_SCREEN_KEYBOARD, + doc: Some( + "A variable that controls whether the on-screen keyboard should be shown\nwhen text input is active.\n\nThe variable can be set to the following values:\n\n- \"auto\": The on-screen keyboard will be shown if there is no physical\nkeyboard attached. (default)\n- \"0\": Do not show the on-screen keyboard.\n- \"1\": Show the on-screen keyboard, if available.\n\nThis hint must be set before [`SDL_StartTextInput()`] is called\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD: Hint = Hint { + module: "hints", + name: "SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD", + short_name: "ENABLE_STEAM_SCREEN_KEYBOARD", + value: crate::hints::SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD, + doc: Some( + "A variable that controls whether the Steam on-screen keyboard should be\nshown when text input is active.\n\nSteam will set this hint via environment variable for games launched in Big\nPicture mode. To override this you should call [`SDL_SetHintWithPriority()`]\nwith priority [`SDL_HINT_OVERRIDE`].\n\nThe variable can be set to the following values:\n\n- \"0\": Do not show the Steam on-screen keyboard.\n- \"1\": Show the Steam on-screen keyboard.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.4.12.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 12)), +}; +pub const METADATA_SDL_HINT_EVDEV_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_EVDEV_DEVICES", + short_name: "EVDEV_DEVICES", + value: crate::hints::SDL_HINT_EVDEV_DEVICES, + doc: Some( + "A variable containing a list of evdev devices to use if udev is not\navailable.\n\nThe list of devices is in the form:\n\ndeviceclass:path\\[,deviceclass:path\\[,...\\]\\]\n\nwhere device class is an integer representing the SDL_UDEV_deviceclass and\npath is the full path to the event device.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_EVENT_LOGGING: Hint = Hint { + module: "hints", + name: "SDL_HINT_EVENT_LOGGING", + short_name: "EVENT_LOGGING", + value: crate::hints::SDL_HINT_EVENT_LOGGING, + doc: Some( + "A variable controlling verbosity of the logging of SDL events pushed onto\nthe internal queue.\n\nThe variable can be set to the following values, from least to most\nverbose:\n\n- \"0\": Don't log any events. (default)\n- \"1\": Log most events (other than the really spammy ones).\n- \"2\": Include mouse and finger motion events.\n\nThis is generally meant to be used to debug SDL itself, but can be useful\nfor application developers that need better visibility into what is going\non in the event queue. Logged events are sent through [`SDL_Log()`], which\nmeans by default they appear on stdout on most platforms or maybe\nOutputDebugString() on Windows, and can be funneled by the app with\n[`SDL_SetLogOutputFunction()`], etc.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_FORCE_RAISEWINDOW: Hint = Hint { + module: "hints", + name: "SDL_HINT_FORCE_RAISEWINDOW", + short_name: "FORCE_RAISEWINDOW", + value: crate::hints::SDL_HINT_FORCE_RAISEWINDOW, + doc: Some( + "A variable controlling whether raising the window should be done more\nforcefully.\n\nThe variable can be set to the following values:\n\n- \"0\": Honor the OS policy for raising windows. (default)\n- \"1\": Force the window to be raised, overriding any OS policy.\n\nAt present, this is only an issue under MS Windows, which makes it nearly\nimpossible to programmatically move a window to the foreground, for\n\"security\" reasons. See for a\ndiscussion.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_FRAMEBUFFER_ACCELERATION: Hint = Hint { + module: "hints", + name: "SDL_HINT_FRAMEBUFFER_ACCELERATION", + short_name: "FRAMEBUFFER_ACCELERATION", + value: crate::hints::SDL_HINT_FRAMEBUFFER_ACCELERATION, + doc: Some( + "A variable controlling how 3D acceleration is used to accelerate the SDL\nscreen surface.\n\nSDL can try to accelerate the SDL screen surface by using streaming\ntextures with a 3D rendering engine. This variable controls whether and how\nthis is done.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable 3D acceleration\n- \"1\": Enable 3D acceleration, using the default renderer. (default)\n- \"X\": Enable 3D acceleration, using X where X is one of the valid\nrendering drivers. (e.g. \"direct3d\", \"opengl\", etc.)\n\nThis hint should be set before calling [`SDL_GetWindowSurface()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GAMECONTROLLERCONFIG: Hint = Hint { + module: "hints", + name: "SDL_HINT_GAMECONTROLLERCONFIG", + short_name: "GAMECONTROLLERCONFIG", + value: crate::hints::SDL_HINT_GAMECONTROLLERCONFIG, + doc: Some( + "A variable that lets you manually hint extra gamecontroller db entries.\n\nThe variable should be newline delimited rows of gamecontroller config\ndata, see SDL_gamepad.h\n\nYou can update mappings after SDL is initialized with\n[`SDL_GetGamepadMappingForGUID()`] and [`SDL_AddGamepadMapping()`]\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GAMECONTROLLERCONFIG_FILE: Hint = Hint { + module: "hints", + name: "SDL_HINT_GAMECONTROLLERCONFIG_FILE", + short_name: "GAMECONTROLLERCONFIG_FILE", + value: crate::hints::SDL_HINT_GAMECONTROLLERCONFIG_FILE, + doc: Some( + "A variable that lets you provide a file with extra gamecontroller db\nentries.\n\nThe file should contain lines of gamecontroller config data, see\nSDL_gamepad.h\n\nYou can update mappings after SDL is initialized with\n[`SDL_GetGamepadMappingForGUID()`] and [`SDL_AddGamepadMapping()`]\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GAMECONTROLLERTYPE: Hint = Hint { + module: "hints", + name: "SDL_HINT_GAMECONTROLLERTYPE", + short_name: "GAMECONTROLLERTYPE", + value: crate::hints::SDL_HINT_GAMECONTROLLERTYPE, + doc: Some( + "A variable that overrides the automatic controller type detection.\n\nThe variable should be comma separated entries, in the form: VID/PID=type\n\nThe VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd\n\nThis hint affects what low level protocol is used with the HIDAPI driver.\n\nThe variable can be set to the following values:\n\n- \"Xbox360\"\n- \"XboxOne\"\n- \"PS3\"\n- \"PS4\"\n- \"PS5\"\n- \"SwitchPro\"\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES", + short_name: "GAMECONTROLLER_IGNORE_DEVICES", + value: crate::hints::SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + doc: Some( + "A variable containing a list of devices to skip when scanning for game\ncontrollers.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n0xAAAA/0xBBBB,0xCCCC/0xDDDD\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT: Hint = Hint { + module: "hints", + name: "SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT", + short_name: "GAMECONTROLLER_IGNORE_DEVICES_EXCEPT", + value: crate::hints::SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + doc: Some( + "If set, all devices will be skipped when scanning for game controllers\nexcept for the ones listed in this variable.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n0xAAAA/0xBBBB,0xCCCC/0xDDDD\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GAMECONTROLLER_SENSOR_FUSION: Hint = Hint { + module: "hints", + name: "SDL_HINT_GAMECONTROLLER_SENSOR_FUSION", + short_name: "GAMECONTROLLER_SENSOR_FUSION", + value: crate::hints::SDL_HINT_GAMECONTROLLER_SENSOR_FUSION, + doc: Some( + "A variable that controls whether the device's built-in accelerometer and\ngyro should be used as sensors for gamepads.\n\nThe variable can be set to the following values:\n\n- \"0\": Sensor fusion is disabled\n- \"1\": Sensor fusion is enabled for all controllers that lack sensors\n\nOr the variable can be a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n0xAAAA/0xBBBB,0xCCCC/0xDDDD\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint should be set before a gamepad is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT: Hint = Hint { + module: "hints", + name: "SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT", + short_name: "GDK_TEXTINPUT_DEFAULT_TEXT", + value: crate::hints::SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT, + doc: Some( + "This variable sets the default text of the TextInput window on GDK\nplatforms.\n\nThis hint is available only if SDL_GDK_TEXTINPUT defined.\n\nThis hint should be set before calling [`SDL_StartTextInput()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GDK_TEXTINPUT_DESCRIPTION: Hint = Hint { + module: "hints", + name: "SDL_HINT_GDK_TEXTINPUT_DESCRIPTION", + short_name: "GDK_TEXTINPUT_DESCRIPTION", + value: crate::hints::SDL_HINT_GDK_TEXTINPUT_DESCRIPTION, + doc: Some( + "This variable sets the description of the TextInput window on GDK\nplatforms.\n\nThis hint is available only if SDL_GDK_TEXTINPUT defined.\n\nThis hint should be set before calling [`SDL_StartTextInput()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH: Hint = Hint { + module: "hints", + name: "SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH", + short_name: "GDK_TEXTINPUT_MAX_LENGTH", + value: crate::hints::SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH, + doc: Some( + "This variable sets the maximum input length of the TextInput window on GDK\nplatforms.\n\nThe value must be a stringified integer, for example \"10\" to allow for up\nto 10 characters of text input.\n\nThis hint is available only if SDL_GDK_TEXTINPUT defined.\n\nThis hint should be set before calling [`SDL_StartTextInput()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GDK_TEXTINPUT_SCOPE: Hint = Hint { + module: "hints", + name: "SDL_HINT_GDK_TEXTINPUT_SCOPE", + short_name: "GDK_TEXTINPUT_SCOPE", + value: crate::hints::SDL_HINT_GDK_TEXTINPUT_SCOPE, + doc: Some( + "This variable sets the input scope of the TextInput window on GDK\nplatforms.\n\nSet this hint to change the XGameUiTextEntryInputScope value that will be\npassed to the window creation function. The value must be a stringified\ninteger, for example \"0\" for XGameUiTextEntryInputScope::Default.\n\nThis hint is available only if SDL_GDK_TEXTINPUT defined.\n\nThis hint should be set before calling [`SDL_StartTextInput()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GDK_TEXTINPUT_TITLE: Hint = Hint { + module: "hints", + name: "SDL_HINT_GDK_TEXTINPUT_TITLE", + short_name: "GDK_TEXTINPUT_TITLE", + value: crate::hints::SDL_HINT_GDK_TEXTINPUT_TITLE, + doc: Some( + "This variable sets the title of the TextInput window on GDK platforms.\n\nThis hint is available only if SDL_GDK_TEXTINPUT defined.\n\nThis hint should be set before calling [`SDL_StartTextInput()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_HIDAPI_LIBUSB: Hint = Hint { + module: "hints", + name: "SDL_HINT_HIDAPI_LIBUSB", + short_name: "HIDAPI_LIBUSB", + value: crate::hints::SDL_HINT_HIDAPI_LIBUSB, + doc: Some( + "A variable to control whether HIDAPI uses libusb for device access.\n\nBy default libusb will only be used for a few devices that require direct\nUSB access, and this can be controlled with\n[`SDL_HINT_HIDAPI_LIBUSB_WHITELIST`].\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI will not use libusb for device access.\n- \"1\": HIDAPI will use libusb for device access if available. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_HIDAPI_LIBUSB_GAMECUBE: Hint = Hint { + module: "hints", + name: "SDL_HINT_HIDAPI_LIBUSB_GAMECUBE", + short_name: "HIDAPI_LIBUSB_GAMECUBE", + value: crate::hints::SDL_HINT_HIDAPI_LIBUSB_GAMECUBE, + doc: Some( + "A variable to control whether HIDAPI uses libusb for GameCube adapters.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI will not use libusb for GameCube adapters.\n- \"1\": HIDAPI will use libusb for GameCube adapters if available. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_HIDAPI_LIBUSB_WHITELIST: Hint = Hint { + module: "hints", + name: "SDL_HINT_HIDAPI_LIBUSB_WHITELIST", + short_name: "HIDAPI_LIBUSB_WHITELIST", + value: crate::hints::SDL_HINT_HIDAPI_LIBUSB_WHITELIST, + doc: Some( + "A variable to control whether HIDAPI uses libusb only for whitelisted\ndevices.\n\nBy default libusb will only be used for a few devices that require direct\nUSB access.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI will use libusb for all device access.\n- \"1\": HIDAPI will use libusb only for whitelisted devices. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_HIDAPI_UDEV: Hint = Hint { + module: "hints", + name: "SDL_HINT_HIDAPI_UDEV", + short_name: "HIDAPI_UDEV", + value: crate::hints::SDL_HINT_HIDAPI_UDEV, + doc: Some( + "A variable to control whether HIDAPI uses udev for device detection.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI will poll for device changes.\n- \"1\": HIDAPI will use udev for device detection. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_GPU_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_GPU_DRIVER", + short_name: "GPU_DRIVER", + value: crate::hints::SDL_HINT_GPU_DRIVER, + doc: Some( + "A variable that specifies a GPU backend to use.\n\nBy default, SDL will try all available GPU backends in a reasonable order\nuntil it finds one that can work, but this hint allows the app or user to\nforce a specific target, such as \"direct3d12\" if, say, your hardware\nsupports Vulkan but you want to try using D3D12 instead.\n\nThis hint should be set before any GPU functions are called.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS: Hint = Hint { + module: "hints", + name: "SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS", + short_name: "HIDAPI_ENUMERATE_ONLY_CONTROLLERS", + value: crate::hints::SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS, + doc: Some( + "A variable to control whether [`SDL_hid_enumerate()`] enumerates all HID\ndevices or only controllers.\n\nThe variable can be set to the following values:\n\n- \"0\": [`SDL_hid_enumerate()`] will enumerate all HID devices.\n- \"1\": [`SDL_hid_enumerate()`] will only enumerate controllers. (default)\n\nBy default SDL will only enumerate controllers, to reduce risk of hanging\nor crashing on devices with bad drivers and avoiding macOS keyboard capture\npermission prompts.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_HIDAPI_IGNORE_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_HIDAPI_IGNORE_DEVICES", + short_name: "HIDAPI_IGNORE_DEVICES", + value: crate::hints::SDL_HINT_HIDAPI_IGNORE_DEVICES, + doc: Some( + "A variable containing a list of devices to ignore in [`SDL_hid_enumerate()`].\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nFor example, to ignore the Shanwan DS3 controller and any Valve controller,\nyou might use the string \"0x2563/0x0523,0x28de/0x0000\"\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_IME_IMPLEMENTED_UI: Hint = Hint { + module: "hints", + name: "SDL_HINT_IME_IMPLEMENTED_UI", + short_name: "IME_IMPLEMENTED_UI", + value: crate::hints::SDL_HINT_IME_IMPLEMENTED_UI, + doc: Some( + "A variable describing what IME UI elements the application can display.\n\nBy default IME UI is handled using native components by the OS where\npossible, however this can interfere with or not be visible when exclusive\nfullscreen mode is used.\n\nThe variable can be set to a comma separated list containing the following\nitems:\n\n- \"none\" or \"0\": The application can't render any IME elements, and native\nUI should be used. (default)\n- \"composition\": The application handles [`SDL_EVENT_TEXT_EDITING`] events and\ncan render the composition text.\n- \"candidates\": The application handles [`SDL_EVENT_TEXT_EDITING_CANDIDATES`]\nand can render the candidate list.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_IOS_HIDE_HOME_INDICATOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_IOS_HIDE_HOME_INDICATOR", + short_name: "IOS_HIDE_HOME_INDICATOR", + value: crate::hints::SDL_HINT_IOS_HIDE_HOME_INDICATOR, + doc: Some( + "A variable controlling whether the home indicator bar on iPhone X and later\nshould be hidden.\n\nThe variable can be set to the following values:\n\n- \"0\": The indicator bar is not hidden. (default for windowed applications)\n- \"1\": The indicator bar is hidden and is shown when the screen is touched\n(useful for movie playback applications).\n- \"2\": The indicator bar is dim and the first swipe makes it visible and\nthe second swipe performs the \"home\" action. (default for fullscreen\napplications)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS", + short_name: "JOYSTICK_ALLOW_BACKGROUND_EVENTS", + value: crate::hints::SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + doc: Some( + "A variable that lets you enable joystick (and gamecontroller) events even\nwhen your app is in the background.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable joystick & gamecontroller input events when the application\nis in the background. (default)\n- \"1\": Enable joystick & gamecontroller input events when the application\nis in the background.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES", + short_name: "JOYSTICK_ARCADESTICK_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES, + doc: Some( + "A variable containing a list of arcade stick style controllers.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED", + short_name: "JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED", + value: crate::hints::SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED, + doc: Some( + "A variable containing a list of devices that are not arcade stick style\ncontrollers.\n\nThis will override [`SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES`] and the built in\ndevice list.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_BLACKLIST_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_BLACKLIST_DEVICES", + short_name: "JOYSTICK_BLACKLIST_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_BLACKLIST_DEVICES, + doc: Some( + "A variable containing a list of devices that should not be considered\njoysticks.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED", + short_name: "JOYSTICK_BLACKLIST_DEVICES_EXCLUDED", + value: crate::hints::SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED, + doc: Some( + "A variable containing a list of devices that should be considered\njoysticks.\n\nThis will override [`SDL_HINT_JOYSTICK_BLACKLIST_DEVICES`] and the built in\ndevice list.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_DEVICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_DEVICE", + short_name: "JOYSTICK_DEVICE", + value: crate::hints::SDL_HINT_JOYSTICK_DEVICE, + doc: Some( + "A variable containing a comma separated list of devices to open as\njoysticks.\n\nThis variable is currently only used by the Linux joystick driver.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_ENHANCED_REPORTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_ENHANCED_REPORTS", + short_name: "JOYSTICK_ENHANCED_REPORTS", + value: crate::hints::SDL_HINT_JOYSTICK_ENHANCED_REPORTS, + doc: Some( + "A variable controlling whether enhanced reports should be used for\ncontrollers when using the HIDAPI driver.\n\nEnhanced reports allow rumble and effects on Bluetooth PlayStation\ncontrollers and gyro on Nintendo Switch controllers, but break Windows\nDirectInput for other applications that don't use SDL.\n\nOnce enhanced reports are enabled, they can't be disabled on PlayStation\ncontrollers without power cycling the controller.\n\nThe variable can be set to the following values:\n\n- \"0\": enhanced reports are not enabled.\n- \"1\": enhanced reports are enabled. (default)\n- \"auto\": enhanced features are advertised to the application, but SDL\ndoesn't change the controller report mode unless the application uses\nthem.\n\nThis hint can be enabled anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES", + short_name: "JOYSTICK_FLIGHTSTICK_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES, + doc: Some( + "A variable containing a list of flightstick style controllers.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of @file, in which case the named file\nwill be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED", + short_name: "JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED", + value: crate::hints::SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED, + doc: Some( + "A variable containing a list of devices that are not flightstick style\ncontrollers.\n\nThis will override [`SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES`] and the built in\ndevice list.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_GAMEINPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_GAMEINPUT", + short_name: "JOYSTICK_GAMEINPUT", + value: crate::hints::SDL_HINT_JOYSTICK_GAMEINPUT, + doc: Some( + "A variable controlling whether GameInput should be used for controller\nhandling on Windows.\n\nThe variable can be set to the following values:\n\n- \"0\": GameInput is not used.\n- \"1\": GameInput is used.\n\nThe default is \"1\" on GDK platforms, and \"0\" otherwise.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_GAMEINPUT_RAW: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_GAMEINPUT_RAW", + short_name: "JOYSTICK_GAMEINPUT_RAW", + value: crate::hints::SDL_HINT_JOYSTICK_GAMEINPUT_RAW, + doc: Some( + "A variable controlling whether GameInput should be used for handling\nGIP devices that require raw report processing, but aren't supported\nby HIDRAW, such as Xbox One Guitars.\n\nNote that this is only supported with GameInput 3 or newer.\n\nThe variable can be set to the following values:\n\n- \"0\": GameInput is not used to handle raw GIP devices.\n- \"1\": GameInput is used.\n\nThe default is \"1\" when using GameInput 3 or newer, and is \"0\" otherwise.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.4.4.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 4)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_GAMECUBE_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_GAMECUBE_DEVICES", + short_name: "JOYSTICK_GAMECUBE_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_GAMECUBE_DEVICES, + doc: Some( + "A variable containing a list of devices known to have a GameCube form\nfactor.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED", + short_name: "JOYSTICK_GAMECUBE_DEVICES_EXCLUDED", + value: crate::hints::SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED, + doc: Some( + "A variable containing a list of devices known not to have a GameCube form\nfactor.\n\nThis will override [`SDL_HINT_JOYSTICK_GAMECUBE_DEVICES`] and the built in\ndevice list.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI", + short_name: "JOYSTICK_HIDAPI", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI, + doc: Some( + "A variable controlling whether the HIDAPI joystick drivers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI drivers are not used.\n- \"1\": HIDAPI drivers are used. (default)\n\nThis variable is the default for all drivers, but can be overridden by the\nhints for specific drivers below.\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS", + short_name: "JOYSTICK_HIDAPI_COMBINE_JOY_CONS", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, + doc: Some( + "A variable controlling whether Nintendo Switch Joy-Con controllers will be\ncombined into a single Pro-like controller when using the HIDAPI driver.\n\nThe variable can be set to the following values:\n\n- \"0\": Left and right Joy-Con controllers will not be combined and each\nwill be a mini-gamepad.\n- \"1\": Left and right Joy-Con controllers will be combined into a single\ncontroller. (default)\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE", + short_name: "JOYSTICK_HIDAPI_GAMECUBE", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE, + doc: Some( + "A variable controlling whether the HIDAPI driver for Nintendo GameCube\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`]\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE", + short_name: "JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE, + doc: Some( + "A variable controlling whether rumble is used to implement the GameCube\ncontroller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2).\n\nThis is useful for applications that need full compatibility for things\nlike ADSR envelopes. - Stop is implemented by setting low_frequency_rumble\nto 0 and high_frequency_rumble >0 - Rumble is both at any arbitrary value -\nStopHard is implemented by setting both low_frequency_rumble and\nhigh_frequency_rumble to 0\n\nThe variable can be set to the following values:\n\n- \"0\": Normal rumble behavior is behavior is used. (default)\n- \"1\": Proper GameCube controller rumble behavior is used.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS", + short_name: "JOYSTICK_HIDAPI_JOY_CONS", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, + doc: Some( + "A variable controlling whether the HIDAPI driver for Nintendo Switch\nJoy-Cons should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED", + short_name: "JOYSTICK_HIDAPI_JOYCON_HOME_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED, + doc: Some( + "A variable controlling whether the Home button LED should be turned on when\na Nintendo Switch Joy-Con controller is opened.\n\nThe variable can be set to the following values:\n\n- \"0\": home button LED is turned off\n- \"1\": home button LED is turned on\n\nBy default the Home button LED state is not changed. This hint can also be\nset to a floating point value between 0.0 and 1.0 which controls the\nbrightness of the Home button LED.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_LUNA: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_LUNA", + short_name: "JOYSTICK_HIDAPI_LUNA", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_LUNA, + doc: Some( + "A variable controlling whether the HIDAPI driver for Amazon Luna\ncontrollers connected via Bluetooth should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC", + short_name: "JOYSTICK_HIDAPI_NINTENDO_CLASSIC", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC, + doc: Some( + "A variable controlling whether the HIDAPI driver for Nintendo Online\nclassic controllers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS3: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_PS3", + short_name: "JOYSTICK_HIDAPI_PS3", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_PS3, + doc: Some( + "A variable controlling whether the HIDAPI driver for PS3 controllers should\nbe used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`] on macOS, and \"0\" on\nother platforms.\n\nFor official Sony driver (sixaxis.sys) use\n[`SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER`]. See\n for an alternative driver on Windows.\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER", + short_name: "JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER, + doc: Some( + "A variable controlling whether the Sony driver (sixaxis.sys) for PS3\ncontrollers (Sixaxis/DualShock 3) should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": Sony driver (sixaxis.sys) is not used.\n- \"1\": Sony driver (sixaxis.sys) is used.\n\nThe default value is 0.\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS4: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_PS4", + short_name: "JOYSTICK_HIDAPI_PS4", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_PS4, + doc: Some( + "A variable controlling whether the HIDAPI driver for PS4 controllers should\nbe used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL", + short_name: "JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL, + doc: Some( + "A variable controlling the update rate of the PS4 controller over Bluetooth\nwhen using the HIDAPI driver.\n\nThis defaults to 4 ms, to match the behavior over USB, and to be more\nfriendly to other Bluetooth devices and older Bluetooth hardware on the\ncomputer. It can be set to \"1\" (1000Hz), \"2\" (500Hz) and \"4\" (250Hz)\n\nThis hint can be set anytime, but only takes effect when extended input\nreports are enabled.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS5: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_PS5", + short_name: "JOYSTICK_HIDAPI_PS5", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_PS5, + doc: Some( + "A variable controlling whether the HIDAPI driver for PS5 controllers should\nbe used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED", + short_name: "JOYSTICK_HIDAPI_PS5_PLAYER_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, + doc: Some( + "A variable controlling whether the player LEDs should be lit to indicate\nwhich player is associated with a PS5 controller.\n\nThe variable can be set to the following values:\n\n- \"0\": player LEDs are not enabled.\n- \"1\": player LEDs are enabled. (default)\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_SHIELD: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_SHIELD", + short_name: "JOYSTICK_HIDAPI_SHIELD", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_SHIELD, + doc: Some( + "A variable controlling whether the HIDAPI driver for NVIDIA SHIELD\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_STADIA: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_STADIA", + short_name: "JOYSTICK_HIDAPI_STADIA", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_STADIA, + doc: Some( + "A variable controlling whether the HIDAPI driver for Google Stadia\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAM: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_STEAM", + short_name: "JOYSTICK_HIDAPI_STEAM", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_STEAM, + doc: Some( + "A variable controlling whether the HIDAPI driver for Bluetooth Steam\nControllers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used. (default)\n- \"1\": HIDAPI driver is used for Steam Controllers, which requires\nBluetooth access and may prompt the user for permission on iOS and\nAndroid.\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED", + short_name: "JOYSTICK_HIDAPI_STEAM_HOME_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED, + doc: Some( + "A variable controlling whether the Steam button LED should be turned on\nwhen a Steam controller is opened.\n\nThe variable can be set to the following values:\n\n- \"0\": Steam button LED is turned off.\n- \"1\": Steam button LED is turned on.\n\nBy default the Steam button LED state is not changed. This hint can also be\nset to a floating point value between 0.0 and 1.0 which controls the\nbrightness of the Steam button LED.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK", + short_name: "JOYSTICK_HIDAPI_STEAMDECK", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, + doc: Some( + "A variable controlling whether the HIDAPI driver for the Steam Deck builtin\ncontroller should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI", + short_name: "JOYSTICK_HIDAPI_STEAM_HORI", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI, + doc: Some( + "A variable controlling whether the HIDAPI driver for HORI licensed Steam\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_LG4FF: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_LG4FF", + short_name: "JOYSTICK_HIDAPI_LG4FF", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_LG4FF, + doc: Some( + "A variable controlling whether the HIDAPI driver for some Logitech wheels\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_8BITDO: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_8BITDO", + short_name: "JOYSTICK_HIDAPI_8BITDO", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_8BITDO, + doc: Some( + "A variable controlling whether the HIDAPI driver for 8BitDo controllers\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_SINPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_SINPUT", + short_name: "JOYSTICK_HIDAPI_SINPUT", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_SINPUT, + doc: Some( + "A variable controlling whether the HIDAPI driver for SInput controllers\nshould be used.\n\nMore info - \n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_ZUIKI: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_ZUIKI", + short_name: "JOYSTICK_HIDAPI_ZUIKI", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_ZUIKI, + doc: Some( + "A variable controlling whether the HIDAPI driver for ZUIKI controllers\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI", + short_name: "JOYSTICK_HIDAPI_FLYDIGI", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI, + doc: Some( + "A variable controlling whether the HIDAPI driver for Flydigi controllers\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_SWITCH", + short_name: "JOYSTICK_HIDAPI_SWITCH", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_SWITCH, + doc: Some( + "A variable controlling whether the HIDAPI driver for Nintendo Switch\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED", + short_name: "JOYSTICK_HIDAPI_SWITCH_HOME_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, + doc: Some( + "A variable controlling whether the Home button LED should be turned on when\na Nintendo Switch Pro controller is opened.\n\nThe variable can be set to the following values:\n\n- \"0\": Home button LED is turned off.\n- \"1\": Home button LED is turned on.\n\nBy default the Home button LED state is not changed. This hint can also be\nset to a floating point value between 0.0 and 1.0 which controls the\nbrightness of the Home button LED.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED", + short_name: "JOYSTICK_HIDAPI_SWITCH_PLAYER_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED, + doc: Some( + "A variable controlling whether the player LEDs should be lit to indicate\nwhich player is associated with a Nintendo Switch controller.\n\nThe variable can be set to the following values:\n\n- \"0\": Player LEDs are not enabled.\n- \"1\": Player LEDs are enabled. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH2: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_SWITCH2", + short_name: "JOYSTICK_HIDAPI_SWITCH2", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_SWITCH2, + doc: Some( + "A variable controlling whether the HIDAPI driver for Nintendo Switch 2\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS", + short_name: "JOYSTICK_HIDAPI_VERTICAL_JOY_CONS", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, + doc: Some( + "A variable controlling whether Nintendo Switch Joy-Con controllers will be\nin vertical mode when using the HIDAPI driver.\n\nThe variable can be set to the following values:\n\n- \"0\": Left and right Joy-Con controllers will not be in vertical mode.\n(default)\n- \"1\": Left and right Joy-Con controllers will be in vertical mode.\n\nThis hint should be set before opening a Joy-Con controller.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_WII: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_WII", + short_name: "JOYSTICK_HIDAPI_WII", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_WII, + doc: Some( + "A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThis driver doesn't work with the dolphinbar, so the default is false for\nnow.\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED", + short_name: "JOYSTICK_HIDAPI_WII_PLAYER_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED, + doc: Some( + "A variable controlling whether the player LEDs should be lit to indicate\nwhich player is associated with a Wii controller.\n\nThe variable can be set to the following values:\n\n- \"0\": Player LEDs are not enabled.\n- \"1\": Player LEDs are enabled. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_XBOX", + short_name: "JOYSTICK_HIDAPI_XBOX", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_XBOX, + doc: Some( + "A variable controlling whether the HIDAPI driver for XBox controllers\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is \"0\" on Windows, otherwise the value of\n[`SDL_HINT_JOYSTICK_HIDAPI`]\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_360: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_XBOX_360", + short_name: "JOYSTICK_HIDAPI_XBOX_360", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_XBOX_360, + doc: Some( + "A variable controlling whether the HIDAPI driver for XBox 360 controllers\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX`]\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED", + short_name: "JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED, + doc: Some( + "A variable controlling whether the player LEDs should be lit to indicate\nwhich player is associated with an Xbox 360 controller.\n\nThe variable can be set to the following values:\n\n- \"0\": Player LEDs are not enabled.\n- \"1\": Player LEDs are enabled. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS", + short_name: "JOYSTICK_HIDAPI_XBOX_360_WIRELESS", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS, + doc: Some( + "A variable controlling whether the HIDAPI driver for XBox 360 wireless\ncontrollers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX_360`]\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE", + short_name: "JOYSTICK_HIDAPI_XBOX_ONE", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE, + doc: Some( + "A variable controlling whether the HIDAPI driver for XBox One controllers\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED", + short_name: "JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED, + doc: Some( + "A variable controlling whether the Home button LED should be turned on when\nan Xbox One controller is opened.\n\nThe variable can be set to the following values:\n\n- \"0\": Home button LED is turned off.\n- \"1\": Home button LED is turned on.\n\nBy default the Home button LED state is not changed. This hint can also be\nset to a floating point value between 0.0 and 1.0 which controls the\nbrightness of the Home button LED. The default brightness is 0.4.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_GIP: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_GIP", + short_name: "JOYSTICK_HIDAPI_GIP", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_GIP, + doc: Some( + "A variable controlling whether the new HIDAPI driver for wired Xbox One\n(GIP) controllers should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": HIDAPI driver is not used.\n- \"1\": HIDAPI driver is used.\n\nThe default is the value of [`SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE`].\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA", + short_name: "JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA", + value: crate::hints::SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA, + doc: Some( + "A variable controlling whether the new HIDAPI driver for wired Xbox One\n(GIP) controllers should reset the controller if it can't get the metadata\nfrom the controller.\n\nThe variable can be set to the following values:\n\n- \"0\": Assume this is a generic controller.\n- \"1\": Reset the controller to get metadata.\n\nBy default the controller is reset. This is so we can properly detect\nthe controller type.\n\nThis hint should be set before initializing joysticks and gamepads.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_IOKIT: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_IOKIT", + short_name: "JOYSTICK_IOKIT", + value: crate::hints::SDL_HINT_JOYSTICK_IOKIT, + doc: Some( + "A variable controlling whether IOKit should be used for controller\nhandling.\n\nThe variable can be set to the following values:\n\n- \"0\": IOKit is not used.\n- \"1\": IOKit is used. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_LINUX_CLASSIC: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_LINUX_CLASSIC", + short_name: "JOYSTICK_LINUX_CLASSIC", + value: crate::hints::SDL_HINT_JOYSTICK_LINUX_CLASSIC, + doc: Some( + "A variable controlling whether to use the classic /dev/input/js* joystick\ninterface or the newer /dev/input/event* joystick interface on Linux.\n\nThe variable can be set to the following values:\n\n- \"0\": Use /dev/input/event* (default)\n- \"1\": Use /dev/input/js*\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_LINUX_DEADZONES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_LINUX_DEADZONES", + short_name: "JOYSTICK_LINUX_DEADZONES", + value: crate::hints::SDL_HINT_JOYSTICK_LINUX_DEADZONES, + doc: Some( + "A variable controlling whether joysticks on Linux adhere to their\nHID-defined deadzones or return unfiltered values.\n\nThe variable can be set to the following values:\n\n- \"0\": Return unfiltered joystick axis values. (default)\n- \"1\": Return axis values with deadzones taken into account.\n\nThis hint should be set before a controller is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS", + short_name: "JOYSTICK_LINUX_DIGITAL_HATS", + value: crate::hints::SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS, + doc: Some( + "A variable controlling whether joysticks on Linux will always treat 'hat'\naxis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking\nwhether they may be analog.\n\nThe variable can be set to the following values:\n\n- \"0\": Only map hat axis inputs to digital hat outputs if the input axes\nappear to actually be digital. (default)\n- \"1\": Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as\ndigital hats.\n\nThis hint should be set before a controller is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES", + short_name: "JOYSTICK_LINUX_HAT_DEADZONES", + value: crate::hints::SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES, + doc: Some( + "A variable controlling whether digital hats on Linux will apply deadzones\nto their underlying input axes or use unfiltered values.\n\nThe variable can be set to the following values:\n\n- \"0\": Return digital hat values based on unfiltered input axis values.\n- \"1\": Return digital hat values with deadzones on the input axes taken\ninto account. (default)\n\nThis hint should be set before a controller is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_MFI: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_MFI", + short_name: "JOYSTICK_MFI", + value: crate::hints::SDL_HINT_JOYSTICK_MFI, + doc: Some( + "A variable controlling whether GCController should be used for controller\nhandling.\n\nThe variable can be set to the following values:\n\n- \"0\": GCController is not used.\n- \"1\": GCController is used. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_RAWINPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_RAWINPUT", + short_name: "JOYSTICK_RAWINPUT", + value: crate::hints::SDL_HINT_JOYSTICK_RAWINPUT, + doc: Some( + "A variable controlling whether the RAWINPUT joystick drivers should be used\nfor better handling XInput-capable devices.\n\nThe variable can be set to the following values:\n\n- \"0\": RAWINPUT drivers are not used. (default)\n- \"1\": RAWINPUT drivers are used.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT", + short_name: "JOYSTICK_RAWINPUT_CORRELATE_XINPUT", + value: crate::hints::SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, + doc: Some( + "A variable controlling whether the RAWINPUT driver should pull correlated\ndata from XInput.\n\nThe variable can be set to the following values:\n\n- \"0\": RAWINPUT driver will only use data from raw input APIs.\n- \"1\": RAWINPUT driver will also pull data from XInput and\nWindows.Gaming.Input, providing better trigger axes, guide button\npresses, and rumble support for Xbox controllers. (default)\n\nThis hint should be set before a gamepad is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_ROG_CHAKRAM: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_ROG_CHAKRAM", + short_name: "JOYSTICK_ROG_CHAKRAM", + value: crate::hints::SDL_HINT_JOYSTICK_ROG_CHAKRAM, + doc: Some( + "A variable controlling whether the ROG Chakram mice should show up as\njoysticks.\n\nThe variable can be set to the following values:\n\n- \"0\": ROG Chakram mice do not show up as joysticks. (default)\n- \"1\": ROG Chakram mice show up as joysticks.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_THREAD: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_THREAD", + short_name: "JOYSTICK_THREAD", + value: crate::hints::SDL_HINT_JOYSTICK_THREAD, + doc: Some( + "A variable controlling whether a separate thread should be used for\nhandling joystick detection and raw input messages on Windows.\n\nThe variable can be set to the following values:\n\n- \"0\": A separate thread is not used.\n- \"1\": A separate thread is used for handling raw input messages. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_THROTTLE_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_THROTTLE_DEVICES", + short_name: "JOYSTICK_THROTTLE_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_THROTTLE_DEVICES, + doc: Some( + "A variable containing a list of throttle style controllers.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED", + short_name: "JOYSTICK_THROTTLE_DEVICES_EXCLUDED", + value: crate::hints::SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED, + doc: Some( + "A variable containing a list of devices that are not throttle style\ncontrollers.\n\nThis will override [`SDL_HINT_JOYSTICK_THROTTLE_DEVICES`] and the built in\ndevice list.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_WGI: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_WGI", + short_name: "JOYSTICK_WGI", + value: crate::hints::SDL_HINT_JOYSTICK_WGI, + doc: Some( + "A variable controlling whether Windows.Gaming.Input should be used for\ncontroller handling.\n\nThe variable can be set to the following values:\n\n- \"0\": WGI is not used. (default)\n- \"1\": WGI is used.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_WHEEL_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_WHEEL_DEVICES", + short_name: "JOYSTICK_WHEEL_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_WHEEL_DEVICES, + doc: Some( + "A variable containing a list of wheel style controllers.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED", + short_name: "JOYSTICK_WHEEL_DEVICES_EXCLUDED", + value: crate::hints::SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED, + doc: Some( + "A variable containing a list of devices that are not wheel style\ncontrollers.\n\nThis will override [`SDL_HINT_JOYSTICK_WHEEL_DEVICES`] and the built in device\nlist.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES", + short_name: "JOYSTICK_ZERO_CENTERED_DEVICES", + value: crate::hints::SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES, + doc: Some( + "A variable containing a list of devices known to have all axes centered at\nzero.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint should be set before a controller is opened.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_JOYSTICK_HAPTIC_AXES: Hint = Hint { + module: "hints", + name: "SDL_HINT_JOYSTICK_HAPTIC_AXES", + short_name: "JOYSTICK_HAPTIC_AXES", + value: crate::hints::SDL_HINT_JOYSTICK_HAPTIC_AXES, + doc: Some( + "A variable containing a list of devices and their desired number of haptic\n(force feedback) enabled axis.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form plus the number of desired axes, e.g.\n\n`0xAAAA/0xBBBB/1,0xCCCC/0xDDDD/3`\n\nThis hint supports a \"wildcard\" device that will set the number of haptic\naxes on all initialized haptic devices which were not defined explicitly in\nthis hint.\n\n`0xFFFF/0xFFFF/1`\n\nThis hint should be set before a controller is opened. The number of haptic\naxes won't exceed the number of real axes found on the device.\n\n## Availability\nThis hint is available since SDL 3.2.5.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 5)), +}; +pub const METADATA_SDL_HINT_KEYCODE_OPTIONS: Hint = Hint { + module: "hints", + name: "SDL_HINT_KEYCODE_OPTIONS", + short_name: "KEYCODE_OPTIONS", + value: crate::hints::SDL_HINT_KEYCODE_OPTIONS, + doc: Some( + "A variable that controls keycode representation in keyboard events.\n\nThis variable is a comma separated set of options for translating keycodes\nin events:\n\n- \"none\": Keycode options are cleared, this overrides other options.\n- \"hide_numpad\": The numpad keysyms will be translated into their\nnon-numpad versions based on the current NumLock state. For example,\nSDLK_KP_4 would become SDLK_4 if [`SDL_KMOD_NUM`] is set in the event\nmodifiers, and SDLK_LEFT if it is unset.\n- \"french_numbers\": The number row on French keyboards is inverted, so\npressing the 1 key would yield the keycode SDLK_1, or '1', instead of\nSDLK_AMPERSAND, or '&'\n- \"latin_letters\": For keyboards using non-Latin letters, such as Russian\nor Thai, the letter keys generate keycodes as though it had an English\nQWERTY layout. e.g. pressing the key associated with [`SDL_SCANCODE_A`] on a\nRussian keyboard would yield 'a' instead of a Cyrillic letter.\n\nThe default value for this hint is \"french_numbers,latin_letters\"\n\nSome platforms like Emscripten only provide modified keycodes and the\noptions are not used.\n\nThese options do not affect the return value of [`SDL_GetKeyFromScancode()`] or\n[`SDL_GetScancodeFromKey()`], they just apply to the keycode included in key\nevents.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_KMSDRM_DEVICE_INDEX: Hint = Hint { + module: "hints", + name: "SDL_HINT_KMSDRM_DEVICE_INDEX", + short_name: "KMSDRM_DEVICE_INDEX", + value: crate::hints::SDL_HINT_KMSDRM_DEVICE_INDEX, + doc: Some( + "A variable that controls what KMSDRM device to use.\n\nSDL might open something like \"/dev/dri/cardNN\" to access KMSDRM\nfunctionality, where \"NN\" is a device index number. SDL makes a guess at\nthe best index to use (usually zero), but the app or user can set this hint\nto a number between 0 and 99 to force selection.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER: Hint = Hint { + module: "hints", + name: "SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER", + short_name: "KMSDRM_REQUIRE_DRM_MASTER", + value: crate::hints::SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, + doc: Some( + "A variable that controls whether SDL requires DRM master access in order to\ninitialize the KMSDRM video backend.\n\nThe DRM subsystem has a concept of a \"DRM master\" which is a DRM client\nthat has the ability to set planes, set cursor, etc. When SDL is DRM\nmaster, it can draw to the screen using the SDL rendering APIs. Without DRM\nmaster, SDL is still able to process input and query attributes of attached\ndisplays, but it cannot change display state or draw to the screen\ndirectly.\n\nIn some cases, it can be useful to have the KMSDRM backend even if it\ncannot be used for rendering. An app may want to use SDL for input\nprocessing while using another rendering API (such as an MMAL overlay on\nRaspberry Pi) or using its own code to render to DRM overlays that SDL\ndoesn't support.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will allow usage of the KMSDRM backend without DRM master.\n- \"1\": SDL Will require DRM master to use the KMSDRM backend. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_KMSDRM_ATOMIC: Hint = Hint { + module: "hints", + name: "SDL_HINT_KMSDRM_ATOMIC", + short_name: "KMSDRM_ATOMIC", + value: crate::hints::SDL_HINT_KMSDRM_ATOMIC, + doc: Some( + "A variable that controls whether KMSDRM will use \"atomic\" functionality.\n\nThe KMSDRM backend can use atomic commits, if both DRM_CLIENT_CAP_ATOMIC\nand DRM_CLIENT_CAP_UNIVERSAL_PLANES is supported by the system. As of SDL\n3.4.0, it will favor this functionality, but in case this doesn't work well\non a given system or other surprises, this hint can be used to disable it.\n\nThis hint can not enable the functionality if it isn't available.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will not use the KMSDRM \"atomic\" functionality.\n- \"1\": SDL will allow usage of the KMSDRM \"atomic\" functionality. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_LOGGING: Hint = Hint { + module: "hints", + name: "SDL_HINT_LOGGING", + short_name: "LOGGING", + value: crate::hints::SDL_HINT_LOGGING, + doc: Some( + "A variable controlling the default SDL log levels.\n\nThis variable is a comma separated set of category=level tokens that define\nthe default logging levels for SDL applications.\n\nThe category can be a numeric category, one of \"app\", \"error\", \"assert\",\n\"system\", \"audio\", \"video\", \"render\", \"input\", \"test\", or `*` for any\nunspecified category.\n\nThe level can be a numeric level, one of \"verbose\", \"debug\", \"info\",\n\"warn\", \"error\", \"critical\", or \"quiet\" to disable that category.\n\nYou can omit the category if you want to set the logging level for all\ncategories.\n\nIf this hint isn't set, the default log levels are equivalent to:\n\n`app=info,assert=warn,test=verbose,*=error`\n\nIf the `DEBUG_INVOCATION` environment variable is set to \"1\", the default\nlog levels are equivalent to:\n\n`assert=warn,test=verbose,*=debug`\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MAC_BACKGROUND_APP: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAC_BACKGROUND_APP", + short_name: "MAC_BACKGROUND_APP", + value: crate::hints::SDL_HINT_MAC_BACKGROUND_APP, + doc: Some( + "A variable controlling whether to force the application to become the\nforeground process when launched on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": The application is brought to the foreground when launched.\n(default)\n- \"1\": The application may remain in the background when launched.\n\nThis hint needs to be set before [`SDL_Init()`].\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK", + short_name: "MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK", + value: crate::hints::SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, + doc: Some( + "A variable that determines whether Ctrl+Click should generate a right-click\nevent on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": Ctrl+Click does not generate a right mouse button click event.\n(default)\n- \"1\": Ctrl+Click generated a right mouse button click event.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH", + short_name: "MAC_OPENGL_ASYNC_DISPATCH", + value: crate::hints::SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH, + doc: Some( + "A variable controlling whether dispatching OpenGL context updates should\nblock the dispatching thread until the main thread finishes processing on\nmacOS.\n\nThe variable can be set to the following values:\n\n- \"0\": Dispatching OpenGL context updates will block the dispatching thread\nuntil the main thread finishes processing. (default)\n- \"1\": Dispatching OpenGL context updates will allow the dispatching thread\nto continue execution.\n\nGenerally you want the default, but if you have OpenGL code in a background\nthread on a Mac, and the main thread hangs because it's waiting for that\nbackground thread, but that background thread is also hanging because it's\nwaiting for the main thread to do an update, this might fix your issue.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MAC_OPTION_AS_ALT: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAC_OPTION_AS_ALT", + short_name: "MAC_OPTION_AS_ALT", + value: crate::hints::SDL_HINT_MAC_OPTION_AS_ALT, + doc: Some( + "A variable controlling whether the Option key on macOS should be remapped\nto act as the Alt key.\n\nThe variable can be set to the following values:\n\n- \"none\": The Option key is not remapped to Alt. (default)\n- \"only_left\": Only the left Option key is remapped to Alt.\n- \"only_right\": Only the right Option key is remapped to Alt.\n- \"both\": Both Option keys are remapped to Alt.\n\nThis will prevent the triggering of key compositions that rely on the\nOption key, but will still send the Alt modifier for keyboard events. In\nthe case that both Alt and Option are pressed, the Option key will be\nignored. This is particularly useful for applications like terminal\nemulators and graphical user interfaces (GUIs) that rely on Alt key\nfunctionality for shortcuts or navigation. This does not apply to\n[`SDL_GetKeyFromScancode`] and only has an effect if IME is enabled.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MAC_SCROLL_MOMENTUM: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAC_SCROLL_MOMENTUM", + short_name: "MAC_SCROLL_MOMENTUM", + value: crate::hints::SDL_HINT_MAC_SCROLL_MOMENTUM, + doc: Some( + "A variable controlling whether [`SDL_EVENT_MOUSE_WHEEL`] event values will have\nmomentum on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": The mouse wheel events will have no momentum. (default)\n- \"1\": The mouse wheel events will have momentum.\n\nThis hint needs to be set before [`SDL_Init()`].\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MAC_PRESS_AND_HOLD: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAC_PRESS_AND_HOLD", + short_name: "MAC_PRESS_AND_HOLD", + value: crate::hints::SDL_HINT_MAC_PRESS_AND_HOLD, + doc: Some( + "A variable controlling whether holding down a key will repeat the pressed\nkey or open the accents menu on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": Holding a key will repeat the pressed key.\n- \"1\": Holding a key will open the accents menu for that key. (default)\n\nThis hint needs to be set before [`SDL_Init()`].\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_MAIN_CALLBACK_RATE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MAIN_CALLBACK_RATE", + short_name: "MAIN_CALLBACK_RATE", + value: crate::hints::SDL_HINT_MAIN_CALLBACK_RATE, + doc: Some( + "Request [`SDL_AppIterate()`] be called at a specific rate.\n\nIf this is set to a number, it represents Hz, so \"60\" means try to iterate\n60 times per second. \"0\" means to iterate as fast as possible. Negative\nvalues are illegal, but reserved, in case they are useful in a future\nrevision of SDL.\n\nThere are other strings that have special meaning. If set to \"waitevent\",\n[`SDL_AppIterate`] will not be called until new event(s) have arrived (and been\nprocessed by [`SDL_AppEvent`]). This can be useful for apps that are completely\nidle except in response to input.\n\nOn some platforms, or if you are using [`SDL_main`] instead of [`SDL_AppIterate`],\nthis hint is ignored. When the hint can be used, it is allowed to be\nchanged at any time.\n\nThis defaults to 0, and specifying NULL for the hint's value will restore\nthe default.\n\nThis doesn't have to be an integer value. For example, \"59.94\" won't be\nrounded to an integer rate; the digits after the decimal are actually\nrespected.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_AUTO_CAPTURE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_AUTO_CAPTURE", + short_name: "MOUSE_AUTO_CAPTURE", + value: crate::hints::SDL_HINT_MOUSE_AUTO_CAPTURE, + doc: Some( + "A variable controlling whether the mouse is captured while mouse buttons\nare pressed.\n\nThe variable can be set to the following values:\n\n- \"0\": The mouse is not captured while mouse buttons are pressed.\n- \"1\": The mouse is captured while mouse buttons are pressed.\n\nBy default the mouse is captured while mouse buttons are pressed so if the\nmouse is dragged outside the window, the application continues to receive\nmouse events until the button is released.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS", + short_name: "MOUSE_DOUBLE_CLICK_RADIUS", + value: crate::hints::SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, + doc: Some( + "A variable setting the double click radius, in pixels.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_DOUBLE_CLICK_TIME: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_DOUBLE_CLICK_TIME", + short_name: "MOUSE_DOUBLE_CLICK_TIME", + value: crate::hints::SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, + doc: Some( + "A variable setting the double click time, in milliseconds.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR", + short_name: "MOUSE_DEFAULT_SYSTEM_CURSOR", + value: crate::hints::SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR, + doc: Some( + "A variable setting which system cursor to use as the default cursor.\n\nThis should be an integer corresponding to the [`SDL_SystemCursor`] enum. The\ndefault value is zero ([`SDL_SYSTEM_CURSOR_DEFAULT`]).\n\nThis hint needs to be set before [`SDL_Init()`].\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_DPI_SCALE_CURSORS: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_DPI_SCALE_CURSORS", + short_name: "MOUSE_DPI_SCALE_CURSORS", + value: crate::hints::SDL_HINT_MOUSE_DPI_SCALE_CURSORS, + doc: Some( + "A variable setting whether we should scale cursors by the current display\nscale.\n\nThe variable can be set to the following values:\n\n- \"0\": Cursors will not change size based on the display content scale.\n(default)\n- \"1\": Cursors will automatically match the display content scale (e.g. a\n2x sized cursor will be used when the window is on a monitor with 200%\nscale). This is currently implemented on Windows.\n\nThis hint needs to be set before creating cursors.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE", + short_name: "MOUSE_EMULATE_WARP_WITH_RELATIVE", + value: crate::hints::SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE, + doc: Some( + "A variable controlling whether warping a hidden mouse cursor will activate\nrelative mouse mode.\n\nWhen this hint is set, the mouse cursor is hidden, and multiple warps to\nthe window center occur within a short time period, SDL will emulate mouse\nwarps using relative mouse mode. This can provide smoother and more\nreliable mouse motion for some older games, which continuously calculate\nthe distance traveled by the mouse pointer and warp it back to the center\nof the window, rather than using relative mouse motion.\n\nNote that relative mouse mode may have different mouse acceleration\nbehavior than pointer warps.\n\nIf your application needs to repeatedly warp the hidden mouse cursor at a\nhigh-frequency for other purposes, it should disable this hint.\n\nThe variable can be set to the following values:\n\n- \"0\": Attempts to warp the mouse will always be made.\n- \"1\": Some mouse warps will be emulated by forcing relative mouse mode.\n(default)\n\nIf not set, this is automatically enabled unless an application uses\nrelative mouse mode directly.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH", + short_name: "MOUSE_FOCUS_CLICKTHROUGH", + value: crate::hints::SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, + doc: Some( + "Allow mouse click events when clicking to focus an SDL window.\n\nThe variable can be set to the following values:\n\n- \"0\": Ignore mouse clicks that activate a window. (default)\n- \"1\": Generate events for mouse clicks that activate a window.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_NORMAL_SPEED_SCALE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_NORMAL_SPEED_SCALE", + short_name: "MOUSE_NORMAL_SPEED_SCALE", + value: crate::hints::SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + doc: Some( + "A variable setting the speed scale for mouse motion, in floating point,\nwhen the mouse is not in relative mode.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_RELATIVE_MODE_CENTER: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_RELATIVE_MODE_CENTER", + short_name: "MOUSE_RELATIVE_MODE_CENTER", + value: crate::hints::SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, + doc: Some( + "A variable controlling whether relative mouse mode constrains the mouse to\nthe center of the window.\n\nConstraining to the center of the window works better for FPS games and\nwhen the application is running over RDP. Constraining to the whole window\nworks better for 2D games and increases the chance that the mouse will be\nin the correct position when using high DPI mice.\n\nThe variable can be set to the following values:\n\n- \"0\": Relative mouse mode constrains the mouse to the window.\n- \"1\": Relative mouse mode constrains the mouse to the center of the\nwindow. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE", + short_name: "MOUSE_RELATIVE_SPEED_SCALE", + value: crate::hints::SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + doc: Some( + "A variable setting the scale for mouse motion, in floating point, when the\nmouse is in relative mode.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE", + short_name: "MOUSE_RELATIVE_SYSTEM_SCALE", + value: crate::hints::SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE, + doc: Some( + "A variable controlling whether the system mouse acceleration curve is used\nfor relative mouse motion.\n\nThe variable can be set to the following values:\n\n- \"0\": Relative mouse motion will be unscaled. (default)\n- \"1\": Relative mouse motion will be scaled using the system mouse\nacceleration curve.\n\nIf [`SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE`] is set, that will be applied after\nsystem speed scale.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_RELATIVE_WARP_MOTION: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_RELATIVE_WARP_MOTION", + short_name: "MOUSE_RELATIVE_WARP_MOTION", + value: crate::hints::SDL_HINT_MOUSE_RELATIVE_WARP_MOTION, + doc: Some( + "A variable controlling whether a motion event should be generated for mouse\nwarping in relative mode.\n\nThe variable can be set to the following values:\n\n- \"0\": Warping the mouse will not generate a motion event in relative mode\n- \"1\": Warping the mouse will generate a motion event in relative mode\n\nBy default warping the mouse will not generate motion events in relative\nmode. This avoids the application having to filter out large relative\nmotion due to warping.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE", + short_name: "MOUSE_RELATIVE_CURSOR_VISIBLE", + value: crate::hints::SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE, + doc: Some( + "A variable controlling whether the hardware cursor stays visible when\nrelative mode is active.\n\nThis variable can be set to the following values:\n\n- \"0\": The cursor will be hidden while relative mode is active (default)\n- \"1\": The cursor will remain visible while relative mode is active\n\nNote that for systems without raw hardware inputs, relative mode is\nimplemented using warping, so the hardware cursor will visibly warp between\nframes if this is enabled on those systems.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MOUSE_TOUCH_EVENTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_MOUSE_TOUCH_EVENTS", + short_name: "MOUSE_TOUCH_EVENTS", + value: crate::hints::SDL_HINT_MOUSE_TOUCH_EVENTS, + doc: Some( + "A variable controlling whether mouse events should generate synthetic touch\nevents.\n\nThe variable can be set to the following values:\n\n- \"0\": Mouse events will not generate touch events. (default for desktop\nplatforms)\n- \"1\": Mouse events will generate touch events. (default for mobile\nplatforms, such as Android and iOS)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_MUTE_CONSOLE_KEYBOARD: Hint = Hint { + module: "hints", + name: "SDL_HINT_MUTE_CONSOLE_KEYBOARD", + short_name: "MUTE_CONSOLE_KEYBOARD", + value: crate::hints::SDL_HINT_MUTE_CONSOLE_KEYBOARD, + doc: Some( + "A variable controlling whether the keyboard should be muted on the console.\n\nNormally the keyboard is muted while SDL applications are running so that\nkeyboard input doesn't show up as key strokes on the console. This hint\nallows you to turn that off for debugging purposes.\n\nThe variable can be set to the following values:\n\n- \"0\": Allow keystrokes to go through to the console.\n- \"1\": Mute keyboard input so it doesn't show up on the console. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_NO_SIGNAL_HANDLERS: Hint = Hint { + module: "hints", + name: "SDL_HINT_NO_SIGNAL_HANDLERS", + short_name: "NO_SIGNAL_HANDLERS", + value: crate::hints::SDL_HINT_NO_SIGNAL_HANDLERS, + doc: Some( + "Tell SDL not to catch the SIGINT or SIGTERM signals on POSIX platforms.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will install a SIGINT and SIGTERM handler, and when it catches a\nsignal, convert it into an [`SDL_EVENT_QUIT`] event. (default)\n- \"1\": SDL will not install a signal handler at all.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_OPENGL_LIBRARY: Hint = Hint { + module: "hints", + name: "SDL_HINT_OPENGL_LIBRARY", + short_name: "OPENGL_LIBRARY", + value: crate::hints::SDL_HINT_OPENGL_LIBRARY, + doc: Some( + "Specify the OpenGL library to load.\n\nThis hint should be set before creating an OpenGL window or creating an\nOpenGL context. If this hint isn't set, SDL will choose a reasonable\ndefault.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_EGL_LIBRARY: Hint = Hint { + module: "hints", + name: "SDL_HINT_EGL_LIBRARY", + short_name: "EGL_LIBRARY", + value: crate::hints::SDL_HINT_EGL_LIBRARY, + doc: Some( + "Specify the EGL library to load.\n\nThis hint should be set before creating an OpenGL window or creating an\nOpenGL context. This hint is only considered if SDL is using EGL to manage\nOpenGL contexts. If this hint isn't set, SDL will choose a reasonable\ndefault.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_OPENGL_ES_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_OPENGL_ES_DRIVER", + short_name: "OPENGL_ES_DRIVER", + value: crate::hints::SDL_HINT_OPENGL_ES_DRIVER, + doc: Some( + "A variable controlling what driver to use for OpenGL ES contexts.\n\nOn some platforms, currently Windows and X11, OpenGL drivers may support\ncreating contexts with an OpenGL ES profile. By default SDL uses these\nprofiles, when available, otherwise it attempts to load an OpenGL ES\nlibrary, e.g. that provided by the ANGLE project. This variable controls\nwhether SDL follows this default behaviour or will always load an OpenGL ES\nlibrary.\n\nCircumstances where this is useful include - Testing an app with a\nparticular OpenGL ES implementation, e.g ANGLE, or emulator, e.g. those\nfrom ARM, Imagination or Qualcomm. - Resolving OpenGL ES function addresses\nat link time by linking with the OpenGL ES library instead of querying them\nat run time with [`SDL_GL_GetProcAddress()`].\n\nCaution: for an application to work with the default behaviour across\ndifferent OpenGL drivers it must query the OpenGL ES function addresses at\nrun time using [`SDL_GL_GetProcAddress()`].\n\nThis variable is ignored on most platforms because OpenGL ES is native or\nnot supported.\n\nThe variable can be set to the following values:\n\n- \"0\": Use ES profile of OpenGL, if available. (default)\n- \"1\": Load OpenGL ES library using the default library names.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER: Hint = Hint { + module: "hints", + name: "SDL_HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER", + short_name: "OPENGL_FORCE_SRGB_FRAMEBUFFER", + value: crate::hints::SDL_HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER, + doc: Some( + "A variable controlling whether to force an sRGB-capable OpenGL context.\n\nAt OpenGL context creation time, some platforms can request an sRGB-capable\ncontext. However, sometimes any form of the request can cause surprising\nresults on some drivers, platforms, and hardware. Usually the surprise is\nin the form of rendering that is either a little darker or a little\nbrighter than intended.\n\nThis hint allows the user to override the app's sRGB requests and either\nforce a specific value, or avoid requesting anything at all, depending on\nwhat makes things work correctly for their system.\n\nThis is meant as a fail-safe; apps should probably not explicitly set this,\nand most users should not, either.\n\nNote that some platforms cannot make this request at all, and on all\nplatforms this request can be denied by the operating system.\n\nIn addition to attempting to obtain the type of sRGB-capable OpenGL context\nrequested by this hint, SDL will try to force the state of\nGL_FRAMEBUFFER_SRGB on the new context, if appropriate.\n\nThe variable can be set to the following values:\n\n- \"0\": Force a request for an OpenGL context that is _not_ sRGB-capable.\n- \"1\": Force a request for an OpenGL context that _is_ sRGB-capable.\n- \"skip\": Don't make any request for an sRGB-capable context (don't specify\nthe attribute at all during context creation time).\n- any other string is undefined behavior.\n\nIf unset, or set to an empty string, SDL will make a request using the\nvalue the app specified with the [`SDL_GL_FRAMEBUFFER_SRGB_CAPABLE`] attribute.\n\nThis hint should be set before an OpenGL context is created.\n\n## Availability\nThis hint is available since SDL 3.4.2.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 2)), +}; +pub const METADATA_SDL_HINT_OPENVR_LIBRARY: Hint = Hint { + module: "hints", + name: "SDL_HINT_OPENVR_LIBRARY", + short_name: "OPENVR_LIBRARY", + value: crate::hints::SDL_HINT_OPENVR_LIBRARY, + doc: Some( + "Mechanism to specify openvr_api library location\n\nBy default, when using the OpenVR driver, it will search for the API\nlibrary in the current folder. But, if you wish to use a system API you can\nspecify that by using this hint. This should be the full or relative path\nto a .dll on Windows or .so on Linux.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ORIENTATIONS: Hint = Hint { + module: "hints", + name: "SDL_HINT_ORIENTATIONS", + short_name: "ORIENTATIONS", + value: crate::hints::SDL_HINT_ORIENTATIONS, + doc: Some( + "A variable controlling which orientations are allowed on iOS/Android.\n\nIn some circumstances it is necessary to be able to explicitly control\nwhich UI orientations are allowed.\n\nThis variable is a space delimited list of the following values:\n\n- \"LandscapeLeft\"\n- \"LandscapeRight\"\n- \"Portrait\"\n- \"PortraitUpsideDown\"\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_POLL_SENTINEL: Hint = Hint { + module: "hints", + name: "SDL_HINT_POLL_SENTINEL", + short_name: "POLL_SENTINEL", + value: crate::hints::SDL_HINT_POLL_SENTINEL, + doc: Some( + "A variable controlling the use of a sentinel event when polling the event\nqueue.\n\nWhen polling for events, [`SDL_PumpEvents`] is used to gather new events from\ndevices. If a device keeps producing new events between calls to\n[`SDL_PumpEvents`], a poll loop will become stuck until the new events stop.\nThis is most noticeable when moving a high frequency mouse.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable poll sentinels.\n- \"1\": Enable poll sentinels. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_PREFERRED_LOCALES: Hint = Hint { + module: "hints", + name: "SDL_HINT_PREFERRED_LOCALES", + short_name: "PREFERRED_LOCALES", + value: crate::hints::SDL_HINT_PREFERRED_LOCALES, + doc: Some( + "Override for [`SDL_GetPreferredLocales()`].\n\nIf set, this will be favored over anything the OS might report for the\nuser's preferred locales. Changing this hint at runtime will not generate a\n[`SDL_EVENT_LOCALE_CHANGED`] event (but if you can change the hint, you can\npush your own event, if you want).\n\nThe format of this hint is a comma-separated list of language and locale,\ncombined with an underscore, as is a common format: \"en_GB\". Locale is\noptional: \"en\". So you might have a list like this: \"en_GB,jp,es_PT\"\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE: Hint = Hint { + module: "hints", + name: "SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE", + short_name: "QUIT_ON_LAST_WINDOW_CLOSE", + value: crate::hints::SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, + doc: Some( + "A variable that decides whether to send [`SDL_EVENT_QUIT`] when closing the\nlast window.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will not send an [`SDL_EVENT_QUIT`] event when the last window is\nrequesting to close. Note that in this case, there are still other\nlegitimate reasons one might get an [`SDL_EVENT_QUIT`] event: choosing \"Quit\"\nfrom the macOS menu bar, sending a SIGINT (ctrl-c) on Unix, etc.\n- \"1\": SDL will send a quit event when the last window is requesting to\nclose. (default)\n\nIf there is at least one active system tray icon, [`SDL_EVENT_QUIT`] will\ninstead be sent when both the last window will be closed and the last tray\nicon will be destroyed.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_DIRECT3D_THREADSAFE: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_DIRECT3D_THREADSAFE", + short_name: "RENDER_DIRECT3D_THREADSAFE", + value: crate::hints::SDL_HINT_RENDER_DIRECT3D_THREADSAFE, + doc: Some( + "A variable controlling whether the Direct3D device is initialized for\nthread-safe operations.\n\nThe variable can be set to the following values:\n\n- \"0\": Thread-safety is not enabled. (default)\n- \"1\": Thread-safety is enabled.\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_DIRECT3D11_DEBUG: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_DIRECT3D11_DEBUG", + short_name: "RENDER_DIRECT3D11_DEBUG", + value: crate::hints::SDL_HINT_RENDER_DIRECT3D11_DEBUG, + doc: Some( + "A variable controlling whether to enable Direct3D 11+'s Debug Layer.\n\nThis variable does not have any effect on the Direct3D 9 based renderer.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable Debug Layer use. (default)\n- \"1\": Enable Debug Layer use.\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_DIRECT3D11_WARP: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_DIRECT3D11_WARP", + short_name: "RENDER_DIRECT3D11_WARP", + value: crate::hints::SDL_HINT_RENDER_DIRECT3D11_WARP, + doc: Some( + "A variable controlling whether to use the Direct3D 11 WARP software\nrasterizer.\n\nFor more information, see:\n\n\nThe variable can be set to the following values:\n\n- \"0\": Disable WARP rasterizer. (default)\n- \"1\": Enable WARP rasterizer.\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_VULKAN_DEBUG: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_VULKAN_DEBUG", + short_name: "RENDER_VULKAN_DEBUG", + value: crate::hints::SDL_HINT_RENDER_VULKAN_DEBUG, + doc: Some( + "A variable controlling whether to enable Vulkan Validation Layers.\n\nThis variable can be set to the following values:\n\n- \"0\": Disable Validation Layer use\n- \"1\": Enable Validation Layer use\n\nBy default, SDL does not use Vulkan Validation Layers.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_GPU_DEBUG: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_GPU_DEBUG", + short_name: "RENDER_GPU_DEBUG", + value: crate::hints::SDL_HINT_RENDER_GPU_DEBUG, + doc: Some( + "A variable controlling whether to create the GPU device in debug mode.\n\nThis variable can be set to the following values:\n\n- \"0\": Disable debug mode use (default)\n- \"1\": Enable debug mode use\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_GPU_LOW_POWER: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_GPU_LOW_POWER", + short_name: "RENDER_GPU_LOW_POWER", + value: crate::hints::SDL_HINT_RENDER_GPU_LOW_POWER, + doc: Some( + "A variable controlling whether to prefer a low-power GPU on multi-GPU\nsystems.\n\nThis variable can be set to the following values:\n\n- \"0\": Prefer high-performance GPU (default)\n- \"1\": Prefer low-power GPU\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_DRIVER", + short_name: "RENDER_DRIVER", + value: crate::hints::SDL_HINT_RENDER_DRIVER, + doc: Some( + "A variable specifying which render driver to use.\n\nIf the application doesn't pick a specific renderer to use, this variable\nspecifies the name of the preferred renderer. If the preferred renderer\ncan't be initialized, creating a renderer will fail.\n\nThis variable is case insensitive and can be set to the following values:\n\n- \"direct3d\"\n- \"direct3d11\"\n- \"direct3d12\"\n- \"opengl\"\n- \"opengles2\"\n- \"opengles\"\n- \"metal\"\n- \"vulkan\"\n- \"gpu\"\n- \"software\"\n\nThis hint accepts a comma-separated list of driver names, and each will be\ntried in the order listed when creating a renderer until one succeeds or\nall of them fail.\n\nThe default varies by platform, but it's the first one in the list that is\navailable on the current platform.\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_LINE_METHOD: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_LINE_METHOD", + short_name: "RENDER_LINE_METHOD", + value: crate::hints::SDL_HINT_RENDER_LINE_METHOD, + doc: Some( + "A variable controlling how the 2D render API renders lines.\n\nThe variable can be set to the following values:\n\n- \"0\": Use the default line drawing method (Bresenham's line algorithm)\n- \"1\": Use the driver point API using Bresenham's line algorithm (correct,\ndraws many points)\n- \"2\": Use the driver line API (occasionally misses line endpoints based on\nhardware driver quirks\n- \"3\": Use the driver geometry API (correct, draws thicker diagonal lines)\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE", + short_name: "RENDER_METAL_PREFER_LOW_POWER_DEVICE", + value: crate::hints::SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE, + doc: Some( + "A variable controlling whether the Metal render driver select low power\ndevice over default one.\n\nThe variable can be set to the following values:\n\n- \"0\": Use the preferred OS device. (default)\n- \"1\": Select a low power device.\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RENDER_VSYNC: Hint = Hint { + module: "hints", + name: "SDL_HINT_RENDER_VSYNC", + short_name: "RENDER_VSYNC", + value: crate::hints::SDL_HINT_RENDER_VSYNC, + doc: Some( + "A variable controlling whether updates to the SDL screen surface should be\nsynchronized with the vertical refresh, to avoid tearing.\n\nThis hint overrides the application preference when creating a renderer.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable vsync. (default)\n- \"1\": Enable vsync.\n\nThis hint should be set before creating a renderer.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_RETURN_KEY_HIDES_IME: Hint = Hint { + module: "hints", + name: "SDL_HINT_RETURN_KEY_HIDES_IME", + short_name: "RETURN_KEY_HIDES_IME", + value: crate::hints::SDL_HINT_RETURN_KEY_HIDES_IME, + doc: Some( + "A variable to control whether the return key on the soft keyboard should\nhide the soft keyboard on Android and iOS.\n\nThis hint sets the default value of [`SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN`].\n\nThe variable can be set to the following values:\n\n- \"0\": The return key will be handled as a key event. (default)\n- \"1\": The return key will hide the keyboard.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ROG_GAMEPAD_MICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_ROG_GAMEPAD_MICE", + short_name: "ROG_GAMEPAD_MICE", + value: crate::hints::SDL_HINT_ROG_GAMEPAD_MICE, + doc: Some( + "A variable containing a list of ROG gamepad capable mice.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED: Hint = Hint { + module: "hints", + name: "SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED", + short_name: "ROG_GAMEPAD_MICE_EXCLUDED", + value: crate::hints::SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED, + doc: Some( + "A variable containing a list of devices that are not ROG gamepad capable\nmice.\n\nThis will override [`SDL_HINT_ROG_GAMEPAD_MICE`] and the built in device list.\n\nThe format of the string is a comma separated list of USB VID/PID pairs in\nhexadecimal form, e.g.\n\n`0xAAAA/0xBBBB,0xCCCC/0xDDDD`\n\nThe variable can also take the form of \"@file\", in which case the named\nfile will be loaded and interpreted as the value of the variable.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_PS2_GS_WIDTH: Hint = Hint { + module: "hints", + name: "SDL_HINT_PS2_GS_WIDTH", + short_name: "PS2_GS_WIDTH", + value: crate::hints::SDL_HINT_PS2_GS_WIDTH, + doc: Some( + "A variable controlling the width of the PS2's framebuffer in pixels.\n\nBy default, the variable is \"640\".\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_PS2_GS_HEIGHT: Hint = Hint { + module: "hints", + name: "SDL_HINT_PS2_GS_HEIGHT", + short_name: "PS2_GS_HEIGHT", + value: crate::hints::SDL_HINT_PS2_GS_HEIGHT, + doc: Some( + "A variable controlling the height of the PS2's framebuffer in pixels.\n\nBy default, the variable is \"448\".\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_PS2_GS_PROGRESSIVE: Hint = Hint { + module: "hints", + name: "SDL_HINT_PS2_GS_PROGRESSIVE", + short_name: "PS2_GS_PROGRESSIVE", + value: crate::hints::SDL_HINT_PS2_GS_PROGRESSIVE, + doc: Some( + "A variable controlling whether the signal is interlaced or progressive.\n\nThe variable can be set to the following values:\n\n- \"0\": Image is interlaced. (default)\n- \"1\": Image is progressive.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_PS2_GS_MODE: Hint = Hint { + module: "hints", + name: "SDL_HINT_PS2_GS_MODE", + short_name: "PS2_GS_MODE", + value: crate::hints::SDL_HINT_PS2_GS_MODE, + doc: Some( + "A variable controlling the video mode of the console.\n\nThe variable can be set to the following values:\n\n- \"\": Console-native. (default)\n- \"NTSC\": 60hz region.\n- \"PAL\": 50hz region.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_RPI_VIDEO_LAYER: Hint = Hint { + module: "hints", + name: "SDL_HINT_RPI_VIDEO_LAYER", + short_name: "RPI_VIDEO_LAYER", + value: crate::hints::SDL_HINT_RPI_VIDEO_LAYER, + doc: Some( + "A variable controlling which Dispmanx layer to use on a Raspberry PI.\n\nAlso known as Z-order. The variable can take a negative or positive value.\nThe default is 10000.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME: Hint = Hint { + module: "hints", + name: "SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME", + short_name: "SCREENSAVER_INHIBIT_ACTIVITY_NAME", + value: crate::hints::SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME, + doc: Some( + "Specify an \"activity name\" for screensaver inhibition.\n\nSome platforms, notably Linux desktops, list the applications which are\ninhibiting the screensaver or other power-saving features.\n\nThis hint lets you specify the \"activity name\" sent to the OS when\n[`SDL_DisableScreenSaver()`] is used (or the screensaver is automatically\ndisabled). The contents of this hint are used when the screensaver is\ndisabled. You should use a string that describes what your program is doing\n(and, therefore, why the screensaver is disabled). For example, \"Playing a\ngame\" or \"Watching a video\".\n\nSetting this to \"\" or leaving it unset will have SDL use a reasonable\ndefault: \"Playing a game\" or something similar.\n\nThis hint should be set before calling [`SDL_DisableScreenSaver()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_SHUTDOWN_DBUS_ON_QUIT: Hint = Hint { + module: "hints", + name: "SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", + short_name: "SHUTDOWN_DBUS_ON_QUIT", + value: crate::hints::SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, + doc: Some( + "A variable controlling whether SDL calls dbus_shutdown() on quit.\n\nThis is useful as a debug tool to validate memory leaks, but shouldn't ever\nbe set in production applications, as other libraries used by the\napplication might use dbus under the hood and this can cause crashes if\nthey continue after [`SDL_Quit()`].\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will not call dbus_shutdown() on quit. (default)\n- \"1\": SDL will call dbus_shutdown() on quit.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_STORAGE_TITLE_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_STORAGE_TITLE_DRIVER", + short_name: "STORAGE_TITLE_DRIVER", + value: crate::hints::SDL_HINT_STORAGE_TITLE_DRIVER, + doc: Some( + "A variable that specifies a backend to use for title storage.\n\nBy default, SDL will try all available storage backends in a reasonable\norder until it finds one that can work, but this hint allows the app or\nuser to force a specific target, such as \"pc\" if, say, you are on Steam but\nwant to avoid SteamRemoteStorage for title data.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_STORAGE_USER_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_STORAGE_USER_DRIVER", + short_name: "STORAGE_USER_DRIVER", + value: crate::hints::SDL_HINT_STORAGE_USER_DRIVER, + doc: Some( + "A variable that specifies a backend to use for user storage.\n\nBy default, SDL will try all available storage backends in a reasonable\norder until it finds one that can work, but this hint allows the app or\nuser to force a specific target, such as \"pc\" if, say, you are on Steam but\nwant to avoid SteamRemoteStorage for user data.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL: Hint = Hint { + module: "hints", + name: "SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL", + short_name: "THREAD_FORCE_REALTIME_TIME_CRITICAL", + value: crate::hints::SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL, + doc: Some( + "Specifies whether [`SDL_THREAD_PRIORITY_TIME_CRITICAL`] should be treated as\nrealtime.\n\nOn some platforms, like Linux, a realtime priority thread may be subject to\nrestrictions that require special handling by the application. This hint\nexists to let SDL know that the app is prepared to handle said\nrestrictions.\n\nOn Linux, SDL will apply the following configuration to any thread that\nbecomes realtime:\n\n- The SCHED_RESET_ON_FORK bit will be set on the scheduling policy,\n- An RLIMIT_RTTIME budget will be configured to the rtkit specified limit.\n- Exceeding this limit will result in the kernel sending SIGKILL to the\napp, refer to the man pages for more information.\n\nThe variable can be set to the following values:\n\n- \"0\": default platform specific behaviour\n- \"1\": Force [`SDL_THREAD_PRIORITY_TIME_CRITICAL`] to a realtime scheduling\npolicy\n\nThis hint should be set before calling [`SDL_SetCurrentThreadPriority()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_THREAD_PRIORITY_POLICY: Hint = Hint { + module: "hints", + name: "SDL_HINT_THREAD_PRIORITY_POLICY", + short_name: "THREAD_PRIORITY_POLICY", + value: crate::hints::SDL_HINT_THREAD_PRIORITY_POLICY, + doc: Some( + "A string specifying additional information to use with\n[`SDL_SetCurrentThreadPriority`].\n\nBy default [`SDL_SetCurrentThreadPriority`] will make appropriate system\nchanges in order to apply a thread priority. For example on systems using\npthreads the scheduler policy is changed automatically to a policy that\nworks well with a given priority. Code which has specific requirements can\noverride SDL's default behavior with this hint.\n\npthread hint values are \"current\", \"other\", \"fifo\" and \"rr\". Currently no\nother platform hint values are defined but may be in the future.\n\nOn Linux, the kernel may send SIGKILL to realtime tasks which exceed the\ndistro configured execution budget for rtkit. This budget can be queried\nthrough RLIMIT_RTTIME after calling [`SDL_SetCurrentThreadPriority()`].\n\nThis hint should be set before calling [`SDL_SetCurrentThreadPriority()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_TIMER_RESOLUTION: Hint = Hint { + module: "hints", + name: "SDL_HINT_TIMER_RESOLUTION", + short_name: "TIMER_RESOLUTION", + value: crate::hints::SDL_HINT_TIMER_RESOLUTION, + doc: Some( + "A variable that controls the timer resolution, in milliseconds.\n\nThe higher resolution the timer, the more frequently the CPU services timer\ninterrupts, and the more precise delays are, but this takes up power and\nCPU time. This hint is only used on Windows.\n\nSee this blog post for more information:\n\n\nThe default value is \"1\".\n\nIf this variable is set to \"0\", the system timer resolution is not set.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_TOUCH_MOUSE_EVENTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_TOUCH_MOUSE_EVENTS", + short_name: "TOUCH_MOUSE_EVENTS", + value: crate::hints::SDL_HINT_TOUCH_MOUSE_EVENTS, + doc: Some( + "A variable controlling whether touch events should generate synthetic mouse\nevents.\n\nThe variable can be set to the following values:\n\n- \"0\": Touch events will not generate mouse events.\n- \"1\": Touch events will generate mouse events. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_TRACKPAD_IS_TOUCH_ONLY: Hint = Hint { + module: "hints", + name: "SDL_HINT_TRACKPAD_IS_TOUCH_ONLY", + short_name: "TRACKPAD_IS_TOUCH_ONLY", + value: crate::hints::SDL_HINT_TRACKPAD_IS_TOUCH_ONLY, + doc: Some( + "A variable controlling whether trackpads should be treated as touch\ndevices.\n\nOn macOS (and possibly other platforms in the future), SDL will report\ntouches on a trackpad as mouse input, which is generally what users expect\nfrom this device; however, these are often actually full multitouch-capable\ntouch devices, so it might be preferable to some apps to treat them as\nsuch.\n\nThe variable can be set to the following values:\n\n- \"0\": Trackpad will send mouse events. (default)\n- \"1\": Trackpad will send touch events.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_TV_REMOTE_AS_JOYSTICK: Hint = Hint { + module: "hints", + name: "SDL_HINT_TV_REMOTE_AS_JOYSTICK", + short_name: "TV_REMOTE_AS_JOYSTICK", + value: crate::hints::SDL_HINT_TV_REMOTE_AS_JOYSTICK, + doc: Some( + "A variable controlling whether the Android / tvOS remotes should be listed\nas joystick devices, instead of sending keyboard events.\n\nThe variable can be set to the following values:\n\n- \"0\": Remotes send enter/escape/arrow key events.\n- \"1\": Remotes are available as 2 axis, 2 button joysticks. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_ALLOW_SCREENSAVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_ALLOW_SCREENSAVER", + short_name: "VIDEO_ALLOW_SCREENSAVER", + value: crate::hints::SDL_HINT_VIDEO_ALLOW_SCREENSAVER, + doc: Some( + "A variable controlling whether the screensaver is enabled.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable screensaver. (default)\n- \"1\": Enable screensaver.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_DISPLAY_PRIORITY: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_DISPLAY_PRIORITY", + short_name: "VIDEO_DISPLAY_PRIORITY", + value: crate::hints::SDL_HINT_VIDEO_DISPLAY_PRIORITY, + doc: Some( + "A comma separated list containing the names of the displays that SDL should\nsort to the front of the display list.\n\nWhen this hint is set, displays with matching name strings will be\nprioritized in the list of displays, as exposed by calling\n[`SDL_GetDisplays()`], with the first listed becoming the primary display. The\nnaming convention can vary depending on the environment, but it is usually\na connector name (e.g. 'DP-1', 'DP-2', 'HDMI-A-1', etc...).\n\nOn Wayland desktops, the connector names associated with displays can be\nfound in the `name` property of the info output from `wayland-info -i\nwl_output`. On X11 desktops, the `xrandr` utility can be used to retrieve\nthe connector names associated with displays.\n\nThis hint is currently supported on the following drivers:\n\n- KMSDRM (kmsdrm)\n- Wayland (wayland)\n- X11 (x11)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_DOUBLE_BUFFER: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_DOUBLE_BUFFER", + short_name: "VIDEO_DOUBLE_BUFFER", + value: crate::hints::SDL_HINT_VIDEO_DOUBLE_BUFFER, + doc: Some( + "Tell the video driver that we only want a double buffer.\n\nBy default, most lowlevel 2D APIs will use a triple buffer scheme that\nwastes no CPU time on waiting for vsync after issuing a flip, but\nintroduces a frame of latency. On the other hand, using a double buffer\nscheme instead is recommended for cases where low latency is an important\nfactor because we save a whole frame of latency.\n\nWe do so by waiting for vsync immediately after issuing a flip, usually\njust after eglSwapBuffers call in the backend's *_SwapWindow function.\n\nThis hint is currently supported on the following drivers:\n\n- Raspberry Pi (raspberrypi)\n- Wayland (wayland)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_DRIVER: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_DRIVER", + short_name: "VIDEO_DRIVER", + value: crate::hints::SDL_HINT_VIDEO_DRIVER, + doc: Some( + "A variable that specifies a video backend to use.\n\nBy default, SDL will try all available video backends in a reasonable order\nuntil it finds one that can work, but this hint allows the app or user to\nforce a specific target, such as \"x11\" if, say, you are on Wayland but want\nto try talking to the X server instead.\n\nThis hint accepts a comma-separated list of driver names, and each will be\ntried in the order listed during init, until one succeeds or all of them\nfail.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES", + short_name: "VIDEO_DUMMY_SAVE_FRAMES", + value: crate::hints::SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES, + doc: Some( + "A variable controlling whether the dummy video driver saves output frames.\n\n- \"0\": Video frames are not saved to disk. (default)\n- \"1\": Video frames are saved to files in the format \"SDL_windowX-Y.bmp\",\nwhere X is the window ID, and Y is the frame number.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK", + short_name: "VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK", + value: crate::hints::SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK, + doc: Some( + "If eglGetPlatformDisplay fails, fall back to calling eglGetDisplay.\n\nThe variable can be set to one of the following values:\n\n- \"0\": Do not fall back to eglGetDisplay.\n- \"1\": Fall back to eglGetDisplay if eglGetPlatformDisplay fails. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_FORCE_EGL: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_FORCE_EGL", + short_name: "VIDEO_FORCE_EGL", + value: crate::hints::SDL_HINT_VIDEO_FORCE_EGL, + doc: Some( + "A variable controlling whether the OpenGL context should be created with\nEGL.\n\nThe variable can be set to the following values:\n\n- \"0\": Use platform-specific GL context creation API (GLX, WGL, CGL, etc).\n(default)\n- \"1\": Use EGL\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES", + short_name: "VIDEO_MAC_FULLSCREEN_SPACES", + value: crate::hints::SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, + doc: Some( + "A variable that specifies the policy for fullscreen Spaces on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable Spaces support (FULLSCREEN_DESKTOP won't use them and\n[`SDL_WINDOW_RESIZABLE`] windows won't offer the \"fullscreen\" button on their\ntitlebars).\n- \"1\": Enable Spaces support (FULLSCREEN_DESKTOP will use them and\n[`SDL_WINDOW_RESIZABLE`] windows will offer the \"fullscreen\" button on their\ntitlebars). (default)\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY", + short_name: "VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY", + value: crate::hints::SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY, + doc: Some( + "A variable that specifies the menu visibility when a window is fullscreen\nin Spaces on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": The menu will be hidden when the window is in a fullscreen space,\nand not accessible by moving the mouse to the top of the screen.\n- \"1\": The menu will be accessible when the window is in a fullscreen\nspace.\n- \"auto\": The menu will be hidden if fullscreen mode was toggled on\nprogrammatically via `SDL_SetWindowFullscreen()`, and accessible if\nfullscreen was entered via the \"fullscreen\" button on the window title\nbar. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_METAL_AUTO_RESIZE_DRAWABLE: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_METAL_AUTO_RESIZE_DRAWABLE", + short_name: "VIDEO_METAL_AUTO_RESIZE_DRAWABLE", + value: crate::hints::SDL_HINT_VIDEO_METAL_AUTO_RESIZE_DRAWABLE, + doc: Some( + "A variable indicating whether the metal layer drawable size should be\nupdated for the [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event on macOS.\n\nThe variable can be set to the following values:\n\n- \"0\": the metal layer drawable size will not be updated on the\n[`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event.\n- \"1\": the metal layer drawable size will be updated on the\n[`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event. (default)\n\nThis hint should be set before [`SDL_Metal_CreateView`] called.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE", + short_name: "VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE", + value: crate::hints::SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE, + doc: Some( + "A variable controlling whether SDL will attempt to automatically set the\ndestination display to a mode most closely matching that of the previous\ndisplay if an exclusive fullscreen window is moved onto it.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will not attempt to automatically set a matching mode on the\ndestination display. If an exclusive fullscreen window is moved to a new\ndisplay, the window will become fullscreen desktop.\n- \"1\": SDL will attempt to automatically set a mode on the destination\ndisplay that most closely matches the mode of the display that the\nexclusive fullscreen window was previously on. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS", + short_name: "VIDEO_MINIMIZE_ON_FOCUS_LOSS", + value: crate::hints::SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, + doc: Some( + "A variable controlling whether fullscreen windows are minimized when they\nlose focus.\n\nThe variable can be set to the following values:\n\n- \"0\": Fullscreen windows will not be minimized when they lose focus.\n- \"1\": Fullscreen windows are minimized when they lose focus.\n- \"auto\": Fullscreen windows are minimized when they lose focus if they use\nexclusive fullscreen modes, so the desktop video mode is restored.\n(default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES", + short_name: "VIDEO_OFFSCREEN_SAVE_FRAMES", + value: crate::hints::SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES, + doc: Some( + "A variable controlling whether the offscreen video driver saves output\nframes.\n\nThis only saves frames that are generated using software rendering, not\naccelerated OpenGL rendering.\n\n- \"0\": Video frames are not saved to disk. (default)\n- \"1\": Video frames are saved to files in the format \"SDL_windowX-Y.bmp\",\nwhere X is the window ID, and Y is the frame number.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS", + short_name: "VIDEO_SYNC_WINDOW_OPERATIONS", + value: crate::hints::SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS, + doc: Some( + "A variable controlling whether all window operations will block until\ncomplete.\n\nWindow systems that run asynchronously may not have the results of window\noperations that resize or move the window applied immediately upon the\nreturn of the requesting function. Setting this hint will cause such\noperations to block after every call until the pending operation has\ncompleted. Setting this to '1' is the equivalent of calling\n[`SDL_SyncWindow()`] after every function call.\n\nBe aware that amount of time spent blocking while waiting for window\noperations to complete can be quite lengthy, as animations may have to\ncomplete, which can take upwards of multiple seconds in some cases.\n\nThe variable can be set to the following values:\n\n- \"0\": Window operations are non-blocking. (default)\n- \"1\": Window operations will block until completed.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR", + short_name: "VIDEO_WAYLAND_ALLOW_LIBDECOR", + value: crate::hints::SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, + doc: Some( + "A variable controlling whether the libdecor Wayland backend is allowed to\nbe used.\n\nlibdecor is used over xdg-shell when xdg-decoration protocol is\nunavailable.\n\nThe variable can be set to the following values:\n\n- \"0\": libdecor use is disabled.\n- \"1\": libdecor use is enabled. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION", + short_name: "VIDEO_WAYLAND_MODE_EMULATION", + value: crate::hints::SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION, + doc: Some( + "A variable controlling whether video mode emulation is enabled under\nWayland.\n\nWhen this hint is set, a standard set of emulated CVT video modes will be\nexposed for use by the application. If it is disabled, the only modes\nexposed will be the logical desktop size and, in the case of a scaled\ndesktop, the native display resolution.\n\nThe variable can be set to the following values:\n\n- \"0\": Video mode emulation is disabled.\n- \"1\": Video mode emulation is enabled. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_WAYLAND_MODE_SCALING: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_WAYLAND_MODE_SCALING", + short_name: "VIDEO_WAYLAND_MODE_SCALING", + value: crate::hints::SDL_HINT_VIDEO_WAYLAND_MODE_SCALING, + doc: Some( + "A variable controlling how modes with a non-native aspect ratio are\ndisplayed under Wayland.\n\nWhen this hint is set, the requested scaling will be used when displaying\nfullscreen video modes that don't match the display's native aspect ratio.\nThis is contingent on compositor viewport support.\n\nThe variable can be set to the following values:\n\n- \"aspect\" - Video modes will be displayed scaled, in their proper aspect\nratio, with black bars.\n- \"stretch\" - Video modes will be scaled to fill the entire display.\n(default)\n- \"none\" - Video modes will be displayed as 1:1 with no scaling.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR", + short_name: "VIDEO_WAYLAND_PREFER_LIBDECOR", + value: crate::hints::SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR, + doc: Some( + "A variable controlling whether the libdecor Wayland backend is preferred\nover native decorations.\n\nWhen this hint is set, libdecor will be used to provide window decorations,\neven if xdg-decoration is available. (Note that, by default, libdecor will\nuse xdg-decoration itself if available).\n\nThe variable can be set to the following values:\n\n- \"0\": libdecor is enabled only if server-side decorations are unavailable.\n(default)\n- \"1\": libdecor is always enabled if available.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY", + short_name: "VIDEO_WAYLAND_SCALE_TO_DISPLAY", + value: crate::hints::SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, + doc: Some( + "A variable forcing non-DPI-aware Wayland windows to output at 1:1 scaling.\n\nThis must be set before initializing the video subsystem.\n\nWhen this hint is set, Wayland windows that are not flagged as being\nDPI-aware will be output with scaling designed to force 1:1 pixel mapping.\n\nThis is intended to allow legacy applications to be displayed without\ndesktop scaling being applied, and has issues with certain display\nconfigurations, as this forces the window to behave in a way that Wayland\ndesktops were not designed to accommodate:\n\n- Rounding errors can result with odd window sizes and/or desktop scales,\nwhich can cause the window contents to appear slightly blurry.\n- Positioning the window may be imprecise due to unit conversions and\nrounding.\n- The window may be unusably small on scaled desktops.\n- The window may jump in size when moving between displays of different\nscale factors.\n- Displays may appear to overlap when using a multi-monitor setup with\nscaling enabled.\n- Possible loss of cursor precision due to the logical size of the window\nbeing reduced.\n\nNew applications should be designed with proper DPI awareness handling\ninstead of enabling this.\n\nThe variable can be set to the following values:\n\n- \"0\": Windows will be scaled normally.\n- \"1\": Windows will be forced to scale to achieve 1:1 output.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_WIN_D3DCOMPILER: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_WIN_D3DCOMPILER", + short_name: "VIDEO_WIN_D3DCOMPILER", + value: crate::hints::SDL_HINT_VIDEO_WIN_D3DCOMPILER, + doc: Some( + "A variable specifying which shader compiler to preload when using the\nChrome ANGLE binaries.\n\nSDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It can\nuse two different sets of binaries, those compiled by the user from source\nor those provided by the Chrome browser. In the later case, these binaries\nrequire that SDL loads a DLL providing the shader compiler.\n\nThe variable can be set to the following values:\n\n- \"d3dcompiler_46.dll\" - best for Vista or later. (default)\n- \"d3dcompiler_43.dll\" - for XP support.\n- \"none\" - do not load any library, useful if you compiled ANGLE from\nsource and included the compiler in your binaries.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT", + short_name: "VIDEO_X11_ENABLE_XSYNC_EXT", + value: crate::hints::SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT, + doc: Some( + "A variable controlling whether the X Synchronization Extension is enabled.\n\nIf set, this can result in smoother window resizing when rendering using\nOpenGL, however, there are some conditions:\n\n- It is only activated on windows created with the [`SDL_WINDOW_OPENGL`] flag\n(windows using an SDL OpenGL renderer have this automatically set).\n- When activated, presentation must be done with `SDL_GL_SwapWindow()`\n(`SDL_RenderPresent()` calls this internally for OpenGL renderers as well).\n\nEnabling this and presenting via an external mechanism will result in sync\nrequests not being acked, and hangs and other odd window behavior may result.\n\nThe variable can be set to the following values:\n\n- \"0\": The X Synchronization Extension is disabled. (default)\n- \"1\": The X Synchronization Extension is enabled.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.4.10.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 10)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT", + short_name: "VIDEO_X11_EXTERNAL_WINDOW_INPUT", + value: crate::hints::SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT, + doc: Some( + "A variable controlling whether SDL should call XSelectInput() to enable\ninput events on X11 windows wrapped by SDL windows.\n\nThe variable can be set to the following values:\n\n- \"0\": Don't call XSelectInput(), assuming the native window code has done\nit already.\n- \"1\": Call XSelectInput() to enable input events. (default)\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.10.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 10)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR", + short_name: "VIDEO_X11_NET_WM_BYPASS_COMPOSITOR", + value: crate::hints::SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, + doc: Some( + "A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint\nshould be used.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable _NET_WM_BYPASS_COMPOSITOR.\n- \"1\": Enable _NET_WM_BYPASS_COMPOSITOR. (default)\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_NET_WM_PING: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_NET_WM_PING", + short_name: "VIDEO_X11_NET_WM_PING", + value: crate::hints::SDL_HINT_VIDEO_X11_NET_WM_PING, + doc: Some( + "A variable controlling whether the X11 _NET_WM_PING protocol should be\nsupported.\n\nBy default SDL will use _NET_WM_PING, but for applications that know they\nwill not always be able to respond to ping requests in a timely manner they\ncan turn it off to avoid the window manager thinking the app is hung.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable _NET_WM_PING.\n- \"1\": Enable _NET_WM_PING. (default)\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_NODIRECTCOLOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_NODIRECTCOLOR", + short_name: "VIDEO_X11_NODIRECTCOLOR", + value: crate::hints::SDL_HINT_VIDEO_X11_NODIRECTCOLOR, + doc: Some( + "A variable controlling whether SDL uses DirectColor visuals.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable DirectColor visuals.\n- \"1\": Enable DirectColor visuals. (default)\n\nThis hint should be set before initializing the video subsystem.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_SCALING_FACTOR: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_SCALING_FACTOR", + short_name: "VIDEO_X11_SCALING_FACTOR", + value: crate::hints::SDL_HINT_VIDEO_X11_SCALING_FACTOR, + doc: Some( + "A variable forcing the content scaling factor for X11 displays.\n\nThe variable can be set to a floating point value in the range 1.0-10.0f\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_VISUALID: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_VISUALID", + short_name: "VIDEO_X11_VISUALID", + value: crate::hints::SDL_HINT_VIDEO_X11_VISUALID, + doc: Some( + "A variable forcing the visual ID used for X11 display modes.\n\nThis hint should be set before initializing the video subsystem.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_WINDOW_VISUALID: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_WINDOW_VISUALID", + short_name: "VIDEO_X11_WINDOW_VISUALID", + value: crate::hints::SDL_HINT_VIDEO_X11_WINDOW_VISUALID, + doc: Some( + "A variable forcing the visual ID chosen for new X11 windows.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VIDEO_X11_XRANDR: Hint = Hint { + module: "hints", + name: "SDL_HINT_VIDEO_X11_XRANDR", + short_name: "VIDEO_X11_XRANDR", + value: crate::hints::SDL_HINT_VIDEO_X11_XRANDR, + doc: Some( + "A variable controlling whether the X11 XRandR extension should be used.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable XRandR.\n- \"1\": Enable XRandR. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_ENABLE_BACK_TOUCH: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_ENABLE_BACK_TOUCH", + short_name: "VITA_ENABLE_BACK_TOUCH", + value: crate::hints::SDL_HINT_VITA_ENABLE_BACK_TOUCH, + doc: Some( + "A variable controlling whether touch should be enabled on the back panel of\nthe PlayStation Vita.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable touch on the back panel.\n- \"1\": Enable touch on the back panel. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_ENABLE_FRONT_TOUCH: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_ENABLE_FRONT_TOUCH", + short_name: "VITA_ENABLE_FRONT_TOUCH", + value: crate::hints::SDL_HINT_VITA_ENABLE_FRONT_TOUCH, + doc: Some( + "A variable controlling whether touch should be enabled on the front panel\nof the PlayStation Vita.\n\nThe variable can be set to the following values:\n\n- \"0\": Disable touch on the front panel.\n- \"1\": Enable touch on the front panel. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_MODULE_PATH: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_MODULE_PATH", + short_name: "VITA_MODULE_PATH", + value: crate::hints::SDL_HINT_VITA_MODULE_PATH, + doc: Some( + "A variable controlling the module path on the PlayStation Vita.\n\nThis hint defaults to \"app0:module\"\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_PVR_INIT: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_PVR_INIT", + short_name: "VITA_PVR_INIT", + value: crate::hints::SDL_HINT_VITA_PVR_INIT, + doc: Some( + "A variable controlling whether to perform PVR initialization on the\nPlayStation Vita.\n\n- \"0\": Skip PVR initialization.\n- \"1\": Perform the normal PVR initialization. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_RESOLUTION: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_RESOLUTION", + short_name: "VITA_RESOLUTION", + value: crate::hints::SDL_HINT_VITA_RESOLUTION, + doc: Some( + "A variable overriding the resolution reported on the PlayStation Vita.\n\nThe variable can be set to the following values:\n\n- \"544\": 544p (default)\n- \"720\": 725p for PSTV\n- \"1080\": 1088i for PSTV\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_PVR_OPENGL: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_PVR_OPENGL", + short_name: "VITA_PVR_OPENGL", + value: crate::hints::SDL_HINT_VITA_PVR_OPENGL, + doc: Some( + "A variable controlling whether OpenGL should be used instead of OpenGL ES\non the PlayStation Vita.\n\nThe variable can be set to the following values:\n\n- \"0\": Use OpenGL ES. (default)\n- \"1\": Use OpenGL.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: Hint = Hint { + module: "hints", + name: "SDL_HINT_VITA_TOUCH_MOUSE_DEVICE", + short_name: "VITA_TOUCH_MOUSE_DEVICE", + value: crate::hints::SDL_HINT_VITA_TOUCH_MOUSE_DEVICE, + doc: Some( + "A variable controlling which touchpad should generate synthetic mouse\nevents.\n\nThe variable can be set to the following values:\n\n- \"0\": Only front touchpad should generate mouse events. (default)\n- \"1\": Only back touchpad should generate mouse events.\n- \"2\": Both touchpads should generate mouse events.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VULKAN_DISPLAY: Hint = Hint { + module: "hints", + name: "SDL_HINT_VULKAN_DISPLAY", + short_name: "VULKAN_DISPLAY", + value: crate::hints::SDL_HINT_VULKAN_DISPLAY, + doc: Some( + "A variable overriding the display index used in [`SDL_Vulkan_CreateSurface()`]\n\nThe display index starts at 0, which is the default.\n\nThis hint should be set before calling [`SDL_Vulkan_CreateSurface()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_VULKAN_LIBRARY: Hint = Hint { + module: "hints", + name: "SDL_HINT_VULKAN_LIBRARY", + short_name: "VULKAN_LIBRARY", + value: crate::hints::SDL_HINT_VULKAN_LIBRARY, + doc: Some( + "Specify the Vulkan library to load.\n\nThis hint should be set before creating a Vulkan window or calling\n[`SDL_Vulkan_LoadLibrary()`].\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WAVE_FACT_CHUNK: Hint = Hint { + module: "hints", + name: "SDL_HINT_WAVE_FACT_CHUNK", + short_name: "WAVE_FACT_CHUNK", + value: crate::hints::SDL_HINT_WAVE_FACT_CHUNK, + doc: Some( + "A variable controlling how the fact chunk affects the loading of a WAVE\nfile.\n\nThe fact chunk stores information about the number of samples of a WAVE\nfile. The Standards Update from Microsoft notes that this value can be used\nto 'determine the length of the data in seconds'. This is especially useful\nfor compressed formats (for which this is a mandatory chunk) if they\nproduce multiple sample frames per block and truncating the block is not\nallowed. The fact chunk can exactly specify how many sample frames there\nshould be in this case.\n\nUnfortunately, most application seem to ignore the fact chunk and so SDL\nignores it by default as well.\n\nThe variable can be set to the following values:\n\n- \"truncate\" - Use the number of samples to truncate the wave data if the\nfact chunk is present and valid.\n- \"strict\" - Like \"truncate\", but raise an error if the fact chunk is\ninvalid, not present for non-PCM formats, or if the data chunk doesn't\nhave that many samples.\n- \"ignorezero\" - Like \"truncate\", but ignore fact chunk if the number of\nsamples is zero.\n- \"ignore\" - Ignore fact chunk entirely. (default)\n\nThis hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WAVE_CHUNK_LIMIT: Hint = Hint { + module: "hints", + name: "SDL_HINT_WAVE_CHUNK_LIMIT", + short_name: "WAVE_CHUNK_LIMIT", + value: crate::hints::SDL_HINT_WAVE_CHUNK_LIMIT, + doc: Some( + "A variable controlling the maximum number of chunks in a WAVE file.\n\nThis sets an upper bound on the number of chunks in a WAVE file to avoid\nwasting time on malformed or corrupt WAVE files. This defaults to \"10000\".\n\nThis hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WAVE_RIFF_CHUNK_SIZE: Hint = Hint { + module: "hints", + name: "SDL_HINT_WAVE_RIFF_CHUNK_SIZE", + short_name: "WAVE_RIFF_CHUNK_SIZE", + value: crate::hints::SDL_HINT_WAVE_RIFF_CHUNK_SIZE, + doc: Some( + "A variable controlling how the size of the RIFF chunk affects the loading\nof a WAVE file.\n\nThe size of the RIFF chunk (which includes all the sub-chunks of the WAVE\nfile) is not always reliable. In case the size is wrong, it's possible to\njust ignore it and step through the chunks until a fixed limit is reached.\n\nNote that files that have trailing data unrelated to the WAVE file or\ncorrupt files may slow down the loading process without a reliable\nboundary. By default, SDL stops after 10000 chunks to prevent wasting time.\nUse [`SDL_HINT_WAVE_CHUNK_LIMIT`] to adjust this value.\n\nThe variable can be set to the following values:\n\n- \"force\" - Always use the RIFF chunk size as a boundary for the chunk\nsearch.\n- \"ignorezero\" - Like \"force\", but a zero size searches up to 4 GiB.\n(default)\n- \"ignore\" - Ignore the RIFF chunk size and always search up to 4 GiB.\n- \"maximum\" - Search for chunks until the end of file. (not recommended)\n\nThis hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WAVE_TRUNCATION: Hint = Hint { + module: "hints", + name: "SDL_HINT_WAVE_TRUNCATION", + short_name: "WAVE_TRUNCATION", + value: crate::hints::SDL_HINT_WAVE_TRUNCATION, + doc: Some( + "A variable controlling how a truncated WAVE file is handled.\n\nA WAVE file is considered truncated if any of the chunks are incomplete or\nthe data chunk size is not a multiple of the block size. By default, SDL\ndecodes until the first incomplete block, as most applications seem to do.\n\nThe variable can be set to the following values:\n\n- \"verystrict\" - Raise an error if the file is truncated.\n- \"strict\" - Like \"verystrict\", but the size of the RIFF chunk is ignored.\n- \"dropframe\" - Decode until the first incomplete sample frame.\n- \"dropblock\" - Decode until the first incomplete block. (default)\n\nThis hint should be set before calling [`SDL_LoadWAV()`] or [`SDL_LoadWAV_IO()`]\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED", + short_name: "WINDOW_ACTIVATE_WHEN_RAISED", + value: crate::hints::SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED, + doc: Some( + "A variable controlling whether the window is activated when the\n[`SDL_RaiseWindow`] function is called.\n\nThe variable can be set to the following values:\n\n- \"0\": The window is not activated when the [`SDL_RaiseWindow`] function is\ncalled.\n- \"1\": The window is activated when the [`SDL_RaiseWindow`] function is called.\n(default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN", + short_name: "WINDOW_ACTIVATE_WHEN_SHOWN", + value: crate::hints::SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, + doc: Some( + "A variable controlling whether the window is activated when the\n[`SDL_ShowWindow`] function is called.\n\nThe variable can be set to the following values:\n\n- \"0\": The window is not activated when the [`SDL_ShowWindow`] function is\ncalled.\n- \"1\": The window is activated when the [`SDL_ShowWindow`] function is called.\n(default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOW_ALLOW_TOPMOST: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOW_ALLOW_TOPMOST", + short_name: "WINDOW_ALLOW_TOPMOST", + value: crate::hints::SDL_HINT_WINDOW_ALLOW_TOPMOST, + doc: Some( + "If set to \"0\" then never set the top-most flag on an SDL Window even if the\napplication requests it.\n\nThis is a debugging aid for developers and not expected to be used by end\nusers.\n\nThe variable can be set to the following values:\n\n- \"0\": don't allow topmost\n- \"1\": allow topmost (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN", + short_name: "WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN", + value: crate::hints::SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, + doc: Some( + "A variable controlling whether the window frame and title bar are\ninteractive when the cursor is hidden.\n\nThe variable can be set to the following values:\n\n- \"0\": The window frame is not interactive when the cursor is hidden (no\nmove, resize, etc).\n- \"1\": The window frame is interactive when the cursor is hidden. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4", + short_name: "WINDOWS_CLOSE_ON_ALT_F4", + value: crate::hints::SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, + doc: Some( + "A variable controlling whether SDL generates window-close events for Alt+F4\non Windows.\n\nThe variable can be set to the following values:\n\n- \"0\": SDL will only do normal key handling for Alt+F4.\n- \"1\": SDL will generate a window-close event when it sees Alt+F4.\n(default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS", + short_name: "WINDOWS_ENABLE_MENU_MNEMONICS", + value: crate::hints::SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS, + doc: Some( + "A variable controlling whether menus can be opened with their keyboard\nshortcut (Alt+mnemonic).\n\nIf the mnemonics are enabled, then menus can be opened by pressing the Alt\nkey and the corresponding mnemonic (for example, Alt+F opens the File\nmenu). However, in case an invalid mnemonic is pressed, Windows makes an\naudible beep to convey that nothing happened. This is true even if the\nwindow has no menu at all!\n\nBecause most SDL applications don't have menus, and some want to use the\nAlt key for other purposes, SDL disables mnemonics (and the beeping) by\ndefault.\n\nNote: This also affects keyboard events: with mnemonics enabled, when a\nmenu is opened from the keyboard, you will not receive a KEYUP event for\nthe mnemonic key, and *might* not receive one for Alt.\n\nThe variable can be set to the following values:\n\n- \"0\": Alt+mnemonic does nothing, no beeping. (default)\n- \"1\": Alt+mnemonic opens menus, invalid mnemonics produce a beep.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP", + short_name: "WINDOWS_ENABLE_MESSAGELOOP", + value: crate::hints::SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, + doc: Some( + "A variable controlling whether the windows message loop is processed by\nSDL.\n\nThe variable can be set to the following values:\n\n- \"0\": The window message loop is not run.\n- \"1\": The window message loop is processed in [`SDL_PumpEvents()`]. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_GAMEINPUT: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_GAMEINPUT", + short_name: "WINDOWS_GAMEINPUT", + value: crate::hints::SDL_HINT_WINDOWS_GAMEINPUT, + doc: Some( + "A variable controlling whether GameInput is used for raw keyboard and mouse\non Windows.\n\nThe variable can be set to the following values:\n\n- \"0\": GameInput is not used for raw keyboard and mouse events. (default)\n- \"1\": GameInput is used for raw keyboard and mouse events, if available.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_RAW_KEYBOARD: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_RAW_KEYBOARD", + short_name: "WINDOWS_RAW_KEYBOARD", + value: crate::hints::SDL_HINT_WINDOWS_RAW_KEYBOARD, + doc: Some( + "A variable controlling whether raw keyboard events are used on Windows.\n\nThe variable can be set to the following values:\n\n- \"0\": The Windows message loop is used for keyboard events. (default)\n- \"1\": Low latency raw keyboard events are used.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS", + short_name: "WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS", + value: crate::hints::SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS, + doc: Some( + "A variable controlling whether or not the RIDEV_NOHOTKEYS flag is set when\nenabling Windows raw keyboard events.\n\nThis blocks any hotkeys that have been registered by applications from\nhaving any effect beyond generating raw WM_INPUT events.\n\nThis flag does not affect system-hotkeys like ALT-TAB or CTRL-ALT-DEL, but\ndoes affect the Windows Logo key since it is a userland hotkey registered\nby explorer.exe.\n\nThe variable can be set to the following values:\n\n- \"0\": Hotkeys are not excluded. (default)\n- \"1\": Hotkeys are excluded.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_RAW_KEYBOARD_INPUTSINK: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_RAW_KEYBOARD_INPUTSINK", + short_name: "WINDOWS_RAW_KEYBOARD_INPUTSINK", + value: crate::hints::SDL_HINT_WINDOWS_RAW_KEYBOARD_INPUTSINK, + doc: Some( + "A variable controlling whether the RIDEV_INPUTSINK flag is set when\nenabling Windows raw keyboard events.\n\nThis enables the window to still receive input even if not in foreground.\n\nFocused windows that receive text input will still prevent input events from triggering.\n\n- \"0\": Input is not received when not in focus or foreground. (default)\n- \"1\": Input will be received even when not in focus or foreground.\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.4.4.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 4)), +}; +pub const METADATA_SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL", + short_name: "WINDOWS_FORCE_SEMAPHORE_KERNEL", + value: crate::hints::SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, + doc: Some( + "A variable controlling whether SDL uses Kernel Semaphores on Windows.\n\nKernel Semaphores are inter-process and require a context switch on every\ninteraction. On Windows 8 and newer, the WaitOnAddress API is available.\nUsing that and atomics to implement semaphores increases performance. SDL\nwill fall back to Kernel Objects on older OS versions or if forced to by\nthis hint.\n\nThe variable can be set to the following values:\n\n- \"0\": Use Atomics and WaitOnAddress API when available, otherwise fall\nback to Kernel Objects. (default)\n- \"1\": Force the use of Kernel Objects in all cases.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_INTRESOURCE_ICON: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_INTRESOURCE_ICON", + short_name: "WINDOWS_INTRESOURCE_ICON", + value: crate::hints::SDL_HINT_WINDOWS_INTRESOURCE_ICON, + doc: Some( + "A variable to specify custom icon resource id from RC file on Windows\nplatform.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL", + short_name: "WINDOWS_INTRESOURCE_ICON_SMALL", + value: crate::hints::SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, + doc: Some( + "A variable to specify custom icon resource id from RC file on Windows\nplatform.\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_USE_D3D9EX: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_USE_D3D9EX", + short_name: "WINDOWS_USE_D3D9EX", + value: crate::hints::SDL_HINT_WINDOWS_USE_D3D9EX, + doc: Some( + "A variable controlling whether SDL uses the D3D9Ex API introduced in\nWindows Vista, instead of normal D3D9.\n\nDirect3D 9Ex contains changes to state management that can eliminate device\nloss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may\nrequire some changes to your application to cope with the new behavior, so\nthis is disabled by default.\n\nFor more information on Direct3D 9Ex, see:\n\n- \n- \n\nThe variable can be set to the following values:\n\n- \"0\": Use the original Direct3D 9 API. (default)\n- \"1\": Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex\nis unavailable)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE: Hint = Hint { + module: "hints", + name: "SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE", + short_name: "WINDOWS_ERASE_BACKGROUND_MODE", + value: crate::hints::SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE, + doc: Some( + "A variable controlling whether SDL will clear the window contents when the\nWM_ERASEBKGND message is received.\n\nThe variable can be set to the following values:\n\n- \"0\"/\"never\": Never clear the window.\n- \"1\"/\"initial\": Clear the window when the first WM_ERASEBKGND event fires.\n(default)\n- \"2\"/\"always\": Clear the window on every WM_ERASEBKGND event.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT: Hint = Hint { + module: "hints", + name: "SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT", + short_name: "X11_FORCE_OVERRIDE_REDIRECT", + value: crate::hints::SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT, + doc: Some( + "A variable controlling whether X11 windows are marked as override-redirect.\n\nIf set, this _might_ increase framerate at the expense of the desktop not\nworking as expected. Override-redirect windows aren't noticed by the window\nmanager at all.\n\nYou should probably only use this for fullscreen windows, and you probably\nshouldn't even use it for that. But it's here if you want to try!\n\nThe variable can be set to the following values:\n\n- \"0\": Do not mark the window as override-redirect. (default)\n- \"1\": Mark the window as override-redirect.\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_X11_WINDOW_TYPE: Hint = Hint { + module: "hints", + name: "SDL_HINT_X11_WINDOW_TYPE", + short_name: "X11_WINDOW_TYPE", + value: crate::hints::SDL_HINT_X11_WINDOW_TYPE, + doc: Some( + "A variable specifying the type of an X11 window.\n\nDuring [`SDL_CreateWindow`], SDL uses the _NET_WM_WINDOW_TYPE X11 property to\nreport to the window manager the type of window it wants to create. This\nmight be set to various things if [`SDL_WINDOW_TOOLTIP`] or\n[`SDL_WINDOW_POPUP_MENU`], etc, were specified. For \"normal\" windows that\nhaven't set a specific type, this hint can be used to specify a custom\ntype. For example, a dock window might set this to\n\"_NET_WM_WINDOW_TYPE_DOCK\".\n\nThis hint should be set before creating a window.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_X11_XCB_LIBRARY: Hint = Hint { + module: "hints", + name: "SDL_HINT_X11_XCB_LIBRARY", + short_name: "X11_XCB_LIBRARY", + value: crate::hints::SDL_HINT_X11_XCB_LIBRARY, + doc: Some( + "Specify the XCB library to load for the X11 driver.\n\nThe default is platform-specific, often \"libX11-xcb.so.1\".\n\nThis hint should be set before initializing the video subsystem.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_XINPUT_ENABLED: Hint = Hint { + module: "hints", + name: "SDL_HINT_XINPUT_ENABLED", + short_name: "XINPUT_ENABLED", + value: crate::hints::SDL_HINT_XINPUT_ENABLED, + doc: Some( + "A variable controlling whether XInput should be used for controller\nhandling.\n\nThe variable can be set to the following values:\n\n- \"0\": XInput is not enabled.\n- \"1\": XInput is enabled. (default)\n\nThis hint should be set before SDL is initialized.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_ASSERT: Hint = Hint { + module: "hints", + name: "SDL_HINT_ASSERT", + short_name: "ASSERT", + value: crate::hints::SDL_HINT_ASSERT, + doc: Some( + "A variable controlling response to [`SDL_assert`] failures.\n\nThe variable can be set to the following case-sensitive values:\n\n- \"abort\": Program terminates immediately.\n- \"break\": Program triggers a debugger breakpoint.\n- \"retry\": Program reruns the SDL_assert's test again.\n- \"ignore\": Program continues on, ignoring this assertion failure this\ntime.\n- \"always_ignore\": Program continues on, ignoring this assertion failure\nfor the rest of the run.\n\nNote that [`SDL_SetAssertionHandler`] offers a programmatic means to deal with\nassertion failures through a callback, and this hint is largely intended to\nbe used via environment variables by end users and automated tools.\n\nThis hint should be set before an assertion failure is triggered and can be\nchanged at any time.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_PEN_MOUSE_EVENTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_PEN_MOUSE_EVENTS", + short_name: "PEN_MOUSE_EVENTS", + value: crate::hints::SDL_HINT_PEN_MOUSE_EVENTS, + doc: Some( + "A variable controlling whether pen events should generate synthetic mouse\nevents.\n\nThe variable can be set to the following values:\n\n- \"0\": Pen events will not generate mouse events.\n- \"1\": Pen events will generate mouse events. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HINT_PEN_TOUCH_EVENTS: Hint = Hint { + module: "hints", + name: "SDL_HINT_PEN_TOUCH_EVENTS", + short_name: "PEN_TOUCH_EVENTS", + value: crate::hints::SDL_HINT_PEN_TOUCH_EVENTS, + doc: Some( + "A variable controlling whether pen events should generate synthetic touch\nevents.\n\nThe variable can be set to the following values:\n\n- \"0\": Pen events will not generate touch events.\n- \"1\": Pen events will generate touch events. (default)\n\nThis hint can be set anytime.\n\n## Availability\nThis hint is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_HintPriority: Group = Group { + module: "hints", + kind: GroupKind::Enum, + name: "SDL_HintPriority", + short_name: "HintPriority", + doc: Some( + "An enumeration of hint priorities.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_HINT_DEFAULT", + short_name: "DEFAULT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_HINT_NORMAL", + short_name: "NORMAL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_HINT_OVERRIDE", + short_name: "OVERRIDE", + doc: None, + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/init.rs b/vendor/sdl3-sys/src/metadata/generated/init.rs new file mode 100644 index 00000000..55640d30 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/init.rs @@ -0,0 +1,159 @@ +//! Metadata for items in the `crate::init` module + +use super::*; + +pub const METADATA_SDL_PROP_APP_METADATA_NAME_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_NAME_STRING", + short_name: "APP_METADATA_NAME_STRING", + value: crate::init::SDL_PROP_APP_METADATA_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_APP_METADATA_VERSION_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_VERSION_STRING", + short_name: "APP_METADATA_VERSION_STRING", + value: crate::init::SDL_PROP_APP_METADATA_VERSION_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_APP_METADATA_IDENTIFIER_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_IDENTIFIER_STRING", + short_name: "APP_METADATA_IDENTIFIER_STRING", + value: crate::init::SDL_PROP_APP_METADATA_IDENTIFIER_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_APP_METADATA_CREATOR_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_CREATOR_STRING", + short_name: "APP_METADATA_CREATOR_STRING", + value: crate::init::SDL_PROP_APP_METADATA_CREATOR_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_APP_METADATA_COPYRIGHT_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_COPYRIGHT_STRING", + short_name: "APP_METADATA_COPYRIGHT_STRING", + value: crate::init::SDL_PROP_APP_METADATA_COPYRIGHT_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_APP_METADATA_URL_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_URL_STRING", + short_name: "APP_METADATA_URL_STRING", + value: crate::init::SDL_PROP_APP_METADATA_URL_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_APP_METADATA_TYPE_STRING: Property = Property { + module: "init", + name: "SDL_PROP_APP_METADATA_TYPE_STRING", + short_name: "APP_METADATA_TYPE_STRING", + value: crate::init::SDL_PROP_APP_METADATA_TYPE_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_InitFlags: Group = Group { + module: "init", + kind: GroupKind::Flags, + name: "SDL_InitFlags", + short_name: "InitFlags", + doc: Some( + "Initialization flags for [`SDL_Init`] and/or [`SDL_InitSubSystem`]\n\nThese are the flags which may be passed to [`SDL_Init()`]. You should specify\nthe subsystems which you will be using in your application.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_Init`]\n- [`SDL_Quit`]\n- [`SDL_InitSubSystem`]\n- [`SDL_QuitSubSystem`]\n- [`SDL_WasInit`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_INIT_AUDIO", + short_name: "AUDIO", + doc: Some("[`SDL_INIT_AUDIO`] implies [`SDL_INIT_EVENTS`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_INIT_VIDEO", + short_name: "VIDEO", + doc: Some( + "[`SDL_INIT_VIDEO`] implies [`SDL_INIT_EVENTS`], should be initialized on the main thread\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_INIT_JOYSTICK", + short_name: "JOYSTICK", + doc: Some("[`SDL_INIT_JOYSTICK`] implies [`SDL_INIT_EVENTS`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_INIT_HAPTIC", + short_name: "HAPTIC", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_INIT_GAMEPAD", + short_name: "GAMEPAD", + doc: Some("[`SDL_INIT_GAMEPAD`] implies [`SDL_INIT_JOYSTICK`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_INIT_EVENTS", + short_name: "EVENTS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_INIT_SENSOR", + short_name: "SENSOR", + doc: Some("[`SDL_INIT_SENSOR`] implies [`SDL_INIT_EVENTS`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_INIT_CAMERA", + short_name: "CAMERA", + doc: Some("[`SDL_INIT_CAMERA`] implies [`SDL_INIT_EVENTS`]\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_AppResult: Group = Group { + module: "init", + kind: GroupKind::Enum, + name: "SDL_AppResult", + short_name: "AppResult", + doc: Some( + "Return values for optional main callbacks.\n\nReturning [`SDL_APP_SUCCESS`] or [`SDL_APP_FAILURE`] from [`SDL_AppInit`],\n[`SDL_AppEvent`], or [`SDL_AppIterate`] will terminate the program and report\nsuccess/failure to the operating system. What that means is\nplatform-dependent. On Unix, for example, on success, the process error\ncode will be zero, and on failure it will be 1. This interface doesn't\nallow you to return specific exit codes, just whether there was an error\ngenerally or not.\n\nReturning [`SDL_APP_CONTINUE`] from these functions will let the app continue\nto run.\n\nSee\n[Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README-main-functions#main-callbacks-in-sdl3)\nfor complete details.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_APP_CONTINUE", + short_name: "CONTINUE", + doc: Some("Value that requests that the app continue from the main callbacks.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_APP_SUCCESS", + short_name: "SUCCESS", + doc: Some("Value that requests termination with success from the main callbacks.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_APP_FAILURE", + short_name: "FAILURE", + doc: Some("Value that requests termination with error from the main callbacks.\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/iostream.rs b/vendor/sdl3-sys/src/metadata/generated/iostream.rs new file mode 100644 index 00000000..38b0932b --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/iostream.rs @@ -0,0 +1,228 @@ +//! Metadata for items in the `crate::iostream` module + +use super::*; + +pub const METADATA_SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER", + short_name: "IOSTREAM_WINDOWS_HANDLE_POINTER", + value: crate::iostream::SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_STDIO_FILE_POINTER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_STDIO_FILE_POINTER", + short_name: "IOSTREAM_STDIO_FILE_POINTER", + value: crate::iostream::SDL_PROP_IOSTREAM_STDIO_FILE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER", + short_name: "IOSTREAM_FILE_DESCRIPTOR_NUMBER", + value: crate::iostream::SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER", + short_name: "IOSTREAM_ANDROID_AASSET_POINTER", + value: crate::iostream::SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_MEMORY_POINTER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_MEMORY_POINTER", + short_name: "IOSTREAM_MEMORY_POINTER", + value: crate::iostream::SDL_PROP_IOSTREAM_MEMORY_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER", + short_name: "IOSTREAM_MEMORY_SIZE_NUMBER", + value: crate::iostream::SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER", + short_name: "IOSTREAM_MEMORY_FREE_FUNC_POINTER", + value: crate::iostream::SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER", + short_name: "IOSTREAM_DYNAMIC_MEMORY_POINTER", + value: crate::iostream::SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER: Property = Property { + module: "iostream", + name: "SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER", + short_name: "IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER", + value: crate::iostream::SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_IOStatus: Group = Group { + module: "iostream", + kind: GroupKind::Enum, + name: "SDL_IOStatus", + short_name: "IOStatus", + doc: Some( + "[`SDL_IOStream`] status, set by a read or write operation.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_IO_STATUS_READY", + short_name: "READY", + doc: Some("Everything is ready (no errors and not EOF).\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_STATUS_ERROR", + short_name: "ERROR", + doc: Some("Read or write I/O error\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_STATUS_EOF", + short_name: "EOF", + doc: Some("End of file\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_STATUS_NOT_READY", + short_name: "NOT_READY", + doc: Some("Non blocking I/O, not ready\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_STATUS_READONLY", + short_name: "READONLY", + doc: Some("Tried to write a read-only buffer\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_STATUS_WRITEONLY", + short_name: "WRITEONLY", + doc: Some("Tried to read a write-only buffer\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_IOWhence: Group = Group { + module: "iostream", + kind: GroupKind::Enum, + name: "SDL_IOWhence", + short_name: "IOWhence", + doc: Some( + "Possible `whence` values for [`SDL_IOStream`] seeking.\n\nThese map to the same \"whence\" concept that `fseek` or `lseek` use in the\nstandard C runtime.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_IO_SEEK_SET", + short_name: "SET", + doc: Some("Seek from the beginning of data\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_SEEK_CUR", + short_name: "CUR", + doc: Some("Seek relative to current read point\n"), + available_since: None, + }, + GroupValue { + name: "SDL_IO_SEEK_END", + short_name: "END", + doc: Some("Seek relative to the end of data\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_IOStreamInterface: Struct = Struct { + module: "iostream", + kind: StructKind::Struct, + name: "SDL_IOStreamInterface", + doc: Some( + "The function pointers that drive an [`SDL_IOStream`].\n\nApplications can provide this struct to [`SDL_OpenIO()`] to create their own\nimplementation of [`SDL_IOStream`]. This is not necessarily required, as SDL\nalready offers several common types of I/O streams, via functions like\n[`SDL_IOFromFile()`] and [`SDL_IOFromMem()`].\n\nThis structure should be initialized using [`SDL_INIT_INTERFACE()`]\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_INIT_INTERFACE`]\n\n## Notes for `sdl3-sys`\nThis interface struct can be initialized with [`SDL_IOStreamInterface::new()`] or `Default::default()`.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "version", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "size", + doc: Some( + "Return the number of bytes in this [`SDL_IOStream`]\n\n\\return the total size of the data stream, or -1 on error.\n", + ), + available_since: None, + ty: "::core::option::Option Sint64>", + }, + Field { + name: "seek", + doc: Some( + "Seek to `offset` relative to `whence`, one of stdio's whence values:\n[`SDL_IO_SEEK_SET`], [`SDL_IO_SEEK_CUR`], [`SDL_IO_SEEK_END`]\n\n\\return the final offset in the data stream, or -1 on error.\n", + ), + available_since: None, + ty: "::core::option::Option Sint64>", + }, + Field { + name: "read", + doc: Some( + "Read up to `size` bytes from the data stream to the area pointed\nat by `ptr`. `size` will always be > 0.\n\nOn an incomplete read, you should set `*status` to a value from the\n[`SDL_IOStatus`] enum. You do not have to explicitly set this on\na complete, successful read.\n\n\\return the number of bytes read\n", + ), + available_since: None, + ty: "::core::option::Option ::core::primitive::usize>", + }, + Field { + name: "write", + doc: Some( + "Write exactly `size` bytes from the area pointed at by `ptr`\nto data stream. `size` will always be > 0.\n\nOn an incomplete write, you should set `*status` to a value from the\n[`SDL_IOStatus`] enum. You do not have to explicitly set this on\na complete, successful write.\n\n\\return the number of bytes written\n", + ), + available_since: None, + ty: "::core::option::Option ::core::primitive::usize>", + }, + Field { + name: "flush", + doc: Some( + "If the stream is buffering, make sure the data is written out.\n\nOn failure, you should set `*status` to a value from the\n[`SDL_IOStatus`] enum. You do not have to explicitly set this on\na successful flush.\n\n\\return true if successful or false on write error when flushing data.\n", + ), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "close", + doc: Some( + "Close and free any allocated resources.\n\nThis does not guarantee file writes will sync to physical media; they\ncan be in the system's file cache, waiting to go to disk.\n\nThe [`SDL_IOStream`] is still destroyed even if this fails, so clean up anything\neven if flushing buffers, etc, returns an error.\n\n\\return true if successful or false on write error when flushing data.\n", + ), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/joystick.rs b/vendor/sdl3-sys/src/metadata/generated/joystick.rs new file mode 100644 index 00000000..e2fcb006 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/joystick.rs @@ -0,0 +1,399 @@ +//! Metadata for items in the `crate::joystick` module + +use super::*; + +pub const METADATA_SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN: Property = Property { + module: "joystick", + name: "SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN", + short_name: "JOYSTICK_CAP_MONO_LED_BOOLEAN", + value: crate::joystick::SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN: Property = Property { + module: "joystick", + name: "SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN", + short_name: "JOYSTICK_CAP_RGB_LED_BOOLEAN", + value: crate::joystick::SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN: Property = Property { + module: "joystick", + name: "SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN", + short_name: "JOYSTICK_CAP_PLAYER_LED_BOOLEAN", + value: crate::joystick::SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN: Property = Property { + module: "joystick", + name: "SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN", + short_name: "JOYSTICK_CAP_RUMBLE_BOOLEAN", + value: crate::joystick::SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN: Property = Property { + module: "joystick", + name: "SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN", + short_name: "JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN", + value: crate::joystick::SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_JoystickID: Group = Group { + module: "joystick", + kind: GroupKind::Id, + name: "SDL_JoystickID", + short_name: "JoystickID", + doc: Some( + "This is a unique ID for a joystick for the time it is connected to the\nsystem, and is never reused for the lifetime of the application.\n\nIf the joystick is disconnected and reconnected, it will get a new ID.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_JoystickType: Group = Group { + module: "joystick", + kind: GroupKind::Enum, + name: "SDL_JoystickType", + short_name: "JoystickType", + doc: Some( + "An enum of some common joystick types.\n\nIn some cases, SDL can identify a low-level joystick as being a certain\ntype of device, and will report it through [`SDL_GetJoystickType`] (or\n[`SDL_GetJoystickTypeForID`]).\n\nThis is by no means a complete list of everything that can be plugged into\na computer.\n\nYou may refer to\n[XInput Controller Types](https://learn.microsoft.com/en-us/windows/win32/xinput/xinput-and-controller-subtypes)\ntable for a general understanding of each joystick type.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_JOYSTICK_TYPE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_GAMEPAD", + short_name: "GAMEPAD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_WHEEL", + short_name: "WHEEL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_ARCADE_STICK", + short_name: "ARCADE_STICK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_FLIGHT_STICK", + short_name: "FLIGHT_STICK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_DANCE_PAD", + short_name: "DANCE_PAD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_GUITAR", + short_name: "GUITAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_DRUM_KIT", + short_name: "DRUM_KIT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_ARCADE_PAD", + short_name: "ARCADE_PAD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_THROTTLE", + short_name: "THROTTLE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_TYPE_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_JoystickConnectionState: Group = Group { + module: "joystick", + kind: GroupKind::Enum, + name: "SDL_JoystickConnectionState", + short_name: "JoystickConnectionState", + doc: Some( + "Possible connection states for a joystick device.\n\nThis is used by [`SDL_GetJoystickConnectionState`] to report how a device is\nconnected to the system.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_JOYSTICK_CONNECTION_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_CONNECTION_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_CONNECTION_WIRED", + short_name: "WIRED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_JOYSTICK_CONNECTION_WIRELESS", + short_name: "WIRELESS", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_VirtualJoystickTouchpadDesc: Struct = Struct { + module: "joystick", + kind: StructKind::Struct, + name: "SDL_VirtualJoystickTouchpadDesc", + doc: Some( + "The structure that describes a virtual joystick touchpad.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_VirtualJoystickDesc`]\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "nfingers", + doc: Some("the number of simultaneous fingers on this touchpad\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "padding", + doc: None, + available_since: None, + ty: "[Uint16; 3]", + }, + ], +}; +pub const METADATA_SDL_VirtualJoystickSensorDesc: Struct = Struct { + module: "joystick", + kind: StructKind::Struct, + name: "SDL_VirtualJoystickSensorDesc", + doc: Some( + "The structure that describes a virtual joystick sensor.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_VirtualJoystickDesc`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r#type", + doc: Some("the type of this sensor\n"), + available_since: None, + ty: "SDL_SensorType", + }, + Field { + name: "rate", + doc: Some("the update frequency of this sensor, may be 0.0f\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_VirtualJoystickDesc: Struct = Struct { + module: "joystick", + kind: StructKind::Struct, + name: "SDL_VirtualJoystickDesc", + doc: Some( + "The structure that describes a virtual joystick.\n\nThis structure should be initialized using [`SDL_INIT_INTERFACE()`]. All\nelements of this structure are optional.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_AttachVirtualJoystick`]\n- [`SDL_INIT_INTERFACE`]\n- [`SDL_VirtualJoystickSensorDesc`]\n- [`SDL_VirtualJoystickTouchpadDesc`]\n\n## Notes for `sdl3-sys`\n- This interface struct can be initialized with [`SDL_VirtualJoystickDesc::new()`] or `Default::default()`.\n- This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "version", + doc: Some("the version of this interface\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "r#type", + doc: Some("[`SDL_JoystickType`]\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "padding", + doc: Some("unused\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "vendor_id", + doc: Some("the USB vendor ID of this joystick\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "product_id", + doc: Some("the USB product ID of this joystick\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "naxes", + doc: Some("the number of axes on this joystick\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "nbuttons", + doc: Some("the number of buttons on this joystick\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "nballs", + doc: Some("the number of balls on this joystick\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "nhats", + doc: Some("the number of hats on this joystick\n"), + available_since: None, + ty: "Uint16", + }, + Field { + name: "ntouchpads", + doc: Some( + "the number of touchpads on this joystick, requires `touchpads` to point at valid descriptions\n", + ), + available_since: None, + ty: "Uint16", + }, + Field { + name: "nsensors", + doc: Some( + "the number of sensors on this joystick, requires `sensors` to point at valid descriptions\n", + ), + available_since: None, + ty: "Uint16", + }, + Field { + name: "padding2", + doc: Some("unused\n"), + available_since: None, + ty: "[Uint16; 2]", + }, + Field { + name: "button_mask", + doc: Some( + "A mask of which buttons are valid for this controller\ne.g. (1 << [`SDL_GAMEPAD_BUTTON_SOUTH`])\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "axis_mask", + doc: Some( + "A mask of which axes are valid for this controller\ne.g. (1 << [`SDL_GAMEPAD_AXIS_LEFTX`])\n", + ), + available_since: None, + ty: "Uint32", + }, + Field { + name: "name", + doc: Some("the name of the joystick\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "touchpads", + doc: Some( + "A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0\n", + ), + available_since: None, + ty: "*const SDL_VirtualJoystickTouchpadDesc", + }, + Field { + name: "sensors", + doc: Some( + "A pointer to an array of sensor descriptions, required if `nsensors` is > 0\n", + ), + available_since: None, + ty: "*const SDL_VirtualJoystickSensorDesc", + }, + Field { + name: "userdata", + doc: Some("User data pointer passed to callbacks\n"), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + Field { + name: "Update", + doc: Some("Called when the joystick state should be updated\n"), + available_since: None, + ty: "::core::option::Option", + }, + Field { + name: "SetPlayerIndex", + doc: Some("Called when the player index is set\n"), + available_since: None, + ty: "::core::option::Option", + }, + Field { + name: "Rumble", + doc: Some("Implements [`SDL_RumbleJoystick()`]\n"), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "RumbleTriggers", + doc: Some("Implements [`SDL_RumbleJoystickTriggers()`]\n"), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "SetLED", + doc: Some("Implements [`SDL_SetJoystickLED()`]\n"), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "SendEffect", + doc: Some("Implements [`SDL_SendJoystickEffect()`]\n"), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "SetSensorsEnabled", + doc: Some("Implements [`SDL_SetGamepadSensorEnabled()`]\n"), + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "Cleanup", + doc: Some("Cleans up the userdata when the joystick is detached\n"), + available_since: None, + ty: "::core::option::Option", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/keyboard.rs b/vendor/sdl3-sys/src/metadata/generated/keyboard.rs new file mode 100644 index 00000000..ee74a0cb --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/keyboard.rs @@ -0,0 +1,162 @@ +//! Metadata for items in the `crate::keyboard` module + +use super::*; + +pub const METADATA_SDL_PROP_TEXTINPUT_TYPE_NUMBER: Property = Property { + module: "keyboard", + name: "SDL_PROP_TEXTINPUT_TYPE_NUMBER", + short_name: "TEXTINPUT_TYPE_NUMBER", + value: crate::keyboard::SDL_PROP_TEXTINPUT_TYPE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER: Property = Property { + module: "keyboard", + name: "SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER", + short_name: "TEXTINPUT_CAPITALIZATION_NUMBER", + value: crate::keyboard::SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN: Property = Property { + module: "keyboard", + name: "SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN", + short_name: "TEXTINPUT_AUTOCORRECT_BOOLEAN", + value: crate::keyboard::SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN: Property = Property { + module: "keyboard", + name: "SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN", + short_name: "TEXTINPUT_MULTILINE_BOOLEAN", + value: crate::keyboard::SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER: Property = Property { + module: "keyboard", + name: "SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER", + short_name: "TEXTINPUT_ANDROID_INPUTTYPE_NUMBER", + value: crate::keyboard::SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_KeyboardID: Group = Group { + module: "keyboard", + kind: GroupKind::Id, + name: "SDL_KeyboardID", + short_name: "KeyboardID", + doc: Some( + "This is a unique ID for a keyboard for the time it is connected to the\nsystem, and is never reused for the lifetime of the application.\n\nIf the keyboard is disconnected and reconnected, it will get a new ID.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_TextInputType: Group = Group { + module: "keyboard", + kind: GroupKind::Enum, + name: "SDL_TextInputType", + short_name: "TextInputType", + doc: Some( + "Text input type.\n\nThese are the valid values for [`SDL_PROP_TEXTINPUT_TYPE_NUMBER`]. Not every\nvalue is valid on every platform, but where a value isn't supported, a\nreasonable fallback will be used.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_StartTextInputWithProperties`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_TEXTINPUT_TYPE_TEXT", + short_name: "TEXT", + doc: Some("The input is text\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_TEXT_NAME", + short_name: "TEXT_NAME", + doc: Some("The input is a person's name\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_TEXT_EMAIL", + short_name: "TEXT_EMAIL", + doc: Some("The input is an e-mail address\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_TEXT_USERNAME", + short_name: "TEXT_USERNAME", + doc: Some("The input is a username\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN", + short_name: "TEXT_PASSWORD_HIDDEN", + doc: Some("The input is a secure password that is hidden\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE", + short_name: "TEXT_PASSWORD_VISIBLE", + doc: Some("The input is a secure password that is visible\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_NUMBER", + short_name: "NUMBER", + doc: Some("The input is a number\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN", + short_name: "NUMBER_PASSWORD_HIDDEN", + doc: Some("The input is a secure PIN that is hidden\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE", + short_name: "NUMBER_PASSWORD_VISIBLE", + doc: Some("The input is a secure PIN that is visible\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Capitalization: Group = Group { + module: "keyboard", + kind: GroupKind::Enum, + name: "SDL_Capitalization", + short_name: "Capitalization", + doc: Some( + "Auto capitalization type.\n\nThese are the valid values for [`SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER`].\nNot every value is valid on every platform, but where a value isn't\nsupported, a reasonable fallback will be used.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_StartTextInputWithProperties`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_CAPITALIZE_NONE", + short_name: "NONE", + doc: Some("No auto-capitalization will be done\n"), + available_since: None, + }, + GroupValue { + name: "SDL_CAPITALIZE_SENTENCES", + short_name: "SENTENCES", + doc: Some("The first letter of sentences will be capitalized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_CAPITALIZE_WORDS", + short_name: "WORDS", + doc: Some("The first letter of words will be capitalized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_CAPITALIZE_LETTERS", + short_name: "LETTERS", + doc: Some("All letters will be capitalized\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/keycode.rs b/vendor/sdl3-sys/src/metadata/generated/keycode.rs new file mode 100644 index 00000000..c0899ec2 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/keycode.rs @@ -0,0 +1,1684 @@ +//! Metadata for items in the `crate::keycode` module + +use super::*; + +pub const METADATA_SDL_Keycode: Group = Group { + module: "keycode", + kind: GroupKind::Id, + name: "SDL_Keycode", + short_name: "Keycode", + doc: Some( + "The SDL virtual key representation.\n\nValues of this type are used to represent keyboard keys using the current\nlayout of the keyboard. These values include Unicode values representing\nthe unmodified character that would be generated by pressing the key, or an\n`SDLK_*` constant for those keys that do not generate characters.\n\nA special exception is the number keys at the top of the keyboard which map\nby default to SDLK_0...SDLK_9 on AZERTY layouts.\n\nKeys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or\nUnicode code point.\n\nMany common keycodes are listed below, but this list is not exhaustive.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HINT_KEYCODE_OPTIONS`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDLK_EXTENDED_MASK", + short_name: "EXTENDED_MASK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDLK_SCANCODE_MASK", + short_name: "SCANCODE_MASK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDLK_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("0\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RETURN", + short_name: "RETURN", + doc: Some("'\\r'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_ESCAPE", + short_name: "ESCAPE", + doc: Some("'\\x1B'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_BACKSPACE", + short_name: "BACKSPACE", + doc: Some("'\\b'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_TAB", + short_name: "TAB", + doc: Some("'\\t'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SPACE", + short_name: "SPACE", + doc: Some("' '\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_EXCLAIM", + short_name: "EXCLAIM", + doc: Some("'!'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_DBLAPOSTROPHE", + short_name: "DBLAPOSTROPHE", + doc: Some("'\"'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_HASH", + short_name: "HASH", + doc: Some("'#'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_DOLLAR", + short_name: "DOLLAR", + doc: Some("'$'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PERCENT", + short_name: "PERCENT", + doc: Some("'%'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AMPERSAND", + short_name: "AMPERSAND", + doc: Some("'&'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_APOSTROPHE", + short_name: "APOSTROPHE", + doc: Some("'\\''\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LEFTPAREN", + short_name: "LEFTPAREN", + doc: Some("'('\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RIGHTPAREN", + short_name: "RIGHTPAREN", + doc: Some("')'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_ASTERISK", + short_name: "ASTERISK", + doc: Some("'*'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PLUS", + short_name: "PLUS", + doc: Some("'+'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_COMMA", + short_name: "COMMA", + doc: Some("','\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MINUS", + short_name: "MINUS", + doc: Some("'-'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PERIOD", + short_name: "PERIOD", + doc: Some("'.'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SLASH", + short_name: "SLASH", + doc: Some("'/'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_0", + short_name: "_0", + doc: Some("'0'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_1", + short_name: "_1", + doc: Some("'1'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_2", + short_name: "_2", + doc: Some("'2'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_3", + short_name: "_3", + doc: Some("'3'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_4", + short_name: "_4", + doc: Some("'4'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_5", + short_name: "_5", + doc: Some("'5'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_6", + short_name: "_6", + doc: Some("'6'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_7", + short_name: "_7", + doc: Some("'7'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_8", + short_name: "_8", + doc: Some("'8'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_9", + short_name: "_9", + doc: Some("'9'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_COLON", + short_name: "COLON", + doc: Some("':'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SEMICOLON", + short_name: "SEMICOLON", + doc: Some("';'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LESS", + short_name: "LESS", + doc: Some("'<'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_EQUALS", + short_name: "EQUALS", + doc: Some("'='\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_GREATER", + short_name: "GREATER", + doc: Some("'>'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_QUESTION", + short_name: "QUESTION", + doc: Some("'?'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AT", + short_name: "AT", + doc: Some("'@'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LEFTBRACKET", + short_name: "LEFTBRACKET", + doc: Some("'['\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_BACKSLASH", + short_name: "BACKSLASH", + doc: Some("'\\\\'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RIGHTBRACKET", + short_name: "RIGHTBRACKET", + doc: Some("']'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CARET", + short_name: "CARET", + doc: Some("'^'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_UNDERSCORE", + short_name: "UNDERSCORE", + doc: Some("'_'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_GRAVE", + short_name: "GRAVE", + doc: Some("'`'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_A", + short_name: "A", + doc: Some("'a'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_B", + short_name: "B", + doc: Some("'b'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_C", + short_name: "C", + doc: Some("'c'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_D", + short_name: "D", + doc: Some("'d'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_E", + short_name: "E", + doc: Some("'e'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F", + short_name: "F", + doc: Some("'f'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_G", + short_name: "G", + doc: Some("'g'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_H", + short_name: "H", + doc: Some("'h'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_I", + short_name: "I", + doc: Some("'i'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_J", + short_name: "J", + doc: Some("'j'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_K", + short_name: "K", + doc: Some("'k'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_L", + short_name: "L", + doc: Some("'l'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_M", + short_name: "M", + doc: Some("'m'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_N", + short_name: "N", + doc: Some("'n'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_O", + short_name: "O", + doc: Some("'o'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_P", + short_name: "P", + doc: Some("'p'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_Q", + short_name: "Q", + doc: Some("'q'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_R", + short_name: "R", + doc: Some("'r'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_S", + short_name: "S", + doc: Some("'s'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_T", + short_name: "T", + doc: Some("'t'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_U", + short_name: "U", + doc: Some("'u'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_V", + short_name: "V", + doc: Some("'v'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_W", + short_name: "W", + doc: Some("'w'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_X", + short_name: "X", + doc: Some("'x'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_Y", + short_name: "Y", + doc: Some("'y'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_Z", + short_name: "Z", + doc: Some("'z'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LEFTBRACE", + short_name: "LEFTBRACE", + doc: Some("'{'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PIPE", + short_name: "PIPE", + doc: Some("'|'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RIGHTBRACE", + short_name: "RIGHTBRACE", + doc: Some("'}'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_TILDE", + short_name: "TILDE", + doc: Some("'~'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_DELETE", + short_name: "DELETE", + doc: Some("'\\x7F'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PLUSMINUS", + short_name: "PLUSMINUS", + doc: Some("'\\xB1'\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CAPSLOCK", + short_name: "CAPSLOCK", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CAPSLOCK`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F1", + short_name: "F1", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F1`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F2", + short_name: "F2", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F2`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F3", + short_name: "F3", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F3`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F4", + short_name: "F4", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F4`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F5", + short_name: "F5", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F5`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F6", + short_name: "F6", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F6`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F7", + short_name: "F7", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F7`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F8", + short_name: "F8", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F8`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F9", + short_name: "F9", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F9`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F10", + short_name: "F10", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F10`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F11", + short_name: "F11", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F11`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F12", + short_name: "F12", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F12`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PRINTSCREEN", + short_name: "PRINTSCREEN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRINTSCREEN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SCROLLLOCK", + short_name: "SCROLLLOCK", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SCROLLLOCK`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PAUSE", + short_name: "PAUSE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAUSE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_INSERT", + short_name: "INSERT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_INSERT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_HOME", + short_name: "HOME", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HOME`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PAGEUP", + short_name: "PAGEUP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEUP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_END", + short_name: "END", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_END`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PAGEDOWN", + short_name: "PAGEDOWN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PAGEDOWN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RIGHT", + short_name: "RIGHT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RIGHT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LEFT", + short_name: "LEFT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LEFT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_DOWN", + short_name: "DOWN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DOWN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_UP", + short_name: "UP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_NUMLOCKCLEAR", + short_name: "NUMLOCKCLEAR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_NUMLOCKCLEAR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_DIVIDE", + short_name: "KP_DIVIDE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DIVIDE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MULTIPLY", + short_name: "KP_MULTIPLY", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MULTIPLY`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MINUS", + short_name: "KP_MINUS", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MINUS`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_PLUS", + short_name: "KP_PLUS", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUS`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_ENTER", + short_name: "KP_ENTER", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_ENTER`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_1", + short_name: "KP_1", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_1`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_2", + short_name: "KP_2", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_2`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_3", + short_name: "KP_3", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_3`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_4", + short_name: "KP_4", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_4`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_5", + short_name: "KP_5", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_5`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_6", + short_name: "KP_6", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_6`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_7", + short_name: "KP_7", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_7`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_8", + short_name: "KP_8", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_8`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_9", + short_name: "KP_9", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_9`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_0", + short_name: "KP_0", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_0`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_PERIOD", + short_name: "KP_PERIOD", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERIOD`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_APPLICATION", + short_name: "APPLICATION", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_APPLICATION`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_POWER", + short_name: "POWER", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_POWER`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_EQUALS", + short_name: "KP_EQUALS", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALS`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F13", + short_name: "F13", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F13`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F14", + short_name: "F14", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F14`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F15", + short_name: "F15", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F15`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F16", + short_name: "F16", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F16`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F17", + short_name: "F17", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F17`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F18", + short_name: "F18", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F18`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F19", + short_name: "F19", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F19`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F20", + short_name: "F20", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F20`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F21", + short_name: "F21", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F21`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F22", + short_name: "F22", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F22`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F23", + short_name: "F23", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F23`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_F24", + short_name: "F24", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_F24`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_EXECUTE", + short_name: "EXECUTE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXECUTE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_HELP", + short_name: "HELP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_HELP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MENU", + short_name: "MENU", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MENU`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SELECT", + short_name: "SELECT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SELECT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_STOP", + short_name: "STOP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_STOP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AGAIN", + short_name: "AGAIN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AGAIN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_UNDO", + short_name: "UNDO", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_UNDO`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CUT", + short_name: "CUT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CUT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_COPY", + short_name: "COPY", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_COPY`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PASTE", + short_name: "PASTE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PASTE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_FIND", + short_name: "FIND", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_FIND`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MUTE", + short_name: "MUTE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MUTE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_VOLUMEUP", + short_name: "VOLUMEUP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEUP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_VOLUMEDOWN", + short_name: "VOLUMEDOWN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_VOLUMEDOWN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_COMMA", + short_name: "KP_COMMA", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COMMA`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_EQUALSAS400", + short_name: "KP_EQUALSAS400", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EQUALSAS400`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_ALTERASE", + short_name: "ALTERASE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ALTERASE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SYSREQ", + short_name: "SYSREQ", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SYSREQ`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CANCEL", + short_name: "CANCEL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CANCEL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CLEAR", + short_name: "CLEAR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEAR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_PRIOR", + short_name: "PRIOR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_PRIOR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RETURN2", + short_name: "RETURN2", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RETURN2`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SEPARATOR", + short_name: "SEPARATOR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SEPARATOR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_OUT", + short_name: "OUT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OUT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_OPER", + short_name: "OPER", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_OPER`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CLEARAGAIN", + short_name: "CLEARAGAIN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CLEARAGAIN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CRSEL", + short_name: "CRSEL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CRSEL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_EXSEL", + short_name: "EXSEL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_EXSEL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_00", + short_name: "KP_00", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_00`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_000", + short_name: "KP_000", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_000`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_THOUSANDSSEPARATOR", + short_name: "THOUSANDSSEPARATOR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_THOUSANDSSEPARATOR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_DECIMALSEPARATOR", + short_name: "DECIMALSEPARATOR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_DECIMALSEPARATOR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CURRENCYUNIT", + short_name: "CURRENCYUNIT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYUNIT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CURRENCYSUBUNIT", + short_name: "CURRENCYSUBUNIT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CURRENCYSUBUNIT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_LEFTPAREN", + short_name: "KP_LEFTPAREN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTPAREN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_RIGHTPAREN", + short_name: "KP_RIGHTPAREN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTPAREN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_LEFTBRACE", + short_name: "KP_LEFTBRACE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LEFTBRACE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_RIGHTBRACE", + short_name: "KP_RIGHTBRACE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_RIGHTBRACE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_TAB", + short_name: "KP_TAB", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_TAB`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_BACKSPACE", + short_name: "KP_BACKSPACE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BACKSPACE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_A", + short_name: "KP_A", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_A`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_B", + short_name: "KP_B", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_B`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_C", + short_name: "KP_C", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_C`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_D", + short_name: "KP_D", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_D`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_E", + short_name: "KP_E", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_E`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_F", + short_name: "KP_F", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_F`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_XOR", + short_name: "KP_XOR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_XOR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_POWER", + short_name: "KP_POWER", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_POWER`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_PERCENT", + short_name: "KP_PERCENT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PERCENT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_LESS", + short_name: "KP_LESS", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_LESS`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_GREATER", + short_name: "KP_GREATER", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_GREATER`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_AMPERSAND", + short_name: "KP_AMPERSAND", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AMPERSAND`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_DBLAMPERSAND", + short_name: "KP_DBLAMPERSAND", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLAMPERSAND`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_VERTICALBAR", + short_name: "KP_VERTICALBAR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_VERTICALBAR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_DBLVERTICALBAR", + short_name: "KP_DBLVERTICALBAR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DBLVERTICALBAR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_COLON", + short_name: "KP_COLON", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_COLON`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_HASH", + short_name: "KP_HASH", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HASH`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_SPACE", + short_name: "KP_SPACE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_SPACE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_AT", + short_name: "KP_AT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_AT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_EXCLAM", + short_name: "KP_EXCLAM", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_EXCLAM`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMSTORE", + short_name: "KP_MEMSTORE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSTORE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMRECALL", + short_name: "KP_MEMRECALL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMRECALL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMCLEAR", + short_name: "KP_MEMCLEAR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMCLEAR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMADD", + short_name: "KP_MEMADD", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMADD`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMSUBTRACT", + short_name: "KP_MEMSUBTRACT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMSUBTRACT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMMULTIPLY", + short_name: "KP_MEMMULTIPLY", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMMULTIPLY`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_MEMDIVIDE", + short_name: "KP_MEMDIVIDE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_MEMDIVIDE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_PLUSMINUS", + short_name: "KP_PLUSMINUS", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_PLUSMINUS`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_CLEAR", + short_name: "KP_CLEAR", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEAR`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_CLEARENTRY", + short_name: "KP_CLEARENTRY", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_CLEARENTRY`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_BINARY", + short_name: "KP_BINARY", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_BINARY`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_OCTAL", + short_name: "KP_OCTAL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_OCTAL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_DECIMAL", + short_name: "KP_DECIMAL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_DECIMAL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_KP_HEXADECIMAL", + short_name: "KP_HEXADECIMAL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_KP_HEXADECIMAL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LCTRL", + short_name: "LCTRL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LCTRL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LSHIFT", + short_name: "LSHIFT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LSHIFT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LALT", + short_name: "LALT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LALT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LGUI", + short_name: "LGUI", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_LGUI`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RCTRL", + short_name: "RCTRL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RCTRL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RSHIFT", + short_name: "RSHIFT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RSHIFT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RALT", + short_name: "RALT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RALT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RGUI", + short_name: "RGUI", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_RGUI`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MODE", + short_name: "MODE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MODE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SLEEP", + short_name: "SLEEP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SLEEP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_WAKE", + short_name: "WAKE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_WAKE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CHANNEL_INCREMENT", + short_name: "CHANNEL_INCREMENT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_INCREMENT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CHANNEL_DECREMENT", + short_name: "CHANNEL_DECREMENT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CHANNEL_DECREMENT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_PLAY", + short_name: "MEDIA_PLAY", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_PAUSE", + short_name: "MEDIA_PAUSE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PAUSE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_RECORD", + short_name: "MEDIA_RECORD", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_RECORD`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_FAST_FORWARD", + short_name: "MEDIA_FAST_FORWARD", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_FAST_FORWARD`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_REWIND", + short_name: "MEDIA_REWIND", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_REWIND`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_NEXT_TRACK", + short_name: "MEDIA_NEXT_TRACK", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_NEXT_TRACK`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_PREVIOUS_TRACK", + short_name: "MEDIA_PREVIOUS_TRACK", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PREVIOUS_TRACK`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_STOP", + short_name: "MEDIA_STOP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_STOP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_EJECT", + short_name: "MEDIA_EJECT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_EJECT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_PLAY_PAUSE", + short_name: "MEDIA_PLAY_PAUSE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_PLAY_PAUSE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MEDIA_SELECT", + short_name: "MEDIA_SELECT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_MEDIA_SELECT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_NEW", + short_name: "AC_NEW", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_NEW`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_OPEN", + short_name: "AC_OPEN", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_OPEN`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_CLOSE", + short_name: "AC_CLOSE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_CLOSE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_EXIT", + short_name: "AC_EXIT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_EXIT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_SAVE", + short_name: "AC_SAVE", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SAVE`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_PRINT", + short_name: "AC_PRINT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PRINT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_PROPERTIES", + short_name: "AC_PROPERTIES", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_PROPERTIES`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_SEARCH", + short_name: "AC_SEARCH", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_SEARCH`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_HOME", + short_name: "AC_HOME", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_HOME`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_BACK", + short_name: "AC_BACK", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BACK`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_FORWARD", + short_name: "AC_FORWARD", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_FORWARD`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_STOP", + short_name: "AC_STOP", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_STOP`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_REFRESH", + short_name: "AC_REFRESH", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_REFRESH`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_AC_BOOKMARKS", + short_name: "AC_BOOKMARKS", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_AC_BOOKMARKS`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SOFTLEFT", + short_name: "SOFTLEFT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTLEFT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_SOFTRIGHT", + short_name: "SOFTRIGHT", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_SOFTRIGHT`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_CALL", + short_name: "CALL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_CALL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_ENDCALL", + short_name: "ENDCALL", + doc: Some("SDL_SCANCODE_TO_KEYCODE([`SDL_SCANCODE_ENDCALL`])\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LEFT_TAB", + short_name: "LEFT_TAB", + doc: Some("Extended key Left Tab\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LEVEL5_SHIFT", + short_name: "LEVEL5_SHIFT", + doc: Some("Extended key Level 5 Shift\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_MULTI_KEY_COMPOSE", + short_name: "MULTI_KEY_COMPOSE", + doc: Some("Extended key Multi-key Compose\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LMETA", + short_name: "LMETA", + doc: Some("Extended key Left Meta\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RMETA", + short_name: "RMETA", + doc: Some("Extended key Right Meta\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_LHYPER", + short_name: "LHYPER", + doc: Some("Extended key Left Hyper\n"), + available_since: None, + }, + GroupValue { + name: "SDLK_RHYPER", + short_name: "RHYPER", + doc: Some("Extended key Right Hyper\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Keymod: Group = Group { + module: "keycode", + kind: GroupKind::Flags, + name: "SDL_Keymod", + short_name: "Keymod", + doc: Some( + "Valid key modifiers (possibly OR'd together).\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_KMOD_NONE", + short_name: "NONE", + doc: Some("no modifier is applicable.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_LSHIFT", + short_name: "LSHIFT", + doc: Some("the left Shift key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_RSHIFT", + short_name: "RSHIFT", + doc: Some("the right Shift key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_LEVEL5", + short_name: "LEVEL5", + doc: Some("the Level 5 Shift key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_LCTRL", + short_name: "LCTRL", + doc: Some("the left Ctrl (Control) key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_RCTRL", + short_name: "RCTRL", + doc: Some("the right Ctrl (Control) key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_LALT", + short_name: "LALT", + doc: Some("the left Alt key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_RALT", + short_name: "RALT", + doc: Some("the right Alt key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_LGUI", + short_name: "LGUI", + doc: Some("the left GUI key (often the Windows key) is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_RGUI", + short_name: "RGUI", + doc: Some("the right GUI key (often the Windows key) is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_NUM", + short_name: "NUM", + doc: Some("the Num Lock key (may be located on an extended keypad) is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_CAPS", + short_name: "CAPS", + doc: Some("the Caps Lock key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_MODE", + short_name: "MODE", + doc: Some("the !AltGr key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_SCROLL", + short_name: "SCROLL", + doc: Some("the Scroll Lock key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_CTRL", + short_name: "CTRL", + doc: Some("Any Ctrl key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_SHIFT", + short_name: "SHIFT", + doc: Some("Any Shift key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_ALT", + short_name: "ALT", + doc: Some("Any Alt key is down.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_KMOD_GUI", + short_name: "GUI", + doc: Some("Any GUI key is down.\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/loadso.rs b/vendor/sdl3-sys/src/metadata/generated/loadso.rs new file mode 100644 index 00000000..0e4cf4c4 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/loadso.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::loadso` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/locale.rs b/vendor/sdl3-sys/src/metadata/generated/locale.rs new file mode 100644 index 00000000..2c32be06 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/locale.rs @@ -0,0 +1,27 @@ +//! Metadata for items in the `crate::locale` module + +use super::*; + +pub const METADATA_SDL_Locale: Struct = Struct { + module: "locale", + kind: StructKind::Struct, + name: "SDL_Locale", + doc: Some( + "A struct to provide locale data.\n\nLocale data is split into a spoken language, like English, and an optional\ncountry, like Canada. The language will be in ISO-639 format (so English\nwould be \"en\"), and the country, if not NULL, will be an ISO-3166 country\ncode (so Canada would be \"CA\").\n\n## Availability\nThis function is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetPreferredLocales`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "language", + doc: Some("A language name, like \"en\" for English.\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "country", + doc: Some("A country, like \"US\" for America. Can be NULL.\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/log.rs b/vendor/sdl3-sys/src/metadata/generated/log.rs new file mode 100644 index 00000000..0b5decea --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/log.rs @@ -0,0 +1,202 @@ +//! Metadata for items in the `crate::log` module + +use super::*; + +pub const METADATA_SDL_LogCategory: Group = Group { + module: "log", + kind: GroupKind::Enum, + name: "SDL_LogCategory", + short_name: "LogCategory", + doc: Some( + "The predefined log categories\n\nBy default the application and gpu categories are enabled at the INFO\nlevel, the assert category is enabled at the WARN level, test is enabled at\nthe VERBOSE level and all other categories are enabled at the ERROR level.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_LOG_CATEGORY_APPLICATION", + short_name: "APPLICATION", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_ERROR", + short_name: "ERROR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_ASSERT", + short_name: "ASSERT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_SYSTEM", + short_name: "SYSTEM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_AUDIO", + short_name: "AUDIO", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_VIDEO", + short_name: "VIDEO", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RENDER", + short_name: "RENDER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_INPUT", + short_name: "INPUT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_TEST", + short_name: "TEST", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_GPU", + short_name: "GPU", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED2", + short_name: "RESERVED2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED3", + short_name: "RESERVED3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED4", + short_name: "RESERVED4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED5", + short_name: "RESERVED5", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED6", + short_name: "RESERVED6", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED7", + short_name: "RESERVED7", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED8", + short_name: "RESERVED8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED9", + short_name: "RESERVED9", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_RESERVED10", + short_name: "RESERVED10", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_CATEGORY_CUSTOM", + short_name: "CUSTOM", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_LogPriority: Group = Group { + module: "log", + kind: GroupKind::Enum, + name: "SDL_LogPriority", + short_name: "LogPriority", + doc: Some( + "The predefined log priorities\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_LOG_PRIORITY_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_TRACE", + short_name: "TRACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_VERBOSE", + short_name: "VERBOSE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_DEBUG", + short_name: "DEBUG", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_INFO", + short_name: "INFO", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_WARN", + short_name: "WARN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_ERROR", + short_name: "ERROR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_CRITICAL", + short_name: "CRITICAL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_LOG_PRIORITY_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/main.rs b/vendor/sdl3-sys/src/metadata/generated/main.rs new file mode 100644 index 00000000..4193853b --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/main.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::main` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/messagebox.rs b/vendor/sdl3-sys/src/metadata/generated/messagebox.rs new file mode 100644 index 00000000..0adf76e9 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/messagebox.rs @@ -0,0 +1,244 @@ +//! Metadata for items in the `crate::messagebox` module + +use super::*; + +pub const METADATA_SDL_MessageBoxFlags: Group = Group { + module: "messagebox", + kind: GroupKind::Flags, + name: "SDL_MessageBoxFlags", + short_name: "MessageBoxFlags", + doc: Some( + "Message box flags.\n\nIf supported will display warning icon, etc.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_MESSAGEBOX_ERROR", + short_name: "ERROR", + doc: Some("error dialog\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_WARNING", + short_name: "WARNING", + doc: Some("warning dialog\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_INFORMATION", + short_name: "INFORMATION", + doc: Some("informational dialog\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT", + short_name: "BUTTONS_LEFT_TO_RIGHT", + doc: Some("buttons placed left to right\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT", + short_name: "BUTTONS_RIGHT_TO_LEFT", + doc: Some("buttons placed right to left\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_MessageBoxButtonFlags: Group = Group { + module: "messagebox", + kind: GroupKind::Flags, + name: "SDL_MessageBoxButtonFlags", + short_name: "MessageBoxButtonFlags", + doc: Some( + "[`SDL_MessageBoxButtonData`] flags.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT", + short_name: "RETURNKEY_DEFAULT", + doc: Some("Marks the default button when return is hit\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT", + short_name: "ESCAPEKEY_DEFAULT", + doc: Some("Marks the default button when escape is hit\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_MessageBoxColorType: Group = Group { + module: "messagebox", + kind: GroupKind::Enum, + name: "SDL_MessageBoxColorType", + short_name: "MessageBoxColorType", + doc: Some( + "An enumeration of indices inside the colors array of\n[`SDL_MessageBoxColorScheme`].\n", + ), + available_since: None, + values: &[ + GroupValue { + name: "SDL_MESSAGEBOX_COLOR_BACKGROUND", + short_name: "BACKGROUND", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_COLOR_TEXT", + short_name: "TEXT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_COLOR_BUTTON_BORDER", + short_name: "BUTTON_BORDER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND", + short_name: "BUTTON_BACKGROUND", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED", + short_name: "BUTTON_SELECTED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MESSAGEBOX_COLOR_COUNT", + short_name: "COUNT", + doc: Some("Size of the colors array of [`SDL_MessageBoxColorScheme`].\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_MessageBoxButtonData: Struct = Struct { + module: "messagebox", + kind: StructKind::Struct, + name: "SDL_MessageBoxButtonData", + doc: Some( + "Individual button data.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "flags", + doc: None, + available_since: None, + ty: "SDL_MessageBoxButtonFlags", + }, + Field { + name: "buttonID", + doc: Some("User defined button id (value returned via [`SDL_ShowMessageBox`])\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "text", + doc: Some("The UTF-8 button text\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + ], +}; +pub const METADATA_SDL_MessageBoxColor: Struct = Struct { + module: "messagebox", + kind: StructKind::Struct, + name: "SDL_MessageBoxColor", + doc: Some( + "RGB value used in a message box color scheme\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "g", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "b", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_MessageBoxColorScheme: Struct = Struct { + module: "messagebox", + kind: StructKind::Struct, + name: "SDL_MessageBoxColorScheme", + doc: Some( + "A set of colors to use for message box dialogs\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[Field { + name: "colors", + doc: None, + available_since: None, + ty: "[SDL_MessageBoxColor; SDL_MESSAGEBOX_COLOR_COUNT.0 as ::core::primitive::usize]", + }], +}; +pub const METADATA_SDL_MessageBoxData: Struct = Struct { + module: "messagebox", + kind: StructKind::Struct, + name: "SDL_MessageBoxData", + doc: Some( + "MessageBox structure containing title, text, window, etc.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "flags", + doc: None, + available_since: None, + ty: "SDL_MessageBoxFlags", + }, + Field { + name: "window", + doc: Some("Parent window, can be NULL\n"), + available_since: None, + ty: "*mut SDL_Window", + }, + Field { + name: "title", + doc: Some("UTF-8 title\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "message", + doc: Some("UTF-8 message text\n"), + available_since: None, + ty: "*const ::core::ffi::c_char", + }, + Field { + name: "numbuttons", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "buttons", + doc: None, + available_since: None, + ty: "*const SDL_MessageBoxButtonData", + }, + Field { + name: "colorScheme", + doc: Some("[`SDL_MessageBoxColorScheme`], can be NULL to use system settings\n"), + available_since: None, + ty: "*const SDL_MessageBoxColorScheme", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/metal.rs b/vendor/sdl3-sys/src/metadata/generated/metal.rs new file mode 100644 index 00000000..6e26c8f9 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/metal.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::metal` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/misc.rs b/vendor/sdl3-sys/src/metadata/generated/misc.rs new file mode 100644 index 00000000..9403066c --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/misc.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::misc` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/mod.rs b/vendor/sdl3-sys/src/metadata/generated/mod.rs new file mode 100644 index 00000000..dbd932f4 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/mod.rs @@ -0,0 +1,1012 @@ +#![allow(non_upper_case_globals, unused)] + +use core::ffi::CStr; +use sdl3_sys::{ + metadata::{ + Field, Group, GroupKind, GroupValue, Hint, Property, PropertyType, Struct, StructKind, + }, + version::SDL_VERSIONNUM, +}; + +pub mod assert; +pub mod asyncio; +pub mod atomic; +pub mod audio; +pub mod bits; +pub mod blendmode; +pub mod camera; +pub mod clipboard; +pub mod cpuinfo; +pub mod dialog; +pub mod error; +pub mod events; +pub mod filesystem; +pub mod gamepad; +pub mod gpu; +pub mod guid; +pub mod haptic; +pub mod hidapi; +pub mod hints; +pub mod init; +pub mod iostream; +pub mod joystick; +pub mod keyboard; +pub mod keycode; +pub mod loadso; +pub mod locale; +pub mod log; +pub mod main; +pub mod messagebox; +pub mod metal; +pub mod misc; +pub mod mouse; +pub mod mutex; +pub mod pen; +pub mod pixels; +pub mod platform; +pub mod power; +pub mod process; +pub mod properties; +pub mod rect; +pub mod render; +pub mod revision; +pub mod scancode; +pub mod sensor; +pub mod stdinc; +pub mod storage; +pub mod surface; +pub mod system; +pub mod thread; +pub mod time; +pub mod timer; +pub mod touch; +pub mod tray; +pub mod version; +pub mod video; +pub mod vulkan; + +/// Reexports of everything from the other modules +pub mod everything { + #[doc(no_inline)] + pub use super::assert::*; + #[doc(no_inline)] + pub use super::asyncio::*; + #[doc(no_inline)] + pub use super::atomic::*; + #[doc(no_inline)] + pub use super::audio::*; + #[doc(no_inline)] + pub use super::bits::*; + #[doc(no_inline)] + pub use super::blendmode::*; + #[doc(no_inline)] + pub use super::camera::*; + #[doc(no_inline)] + pub use super::clipboard::*; + #[doc(no_inline)] + pub use super::cpuinfo::*; + #[doc(no_inline)] + pub use super::dialog::*; + #[doc(no_inline)] + pub use super::error::*; + #[doc(no_inline)] + pub use super::events::*; + #[doc(no_inline)] + pub use super::filesystem::*; + #[doc(no_inline)] + pub use super::gamepad::*; + #[doc(no_inline)] + pub use super::gpu::*; + #[doc(no_inline)] + pub use super::guid::*; + #[doc(no_inline)] + pub use super::haptic::*; + #[doc(no_inline)] + pub use super::hidapi::*; + #[doc(no_inline)] + pub use super::hints::*; + #[doc(no_inline)] + pub use super::init::*; + #[doc(no_inline)] + pub use super::iostream::*; + #[doc(no_inline)] + pub use super::joystick::*; + #[doc(no_inline)] + pub use super::keyboard::*; + #[doc(no_inline)] + pub use super::keycode::*; + #[doc(no_inline)] + pub use super::loadso::*; + #[doc(no_inline)] + pub use super::locale::*; + #[doc(no_inline)] + pub use super::log::*; + #[doc(no_inline)] + pub use super::main::*; + #[doc(no_inline)] + pub use super::messagebox::*; + #[doc(no_inline)] + pub use super::metal::*; + #[doc(no_inline)] + pub use super::misc::*; + #[doc(no_inline)] + pub use super::mouse::*; + #[doc(no_inline)] + pub use super::mutex::*; + #[doc(no_inline)] + pub use super::pen::*; + #[doc(no_inline)] + pub use super::pixels::*; + #[doc(no_inline)] + pub use super::platform::*; + #[doc(no_inline)] + pub use super::power::*; + #[doc(no_inline)] + pub use super::process::*; + #[doc(no_inline)] + pub use super::properties::*; + #[doc(no_inline)] + pub use super::rect::*; + #[doc(no_inline)] + pub use super::render::*; + #[doc(no_inline)] + pub use super::revision::*; + #[doc(no_inline)] + pub use super::scancode::*; + #[doc(no_inline)] + pub use super::sensor::*; + #[doc(no_inline)] + pub use super::stdinc::*; + #[doc(no_inline)] + pub use super::storage::*; + #[doc(no_inline)] + pub use super::surface::*; + #[doc(no_inline)] + pub use super::system::*; + #[doc(no_inline)] + pub use super::thread::*; + #[doc(no_inline)] + pub use super::time::*; + #[doc(no_inline)] + pub use super::timer::*; + #[doc(no_inline)] + pub use super::touch::*; + #[doc(no_inline)] + pub use super::tray::*; + #[doc(no_inline)] + pub use super::version::*; + #[doc(no_inline)] + pub use super::video::*; + #[doc(no_inline)] + pub use super::vulkan::*; +} + +/// Metadata for hint constants in this crate +pub const HINTS: &[&Hint] = &[ + &hints::METADATA_SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, + &hints::METADATA_SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, + &hints::METADATA_SDL_HINT_ANDROID_BLOCK_ON_PAUSE, + &hints::METADATA_SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, + &hints::METADATA_SDL_HINT_ANDROID_AAUDIO_INPUT_PRESET, + &hints::METADATA_SDL_HINT_ANDROID_TRAP_BACK_BUTTON, + &hints::METADATA_SDL_HINT_APP_ID, + &hints::METADATA_SDL_HINT_APP_NAME, + &hints::METADATA_SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, + &hints::METADATA_SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, + &hints::METADATA_SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE, + &hints::METADATA_SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE, + &hints::METADATA_SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE, + &hints::METADATA_SDL_HINT_AUDIO_CATEGORY, + &hints::METADATA_SDL_HINT_AUDIO_CHANNELS, + &hints::METADATA_SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME, + &hints::METADATA_SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES, + &hints::METADATA_SDL_HINT_AUDIO_DEVICE_STREAM_NAME, + &hints::METADATA_SDL_HINT_AUDIO_DEVICE_STREAM_ROLE, + &hints::METADATA_SDL_HINT_AUDIO_DEVICE_RAW_STREAM, + &hints::METADATA_SDL_HINT_AUDIO_DISK_INPUT_FILE, + &hints::METADATA_SDL_HINT_AUDIO_DISK_OUTPUT_FILE, + &hints::METADATA_SDL_HINT_AUDIO_DISK_TIMESCALE, + &hints::METADATA_SDL_HINT_AUDIO_DRIVER, + &hints::METADATA_SDL_HINT_AUDIO_DUMMY_TIMESCALE, + &hints::METADATA_SDL_HINT_AUDIO_FORMAT, + &hints::METADATA_SDL_HINT_AUDIO_FREQUENCY, + &hints::METADATA_SDL_HINT_AUDIO_INCLUDE_MONITORS, + &hints::METADATA_SDL_HINT_AUTO_UPDATE_JOYSTICKS, + &hints::METADATA_SDL_HINT_AUTO_UPDATE_SENSORS, + &hints::METADATA_SDL_HINT_BMP_SAVE_LEGACY_FORMAT, + &hints::METADATA_SDL_HINT_CAMERA_DRIVER, + &hints::METADATA_SDL_HINT_CPU_FEATURE_MASK, + &hints::METADATA_SDL_HINT_JOYSTICK_DIRECTINPUT, + &hints::METADATA_SDL_HINT_FILE_DIALOG_DRIVER, + &hints::METADATA_SDL_HINT_DISPLAY_USABLE_BOUNDS, + &hints::METADATA_SDL_HINT_INVALID_PARAM_CHECKS, + &hints::METADATA_SDL_HINT_EMSCRIPTEN_ASYNCIFY, + &hints::METADATA_SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR, + &hints::METADATA_SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, + &hints::METADATA_SDL_HINT_ENABLE_SCREEN_KEYBOARD, + &hints::METADATA_SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD, + &hints::METADATA_SDL_HINT_EVDEV_DEVICES, + &hints::METADATA_SDL_HINT_EVENT_LOGGING, + &hints::METADATA_SDL_HINT_FORCE_RAISEWINDOW, + &hints::METADATA_SDL_HINT_FRAMEBUFFER_ACCELERATION, + &hints::METADATA_SDL_HINT_GAMECONTROLLERCONFIG, + &hints::METADATA_SDL_HINT_GAMECONTROLLERCONFIG_FILE, + &hints::METADATA_SDL_HINT_GAMECONTROLLERTYPE, + &hints::METADATA_SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + &hints::METADATA_SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + &hints::METADATA_SDL_HINT_GAMECONTROLLER_SENSOR_FUSION, + &hints::METADATA_SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT, + &hints::METADATA_SDL_HINT_GDK_TEXTINPUT_DESCRIPTION, + &hints::METADATA_SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH, + &hints::METADATA_SDL_HINT_GDK_TEXTINPUT_SCOPE, + &hints::METADATA_SDL_HINT_GDK_TEXTINPUT_TITLE, + &hints::METADATA_SDL_HINT_HIDAPI_LIBUSB, + &hints::METADATA_SDL_HINT_HIDAPI_LIBUSB_GAMECUBE, + &hints::METADATA_SDL_HINT_HIDAPI_LIBUSB_WHITELIST, + &hints::METADATA_SDL_HINT_HIDAPI_UDEV, + &hints::METADATA_SDL_HINT_GPU_DRIVER, + &hints::METADATA_SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS, + &hints::METADATA_SDL_HINT_HIDAPI_IGNORE_DEVICES, + &hints::METADATA_SDL_HINT_IME_IMPLEMENTED_UI, + &hints::METADATA_SDL_HINT_IOS_HIDE_HOME_INDICATOR, + &hints::METADATA_SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + &hints::METADATA_SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED, + &hints::METADATA_SDL_HINT_JOYSTICK_BLACKLIST_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED, + &hints::METADATA_SDL_HINT_JOYSTICK_DEVICE, + &hints::METADATA_SDL_HINT_JOYSTICK_ENHANCED_REPORTS, + &hints::METADATA_SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED, + &hints::METADATA_SDL_HINT_JOYSTICK_GAMEINPUT, + &hints::METADATA_SDL_HINT_JOYSTICK_GAMEINPUT_RAW, + &hints::METADATA_SDL_HINT_JOYSTICK_GAMECUBE_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_LUNA, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS3, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS4, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS5, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_SHIELD, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_STADIA, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAM, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_LG4FF, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_8BITDO, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_SINPUT, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_ZUIKI, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_FLYDIGI, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_SWITCH2, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_WII, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_360, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_GIP, + &hints::METADATA_SDL_HINT_JOYSTICK_HIDAPI_GIP_RESET_FOR_METADATA, + &hints::METADATA_SDL_HINT_JOYSTICK_IOKIT, + &hints::METADATA_SDL_HINT_JOYSTICK_LINUX_CLASSIC, + &hints::METADATA_SDL_HINT_JOYSTICK_LINUX_DEADZONES, + &hints::METADATA_SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS, + &hints::METADATA_SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES, + &hints::METADATA_SDL_HINT_JOYSTICK_MFI, + &hints::METADATA_SDL_HINT_JOYSTICK_RAWINPUT, + &hints::METADATA_SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, + &hints::METADATA_SDL_HINT_JOYSTICK_ROG_CHAKRAM, + &hints::METADATA_SDL_HINT_JOYSTICK_THREAD, + &hints::METADATA_SDL_HINT_JOYSTICK_THROTTLE_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED, + &hints::METADATA_SDL_HINT_JOYSTICK_WGI, + &hints::METADATA_SDL_HINT_JOYSTICK_WHEEL_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED, + &hints::METADATA_SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES, + &hints::METADATA_SDL_HINT_JOYSTICK_HAPTIC_AXES, + &hints::METADATA_SDL_HINT_KEYCODE_OPTIONS, + &hints::METADATA_SDL_HINT_KMSDRM_DEVICE_INDEX, + &hints::METADATA_SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, + &hints::METADATA_SDL_HINT_KMSDRM_ATOMIC, + &hints::METADATA_SDL_HINT_LOGGING, + &hints::METADATA_SDL_HINT_MAC_BACKGROUND_APP, + &hints::METADATA_SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, + &hints::METADATA_SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH, + &hints::METADATA_SDL_HINT_MAC_OPTION_AS_ALT, + &hints::METADATA_SDL_HINT_MAC_SCROLL_MOMENTUM, + &hints::METADATA_SDL_HINT_MAC_PRESS_AND_HOLD, + &hints::METADATA_SDL_HINT_MAIN_CALLBACK_RATE, + &hints::METADATA_SDL_HINT_MOUSE_AUTO_CAPTURE, + &hints::METADATA_SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, + &hints::METADATA_SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, + &hints::METADATA_SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR, + &hints::METADATA_SDL_HINT_MOUSE_DPI_SCALE_CURSORS, + &hints::METADATA_SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE, + &hints::METADATA_SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, + &hints::METADATA_SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + &hints::METADATA_SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, + &hints::METADATA_SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + &hints::METADATA_SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE, + &hints::METADATA_SDL_HINT_MOUSE_RELATIVE_WARP_MOTION, + &hints::METADATA_SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE, + &hints::METADATA_SDL_HINT_MOUSE_TOUCH_EVENTS, + &hints::METADATA_SDL_HINT_MUTE_CONSOLE_KEYBOARD, + &hints::METADATA_SDL_HINT_NO_SIGNAL_HANDLERS, + &hints::METADATA_SDL_HINT_OPENGL_LIBRARY, + &hints::METADATA_SDL_HINT_EGL_LIBRARY, + &hints::METADATA_SDL_HINT_OPENGL_ES_DRIVER, + &hints::METADATA_SDL_HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER, + &hints::METADATA_SDL_HINT_OPENVR_LIBRARY, + &hints::METADATA_SDL_HINT_ORIENTATIONS, + &hints::METADATA_SDL_HINT_POLL_SENTINEL, + &hints::METADATA_SDL_HINT_PREFERRED_LOCALES, + &hints::METADATA_SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, + &hints::METADATA_SDL_HINT_RENDER_DIRECT3D_THREADSAFE, + &hints::METADATA_SDL_HINT_RENDER_DIRECT3D11_DEBUG, + &hints::METADATA_SDL_HINT_RENDER_DIRECT3D11_WARP, + &hints::METADATA_SDL_HINT_RENDER_VULKAN_DEBUG, + &hints::METADATA_SDL_HINT_RENDER_GPU_DEBUG, + &hints::METADATA_SDL_HINT_RENDER_GPU_LOW_POWER, + &hints::METADATA_SDL_HINT_RENDER_DRIVER, + &hints::METADATA_SDL_HINT_RENDER_LINE_METHOD, + &hints::METADATA_SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE, + &hints::METADATA_SDL_HINT_RENDER_VSYNC, + &hints::METADATA_SDL_HINT_RETURN_KEY_HIDES_IME, + &hints::METADATA_SDL_HINT_ROG_GAMEPAD_MICE, + &hints::METADATA_SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED, + &hints::METADATA_SDL_HINT_PS2_GS_WIDTH, + &hints::METADATA_SDL_HINT_PS2_GS_HEIGHT, + &hints::METADATA_SDL_HINT_PS2_GS_PROGRESSIVE, + &hints::METADATA_SDL_HINT_PS2_GS_MODE, + &hints::METADATA_SDL_HINT_RPI_VIDEO_LAYER, + &hints::METADATA_SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME, + &hints::METADATA_SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, + &hints::METADATA_SDL_HINT_STORAGE_TITLE_DRIVER, + &hints::METADATA_SDL_HINT_STORAGE_USER_DRIVER, + &hints::METADATA_SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL, + &hints::METADATA_SDL_HINT_THREAD_PRIORITY_POLICY, + &hints::METADATA_SDL_HINT_TIMER_RESOLUTION, + &hints::METADATA_SDL_HINT_TOUCH_MOUSE_EVENTS, + &hints::METADATA_SDL_HINT_TRACKPAD_IS_TOUCH_ONLY, + &hints::METADATA_SDL_HINT_TV_REMOTE_AS_JOYSTICK, + &hints::METADATA_SDL_HINT_VIDEO_ALLOW_SCREENSAVER, + &hints::METADATA_SDL_HINT_VIDEO_DISPLAY_PRIORITY, + &hints::METADATA_SDL_HINT_VIDEO_DOUBLE_BUFFER, + &hints::METADATA_SDL_HINT_VIDEO_DRIVER, + &hints::METADATA_SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES, + &hints::METADATA_SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK, + &hints::METADATA_SDL_HINT_VIDEO_FORCE_EGL, + &hints::METADATA_SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, + &hints::METADATA_SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY, + &hints::METADATA_SDL_HINT_VIDEO_METAL_AUTO_RESIZE_DRAWABLE, + &hints::METADATA_SDL_HINT_VIDEO_MATCH_EXCLUSIVE_MODE_ON_MOVE, + &hints::METADATA_SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, + &hints::METADATA_SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES, + &hints::METADATA_SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS, + &hints::METADATA_SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, + &hints::METADATA_SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION, + &hints::METADATA_SDL_HINT_VIDEO_WAYLAND_MODE_SCALING, + &hints::METADATA_SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR, + &hints::METADATA_SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, + &hints::METADATA_SDL_HINT_VIDEO_WIN_D3DCOMPILER, + &hints::METADATA_SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT, + &hints::METADATA_SDL_HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT, + &hints::METADATA_SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, + &hints::METADATA_SDL_HINT_VIDEO_X11_NET_WM_PING, + &hints::METADATA_SDL_HINT_VIDEO_X11_NODIRECTCOLOR, + &hints::METADATA_SDL_HINT_VIDEO_X11_SCALING_FACTOR, + &hints::METADATA_SDL_HINT_VIDEO_X11_VISUALID, + &hints::METADATA_SDL_HINT_VIDEO_X11_WINDOW_VISUALID, + &hints::METADATA_SDL_HINT_VIDEO_X11_XRANDR, + &hints::METADATA_SDL_HINT_VITA_ENABLE_BACK_TOUCH, + &hints::METADATA_SDL_HINT_VITA_ENABLE_FRONT_TOUCH, + &hints::METADATA_SDL_HINT_VITA_MODULE_PATH, + &hints::METADATA_SDL_HINT_VITA_PVR_INIT, + &hints::METADATA_SDL_HINT_VITA_RESOLUTION, + &hints::METADATA_SDL_HINT_VITA_PVR_OPENGL, + &hints::METADATA_SDL_HINT_VITA_TOUCH_MOUSE_DEVICE, + &hints::METADATA_SDL_HINT_VULKAN_DISPLAY, + &hints::METADATA_SDL_HINT_VULKAN_LIBRARY, + &hints::METADATA_SDL_HINT_WAVE_FACT_CHUNK, + &hints::METADATA_SDL_HINT_WAVE_CHUNK_LIMIT, + &hints::METADATA_SDL_HINT_WAVE_RIFF_CHUNK_SIZE, + &hints::METADATA_SDL_HINT_WAVE_TRUNCATION, + &hints::METADATA_SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED, + &hints::METADATA_SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, + &hints::METADATA_SDL_HINT_WINDOW_ALLOW_TOPMOST, + &hints::METADATA_SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, + &hints::METADATA_SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, + &hints::METADATA_SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS, + &hints::METADATA_SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, + &hints::METADATA_SDL_HINT_WINDOWS_GAMEINPUT, + &hints::METADATA_SDL_HINT_WINDOWS_RAW_KEYBOARD, + &hints::METADATA_SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS, + &hints::METADATA_SDL_HINT_WINDOWS_RAW_KEYBOARD_INPUTSINK, + &hints::METADATA_SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, + &hints::METADATA_SDL_HINT_WINDOWS_INTRESOURCE_ICON, + &hints::METADATA_SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, + &hints::METADATA_SDL_HINT_WINDOWS_USE_D3D9EX, + &hints::METADATA_SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE, + &hints::METADATA_SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT, + &hints::METADATA_SDL_HINT_X11_WINDOW_TYPE, + &hints::METADATA_SDL_HINT_X11_XCB_LIBRARY, + &hints::METADATA_SDL_HINT_XINPUT_ENABLED, + &hints::METADATA_SDL_HINT_ASSERT, + &hints::METADATA_SDL_HINT_PEN_MOUSE_EVENTS, + &hints::METADATA_SDL_HINT_PEN_TOUCH_EVENTS, +]; + +/// Metadata for property constants in this crate +pub const PROPERTIES: &[&Property] = &[ + &audio::METADATA_SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_FILTERS_POINTER, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_WINDOW_POINTER, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_LOCATION_STRING, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_TITLE_STRING, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_ACCEPT_STRING, + &dialog::METADATA_SDL_PROP_FILE_DIALOG_CANCEL_STRING, + &gamepad::METADATA_SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN, + &gamepad::METADATA_SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN, + &gamepad::METADATA_SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN, + &gamepad::METADATA_SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, + &gamepad::METADATA_SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING, + &gpu::METADATA_SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING, + &gpu::METADATA_SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_SHADER_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER, + &gpu::METADATA_SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, + &gpu::METADATA_SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING, + &hidapi::METADATA_SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER, + &init::METADATA_SDL_PROP_APP_METADATA_NAME_STRING, + &init::METADATA_SDL_PROP_APP_METADATA_VERSION_STRING, + &init::METADATA_SDL_PROP_APP_METADATA_IDENTIFIER_STRING, + &init::METADATA_SDL_PROP_APP_METADATA_CREATOR_STRING, + &init::METADATA_SDL_PROP_APP_METADATA_COPYRIGHT_STRING, + &init::METADATA_SDL_PROP_APP_METADATA_URL_STRING, + &init::METADATA_SDL_PROP_APP_METADATA_TYPE_STRING, + &iostream::METADATA_SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER, + &iostream::METADATA_SDL_PROP_IOSTREAM_STDIO_FILE_POINTER, + &iostream::METADATA_SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER, + &iostream::METADATA_SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER, + &iostream::METADATA_SDL_PROP_IOSTREAM_MEMORY_POINTER, + &iostream::METADATA_SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER, + &iostream::METADATA_SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER, + &iostream::METADATA_SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, + &iostream::METADATA_SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER, + &joystick::METADATA_SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN, + &joystick::METADATA_SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, + &joystick::METADATA_SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN, + &joystick::METADATA_SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, + &joystick::METADATA_SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN, + &keyboard::METADATA_SDL_PROP_TEXTINPUT_TYPE_NUMBER, + &keyboard::METADATA_SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, + &keyboard::METADATA_SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, + &keyboard::METADATA_SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN, + &keyboard::METADATA_SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_ARGS_POINTER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDIN_NUMBER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDIN_POINTER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDOUT_POINTER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDERR_NUMBER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDERR_POINTER, + &process::METADATA_SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN, + &process::METADATA_SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN, + &process::METADATA_SDL_PROP_PROCESS_CREATE_CMDLINE_STRING, + &process::METADATA_SDL_PROP_PROCESS_PID_NUMBER, + &process::METADATA_SDL_PROP_PROCESS_STDIN_POINTER, + &process::METADATA_SDL_PROP_PROCESS_STDOUT_POINTER, + &process::METADATA_SDL_PROP_PROCESS_STDERR_POINTER, + &process::METADATA_SDL_PROP_PROCESS_BACKGROUND_BOOLEAN, + &properties::METADATA_SDL_PROP_NAME_STRING, + &render::METADATA_SDL_PROP_RENDERER_CREATE_NAME_STRING, + &render::METADATA_SDL_PROP_RENDERER_CREATE_WINDOW_POINTER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_SURFACE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN, + &render::METADATA_SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN, + &render::METADATA_SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN, + &render::METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_NAME_STRING, + &render::METADATA_SDL_PROP_RENDERER_WINDOW_POINTER, + &render::METADATA_SDL_PROP_RENDERER_SURFACE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_VSYNC_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, + &render::METADATA_SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN, + &render::METADATA_SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN, + &render::METADATA_SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT, + &render::METADATA_SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT, + &render::METADATA_SDL_PROP_RENDERER_D3D9_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_D3D11_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER, + &render::METADATA_SDL_PROP_RENDERER_D3D12_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER, + &render::METADATA_SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER, + &render::METADATA_SDL_PROP_RENDERER_GPU_DEVICE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_COLORSPACE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_FORMAT_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_ACCESS_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_WIDTH_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_HEIGHT_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT, + &render::METADATA_SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT, + &render::METADATA_SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT, + &render::METADATA_SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT, + &render::METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER, + &render::METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER, + &render::METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER, + &surface::METADATA_SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT, + &surface::METADATA_SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, + &surface::METADATA_SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING, + &surface::METADATA_SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, + &surface::METADATA_SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER, + &surface::METADATA_SDL_PROP_SURFACE_ROTATION_FLOAT, + &thread::METADATA_SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, + &thread::METADATA_SDL_PROP_THREAD_CREATE_NAME_STRING, + &thread::METADATA_SDL_PROP_THREAD_CREATE_USERDATA_POINTER, + &thread::METADATA_SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, + &video::METADATA_SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, + &video::METADATA_SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, + &video::METADATA_SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER, + &video::METADATA_SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER, + &video::METADATA_SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_PARENT_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_TITLE_STRING, + &video::METADATA_SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_X_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_Y_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING, + &video::METADATA_SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING, + &video::METADATA_SDL_PROP_WINDOW_SHAPE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN, + &video::METADATA_SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT, + &video::METADATA_SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT, + &video::METADATA_SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER, + &video::METADATA_SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WIN32_HWND_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WIN32_HDC_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER, + &video::METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER, + &video::METADATA_SDL_PROP_WINDOW_X11_DISPLAY_POINTER, + &video::METADATA_SDL_PROP_WINDOW_X11_SCREEN_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_X11_WINDOW_NUMBER, + &video::METADATA_SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING, + &video::METADATA_SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING, +]; + +/// Metadata for groups in this crate +pub const GROUPS: &[&Group] = &[ + &assert::METADATA_SDL_AssertState, + &asyncio::METADATA_SDL_AsyncIOTaskType, + &asyncio::METADATA_SDL_AsyncIOResult, + &atomic::METADATA_SDL_SpinLock, + &audio::METADATA_SDL_AudioFormat, + &audio::METADATA_SDL_AudioDeviceID, + &blendmode::METADATA_SDL_BlendMode, + &blendmode::METADATA_SDL_BlendOperation, + &blendmode::METADATA_SDL_BlendFactor, + &camera::METADATA_SDL_CameraID, + &camera::METADATA_SDL_CameraPosition, + &camera::METADATA_SDL_CameraPermissionState, + &dialog::METADATA_SDL_FileDialogType, + &events::METADATA_SDL_EventType, + &events::METADATA_SDL_EventAction, + &filesystem::METADATA_SDL_Folder, + &filesystem::METADATA_SDL_PathType, + &filesystem::METADATA_SDL_GlobFlags, + &filesystem::METADATA_SDL_EnumerationResult, + &gamepad::METADATA_SDL_GamepadType, + &gamepad::METADATA_SDL_GamepadButton, + &gamepad::METADATA_SDL_GamepadButtonLabel, + &gamepad::METADATA_SDL_GamepadAxis, + &gamepad::METADATA_SDL_GamepadBindingType, + &gpu::METADATA_SDL_GPUPrimitiveType, + &gpu::METADATA_SDL_GPULoadOp, + &gpu::METADATA_SDL_GPUStoreOp, + &gpu::METADATA_SDL_GPUIndexElementSize, + &gpu::METADATA_SDL_GPUTextureFormat, + &gpu::METADATA_SDL_GPUTextureUsageFlags, + &gpu::METADATA_SDL_GPUTextureType, + &gpu::METADATA_SDL_GPUSampleCount, + &gpu::METADATA_SDL_GPUCubeMapFace, + &gpu::METADATA_SDL_GPUBufferUsageFlags, + &gpu::METADATA_SDL_GPUTransferBufferUsage, + &gpu::METADATA_SDL_GPUShaderStage, + &gpu::METADATA_SDL_GPUShaderFormat, + &gpu::METADATA_SDL_GPUVertexElementFormat, + &gpu::METADATA_SDL_GPUVertexInputRate, + &gpu::METADATA_SDL_GPUFillMode, + &gpu::METADATA_SDL_GPUCullMode, + &gpu::METADATA_SDL_GPUFrontFace, + &gpu::METADATA_SDL_GPUCompareOp, + &gpu::METADATA_SDL_GPUStencilOp, + &gpu::METADATA_SDL_GPUBlendOp, + &gpu::METADATA_SDL_GPUBlendFactor, + &gpu::METADATA_SDL_GPUColorComponentFlags, + &gpu::METADATA_SDL_GPUFilter, + &gpu::METADATA_SDL_GPUSamplerMipmapMode, + &gpu::METADATA_SDL_GPUSamplerAddressMode, + &gpu::METADATA_SDL_GPUPresentMode, + &gpu::METADATA_SDL_GPUSwapchainComposition, + &haptic::METADATA_SDL_HapticEffectType, + &haptic::METADATA_SDL_HapticDirectionType, + &haptic::METADATA_SDL_HapticEffectID, + &haptic::METADATA_SDL_HapticID, + &hidapi::METADATA_SDL_hid_bus_type, + &hints::METADATA_SDL_HintPriority, + &init::METADATA_SDL_InitFlags, + &init::METADATA_SDL_AppResult, + &iostream::METADATA_SDL_IOStatus, + &iostream::METADATA_SDL_IOWhence, + &joystick::METADATA_SDL_JoystickID, + &joystick::METADATA_SDL_JoystickType, + &joystick::METADATA_SDL_JoystickConnectionState, + &keyboard::METADATA_SDL_KeyboardID, + &keyboard::METADATA_SDL_TextInputType, + &keyboard::METADATA_SDL_Capitalization, + &keycode::METADATA_SDL_Keycode, + &keycode::METADATA_SDL_Keymod, + &log::METADATA_SDL_LogCategory, + &log::METADATA_SDL_LogPriority, + &messagebox::METADATA_SDL_MessageBoxFlags, + &messagebox::METADATA_SDL_MessageBoxButtonFlags, + &messagebox::METADATA_SDL_MessageBoxColorType, + &mouse::METADATA_SDL_MouseID, + &mouse::METADATA_SDL_SystemCursor, + &mouse::METADATA_SDL_MouseWheelDirection, + &mouse::METADATA_SDL_MouseButtonFlags, + &mutex::METADATA_SDL_InitStatus, + &pen::METADATA_SDL_PenID, + &pen::METADATA_SDL_PenInputFlags, + &pen::METADATA_SDL_PenAxis, + &pen::METADATA_SDL_PenDeviceType, + &pixels::METADATA_SDL_PixelType, + &pixels::METADATA_SDL_BitmapOrder, + &pixels::METADATA_SDL_PackedOrder, + &pixels::METADATA_SDL_ArrayOrder, + &pixels::METADATA_SDL_PackedLayout, + &pixels::METADATA_SDL_PixelFormat, + &pixels::METADATA_SDL_ColorType, + &pixels::METADATA_SDL_ColorRange, + &pixels::METADATA_SDL_ColorPrimaries, + &pixels::METADATA_SDL_TransferCharacteristics, + &pixels::METADATA_SDL_MatrixCoefficients, + &pixels::METADATA_SDL_ChromaLocation, + &pixels::METADATA_SDL_Colorspace, + &power::METADATA_SDL_PowerState, + &process::METADATA_SDL_ProcessIO, + &properties::METADATA_SDL_PropertiesID, + &properties::METADATA_SDL_PropertyType, + &render::METADATA_SDL_TextureAccess, + &render::METADATA_SDL_TextureAddressMode, + &render::METADATA_SDL_RendererLogicalPresentation, + &scancode::METADATA_SDL_Scancode, + &sensor::METADATA_SDL_SensorID, + &sensor::METADATA_SDL_SensorType, + &surface::METADATA_SDL_SurfaceFlags, + &surface::METADATA_SDL_ScaleMode, + &surface::METADATA_SDL_FlipMode, + &system::METADATA_SDL_Sandbox, + &thread::METADATA_SDL_ThreadID, + &thread::METADATA_SDL_TLSID, + &thread::METADATA_SDL_ThreadPriority, + &thread::METADATA_SDL_ThreadState, + &time::METADATA_SDL_DateFormat, + &time::METADATA_SDL_TimeFormat, + &timer::METADATA_SDL_TimerID, + &touch::METADATA_SDL_TouchID, + &touch::METADATA_SDL_FingerID, + &touch::METADATA_SDL_TouchDeviceType, + &tray::METADATA_SDL_TrayEntryFlags, + &video::METADATA_SDL_DisplayID, + &video::METADATA_SDL_WindowID, + &video::METADATA_SDL_SystemTheme, + &video::METADATA_SDL_DisplayOrientation, + &video::METADATA_SDL_WindowFlags, + &video::METADATA_SDL_FlashOperation, + &video::METADATA_SDL_ProgressState, + &video::METADATA_SDL_GLAttr, + &video::METADATA_SDL_GLProfile, + &video::METADATA_SDL_GLContextFlag, + &video::METADATA_SDL_GLContextReleaseFlag, + &video::METADATA_SDL_GLContextResetNotification, + &video::METADATA_SDL_HitTestResult, +]; + +/// Metadata for structs and unions in this crate +pub const STRUCTS: &[&Struct] = &[ + &assert::METADATA_SDL_AssertData, + &asyncio::METADATA_SDL_AsyncIOOutcome, + &atomic::METADATA_SDL_AtomicInt, + &atomic::METADATA_SDL_AtomicU32, + &audio::METADATA_SDL_AudioSpec, + &camera::METADATA_SDL_CameraSpec, + &dialog::METADATA_SDL_DialogFileFilter, + &events::METADATA_SDL_CommonEvent, + &events::METADATA_SDL_DisplayEvent, + &events::METADATA_SDL_WindowEvent, + &events::METADATA_SDL_KeyboardDeviceEvent, + &events::METADATA_SDL_KeyboardEvent, + &events::METADATA_SDL_TextEditingEvent, + &events::METADATA_SDL_TextEditingCandidatesEvent, + &events::METADATA_SDL_TextInputEvent, + &events::METADATA_SDL_MouseDeviceEvent, + &events::METADATA_SDL_MouseMotionEvent, + &events::METADATA_SDL_MouseButtonEvent, + &events::METADATA_SDL_MouseWheelEvent, + &events::METADATA_SDL_JoyAxisEvent, + &events::METADATA_SDL_JoyBallEvent, + &events::METADATA_SDL_JoyHatEvent, + &events::METADATA_SDL_JoyButtonEvent, + &events::METADATA_SDL_JoyDeviceEvent, + &events::METADATA_SDL_JoyBatteryEvent, + &events::METADATA_SDL_GamepadAxisEvent, + &events::METADATA_SDL_GamepadButtonEvent, + &events::METADATA_SDL_GamepadDeviceEvent, + &events::METADATA_SDL_GamepadTouchpadEvent, + &events::METADATA_SDL_GamepadSensorEvent, + &events::METADATA_SDL_AudioDeviceEvent, + &events::METADATA_SDL_CameraDeviceEvent, + &events::METADATA_SDL_RenderEvent, + &events::METADATA_SDL_TouchFingerEvent, + &events::METADATA_SDL_PinchFingerEvent, + &events::METADATA_SDL_PenProximityEvent, + &events::METADATA_SDL_PenMotionEvent, + &events::METADATA_SDL_PenTouchEvent, + &events::METADATA_SDL_PenButtonEvent, + &events::METADATA_SDL_PenAxisEvent, + &events::METADATA_SDL_DropEvent, + &events::METADATA_SDL_ClipboardEvent, + &events::METADATA_SDL_SensorEvent, + &events::METADATA_SDL_QuitEvent, + &events::METADATA_SDL_UserEvent, + &events::METADATA_SDL_Event, + &filesystem::METADATA_SDL_PathInfo, + &gamepad::METADATA_SDL_GamepadBinding__AnonUnion1__AnonStruct1, + &gamepad::METADATA_SDL_GamepadBinding__AnonUnion1__AnonStruct2, + &gamepad::METADATA_SDL_GamepadBinding__AnonUnion1, + &gamepad::METADATA_SDL_GamepadBinding__AnonUnion2__AnonStruct1, + &gamepad::METADATA_SDL_GamepadBinding__AnonUnion2, + &gamepad::METADATA_SDL_GamepadBinding, + &gpu::METADATA_SDL_GPUViewport, + &gpu::METADATA_SDL_GPUTextureTransferInfo, + &gpu::METADATA_SDL_GPUTransferBufferLocation, + &gpu::METADATA_SDL_GPUTextureLocation, + &gpu::METADATA_SDL_GPUTextureRegion, + &gpu::METADATA_SDL_GPUBlitRegion, + &gpu::METADATA_SDL_GPUBufferLocation, + &gpu::METADATA_SDL_GPUBufferRegion, + &gpu::METADATA_SDL_GPUIndirectDrawCommand, + &gpu::METADATA_SDL_GPUIndexedIndirectDrawCommand, + &gpu::METADATA_SDL_GPUIndirectDispatchCommand, + &gpu::METADATA_SDL_GPUSamplerCreateInfo, + &gpu::METADATA_SDL_GPUVertexBufferDescription, + &gpu::METADATA_SDL_GPUVertexAttribute, + &gpu::METADATA_SDL_GPUVertexInputState, + &gpu::METADATA_SDL_GPUStencilOpState, + &gpu::METADATA_SDL_GPUColorTargetBlendState, + &gpu::METADATA_SDL_GPUShaderCreateInfo, + &gpu::METADATA_SDL_GPUTextureCreateInfo, + &gpu::METADATA_SDL_GPUBufferCreateInfo, + &gpu::METADATA_SDL_GPUTransferBufferCreateInfo, + &gpu::METADATA_SDL_GPURasterizerState, + &gpu::METADATA_SDL_GPUMultisampleState, + &gpu::METADATA_SDL_GPUDepthStencilState, + &gpu::METADATA_SDL_GPUColorTargetDescription, + &gpu::METADATA_SDL_GPUGraphicsPipelineTargetInfo, + &gpu::METADATA_SDL_GPUGraphicsPipelineCreateInfo, + &gpu::METADATA_SDL_GPUComputePipelineCreateInfo, + &gpu::METADATA_SDL_GPUColorTargetInfo, + &gpu::METADATA_SDL_GPUDepthStencilTargetInfo, + &gpu::METADATA_SDL_GPUBlitInfo, + &gpu::METADATA_SDL_GPUBufferBinding, + &gpu::METADATA_SDL_GPUTextureSamplerBinding, + &gpu::METADATA_SDL_GPUStorageBufferReadWriteBinding, + &gpu::METADATA_SDL_GPUStorageTextureReadWriteBinding, + &gpu::METADATA_SDL_GPUVulkanOptions, + &guid::METADATA_SDL_GUID, + &haptic::METADATA_SDL_HapticDirection, + &haptic::METADATA_SDL_HapticConstant, + &haptic::METADATA_SDL_HapticPeriodic, + &haptic::METADATA_SDL_HapticCondition, + &haptic::METADATA_SDL_HapticRamp, + &haptic::METADATA_SDL_HapticLeftRight, + &haptic::METADATA_SDL_HapticCustom, + &haptic::METADATA_SDL_HapticEffect, + &hidapi::METADATA_SDL_hid_device_info, + &iostream::METADATA_SDL_IOStreamInterface, + &joystick::METADATA_SDL_VirtualJoystickTouchpadDesc, + &joystick::METADATA_SDL_VirtualJoystickSensorDesc, + &joystick::METADATA_SDL_VirtualJoystickDesc, + &locale::METADATA_SDL_Locale, + &messagebox::METADATA_SDL_MessageBoxButtonData, + &messagebox::METADATA_SDL_MessageBoxColor, + &messagebox::METADATA_SDL_MessageBoxColorScheme, + &messagebox::METADATA_SDL_MessageBoxData, + &mouse::METADATA_SDL_CursorFrameInfo, + &mutex::METADATA_SDL_InitState, + &pixels::METADATA_SDL_Color, + &pixels::METADATA_SDL_FColor, + &pixels::METADATA_SDL_Palette, + &pixels::METADATA_SDL_PixelFormatDetails, + &rect::METADATA_SDL_Point, + &rect::METADATA_SDL_FPoint, + &rect::METADATA_SDL_Rect, + &rect::METADATA_SDL_FRect, + &render::METADATA_SDL_Vertex, + &render::METADATA_SDL_Texture, + &render::METADATA_SDL_GPURenderStateCreateInfo, + &stdinc::METADATA_SDL_alignment_test, + &storage::METADATA_SDL_StorageInterface, + &surface::METADATA_SDL_Surface, + &time::METADATA_SDL_DateTime, + &touch::METADATA_SDL_Finger, + &video::METADATA_SDL_DisplayMode, +]; diff --git a/vendor/sdl3-sys/src/metadata/generated/mouse.rs b/vendor/sdl3-sys/src/metadata/generated/mouse.rs new file mode 100644 index 00000000..a439d650 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/mouse.rs @@ -0,0 +1,244 @@ +//! Metadata for items in the `crate::mouse` module + +use super::*; + +pub const METADATA_SDL_MouseID: Group = Group { + module: "mouse", + kind: GroupKind::Id, + name: "SDL_MouseID", + short_name: "MouseID", + doc: Some( + "This is a unique ID for a mouse for the time it is connected to the system,\nand is never reused for the lifetime of the application.\n\nIf the mouse is disconnected and reconnected, it will get a new ID.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_SystemCursor: Group = Group { + module: "mouse", + kind: GroupKind::Enum, + name: "SDL_SystemCursor", + short_name: "SystemCursor", + doc: Some( + "Cursor types for [`SDL_CreateSystemCursor()`].\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SYSTEM_CURSOR_DEFAULT", + short_name: "DEFAULT", + doc: Some("Default cursor. Usually an arrow.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_TEXT", + short_name: "TEXT", + doc: Some("Text selection. Usually an I-beam.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_WAIT", + short_name: "WAIT", + doc: Some("Wait. Usually an hourglass or watch or spinning ball.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_CROSSHAIR", + short_name: "CROSSHAIR", + doc: Some("Crosshair.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_PROGRESS", + short_name: "PROGRESS", + doc: Some("Program is busy but still interactive. Usually it's WAIT with an arrow.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_NWSE_RESIZE", + short_name: "NWSE_RESIZE", + doc: Some("Double arrow pointing northwest and southeast.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_NESW_RESIZE", + short_name: "NESW_RESIZE", + doc: Some("Double arrow pointing northeast and southwest.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_EW_RESIZE", + short_name: "EW_RESIZE", + doc: Some("Double arrow pointing west and east.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_NS_RESIZE", + short_name: "NS_RESIZE", + doc: Some("Double arrow pointing north and south.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_MOVE", + short_name: "MOVE", + doc: Some("Four pointed arrow pointing north, south, east, and west.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_NOT_ALLOWED", + short_name: "NOT_ALLOWED", + doc: Some("Not permitted. Usually a slashed circle or crossbones.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_POINTER", + short_name: "POINTER", + doc: Some("Pointer that indicates a link. Usually a pointing hand.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_NW_RESIZE", + short_name: "NW_RESIZE", + doc: Some( + "Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_N_RESIZE", + short_name: "N_RESIZE", + doc: Some("Window resize top. May be NS_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_NE_RESIZE", + short_name: "NE_RESIZE", + doc: Some("Window resize top-right. May be NESW_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_E_RESIZE", + short_name: "E_RESIZE", + doc: Some("Window resize right. May be EW_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_SE_RESIZE", + short_name: "SE_RESIZE", + doc: Some("Window resize bottom-right. May be NWSE_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_S_RESIZE", + short_name: "S_RESIZE", + doc: Some("Window resize bottom. May be NS_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_SW_RESIZE", + short_name: "SW_RESIZE", + doc: Some("Window resize bottom-left. May be NESW_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_W_RESIZE", + short_name: "W_RESIZE", + doc: Some("Window resize left. May be EW_RESIZE.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_CURSOR_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_MouseWheelDirection: Group = Group { + module: "mouse", + kind: GroupKind::Enum, + name: "SDL_MouseWheelDirection", + short_name: "MouseWheelDirection", + doc: Some( + "Scroll direction types for the Scroll event\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_MOUSEWHEEL_NORMAL", + short_name: "NORMAL", + doc: Some("The scroll direction is normal\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MOUSEWHEEL_FLIPPED", + short_name: "FLIPPED", + doc: Some("The scroll direction is flipped / natural\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_MouseButtonFlags: Group = Group { + module: "mouse", + kind: GroupKind::Flags, + name: "SDL_MouseButtonFlags", + short_name: "MouseButtonFlags", + doc: Some( + "A bitmask of pressed mouse buttons, as reported by [`SDL_GetMouseState`], etc.\n\n- Button 1: Left mouse button\n- Button 2: Middle mouse button\n- Button 3: Right mouse button\n- Button 4: Side mouse button 1\n- Button 5: Side mouse button 2\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetMouseState`]\n- [`SDL_GetGlobalMouseState`]\n- [`SDL_GetRelativeMouseState`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_BUTTON_LMASK", + short_name: "LMASK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_BUTTON_MMASK", + short_name: "MMASK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_BUTTON_RMASK", + short_name: "RMASK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_BUTTON_X1MASK", + short_name: "X1MASK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_BUTTON_X2MASK", + short_name: "X2MASK", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_CursorFrameInfo: Struct = Struct { + module: "mouse", + kind: StructKind::Struct, + name: "SDL_CursorFrameInfo", + doc: Some( + "Animated cursor frame info.\n\n## Availability\nThis struct is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), + fields: &[ + Field { + name: "surface", + doc: Some("The surface data for this frame\n"), + available_since: None, + ty: "*mut SDL_Surface", + }, + Field { + name: "duration", + doc: Some("The frame duration in milliseconds (a duration of 0 is infinite)\n"), + available_since: None, + ty: "Uint32", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/mutex.rs b/vendor/sdl3-sys/src/metadata/generated/mutex.rs new file mode 100644 index 00000000..69c6c98c --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/mutex.rs @@ -0,0 +1,69 @@ +//! Metadata for items in the `crate::mutex` module + +use super::*; + +pub const METADATA_SDL_InitStatus: Group = Group { + module: "mutex", + kind: GroupKind::Enum, + name: "SDL_InitStatus", + short_name: "InitStatus", + doc: Some( + "The current status of an [`SDL_InitState`] structure.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_INIT_STATUS_UNINITIALIZED", + short_name: "UNINITIALIZED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_INIT_STATUS_INITIALIZING", + short_name: "INITIALIZING", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_INIT_STATUS_INITIALIZED", + short_name: "INITIALIZED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_INIT_STATUS_UNINITIALIZING", + short_name: "UNINITIALIZING", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_InitState: Struct = Struct { + module: "mutex", + kind: StructKind::Struct, + name: "SDL_InitState", + doc: Some( + "A structure used for thread-safe initialization and shutdown.\n\nHere is an example of using this:\n\n```c\nstatic SDL_InitState init;\n\nbool InitSystem(void)\n{\nif (!SDL_ShouldInit(&init)) {\n// The system is initialized\nreturn true;\n}\n\n// At this point, you should not leave this function without calling SDL_SetInitialized()\n\nbool initialized = DoInitTasks();\nSDL_SetInitialized(&init, initialized);\nreturn initialized;\n}\n\nbool UseSubsystem(void)\n{\nif (SDL_ShouldInit(&init)) {\n// Error, the subsystem isn't initialized\nSDL_SetInitialized(&init, false);\nreturn false;\n}\n\n// Do work using the initialized subsystem\n\nreturn true;\n}\n\nvoid QuitSystem(void)\n{\nif (!SDL_ShouldQuit(&init)) {\n// The system is not initialized\nreturn;\n}\n\n// At this point, you should not leave this function without calling SDL_SetInitialized()\n\nDoQuitTasks();\nSDL_SetInitialized(&init, false);\n}\n```\n\nNote that this doesn't protect any resources created during initialization,\nor guarantee that nobody is using those resources during cleanup. You\nshould use other mechanisms to protect those, if that's a concern for your\ncode.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "status", + doc: None, + available_since: None, + ty: "SDL_AtomicInt", + }, + Field { + name: "thread", + doc: None, + available_since: None, + ty: "SDL_ThreadID", + }, + Field { + name: "reserved", + doc: None, + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/pen.rs b/vendor/sdl3-sys/src/metadata/generated/pen.rs new file mode 100644 index 00000000..57175039 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/pen.rs @@ -0,0 +1,179 @@ +//! Metadata for items in the `crate::pen` module + +use super::*; + +pub const METADATA_SDL_PenID: Group = Group { + module: "pen", + kind: GroupKind::Id, + name: "SDL_PenID", + short_name: "PenID", + doc: Some( + "SDL pen instance IDs.\n\nZero is used to signify an invalid/null device.\n\nThese show up in pen events when SDL sees input from them. They remain\nconsistent as long as SDL can recognize a tool to be the same pen; but if a\npen's digitizer table is physically detached from the computer, it might\nget a new ID when reconnected, as SDL won't know it's the same device.\n\nThese IDs are only stable within a single run of a program; the next time a\nprogram is run, the pen's ID will likely be different, even if the hardware\nhasn't been disconnected, etc.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_PenInputFlags: Group = Group { + module: "pen", + kind: GroupKind::Flags, + name: "SDL_PenInputFlags", + short_name: "PenInputFlags", + doc: Some( + "Pen input flags, as reported by various pen events' `pen_state` field.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PEN_INPUT_DOWN", + short_name: "DOWN", + doc: Some("pen is pressed down\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_BUTTON_1", + short_name: "BUTTON_1", + doc: Some("button 1 is pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_BUTTON_2", + short_name: "BUTTON_2", + doc: Some("button 2 is pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_BUTTON_3", + short_name: "BUTTON_3", + doc: Some("button 3 is pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_BUTTON_4", + short_name: "BUTTON_4", + doc: Some("button 4 is pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_BUTTON_5", + short_name: "BUTTON_5", + doc: Some("button 5 is pressed\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_ERASER_TIP", + short_name: "ERASER_TIP", + doc: Some("eraser tip is used\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_INPUT_IN_PROXIMITY", + short_name: "IN_PROXIMITY", + doc: Some("pen is in proximity (since SDL 3.4.0)\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PenAxis: Group = Group { + module: "pen", + kind: GroupKind::Enum, + name: "SDL_PenAxis", + short_name: "PenAxis", + doc: Some( + "Pen axis indices.\n\nThese are the valid values for the `axis` field in [`SDL_PenAxisEvent`]. All\naxes are either normalised to 0..1 or report a (positive or negative) angle\nin degrees, with 0.0 representing the centre. Not all pens/backends support\nall axes: unsupported axes are always zero.\n\nTo convert angles for tilt and rotation into vector representation, use\n[`SDL_sinf`] on the XTILT, YTILT, or ROTATION component, for example:\n\n`SDL_sinf(xtilt * SDL_PI_F / 180.0)`.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PEN_AXIS_PRESSURE", + short_name: "PRESSURE", + doc: Some("Pen pressure. Unidirectional: 0 to 1.0\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_XTILT", + short_name: "XTILT", + doc: Some( + "Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right).\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_YTILT", + short_name: "YTILT", + doc: Some("Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down).\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_DISTANCE", + short_name: "DISTANCE", + doc: Some("Pen distance to drawing surface. Unidirectional: 0.0 to 1.0\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_ROTATION", + short_name: "ROTATION", + doc: Some( + "Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down).\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_SLIDER", + short_name: "SLIDER", + doc: Some( + "Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_TANGENTIAL_PRESSURE", + short_name: "TANGENTIAL_PRESSURE", + doc: Some("Pressure from squeezing the pen (\"barrel pressure\").\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_AXIS_COUNT", + short_name: "COUNT", + doc: Some( + "Total known pen axis types in this version of SDL. This number may grow in future releases!\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PenDeviceType: Group = Group { + module: "pen", + kind: GroupKind::Enum, + name: "SDL_PenDeviceType", + short_name: "PenDeviceType", + doc: Some( + "An enum that describes the type of a pen device.\n\nA \"direct\" device is a pen that touches a graphic display (like an Apple\nPencil on an iPad's screen). \"Indirect\" devices touch an external tablet\nsurface that is connected to the machine but is not a display (like a\nlower-end Wacom tablet connected over USB).\n\nApps may use this information to decide if they should draw a cursor; if\nthe pen is touching the screen directly, a cursor doesn't make sense and\ncan be in the way, but becomes necessary for indirect devices to know where\non the display they are interacting.\n\n## Availability\nThis enum is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), + values: &[ + GroupValue { + name: "SDL_PEN_DEVICE_TYPE_INVALID", + short_name: "INVALID", + doc: Some("Not a valid pen device.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_DEVICE_TYPE_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("Don't know specifics of this pen.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_DEVICE_TYPE_DIRECT", + short_name: "DIRECT", + doc: Some("Pen touches display.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PEN_DEVICE_TYPE_INDIRECT", + short_name: "INDIRECT", + doc: Some("Pen touches something that isn't the display.\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/pixels.rs b/vendor/sdl3-sys/src/metadata/generated/pixels.rs new file mode 100644 index 00000000..7341e039 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/pixels.rs @@ -0,0 +1,1540 @@ +//! Metadata for items in the `crate::pixels` module + +use super::*; + +pub const METADATA_SDL_PixelType: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_PixelType", + short_name: "PixelType", + doc: Some("Pixel type.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n"), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PIXELTYPE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_INDEX1", + short_name: "INDEX1", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_INDEX4", + short_name: "INDEX4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_INDEX8", + short_name: "INDEX8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_PACKED8", + short_name: "PACKED8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_PACKED16", + short_name: "PACKED16", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_PACKED32", + short_name: "PACKED32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_ARRAYU8", + short_name: "ARRAYU8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_ARRAYU16", + short_name: "ARRAYU16", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_ARRAYU32", + short_name: "ARRAYU32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_ARRAYF16", + short_name: "ARRAYF16", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_ARRAYF32", + short_name: "ARRAYF32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELTYPE_INDEX2", + short_name: "INDEX2", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_BitmapOrder: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_BitmapOrder", + short_name: "BitmapOrder", + doc: Some( + "Bitmap pixel order, high bit -> low bit.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_BITMAPORDER_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_BITMAPORDER_4321", + short_name: "_4321", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_BITMAPORDER_1234", + short_name: "_1234", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PackedOrder: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_PackedOrder", + short_name: "PackedOrder", + doc: Some( + "Packed component order, high bit -> low bit.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PACKEDORDER_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_XRGB", + short_name: "XRGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_RGBX", + short_name: "RGBX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_ARGB", + short_name: "ARGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_RGBA", + short_name: "RGBA", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_XBGR", + short_name: "XBGR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_BGRX", + short_name: "BGRX", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_ABGR", + short_name: "ABGR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDORDER_BGRA", + short_name: "BGRA", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ArrayOrder: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_ArrayOrder", + short_name: "ArrayOrder", + doc: Some( + "Array component order, low byte -> high byte.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ARRAYORDER_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_ARRAYORDER_RGB", + short_name: "RGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_ARRAYORDER_RGBA", + short_name: "RGBA", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_ARRAYORDER_ARGB", + short_name: "ARGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_ARRAYORDER_BGR", + short_name: "BGR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_ARRAYORDER_BGRA", + short_name: "BGRA", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_ARRAYORDER_ABGR", + short_name: "ABGR", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PackedLayout: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_PackedLayout", + short_name: "PackedLayout", + doc: Some( + "Packed component layout.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PACKEDLAYOUT_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_332", + short_name: "_332", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_4444", + short_name: "_4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_1555", + short_name: "_1555", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_5551", + short_name: "_5551", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_565", + short_name: "_565", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_8888", + short_name: "_8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_2101010", + short_name: "_2101010", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PACKEDLAYOUT_1010102", + short_name: "_1010102", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_PixelFormat: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_PixelFormat", + short_name: "PixelFormat", + doc: Some( + "Pixel format.\n\nSDL's pixel formats have the following naming convention:\n\n- Names with a list of components and a single bit count, such as RGB24 and\nABGR32, define a platform-independent encoding into bytes in the order\nspecified. For example, in RGB24 data, each pixel is encoded in 3 bytes\n(red, green, blue) in that order, and in ABGR32 data, each pixel is\nencoded in 4 bytes (alpha, blue, green, red) in that order. Use these\nnames if the property of a format that is important to you is the order\nof the bytes in memory or on disk.\n- Names with a bit count per component, such as ARGB8888 and XRGB1555, are\n\"packed\" into an appropriately-sized integer in the platform's native\nendianness. For example, ARGB8888 is a sequence of 32-bit integers; in\neach integer, the most significant bits are alpha, and the least\nsignificant bits are blue. On a little-endian CPU such as x86, the least\nsignificant bits of each integer are arranged first in memory, but on a\nbig-endian CPU such as s390x, the most significant bits are arranged\nfirst. Use these names if the property of a format that is important to\nyou is the meaning of each bit position within a native-endianness\ninteger.\n- In indexed formats such as INDEX4LSB, each pixel is represented by\nencoding an index into the palette into the indicated number of bits,\nwith multiple pixels packed into each byte if appropriate. In LSB\nformats, the first (leftmost) pixel is stored in the least-significant\nbits of the byte; in MSB formats, it's stored in the most-significant\nbits. INDEX8 does not need LSB/MSB variants, because each pixel exactly\nfills one byte.\n\nThe 32-bit byte-array encodings such as RGBA32 are aliases for the\nappropriate 8888 encoding for the current platform. For example, RGBA32 is\nan alias for ABGR8888 on little-endian CPUs like x86, or an alias for\nRGBA8888 on big-endian CPUs.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PIXELFORMAT_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX1LSB", + short_name: "INDEX1LSB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX1MSB", + short_name: "INDEX1MSB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX2LSB", + short_name: "INDEX2LSB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX2MSB", + short_name: "INDEX2MSB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX4LSB", + short_name: "INDEX4LSB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX4MSB", + short_name: "INDEX4MSB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_INDEX8", + short_name: "INDEX8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGB332", + short_name: "RGB332", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XRGB4444", + short_name: "XRGB4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XBGR4444", + short_name: "XBGR4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XRGB1555", + short_name: "XRGB1555", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XBGR1555", + short_name: "XBGR1555", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB4444", + short_name: "ARGB4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA4444", + short_name: "RGBA4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR4444", + short_name: "ABGR4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA4444", + short_name: "BGRA4444", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB1555", + short_name: "ARGB1555", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA5551", + short_name: "RGBA5551", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR1555", + short_name: "ABGR1555", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA5551", + short_name: "BGRA5551", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGB565", + short_name: "RGB565", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGR565", + short_name: "BGR565", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGB24", + short_name: "RGB24", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGR24", + short_name: "BGR24", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XRGB8888", + short_name: "XRGB8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBX8888", + short_name: "RGBX8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XBGR8888", + short_name: "XBGR8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRX8888", + short_name: "BGRX8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB8888", + short_name: "ARGB8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA8888", + short_name: "RGBA8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR8888", + short_name: "ABGR8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA8888", + short_name: "BGRA8888", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XRGB2101010", + short_name: "XRGB2101010", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XBGR2101010", + short_name: "XBGR2101010", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB2101010", + short_name: "ARGB2101010", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR2101010", + short_name: "ABGR2101010", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGB48", + short_name: "RGB48", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGR48", + short_name: "BGR48", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA64", + short_name: "RGBA64", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB64", + short_name: "ARGB64", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA64", + short_name: "BGRA64", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR64", + short_name: "ABGR64", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGB48_FLOAT", + short_name: "RGB48_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGR48_FLOAT", + short_name: "BGR48_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA64_FLOAT", + short_name: "RGBA64_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB64_FLOAT", + short_name: "ARGB64_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA64_FLOAT", + short_name: "BGRA64_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR64_FLOAT", + short_name: "ABGR64_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGB96_FLOAT", + short_name: "RGB96_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGR96_FLOAT", + short_name: "BGR96_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA128_FLOAT", + short_name: "RGBA128_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB128_FLOAT", + short_name: "ARGB128_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA128_FLOAT", + short_name: "BGRA128_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR128_FLOAT", + short_name: "ABGR128_FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_YV12", + short_name: "YV12", + doc: Some("Planar mode: Y + V + U (3 planes)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_IYUV", + short_name: "IYUV", + doc: Some("Planar mode: Y + U + V (3 planes)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_YUY2", + short_name: "YUY2", + doc: Some("Packed mode: Y0+U0+Y1+V0 (1 plane)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_UYVY", + short_name: "UYVY", + doc: Some("Packed mode: U0+Y0+V0+Y1 (1 plane)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_YVYU", + short_name: "YVYU", + doc: Some("Packed mode: Y0+V0+Y1+U0 (1 plane)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_NV12", + short_name: "NV12", + doc: Some("Planar mode: Y + U/V interleaved (2 planes)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_NV21", + short_name: "NV21", + doc: Some("Planar mode: Y + V/U interleaved (2 planes)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_P010", + short_name: "P010", + doc: Some("Planar mode: Y + U/V interleaved (2 planes)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_EXTERNAL_OES", + short_name: "EXTERNAL_OES", + doc: Some("Android video texture format\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_MJPG", + short_name: "MJPG", + doc: Some("Motion JPEG\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA32", + short_name: "RGBA32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB32", + short_name: "ARGB32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA32", + short_name: "BGRA32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR32", + short_name: "ABGR32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBX32", + short_name: "RGBX32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XRGB32", + short_name: "XRGB32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRX32", + short_name: "BGRX32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XBGR32", + short_name: "XBGR32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBA32", + short_name: "RGBA32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ARGB32", + short_name: "ARGB32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRA32", + short_name: "BGRA32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_ABGR32", + short_name: "ABGR32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_RGBX32", + short_name: "RGBX32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XRGB32", + short_name: "XRGB32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_BGRX32", + short_name: "BGRX32", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PIXELFORMAT_XBGR32", + short_name: "XBGR32", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ColorType: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_ColorType", + short_name: "ColorType", + doc: Some( + "Colorspace color type.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_COLOR_TYPE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_TYPE_RGB", + short_name: "RGB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_TYPE_YCBCR", + short_name: "YCBCR", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ColorRange: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_ColorRange", + short_name: "ColorRange", + doc: Some( + "Colorspace color range, as described by\n\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_COLOR_RANGE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_RANGE_LIMITED", + short_name: "LIMITED", + doc: Some( + "Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_RANGE_FULL", + short_name: "FULL", + doc: Some( + "Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ColorPrimaries: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_ColorPrimaries", + short_name: "ColorPrimaries", + doc: Some( + "Colorspace color primaries, as described by\n\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_COLOR_PRIMARIES_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_BT709", + short_name: "BT709", + doc: Some("ITU-R BT.709-6\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_UNSPECIFIED", + short_name: "UNSPECIFIED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_BT470M", + short_name: "BT470M", + doc: Some("ITU-R BT.470-6 System M\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_BT470BG", + short_name: "BT470BG", + doc: Some("ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_BT601", + short_name: "BT601", + doc: Some("ITU-R BT.601-7 525, SMPTE 170M\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_SMPTE240", + short_name: "SMPTE240", + doc: Some("SMPTE 240M, functionally the same as [`SDL_COLOR_PRIMARIES_BT601`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_GENERIC_FILM", + short_name: "GENERIC_FILM", + doc: Some("Generic film (color filters using Illuminant C)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_BT2020", + short_name: "BT2020", + doc: Some("ITU-R BT.2020-2 / ITU-R BT.2100-0\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_XYZ", + short_name: "XYZ", + doc: Some("SMPTE ST 428-1\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_SMPTE431", + short_name: "SMPTE431", + doc: Some("SMPTE RP 431-2\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_SMPTE432", + short_name: "SMPTE432", + doc: Some("SMPTE EG 432-1 / DCI P3\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_EBU3213", + short_name: "EBU3213", + doc: Some("EBU Tech. 3213-E\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLOR_PRIMARIES_CUSTOM", + short_name: "CUSTOM", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_TransferCharacteristics: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_TransferCharacteristics", + short_name: "TransferCharacteristics", + doc: Some( + "Colorspace transfer characteristics.\n\nThese are as described by \n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_BT709", + short_name: "BT709", + doc: Some("Rec. ITU-R BT.709-6 / ITU-R BT1361\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED", + short_name: "UNSPECIFIED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_GAMMA22", + short_name: "GAMMA22", + doc: Some("ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_GAMMA28", + short_name: "GAMMA28", + doc: Some("ITU-R BT.470-6 System B, G\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_BT601", + short_name: "BT601", + doc: Some("SMPTE ST 170M / ITU-R BT.601-7 525 or 625\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_SMPTE240", + short_name: "SMPTE240", + doc: Some("SMPTE ST 240M\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_LINEAR", + short_name: "LINEAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_LOG100", + short_name: "LOG100", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10", + short_name: "LOG100_SQRT10", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_IEC61966", + short_name: "IEC61966", + doc: Some("IEC 61966-2-4\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_BT1361", + short_name: "BT1361", + doc: Some("ITU-R BT1361 Extended Colour Gamut\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_SRGB", + short_name: "SRGB", + doc: Some("IEC 61966-2-1 (sRGB or sYCC)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT", + short_name: "BT2020_10BIT", + doc: Some("ITU-R BT2020 for 10-bit system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT", + short_name: "BT2020_12BIT", + doc: Some("ITU-R BT2020 for 12-bit system\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_PQ", + short_name: "PQ", + doc: Some("SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_SMPTE428", + short_name: "SMPTE428", + doc: Some("SMPTE ST 428-1\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_HLG", + short_name: "HLG", + doc: Some("ARIB STD-B67, known as \"hybrid log-gamma\" (HLG)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRANSFER_CHARACTERISTICS_CUSTOM", + short_name: "CUSTOM", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_MatrixCoefficients: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_MatrixCoefficients", + short_name: "MatrixCoefficients", + doc: Some( + "Colorspace matrix coefficients.\n\nThese are as described by \n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_IDENTITY", + short_name: "IDENTITY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_BT709", + short_name: "BT709", + doc: Some("ITU-R BT.709-6\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_UNSPECIFIED", + short_name: "UNSPECIFIED", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_FCC", + short_name: "FCC", + doc: Some("US FCC Title 47\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_BT470BG", + short_name: "BT470BG", + doc: Some( + "ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as [`SDL_MATRIX_COEFFICIENTS_BT601`]\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_BT601", + short_name: "BT601", + doc: Some("ITU-R BT.601-7 525\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_SMPTE240", + short_name: "SMPTE240", + doc: Some("SMPTE 240M\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_YCGCO", + short_name: "YCGCO", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_BT2020_NCL", + short_name: "BT2020_NCL", + doc: Some("ITU-R BT.2020-2 non-constant luminance\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_BT2020_CL", + short_name: "BT2020_CL", + doc: Some("ITU-R BT.2020-2 constant luminance\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_SMPTE2085", + short_name: "SMPTE2085", + doc: Some("SMPTE ST 2085\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL", + short_name: "CHROMA_DERIVED_NCL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL", + short_name: "CHROMA_DERIVED_CL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_ICTCP", + short_name: "ICTCP", + doc: Some("ITU-R BT.2100-0 ICTCP\n"), + available_since: None, + }, + GroupValue { + name: "SDL_MATRIX_COEFFICIENTS_CUSTOM", + short_name: "CUSTOM", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ChromaLocation: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_ChromaLocation", + short_name: "ChromaLocation", + doc: Some( + "Colorspace chroma sample location.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_CHROMA_LOCATION_NONE", + short_name: "NONE", + doc: Some("RGB, no chroma sampling\n"), + available_since: None, + }, + GroupValue { + name: "SDL_CHROMA_LOCATION_LEFT", + short_name: "LEFT", + doc: Some( + "In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_CHROMA_LOCATION_CENTER", + short_name: "CENTER", + doc: Some( + "In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_CHROMA_LOCATION_TOPLEFT", + short_name: "TOPLEFT", + doc: Some( + "In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel (\"co-sited\", \"co-located\").\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Colorspace: Group = Group { + module: "pixels", + kind: GroupKind::Enum, + name: "SDL_Colorspace", + short_name: "Colorspace", + doc: Some( + "Colorspace definitions.\n\nSince similar colorspaces may vary in their details (matrix, transfer\nfunction, etc.), this is not an exhaustive list, but rather a\nrepresentative sample of the kinds of colorspaces supported in SDL.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_ColorPrimaries`]\n- [`SDL_ColorRange`]\n- [`SDL_ColorType`]\n- [`SDL_MatrixCoefficients`]\n- [`SDL_TransferCharacteristics`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_COLORSPACE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_SRGB", + short_name: "SRGB", + doc: Some("Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_SRGB_LINEAR", + short_name: "SRGB_LINEAR", + doc: Some("Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_HDR10", + short_name: "HDR10", + doc: Some("Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_JPEG", + short_name: "JPEG", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_BT601_LIMITED", + short_name: "BT601_LIMITED", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_BT601_FULL", + short_name: "BT601_FULL", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_BT709_LIMITED", + short_name: "BT709_LIMITED", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_BT709_FULL", + short_name: "BT709_FULL", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_BT2020_LIMITED", + short_name: "BT2020_LIMITED", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_BT2020_FULL", + short_name: "BT2020_FULL", + doc: Some("Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_RGB_DEFAULT", + short_name: "RGB_DEFAULT", + doc: Some("The default colorspace for RGB surfaces if no colorspace is specified\n"), + available_since: None, + }, + GroupValue { + name: "SDL_COLORSPACE_YUV_DEFAULT", + short_name: "YUV_DEFAULT", + doc: Some("The default colorspace for YUV surfaces if no colorspace is specified\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Color: Struct = Struct { + module: "pixels", + kind: StructKind::Struct, + name: "SDL_Color", + doc: Some( + "A structure that represents a color as RGBA components.\n\nThe bits of this structure can be directly reinterpreted as an\ninteger-packed color which uses the [`SDL_PIXELFORMAT_RGBA32`] format\n([`SDL_PIXELFORMAT_ABGR8888`] on little-endian systems and\n[`SDL_PIXELFORMAT_RGBA8888`] on big-endian systems).\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "g", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "b", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "a", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; +pub const METADATA_SDL_FColor: Struct = Struct { + module: "pixels", + kind: StructKind::Struct, + name: "SDL_FColor", + doc: Some( + "The bits of this structure can be directly reinterpreted as a float-packed\ncolor which uses the [`SDL_PIXELFORMAT_RGBA128_FLOAT`] format\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "r", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "g", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "b", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "a", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_Palette: Struct = Struct { + module: "pixels", + kind: StructKind::Struct, + name: "SDL_Palette", + doc: Some( + "A set of indexed colors representing a palette.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_SetPaletteColors`]\n\n## Notes for `sdl3-sys`\nThis struct can't be created manually. Use the corresponding SDL functions.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "ncolors", + doc: Some("number of elements in `colors`.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "colors", + doc: Some("an array of colors, `ncolors` long.\n"), + available_since: None, + ty: "*mut SDL_Color", + }, + Field { + name: "version", + doc: Some("internal use only, do not touch.\n"), + available_since: None, + ty: "Uint32", + }, + Field { + name: "refcount", + doc: Some("internal use only, do not touch.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_PixelFormatDetails: Struct = Struct { + module: "pixels", + kind: StructKind::Struct, + name: "SDL_PixelFormatDetails", + doc: Some( + "Details about the format of a pixel.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## Notes for `sdl3-sys`\nThis struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "format", + doc: None, + available_since: None, + ty: "SDL_PixelFormat", + }, + Field { + name: "bits_per_pixel", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "bytes_per_pixel", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "padding", + doc: None, + available_since: None, + ty: "[Uint8; 2]", + }, + Field { + name: "Rmask", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "Gmask", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "Bmask", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "Amask", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "Rbits", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Gbits", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Bbits", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Abits", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Rshift", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Gshift", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Bshift", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "Ashift", + doc: None, + available_since: None, + ty: "Uint8", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/platform.rs b/vendor/sdl3-sys/src/metadata/generated/platform.rs new file mode 100644 index 00000000..681be288 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/platform.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::platform` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/power.rs b/vendor/sdl3-sys/src/metadata/generated/power.rs new file mode 100644 index 00000000..6b006d13 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/power.rs @@ -0,0 +1,52 @@ +//! Metadata for items in the `crate::power` module + +use super::*; + +pub const METADATA_SDL_PowerState: Group = Group { + module: "power", + kind: GroupKind::Enum, + name: "SDL_PowerState", + short_name: "PowerState", + doc: Some( + "The basic state for the system's power supply.\n\nThese are results returned by [`SDL_GetPowerInfo()`].\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_POWERSTATE_ERROR", + short_name: "ERROR", + doc: Some("error determining power status\n"), + available_since: None, + }, + GroupValue { + name: "SDL_POWERSTATE_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("cannot determine power status\n"), + available_since: None, + }, + GroupValue { + name: "SDL_POWERSTATE_ON_BATTERY", + short_name: "ON_BATTERY", + doc: Some("Not plugged in, running on the battery\n"), + available_since: None, + }, + GroupValue { + name: "SDL_POWERSTATE_NO_BATTERY", + short_name: "NO_BATTERY", + doc: Some("Plugged in, no battery available\n"), + available_since: None, + }, + GroupValue { + name: "SDL_POWERSTATE_CHARGING", + short_name: "CHARGING", + doc: Some("Plugged in, charging battery\n"), + available_since: None, + }, + GroupValue { + name: "SDL_POWERSTATE_CHARGED", + short_name: "CHARGED", + doc: Some("Plugged in, battery charged\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/process.rs b/vendor/sdl3-sys/src/metadata/generated/process.rs new file mode 100644 index 00000000..53987079 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/process.rs @@ -0,0 +1,195 @@ +//! Metadata for items in the `crate::process` module + +use super::*; + +pub const METADATA_SDL_PROP_PROCESS_CREATE_ARGS_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_ARGS_POINTER", + short_name: "PROCESS_CREATE_ARGS_POINTER", + value: crate::process::SDL_PROP_PROCESS_CREATE_ARGS_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER", + short_name: "PROCESS_CREATE_ENVIRONMENT_POINTER", + value: crate::process::SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING", + short_name: "PROCESS_CREATE_WORKING_DIRECTORY_STRING", + value: crate::process::SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDIN_NUMBER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDIN_NUMBER", + short_name: "PROCESS_CREATE_STDIN_NUMBER", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDIN_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDIN_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDIN_POINTER", + short_name: "PROCESS_CREATE_STDIN_POINTER", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDIN_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER", + short_name: "PROCESS_CREATE_STDOUT_NUMBER", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDOUT_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDOUT_POINTER", + short_name: "PROCESS_CREATE_STDOUT_POINTER", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDOUT_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDERR_NUMBER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDERR_NUMBER", + short_name: "PROCESS_CREATE_STDERR_NUMBER", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDERR_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDERR_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDERR_POINTER", + short_name: "PROCESS_CREATE_STDERR_POINTER", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDERR_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN", + short_name: "PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN", + value: crate::process::SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN", + short_name: "PROCESS_CREATE_BACKGROUND_BOOLEAN", + value: crate::process::SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_CREATE_CMDLINE_STRING: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_CREATE_CMDLINE_STRING", + short_name: "PROCESS_CREATE_CMDLINE_STRING", + value: crate::process::SDL_PROP_PROCESS_CREATE_CMDLINE_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_PID_NUMBER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_PID_NUMBER", + short_name: "PROCESS_PID_NUMBER", + value: crate::process::SDL_PROP_PROCESS_PID_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_STDIN_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_STDIN_POINTER", + short_name: "PROCESS_STDIN_POINTER", + value: crate::process::SDL_PROP_PROCESS_STDIN_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_STDOUT_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_STDOUT_POINTER", + short_name: "PROCESS_STDOUT_POINTER", + value: crate::process::SDL_PROP_PROCESS_STDOUT_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_STDERR_POINTER: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_STDERR_POINTER", + short_name: "PROCESS_STDERR_POINTER", + value: crate::process::SDL_PROP_PROCESS_STDERR_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_PROCESS_BACKGROUND_BOOLEAN: Property = Property { + module: "process", + name: "SDL_PROP_PROCESS_BACKGROUND_BOOLEAN", + short_name: "PROCESS_BACKGROUND_BOOLEAN", + value: crate::process::SDL_PROP_PROCESS_BACKGROUND_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_ProcessIO: Group = Group { + module: "process", + kind: GroupKind::Enum, + name: "SDL_ProcessIO", + short_name: "ProcessIO", + doc: Some( + "Description of where standard I/O should be directed when creating a\nprocess.\n\nIf a standard I/O stream is set to [`SDL_PROCESS_STDIO_INHERITED`], it will go\nto the same place as the application's I/O stream. This is the default for\nstandard output and standard error.\n\nIf a standard I/O stream is set to [`SDL_PROCESS_STDIO_NULL`], it is connected\nto `NUL:` on Windows and `/dev/null` on POSIX systems. This is the default\nfor standard input.\n\nIf a standard I/O stream is set to [`SDL_PROCESS_STDIO_APP`], it is connected\nto a new [`SDL_IOStream`] that is available to the application. Standard input\nwill be available as [`SDL_PROP_PROCESS_STDIN_POINTER`] and allows\n[`SDL_GetProcessInput()`], standard output will be available as\n[`SDL_PROP_PROCESS_STDOUT_POINTER`] and allows [`SDL_ReadProcess()`] and\n[`SDL_GetProcessOutput()`], and standard error will be available as\n[`SDL_PROP_PROCESS_STDERR_POINTER`] in the properties for the created\nprocess.\n\nIf a standard I/O stream is set to [`SDL_PROCESS_STDIO_REDIRECT`], it is\nconnected to an existing [`SDL_IOStream`] provided by the application. Standard\ninput is provided using [`SDL_PROP_PROCESS_CREATE_STDIN_POINTER`], standard\noutput is provided using [`SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`], and\nstandard error is provided using [`SDL_PROP_PROCESS_CREATE_STDERR_POINTER`]\nin the creation properties. These existing streams should be closed by the\napplication once the new process is created.\n\nIn order to use an [`SDL_IOStream`] with [`SDL_PROCESS_STDIO_REDIRECT`], it must\nhave [`SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`] or\n[`SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`] set. This is true for streams\nrepresenting files and process I/O.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_CreateProcessWithProperties`]\n- [`SDL_GetProcessProperties`]\n- [`SDL_ReadProcess`]\n- [`SDL_GetProcessInput`]\n- [`SDL_GetProcessOutput`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PROCESS_STDIO_INHERITED", + short_name: "INHERITED", + doc: Some("The I/O stream is inherited from the application.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROCESS_STDIO_NULL", + short_name: "NULL", + doc: Some("The I/O stream is ignored.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROCESS_STDIO_APP", + short_name: "APP", + doc: Some( + "The I/O stream is connected to a new [`SDL_IOStream`] that the application can read or write\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_PROCESS_STDIO_REDIRECT", + short_name: "REDIRECT", + doc: Some("The I/O stream is redirected to an existing [`SDL_IOStream`].\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/properties.rs b/vendor/sdl3-sys/src/metadata/generated/properties.rs new file mode 100644 index 00000000..423081b1 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/properties.rs @@ -0,0 +1,72 @@ +//! Metadata for items in the `crate::properties` module + +use super::*; + +pub const METADATA_SDL_PROP_NAME_STRING: Property = Property { + module: "properties", + name: "SDL_PROP_NAME_STRING", + short_name: "NAME_STRING", + value: crate::properties::SDL_PROP_NAME_STRING, + ty: PropertyType::STRING, + doc: Some( + "A generic property for naming things.\n\nThis property is intended to be added to any [`SDL_PropertiesID`] that needs a\ngeneric name associated with the property set. It is not guaranteed that\nany property set will include this key, but it is convenient to have a\nstandard key that any piece of code could reasonably agree to use.\n\nFor example, the properties associated with an [`SDL_Texture`] might have a\nname string of \"player sprites\", or an [`SDL_AudioStream`] might have\n\"background music\", etc. This might also be useful for an [`SDL_IOStream`] to\nlist the path to its asset.\n\nThere is no format for the value set with this key; it is expected to be\nhuman-readable and informational in nature, possibly for logging or\ndebugging purposes.\n\nSDL does not currently set this property on any objects it creates, but\nthis may change in later versions; it is currently expected that apps and\nexternal libraries will take advantage of it, when appropriate.\n\n## Availability\nThis macro is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), +}; +pub const METADATA_SDL_PropertiesID: Group = Group { + module: "properties", + kind: GroupKind::Id, + name: "SDL_PropertiesID", + short_name: "PropertiesID", + doc: Some( + "An ID that represents a properties set.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_PropertyType: Group = Group { + module: "properties", + kind: GroupKind::Enum, + name: "SDL_PropertyType", + short_name: "PropertyType", + doc: Some("SDL property type\n\n## Availability\nThis enum is available since SDL 3.2.0.\n"), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_PROPERTY_TYPE_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PROPERTY_TYPE_POINTER", + short_name: "POINTER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PROPERTY_TYPE_STRING", + short_name: "STRING", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PROPERTY_TYPE_NUMBER", + short_name: "NUMBER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PROPERTY_TYPE_FLOAT", + short_name: "FLOAT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_PROPERTY_TYPE_BOOLEAN", + short_name: "BOOLEAN", + doc: None, + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/rect.rs b/vendor/sdl3-sys/src/metadata/generated/rect.rs new file mode 100644 index 00000000..b3fe772c --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/rect.rs @@ -0,0 +1,120 @@ +//! Metadata for items in the `crate::rect` module + +use super::*; + +pub const METADATA_SDL_Point: Struct = Struct { + module: "rect", + kind: StructKind::Struct, + name: "SDL_Point", + doc: Some( + "The structure that defines a point (using integers).\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetRectEnclosingPoints`]\n- [`SDL_PointInRect`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "x", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "y", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_FPoint: Struct = Struct { + module: "rect", + kind: StructKind::Struct, + name: "SDL_FPoint", + doc: Some( + "The structure that defines a point (using floating point values).\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetRectEnclosingPointsFloat`]\n- [`SDL_PointInRectFloat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "x", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; +pub const METADATA_SDL_Rect: Struct = Struct { + module: "rect", + kind: StructKind::Struct, + name: "SDL_Rect", + doc: Some( + "A rectangle, with the origin at the upper left (using integers).\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_RectEmpty`]\n- [`SDL_RectsEqual`]\n- [`SDL_HasRectIntersection`]\n- [`SDL_GetRectIntersection`]\n- [`SDL_GetRectAndLineIntersection`]\n- [`SDL_GetRectUnion`]\n- [`SDL_GetRectEnclosingPoints`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "x", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "y", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "w", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "h", + doc: None, + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_FRect: Struct = Struct { + module: "rect", + kind: StructKind::Struct, + name: "SDL_FRect", + doc: Some( + "A rectangle stored using floating point values.\n\nThe origin of the coordinate space is in the top-left, with increasing\nvalues moving down and right. The properties `x` and `y` represent the\ncoordinates of the top-left corner of the rectangle.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_RectEmptyFloat`]\n- [`SDL_RectsEqualFloat`]\n- [`SDL_RectsEqualEpsilon`]\n- [`SDL_HasRectIntersectionFloat`]\n- [`SDL_GetRectIntersectionFloat`]\n- [`SDL_GetRectAndLineIntersectionFloat`]\n- [`SDL_GetRectUnionFloat`]\n- [`SDL_GetRectEnclosingPointsFloat`]\n- [`SDL_PointInRectFloat`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "x", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "w", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "h", + doc: None, + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/render.rs b/vendor/sdl3-sys/src/metadata/generated/render.rs new file mode 100644 index 00000000..eef198c4 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/render.rs @@ -0,0 +1,1136 @@ +//! Metadata for items in the `crate::render` module + +use super::*; + +pub const METADATA_SDL_PROP_RENDERER_CREATE_NAME_STRING: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_NAME_STRING", + short_name: "RENDERER_CREATE_NAME_STRING", + value: crate::render::SDL_PROP_RENDERER_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_WINDOW_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_WINDOW_POINTER", + short_name: "RENDERER_CREATE_WINDOW_POINTER", + value: crate::render::SDL_PROP_RENDERER_CREATE_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_SURFACE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_SURFACE_POINTER", + short_name: "RENDERER_CREATE_SURFACE_POINTER", + value: crate::render::SDL_PROP_RENDERER_CREATE_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER", + short_name: "RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER", + value: crate::render::SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER", + short_name: "RENDERER_CREATE_PRESENT_VSYNC_NUMBER", + value: crate::render::SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER", + short_name: "RENDERER_CREATE_GPU_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN", + short_name: "RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN", + value: crate::render::SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN", + short_name: "RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN", + value: crate::render::SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN", + short_name: "RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN", + value: crate::render::SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER", + short_name: "RENDERER_CREATE_VULKAN_INSTANCE_POINTER", + value: crate::render::SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER", + short_name: "RENDERER_CREATE_VULKAN_SURFACE_NUMBER", + value: crate::render::SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER", + short_name: "RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER", + short_name: "RENDERER_CREATE_VULKAN_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER: Property = + Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER", + short_name: "RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER", + value: crate::render::SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER: Property = + Property { + module: "render", + name: "SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER", + short_name: "RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER", + value: crate::render::SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_RENDERER_NAME_STRING: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_NAME_STRING", + short_name: "RENDERER_NAME_STRING", + value: crate::render::SDL_PROP_RENDERER_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_WINDOW_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_WINDOW_POINTER", + short_name: "RENDERER_WINDOW_POINTER", + value: crate::render::SDL_PROP_RENDERER_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_SURFACE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_SURFACE_POINTER", + short_name: "RENDERER_SURFACE_POINTER", + value: crate::render::SDL_PROP_RENDERER_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_VSYNC_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_VSYNC_NUMBER", + short_name: "RENDERER_VSYNC_NUMBER", + value: crate::render::SDL_PROP_RENDERER_VSYNC_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER", + short_name: "RENDERER_MAX_TEXTURE_SIZE_NUMBER", + value: crate::render::SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER", + short_name: "RENDERER_TEXTURE_FORMATS_POINTER", + value: crate::render::SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN", + short_name: "RENDERER_TEXTURE_WRAPPING_BOOLEAN", + value: crate::render::SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER", + short_name: "RENDERER_OUTPUT_COLORSPACE_NUMBER", + value: crate::render::SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN", + short_name: "RENDERER_HDR_ENABLED_BOOLEAN", + value: crate::render::SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT", + short_name: "RENDERER_SDR_WHITE_POINT_FLOAT", + value: crate::render::SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT", + short_name: "RENDERER_HDR_HEADROOM_FLOAT", + value: crate::render::SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_D3D9_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_D3D9_DEVICE_POINTER", + short_name: "RENDERER_D3D9_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_D3D9_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_D3D11_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_D3D11_DEVICE_POINTER", + short_name: "RENDERER_D3D11_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_D3D11_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER", + short_name: "RENDERER_D3D11_SWAPCHAIN_POINTER", + value: crate::render::SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_D3D12_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_D3D12_DEVICE_POINTER", + short_name: "RENDERER_D3D12_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_D3D12_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER", + short_name: "RENDERER_D3D12_SWAPCHAIN_POINTER", + value: crate::render::SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER", + short_name: "RENDERER_D3D12_COMMAND_QUEUE_POINTER", + value: crate::render::SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER", + short_name: "RENDERER_VULKAN_INSTANCE_POINTER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER", + short_name: "RENDERER_VULKAN_SURFACE_NUMBER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER", + short_name: "RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER", + short_name: "RENDERER_VULKAN_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER: Property = + Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER", + short_name: "RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER: Property = + Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER", + short_name: "RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER", + short_name: "RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER", + value: crate::render::SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_RENDERER_GPU_DEVICE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_RENDERER_GPU_DEVICE_POINTER", + short_name: "RENDERER_GPU_DEVICE_POINTER", + value: crate::render::SDL_PROP_RENDERER_GPU_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER", + short_name: "TEXTURE_CREATE_COLORSPACE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER", + short_name: "TEXTURE_CREATE_FORMAT_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER", + short_name: "TEXTURE_CREATE_ACCESS_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER", + short_name: "TEXTURE_CREATE_WIDTH_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER", + short_name: "TEXTURE_CREATE_HEIGHT_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER", + short_name: "TEXTURE_CREATE_PALETTE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT", + short_name: "TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT", + value: crate::render::SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT", + short_name: "TEXTURE_CREATE_HDR_HEADROOM_FLOAT", + value: crate::render::SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER", + short_name: "TEXTURE_CREATE_D3D11_TEXTURE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER", + short_name: "TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER", + short_name: "TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER", + short_name: "TEXTURE_CREATE_D3D12_TEXTURE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER", + short_name: "TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER", + short_name: "TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER", + short_name: "TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER", + short_name: "TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER", + short_name: "TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER", + short_name: "TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER", + short_name: "TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER", + short_name: "TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER", + short_name: "TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER", + short_name: "TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER", + short_name: "TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER", + short_name: "TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER", + short_name: "TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER", + short_name: "TEXTURE_CREATE_GPU_TEXTURE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER", + short_name: "TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER", + short_name: "TEXTURE_CREATE_GPU_TEXTURE_U_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER", + short_name: "TEXTURE_CREATE_GPU_TEXTURE_V_POINTER", + value: crate::render::SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_COLORSPACE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_COLORSPACE_NUMBER", + short_name: "TEXTURE_COLORSPACE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_COLORSPACE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_FORMAT_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_FORMAT_NUMBER", + short_name: "TEXTURE_FORMAT_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_FORMAT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_ACCESS_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_ACCESS_NUMBER", + short_name: "TEXTURE_ACCESS_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_ACCESS_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_WIDTH_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_WIDTH_NUMBER", + short_name: "TEXTURE_WIDTH_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_WIDTH_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_HEIGHT_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_HEIGHT_NUMBER", + short_name: "TEXTURE_HEIGHT_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_HEIGHT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT", + short_name: "TEXTURE_SDR_WHITE_POINT_FLOAT", + value: crate::render::SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT", + short_name: "TEXTURE_HDR_HEADROOM_FLOAT", + value: crate::render::SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER", + short_name: "TEXTURE_D3D11_TEXTURE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER", + short_name: "TEXTURE_D3D11_TEXTURE_U_POINTER", + value: crate::render::SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER", + short_name: "TEXTURE_D3D11_TEXTURE_V_POINTER", + value: crate::render::SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER", + short_name: "TEXTURE_D3D12_TEXTURE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER", + short_name: "TEXTURE_D3D12_TEXTURE_U_POINTER", + value: crate::render::SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER", + short_name: "TEXTURE_D3D12_TEXTURE_V_POINTER", + value: crate::render::SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER", + short_name: "TEXTURE_OPENGL_TEXTURE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER", + short_name: "TEXTURE_OPENGL_TEXTURE_UV_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER", + short_name: "TEXTURE_OPENGL_TEXTURE_U_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER", + short_name: "TEXTURE_OPENGL_TEXTURE_V_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER", + short_name: "TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT", + short_name: "TEXTURE_OPENGL_TEX_W_FLOAT", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT", + short_name: "TEXTURE_OPENGL_TEX_H_FLOAT", + value: crate::render::SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER", + short_name: "TEXTURE_OPENGLES2_TEXTURE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER", + short_name: "TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER", + short_name: "TEXTURE_OPENGLES2_TEXTURE_U_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER", + short_name: "TEXTURE_OPENGLES2_TEXTURE_V_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER", + short_name: "TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER", + short_name: "TEXTURE_VULKAN_TEXTURE_NUMBER", + value: crate::render::SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER", + short_name: "TEXTURE_GPU_TEXTURE_POINTER", + value: crate::render::SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER", + short_name: "TEXTURE_GPU_TEXTURE_UV_POINTER", + value: crate::render::SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER", + short_name: "TEXTURE_GPU_TEXTURE_U_POINTER", + value: crate::render::SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER: Property = Property { + module: "render", + name: "SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER", + short_name: "TEXTURE_GPU_TEXTURE_V_POINTER", + value: crate::render::SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_TextureAccess: Group = Group { + module: "render", + kind: GroupKind::Enum, + name: "SDL_TextureAccess", + short_name: "TextureAccess", + doc: Some( + "The access pattern allowed for a texture.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_TEXTUREACCESS_STATIC", + short_name: "STATIC", + doc: Some("Changes rarely, not lockable\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTUREACCESS_STREAMING", + short_name: "STREAMING", + doc: Some("Changes frequently, lockable\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTUREACCESS_TARGET", + short_name: "TARGET", + doc: Some("Texture can be used as a render target\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_TextureAddressMode: Group = Group { + module: "render", + kind: GroupKind::Enum, + name: "SDL_TextureAddressMode", + short_name: "TextureAddressMode", + doc: Some( + "The addressing mode for a texture when used in [`SDL_RenderGeometry()`].\n\nThis affects how texture coordinates are interpreted outside of \\[0, 1\\]\n\nTexture wrapping is always supported for power of two texture sizes, and is\nsupported for other texture sizes if\n[`SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN`] is set to true.\n\n## Availability\nThis enum is available since SDL 3.4.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), + values: &[ + GroupValue { + name: "SDL_TEXTURE_ADDRESS_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TEXTURE_ADDRESS_AUTO", + short_name: "AUTO", + doc: Some( + "Wrapping is enabled if texture coordinates are outside \\[0, 1\\], this is the default\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTURE_ADDRESS_CLAMP", + short_name: "CLAMP", + doc: Some("Texture coordinates are clamped to the \\[0, 1\\] range\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TEXTURE_ADDRESS_WRAP", + short_name: "WRAP", + doc: Some("The texture is repeated (tiled)\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_RendererLogicalPresentation: Group = Group { + module: "render", + kind: GroupKind::Enum, + name: "SDL_RendererLogicalPresentation", + short_name: "RendererLogicalPresentation", + doc: Some( + "How the logical size is mapped to the output.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_LOGICAL_PRESENTATION_DISABLED", + short_name: "DISABLED", + doc: Some("There is no logical size in effect\n"), + available_since: None, + }, + GroupValue { + name: "SDL_LOGICAL_PRESENTATION_STRETCH", + short_name: "STRETCH", + doc: Some("The rendered content is stretched to the output resolution\n"), + available_since: None, + }, + GroupValue { + name: "SDL_LOGICAL_PRESENTATION_LETTERBOX", + short_name: "LETTERBOX", + doc: Some( + "The rendered content is fit to the largest dimension and the other dimension is letterboxed with the clear color\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_LOGICAL_PRESENTATION_OVERSCAN", + short_name: "OVERSCAN", + doc: Some( + "The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_LOGICAL_PRESENTATION_INTEGER_SCALE", + short_name: "INTEGER_SCALE", + doc: Some( + "The rendered content is scaled up by integer multiples to fit the output resolution\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Vertex: Struct = Struct { + module: "render", + kind: StructKind::Struct, + name: "SDL_Vertex", + doc: Some("Vertex structure.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n"), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "position", + doc: Some("Vertex position, in [`SDL_Renderer`] coordinates\n"), + available_since: None, + ty: "SDL_FPoint", + }, + Field { + name: "color", + doc: Some("Vertex color\n"), + available_since: None, + ty: "SDL_FColor", + }, + Field { + name: "tex_coord", + doc: Some("Normalized texture coordinates, if needed\n"), + available_since: None, + ty: "SDL_FPoint", + }, + ], +}; +pub const METADATA_SDL_Texture: Struct = Struct { + module: "render", + kind: StructKind::Struct, + name: "SDL_Texture", + doc: None, + available_since: None, + fields: &[ + Field { + name: "format", + doc: Some("The format of the texture, read-only\n"), + available_since: None, + ty: "SDL_PixelFormat", + }, + Field { + name: "w", + doc: Some("The width of the texture, read-only.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "h", + doc: Some("The height of the texture, read-only.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "refcount", + doc: Some("Application reference count, used when freeing texture\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; +pub const METADATA_SDL_GPURenderStateCreateInfo: Struct = Struct { + module: "render", + kind: StructKind::Struct, + name: "SDL_GPURenderStateCreateInfo", + doc: Some( + "A structure specifying the parameters of a GPU render state.\n\n## Availability\nThis struct is available since SDL 3.4.0.\n\n## See also\n- [`SDL_CreateGPURenderState`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 4, 0)), + fields: &[ + Field { + name: "fragment_shader", + doc: Some("The fragment shader to use when this render state is active\n"), + available_since: None, + ty: "*mut SDL_GPUShader", + }, + Field { + name: "num_sampler_bindings", + doc: Some( + "The number of additional fragment samplers to bind when this render state is active\n", + ), + available_since: None, + ty: "Sint32", + }, + Field { + name: "sampler_bindings", + doc: Some("Additional fragment samplers to bind when this render state is active\n"), + available_since: None, + ty: "*const SDL_GPUTextureSamplerBinding", + }, + Field { + name: "num_storage_textures", + doc: Some("The number of storage textures to bind when this render state is active\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "storage_textures", + doc: Some("Storage textures to bind when this render state is active\n"), + available_since: None, + ty: "*const *mut SDL_GPUTexture", + }, + Field { + name: "num_storage_buffers", + doc: Some("The number of storage buffers to bind when this render state is active\n"), + available_since: None, + ty: "Sint32", + }, + Field { + name: "storage_buffers", + doc: Some("Storage buffers to bind when this render state is active\n"), + available_since: None, + ty: "*const *mut SDL_GPUBuffer", + }, + Field { + name: "props", + doc: Some("A properties ID for extensions. Should be 0 if no extensions are needed.\n"), + available_since: None, + ty: "SDL_PropertiesID", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/revision.rs b/vendor/sdl3-sys/src/metadata/generated/revision.rs new file mode 100644 index 00000000..acc23bf4 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/revision.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::revision` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/scancode.rs b/vendor/sdl3-sys/src/metadata/generated/scancode.rs new file mode 100644 index 00000000..0239cdc1 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/scancode.rs @@ -0,0 +1,1528 @@ +//! Metadata for items in the `crate::scancode` module + +use super::*; + +pub const METADATA_SDL_Scancode: Group = Group { + module: "scancode", + kind: GroupKind::Enum, + name: "SDL_Scancode", + short_name: "Scancode", + doc: Some( + "The SDL keyboard scancode representation.\n\nAn SDL scancode is the physical representation of a key on the keyboard,\nindependent of language and keyboard mapping.\n\nValues of this type are used to represent keyboard keys, among other places\nin the `scancode` field of the [`SDL_KeyboardEvent`] structure.\n\nThe values in this enumeration are based on the USB usage page standard:\n\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SCANCODE_UNKNOWN", + short_name: "UNKNOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_A", + short_name: "A", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_B", + short_name: "B", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_C", + short_name: "C", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_D", + short_name: "D", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_E", + short_name: "E", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F", + short_name: "F", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_G", + short_name: "G", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_H", + short_name: "H", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_I", + short_name: "I", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_J", + short_name: "J", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_K", + short_name: "K", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_L", + short_name: "L", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_M", + short_name: "M", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_N", + short_name: "N", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_O", + short_name: "O", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_P", + short_name: "P", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_Q", + short_name: "Q", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_R", + short_name: "R", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_S", + short_name: "S", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_T", + short_name: "T", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_U", + short_name: "U", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_V", + short_name: "V", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_W", + short_name: "W", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_X", + short_name: "X", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_Y", + short_name: "Y", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_Z", + short_name: "Z", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_1", + short_name: "_1", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_2", + short_name: "_2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_3", + short_name: "_3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_4", + short_name: "_4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_5", + short_name: "_5", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_6", + short_name: "_6", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_7", + short_name: "_7", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_8", + short_name: "_8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_9", + short_name: "_9", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_0", + short_name: "_0", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RETURN", + short_name: "RETURN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_ESCAPE", + short_name: "ESCAPE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_BACKSPACE", + short_name: "BACKSPACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_TAB", + short_name: "TAB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SPACE", + short_name: "SPACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MINUS", + short_name: "MINUS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_EQUALS", + short_name: "EQUALS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LEFTBRACKET", + short_name: "LEFTBRACKET", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RIGHTBRACKET", + short_name: "RIGHTBRACKET", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_BACKSLASH", + short_name: "BACKSLASH", + doc: Some( + "Located at the lower left of the return\nkey on ISO keyboards and at the right end\nof the QWERTY row on ANSI keyboards.\nProduces REVERSE SOLIDUS (backslash) and\nVERTICAL LINE in a US layout, REVERSE\nSOLIDUS and VERTICAL LINE in a UK Mac\nlayout, NUMBER SIGN and TILDE in a UK\nWindows layout, DOLLAR SIGN and POUND SIGN\nin a Swiss German layout, NUMBER SIGN and\nAPOSTROPHE in a German layout, GRAVE\nACCENT and POUND SIGN in a French Mac\nlayout, and ASTERISK and MICRO SIGN in a\nFrench Windows layout.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_NONUSHASH", + short_name: "NONUSHASH", + doc: Some( + "ISO USB keyboards actually use this code\ninstead of 49 for the same key, but all\nOSes I've seen treat the two codes\nidentically. So, as an implementor, unless\nyour keyboard generates both of those\ncodes and your OS treats them differently,\nyou should generate [`SDL_SCANCODE_BACKSLASH`]\ninstead of this code. As a user, you\nshould not rely on this code because SDL\nwill never generate it with most (all?)\nkeyboards.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SEMICOLON", + short_name: "SEMICOLON", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_APOSTROPHE", + short_name: "APOSTROPHE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_GRAVE", + short_name: "GRAVE", + doc: Some( + "Located in the top left corner (on both ANSI\nand ISO keyboards). Produces GRAVE ACCENT and\nTILDE in a US Windows layout and in US and UK\nMac layouts on ANSI keyboards, GRAVE ACCENT\nand NOT SIGN in a UK Windows layout, SECTION\nSIGN and PLUS-MINUS SIGN in US and UK Mac\nlayouts on ISO keyboards, SECTION SIGN and\nDEGREE SIGN in a Swiss German layout (Mac:\nonly on ISO keyboards), CIRCUMFLEX ACCENT and\nDEGREE SIGN in a German layout (Mac: only on\nISO keyboards), SUPERSCRIPT TWO and TILDE in a\nFrench Windows layout, COMMERCIAL AT and\nNUMBER SIGN in a French Mac layout on ISO\nkeyboards, and LESS-THAN SIGN and GREATER-THAN\nSIGN in a Swiss German, German, or French Mac\nlayout on ANSI keyboards.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_COMMA", + short_name: "COMMA", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PERIOD", + short_name: "PERIOD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SLASH", + short_name: "SLASH", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CAPSLOCK", + short_name: "CAPSLOCK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F1", + short_name: "F1", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F2", + short_name: "F2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F3", + short_name: "F3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F4", + short_name: "F4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F5", + short_name: "F5", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F6", + short_name: "F6", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F7", + short_name: "F7", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F8", + short_name: "F8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F9", + short_name: "F9", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F10", + short_name: "F10", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F11", + short_name: "F11", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F12", + short_name: "F12", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PRINTSCREEN", + short_name: "PRINTSCREEN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SCROLLLOCK", + short_name: "SCROLLLOCK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PAUSE", + short_name: "PAUSE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INSERT", + short_name: "INSERT", + doc: Some( + "insert on PC, help on some Mac keyboards (but\ndoes send code 73, not 117)\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_HOME", + short_name: "HOME", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PAGEUP", + short_name: "PAGEUP", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_DELETE", + short_name: "DELETE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_END", + short_name: "END", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PAGEDOWN", + short_name: "PAGEDOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RIGHT", + short_name: "RIGHT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LEFT", + short_name: "LEFT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_DOWN", + short_name: "DOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_UP", + short_name: "UP", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_NUMLOCKCLEAR", + short_name: "NUMLOCKCLEAR", + doc: Some("num lock on PC, clear on Mac keyboards\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_DIVIDE", + short_name: "KP_DIVIDE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MULTIPLY", + short_name: "KP_MULTIPLY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MINUS", + short_name: "KP_MINUS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_PLUS", + short_name: "KP_PLUS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_ENTER", + short_name: "KP_ENTER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_1", + short_name: "KP_1", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_2", + short_name: "KP_2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_3", + short_name: "KP_3", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_4", + short_name: "KP_4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_5", + short_name: "KP_5", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_6", + short_name: "KP_6", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_7", + short_name: "KP_7", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_8", + short_name: "KP_8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_9", + short_name: "KP_9", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_0", + short_name: "KP_0", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_PERIOD", + short_name: "KP_PERIOD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_NONUSBACKSLASH", + short_name: "NONUSBACKSLASH", + doc: Some( + "This is the additional key that ISO\nkeyboards have over ANSI ones,\nlocated between left shift and Z.\nProduces GRAVE ACCENT and TILDE in a\nUS or UK Mac layout, REVERSE SOLIDUS\n(backslash) and VERTICAL LINE in a\nUS or UK Windows layout, and\nLESS-THAN SIGN and GREATER-THAN SIGN\nin a Swiss German, German, or French\nlayout.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_APPLICATION", + short_name: "APPLICATION", + doc: Some("windows contextual menu, compose\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_POWER", + short_name: "POWER", + doc: Some( + "The USB document says this is a status flag,\nnot a physical key - but some Mac keyboards\ndo have a power key.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_EQUALS", + short_name: "KP_EQUALS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F13", + short_name: "F13", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F14", + short_name: "F14", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F15", + short_name: "F15", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F16", + short_name: "F16", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F17", + short_name: "F17", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F18", + short_name: "F18", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F19", + short_name: "F19", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F20", + short_name: "F20", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F21", + short_name: "F21", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F22", + short_name: "F22", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F23", + short_name: "F23", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_F24", + short_name: "F24", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_EXECUTE", + short_name: "EXECUTE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_HELP", + short_name: "HELP", + doc: Some("AL Integrated Help Center\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MENU", + short_name: "MENU", + doc: Some("Menu (show menu)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SELECT", + short_name: "SELECT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_STOP", + short_name: "STOP", + doc: Some("AC Stop\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AGAIN", + short_name: "AGAIN", + doc: Some("AC Redo/Repeat\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_UNDO", + short_name: "UNDO", + doc: Some("AC Undo\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CUT", + short_name: "CUT", + doc: Some("AC Cut\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_COPY", + short_name: "COPY", + doc: Some("AC Copy\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PASTE", + short_name: "PASTE", + doc: Some("AC Paste\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_FIND", + short_name: "FIND", + doc: Some("AC Find\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MUTE", + short_name: "MUTE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_VOLUMEUP", + short_name: "VOLUMEUP", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_VOLUMEDOWN", + short_name: "VOLUMEDOWN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_COMMA", + short_name: "KP_COMMA", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_EQUALSAS400", + short_name: "KP_EQUALSAS400", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL1", + short_name: "INTERNATIONAL1", + doc: Some("used on Asian keyboards, see\nfootnotes in USB doc\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL2", + short_name: "INTERNATIONAL2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL3", + short_name: "INTERNATIONAL3", + doc: Some("Yen\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL4", + short_name: "INTERNATIONAL4", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL5", + short_name: "INTERNATIONAL5", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL6", + short_name: "INTERNATIONAL6", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL7", + short_name: "INTERNATIONAL7", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL8", + short_name: "INTERNATIONAL8", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_INTERNATIONAL9", + short_name: "INTERNATIONAL9", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG1", + short_name: "LANG1", + doc: Some("Hangul/English toggle\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG2", + short_name: "LANG2", + doc: Some("Hanja conversion\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG3", + short_name: "LANG3", + doc: Some("Katakana\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG4", + short_name: "LANG4", + doc: Some("Hiragana\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG5", + short_name: "LANG5", + doc: Some("Zenkaku/Hankaku\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG6", + short_name: "LANG6", + doc: Some("reserved\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG7", + short_name: "LANG7", + doc: Some("reserved\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG8", + short_name: "LANG8", + doc: Some("reserved\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LANG9", + short_name: "LANG9", + doc: Some("reserved\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_ALTERASE", + short_name: "ALTERASE", + doc: Some("Erase-Eaze\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SYSREQ", + short_name: "SYSREQ", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CANCEL", + short_name: "CANCEL", + doc: Some("AC Cancel\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CLEAR", + short_name: "CLEAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_PRIOR", + short_name: "PRIOR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RETURN2", + short_name: "RETURN2", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SEPARATOR", + short_name: "SEPARATOR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_OUT", + short_name: "OUT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_OPER", + short_name: "OPER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CLEARAGAIN", + short_name: "CLEARAGAIN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CRSEL", + short_name: "CRSEL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_EXSEL", + short_name: "EXSEL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_00", + short_name: "KP_00", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_000", + short_name: "KP_000", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_THOUSANDSSEPARATOR", + short_name: "THOUSANDSSEPARATOR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_DECIMALSEPARATOR", + short_name: "DECIMALSEPARATOR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CURRENCYUNIT", + short_name: "CURRENCYUNIT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CURRENCYSUBUNIT", + short_name: "CURRENCYSUBUNIT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_LEFTPAREN", + short_name: "KP_LEFTPAREN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_RIGHTPAREN", + short_name: "KP_RIGHTPAREN", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_LEFTBRACE", + short_name: "KP_LEFTBRACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_RIGHTBRACE", + short_name: "KP_RIGHTBRACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_TAB", + short_name: "KP_TAB", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_BACKSPACE", + short_name: "KP_BACKSPACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_A", + short_name: "KP_A", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_B", + short_name: "KP_B", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_C", + short_name: "KP_C", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_D", + short_name: "KP_D", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_E", + short_name: "KP_E", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_F", + short_name: "KP_F", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_XOR", + short_name: "KP_XOR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_POWER", + short_name: "KP_POWER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_PERCENT", + short_name: "KP_PERCENT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_LESS", + short_name: "KP_LESS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_GREATER", + short_name: "KP_GREATER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_AMPERSAND", + short_name: "KP_AMPERSAND", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_DBLAMPERSAND", + short_name: "KP_DBLAMPERSAND", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_VERTICALBAR", + short_name: "KP_VERTICALBAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_DBLVERTICALBAR", + short_name: "KP_DBLVERTICALBAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_COLON", + short_name: "KP_COLON", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_HASH", + short_name: "KP_HASH", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_SPACE", + short_name: "KP_SPACE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_AT", + short_name: "KP_AT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_EXCLAM", + short_name: "KP_EXCLAM", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMSTORE", + short_name: "KP_MEMSTORE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMRECALL", + short_name: "KP_MEMRECALL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMCLEAR", + short_name: "KP_MEMCLEAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMADD", + short_name: "KP_MEMADD", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMSUBTRACT", + short_name: "KP_MEMSUBTRACT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMMULTIPLY", + short_name: "KP_MEMMULTIPLY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_MEMDIVIDE", + short_name: "KP_MEMDIVIDE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_PLUSMINUS", + short_name: "KP_PLUSMINUS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_CLEAR", + short_name: "KP_CLEAR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_CLEARENTRY", + short_name: "KP_CLEARENTRY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_BINARY", + short_name: "KP_BINARY", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_OCTAL", + short_name: "KP_OCTAL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_DECIMAL", + short_name: "KP_DECIMAL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_KP_HEXADECIMAL", + short_name: "KP_HEXADECIMAL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LCTRL", + short_name: "LCTRL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LSHIFT", + short_name: "LSHIFT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LALT", + short_name: "LALT", + doc: Some("alt, option\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_LGUI", + short_name: "LGUI", + doc: Some("windows, command (apple), meta\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RCTRL", + short_name: "RCTRL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RSHIFT", + short_name: "RSHIFT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RALT", + short_name: "RALT", + doc: Some("alt gr, option\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RGUI", + short_name: "RGUI", + doc: Some("windows, command (apple), meta\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MODE", + short_name: "MODE", + doc: Some( + "I'm not sure if this is really not covered\nby any of the above, but since there's a\nspecial [`SDL_KMOD_MODE`] for it I'm adding it here\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SLEEP", + short_name: "SLEEP", + doc: Some("Sleep\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_WAKE", + short_name: "WAKE", + doc: Some("Wake\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CHANNEL_INCREMENT", + short_name: "CHANNEL_INCREMENT", + doc: Some("Channel Increment\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CHANNEL_DECREMENT", + short_name: "CHANNEL_DECREMENT", + doc: Some("Channel Decrement\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_PLAY", + short_name: "MEDIA_PLAY", + doc: Some("Play\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_PAUSE", + short_name: "MEDIA_PAUSE", + doc: Some("Pause\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_RECORD", + short_name: "MEDIA_RECORD", + doc: Some("Record\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_FAST_FORWARD", + short_name: "MEDIA_FAST_FORWARD", + doc: Some("Fast Forward\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_REWIND", + short_name: "MEDIA_REWIND", + doc: Some("Rewind\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_NEXT_TRACK", + short_name: "MEDIA_NEXT_TRACK", + doc: Some("Next Track\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_PREVIOUS_TRACK", + short_name: "MEDIA_PREVIOUS_TRACK", + doc: Some("Previous Track\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_STOP", + short_name: "MEDIA_STOP", + doc: Some("Stop\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_EJECT", + short_name: "MEDIA_EJECT", + doc: Some("Eject\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_PLAY_PAUSE", + short_name: "MEDIA_PLAY_PAUSE", + doc: Some("Play / Pause\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_MEDIA_SELECT", + short_name: "MEDIA_SELECT", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_NEW", + short_name: "AC_NEW", + doc: Some("AC New\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_OPEN", + short_name: "AC_OPEN", + doc: Some("AC Open\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_CLOSE", + short_name: "AC_CLOSE", + doc: Some("AC Close\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_EXIT", + short_name: "AC_EXIT", + doc: Some("AC Exit\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_SAVE", + short_name: "AC_SAVE", + doc: Some("AC Save\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_PRINT", + short_name: "AC_PRINT", + doc: Some("AC Print\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_PROPERTIES", + short_name: "AC_PROPERTIES", + doc: Some("AC Properties\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_SEARCH", + short_name: "AC_SEARCH", + doc: Some("AC Search\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_HOME", + short_name: "AC_HOME", + doc: Some("AC Home\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_BACK", + short_name: "AC_BACK", + doc: Some("AC Back\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_FORWARD", + short_name: "AC_FORWARD", + doc: Some("AC Forward\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_STOP", + short_name: "AC_STOP", + doc: Some("AC Stop\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_REFRESH", + short_name: "AC_REFRESH", + doc: Some("AC Refresh\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_AC_BOOKMARKS", + short_name: "AC_BOOKMARKS", + doc: Some("AC Bookmarks\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SOFTLEFT", + short_name: "SOFTLEFT", + doc: Some( + "Usually situated below the display on phones and\nused as a multi-function feature key for selecting\na software defined function shown on the bottom left\nof the display.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_SOFTRIGHT", + short_name: "SOFTRIGHT", + doc: Some( + "Usually situated below the display on phones and\nused as a multi-function feature key for selecting\na software defined function shown on the bottom right\nof the display.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_CALL", + short_name: "CALL", + doc: Some("Used for accepting phone calls.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_ENDCALL", + short_name: "ENDCALL", + doc: Some("Used for rejecting phone calls.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_RESERVED", + short_name: "RESERVED", + doc: Some("400-500 reserved for dynamic keycodes\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCANCODE_COUNT", + short_name: "COUNT", + doc: Some("not a key, just marks the number of scancodes for array bounds\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/sensor.rs b/vendor/sdl3-sys/src/metadata/generated/sensor.rs new file mode 100644 index 00000000..f38c5661 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/sensor.rs @@ -0,0 +1,81 @@ +//! Metadata for items in the `crate::sensor` module + +use super::*; + +pub const METADATA_SDL_SensorID: Group = Group { + module: "sensor", + kind: GroupKind::Id, + name: "SDL_SensorID", + short_name: "SensorID", + doc: Some( + "This is a unique ID for a sensor for the time it is connected to the\nsystem, and is never reused for the lifetime of the application.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_SensorType: Group = Group { + module: "sensor", + kind: GroupKind::Enum, + name: "SDL_SensorType", + short_name: "SensorType", + doc: Some( + "The different sensors defined by SDL.\n\nAdditional sensors may be available, using platform dependent semantics.\n\nHere are the additional Android sensors:\n\n\n\nAccelerometer sensor notes:\n\nThe accelerometer returns the current acceleration in SI meters per second\nsquared. This measurement includes the force of gravity, so a device at\nrest will have an value of [`SDL_STANDARD_GRAVITY`] away from the center of the\nearth, which is a positive Y value.\n\n- `values[0]`: Acceleration on the x axis\n- `values[1]`: Acceleration on the y axis\n- `values[2]`: Acceleration on the z axis\n\nFor phones and tablets held in natural orientation and game controllers\nheld in front of you, the axes are defined as follows:\n\n- -X ... +X : left ... right\n- -Y ... +Y : bottom ... top\n- -Z ... +Z : farther ... closer\n\nThe accelerometer axis data is not changed when the device is rotated.\n\nGyroscope sensor notes:\n\nThe gyroscope returns the current rate of rotation in radians per second.\nThe rotation is positive in the counter-clockwise direction. That is, an\nobserver looking from a positive location on one of the axes would see\npositive rotation on that axis when it appeared to be rotating\ncounter-clockwise.\n\n- `values[0]`: Angular speed around the x axis (pitch)\n- `values[1]`: Angular speed around the y axis (yaw)\n- `values[2]`: Angular speed around the z axis (roll)\n\nFor phones and tablets held in natural orientation and game controllers\nheld in front of you, the axes are defined as follows:\n\n- -X ... +X : left ... right\n- -Y ... +Y : bottom ... top\n- -Z ... +Z : farther ... closer\n\nThe gyroscope axis data is not changed when the device is rotated.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetCurrentDisplayOrientation`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SENSOR_INVALID", + short_name: "INVALID", + doc: Some("Returned for an invalid sensor\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("Unknown sensor type\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_ACCEL", + short_name: "ACCEL", + doc: Some("Accelerometer\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_GYRO", + short_name: "GYRO", + doc: Some("Gyroscope\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_ACCEL_L", + short_name: "ACCEL_L", + doc: Some("Accelerometer for left Joy-Con controller and Wii nunchuk\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_GYRO_L", + short_name: "GYRO_L", + doc: Some("Gyroscope for left Joy-Con controller\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_ACCEL_R", + short_name: "ACCEL_R", + doc: Some("Accelerometer for right Joy-Con controller\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_GYRO_R", + short_name: "GYRO_R", + doc: Some("Gyroscope for right Joy-Con controller\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SENSOR_COUNT", + short_name: "COUNT", + doc: None, + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/stdinc.rs b/vendor/sdl3-sys/src/metadata/generated/stdinc.rs new file mode 100644 index 00000000..ba2d273f --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/stdinc.rs @@ -0,0 +1,25 @@ +//! Metadata for items in the `crate::stdinc` module + +use super::*; + +pub const METADATA_SDL_alignment_test: Struct = Struct { + module: "stdinc", + kind: StructKind::Struct, + name: "SDL_alignment_test", + doc: None, + available_since: None, + fields: &[ + Field { + name: "a", + doc: None, + available_since: None, + ty: "Uint8", + }, + Field { + name: "b", + doc: None, + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/storage.rs b/vendor/sdl3-sys/src/metadata/generated/storage.rs new file mode 100644 index 00000000..f5c75559 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/storage.rs @@ -0,0 +1,87 @@ +//! Metadata for items in the `crate::storage` module + +use super::*; + +pub const METADATA_SDL_StorageInterface: Struct = Struct { + module: "storage", + kind: StructKind::Struct, + name: "SDL_StorageInterface", + doc: Some( + "Function interface for [`SDL_Storage`].\n\nApps that want to supply a custom implementation of [`SDL_Storage`] will fill\nin all the functions in this struct, and then pass it to [`SDL_OpenStorage`] to\ncreate a custom [`SDL_Storage`] object.\n\nIt is not usually necessary to do this; SDL provides standard\nimplementations for many things you might expect to do with an [`SDL_Storage`].\n\nThis structure should be initialized using [`SDL_INIT_INTERFACE()`]\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_INIT_INTERFACE`]\n\n## Notes for `sdl3-sys`\nThis interface struct can be initialized with [`SDL_StorageInterface::new()`] or `Default::default()`.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "version", + doc: None, + available_since: None, + ty: "Uint32", + }, + Field { + name: "close", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "ready", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "enumerate", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "info", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "read_file", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "write_file", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "mkdir", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "remove", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "rename", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "copy", + doc: None, + available_since: None, + ty: "::core::option::Option ::core::primitive::bool>", + }, + Field { + name: "space_remaining", + doc: None, + available_since: None, + ty: "::core::option::Option Uint64>", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/surface.rs b/vendor/sdl3-sys/src/metadata/generated/surface.rs new file mode 100644 index 00000000..3a4f1674 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/surface.rs @@ -0,0 +1,223 @@ +//! Metadata for items in the `crate::surface` module + +use super::*; + +pub const METADATA_SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT: Property = Property { + module: "surface", + name: "SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT", + short_name: "SURFACE_SDR_WHITE_POINT_FLOAT", + value: crate::surface::SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT: Property = Property { + module: "surface", + name: "SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT", + short_name: "SURFACE_HDR_HEADROOM_FLOAT", + value: crate::surface::SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING: Property = Property { + module: "surface", + name: "SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING", + short_name: "SURFACE_TONEMAP_OPERATOR_STRING", + value: crate::surface::SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_SURFACE_HOTSPOT_X_NUMBER: Property = Property { + module: "surface", + name: "SDL_PROP_SURFACE_HOTSPOT_X_NUMBER", + short_name: "SURFACE_HOTSPOT_X_NUMBER", + value: crate::surface::SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER: Property = Property { + module: "surface", + name: "SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER", + short_name: "SURFACE_HOTSPOT_Y_NUMBER", + value: crate::surface::SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_SURFACE_ROTATION_FLOAT: Property = Property { + module: "surface", + name: "SDL_PROP_SURFACE_ROTATION_FLOAT", + short_name: "SURFACE_ROTATION_FLOAT", + value: crate::surface::SDL_PROP_SURFACE_ROTATION_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_SurfaceFlags: Group = Group { + module: "surface", + kind: GroupKind::Flags, + name: "SDL_SurfaceFlags", + short_name: "SurfaceFlags", + doc: Some( + "The flags on an [`SDL_Surface`].\n\nThese are generally considered read-only.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SURFACE_PREALLOCATED", + short_name: "PREALLOCATED", + doc: Some("Surface uses preallocated pixel memory\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SURFACE_LOCK_NEEDED", + short_name: "LOCK_NEEDED", + doc: Some("Surface needs to be locked to access pixels\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SURFACE_LOCKED", + short_name: "LOCKED", + doc: Some("Surface is currently locked\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SURFACE_SIMD_ALIGNED", + short_name: "SIMD_ALIGNED", + doc: Some("Surface uses pixel memory allocated with [`SDL_aligned_alloc()`]\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ScaleMode: Group = Group { + module: "surface", + kind: GroupKind::Enum, + name: "SDL_ScaleMode", + short_name: "ScaleMode", + doc: Some("The scaling mode.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n"), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SCALEMODE_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SCALEMODE_NEAREST", + short_name: "NEAREST", + doc: Some("nearest pixel sampling\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCALEMODE_LINEAR", + short_name: "LINEAR", + doc: Some("linear filtering\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SCALEMODE_PIXELART", + short_name: "PIXELART", + doc: Some( + "nearest pixel sampling with improved scaling for pixel art, available since SDL 3.4.0\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_FlipMode: Group = Group { + module: "surface", + kind: GroupKind::Flags, + name: "SDL_FlipMode", + short_name: "FlipMode", + doc: Some("The flip mode.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n"), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_FLIP_NONE", + short_name: "NONE", + doc: Some("Do not flip\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FLIP_HORIZONTAL", + short_name: "HORIZONTAL", + doc: Some("flip horizontally\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FLIP_VERTICAL", + short_name: "VERTICAL", + doc: Some("flip vertically\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FLIP_HORIZONTAL_AND_VERTICAL", + short_name: "HORIZONTAL_AND_VERTICAL", + doc: Some("flip horizontally and vertically (not a diagonal flip)\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Surface: Struct = Struct { + module: "surface", + kind: StructKind::Struct, + name: "SDL_Surface", + doc: None, + available_since: None, + fields: &[ + Field { + name: "flags", + doc: Some("The flags of the surface, read-only\n"), + available_since: None, + ty: "SDL_SurfaceFlags", + }, + Field { + name: "format", + doc: Some("The format of the surface, read-only\n"), + available_since: None, + ty: "SDL_PixelFormat", + }, + Field { + name: "w", + doc: Some("The width of the surface, read-only.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "h", + doc: Some("The height of the surface, read-only.\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "pitch", + doc: Some("The distance in bytes between rows of pixels, read-only\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "pixels", + doc: Some( + "A pointer to the pixels of the surface, the pixels are writeable if non-NULL\n", + ), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + Field { + name: "refcount", + doc: Some("Application reference count, used when freeing surface\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "reserved", + doc: Some("Reserved for internal use\n"), + available_since: None, + ty: "*mut ::core::ffi::c_void", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/system.rs b/vendor/sdl3-sys/src/metadata/generated/system.rs new file mode 100644 index 00000000..3e3b5224 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/system.rs @@ -0,0 +1,46 @@ +//! Metadata for items in the `crate::system` module + +use super::*; + +pub const METADATA_SDL_Sandbox: Group = Group { + module: "system", + kind: GroupKind::Enum, + name: "SDL_Sandbox", + short_name: "Sandbox", + doc: Some( + "Application sandbox environment.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SANDBOX_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SANDBOX_UNKNOWN_CONTAINER", + short_name: "UNKNOWN_CONTAINER", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SANDBOX_FLATPAK", + short_name: "FLATPAK", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SANDBOX_SNAP", + short_name: "SNAP", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_SANDBOX_MACOS", + short_name: "MACOS", + doc: None, + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/thread.rs b/vendor/sdl3-sys/src/metadata/generated/thread.rs new file mode 100644 index 00000000..4308ffc8 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/thread.rs @@ -0,0 +1,136 @@ +//! Metadata for items in the `crate::thread` module + +use super::*; + +pub const METADATA_SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER: Property = Property { + module: "thread", + name: "SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER", + short_name: "THREAD_CREATE_ENTRY_FUNCTION_POINTER", + value: crate::thread::SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_THREAD_CREATE_NAME_STRING: Property = Property { + module: "thread", + name: "SDL_PROP_THREAD_CREATE_NAME_STRING", + short_name: "THREAD_CREATE_NAME_STRING", + value: crate::thread::SDL_PROP_THREAD_CREATE_NAME_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_THREAD_CREATE_USERDATA_POINTER: Property = Property { + module: "thread", + name: "SDL_PROP_THREAD_CREATE_USERDATA_POINTER", + short_name: "THREAD_CREATE_USERDATA_POINTER", + value: crate::thread::SDL_PROP_THREAD_CREATE_USERDATA_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER: Property = Property { + module: "thread", + name: "SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER", + short_name: "THREAD_CREATE_STACKSIZE_NUMBER", + value: crate::thread::SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_ThreadID: Group = Group { + module: "thread", + kind: GroupKind::Id, + name: "SDL_ThreadID", + short_name: "ThreadID", + doc: Some( + "A unique numeric ID that identifies a thread.\n\nThese are different from [`SDL_Thread`] objects, which are generally what an\napplication will operate on, but having a way to uniquely identify a thread\ncan be useful at times.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetThreadID`]\n- [`SDL_GetCurrentThreadID`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_TLSID: Group = Group { + module: "thread", + kind: GroupKind::Id, + name: "SDL_TLSID", + short_name: "TLSID", + doc: Some( + "Thread local storage ID.\n\n0 is the invalid ID. An app can create these and then set data for these\nIDs that is unique to each thread.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetTLS`]\n- [`SDL_SetTLS`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_ThreadPriority: Group = Group { + module: "thread", + kind: GroupKind::Enum, + name: "SDL_ThreadPriority", + short_name: "ThreadPriority", + doc: Some( + "The SDL thread priority.\n\nSDL will make system changes as necessary in order to apply the thread\npriority. Code which attempts to control thread state related to priority\nshould be aware that calling [`SDL_SetCurrentThreadPriority`] may alter such\nstate. [`SDL_HINT_THREAD_PRIORITY_POLICY`] can be used to control aspects of\nthis behavior.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_THREAD_PRIORITY_LOW", + short_name: "LOW", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_THREAD_PRIORITY_NORMAL", + short_name: "NORMAL", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_THREAD_PRIORITY_HIGH", + short_name: "HIGH", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_THREAD_PRIORITY_TIME_CRITICAL", + short_name: "TIME_CRITICAL", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ThreadState: Group = Group { + module: "thread", + kind: GroupKind::Enum, + name: "SDL_ThreadState", + short_name: "ThreadState", + doc: Some( + "The SDL thread state.\n\nThe current state of a thread can be checked by calling [`SDL_GetThreadState`].\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetThreadState`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_THREAD_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("The thread is not valid\n"), + available_since: None, + }, + GroupValue { + name: "SDL_THREAD_ALIVE", + short_name: "ALIVE", + doc: Some("The thread is currently running\n"), + available_since: None, + }, + GroupValue { + name: "SDL_THREAD_DETACHED", + short_name: "DETACHED", + doc: Some("The thread is detached and can't be waited on\n"), + available_since: None, + }, + GroupValue { + name: "SDL_THREAD_COMPLETE", + short_name: "COMPLETE", + doc: Some( + "The thread has finished and should be cleaned up with [`SDL_WaitThread()`]\n", + ), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/time.rs b/vendor/sdl3-sys/src/metadata/generated/time.rs new file mode 100644 index 00000000..eabd94ff --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/time.rs @@ -0,0 +1,123 @@ +//! Metadata for items in the `crate::time` module + +use super::*; + +pub const METADATA_SDL_DateFormat: Group = Group { + module: "time", + kind: GroupKind::Enum, + name: "SDL_DateFormat", + short_name: "DateFormat", + doc: Some( + "The preferred date format of the current system locale.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetDateTimeLocalePreferences`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_DATE_FORMAT_YYYYMMDD", + short_name: "YYYYMMDD", + doc: Some("Year/Month/Day\n"), + available_since: None, + }, + GroupValue { + name: "SDL_DATE_FORMAT_DDMMYYYY", + short_name: "DDMMYYYY", + doc: Some("Day/Month/Year\n"), + available_since: None, + }, + GroupValue { + name: "SDL_DATE_FORMAT_MMDDYYYY", + short_name: "MMDDYYYY", + doc: Some("Month/Day/Year\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_TimeFormat: Group = Group { + module: "time", + kind: GroupKind::Enum, + name: "SDL_TimeFormat", + short_name: "TimeFormat", + doc: Some( + "The preferred time format of the current system locale.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetDateTimeLocalePreferences`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_TIME_FORMAT_24HR", + short_name: "_24HR", + doc: Some("24 hour time\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TIME_FORMAT_12HR", + short_name: "_12HR", + doc: Some("12 hour time\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_DateTime: Struct = Struct { + module: "time", + kind: StructKind::Struct, + name: "SDL_DateTime", + doc: Some( + "A structure holding a calendar date and time broken down into its\ncomponents.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "year", + doc: Some("Year\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "month", + doc: Some("Month \\[01-12\\]\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "day", + doc: Some("Day of the month \\[01-31\\]\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "hour", + doc: Some("Hour \\[0-23\\]\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "minute", + doc: Some("Minute \\[0-59\\]\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "second", + doc: Some("Seconds \\[0-60\\]\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "nanosecond", + doc: Some("Nanoseconds \\[0-999999999\\]\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "day_of_week", + doc: Some("Day of the week \\[0-6\\] (0 being Sunday)\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "utc_offset", + doc: Some("Seconds east of UTC\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/timer.rs b/vendor/sdl3-sys/src/metadata/generated/timer.rs new file mode 100644 index 00000000..ec1c97cf --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/timer.rs @@ -0,0 +1,15 @@ +//! Metadata for items in the `crate::timer` module + +use super::*; + +pub const METADATA_SDL_TimerID: Group = Group { + module: "timer", + kind: GroupKind::Id, + name: "SDL_TimerID", + short_name: "TimerID", + doc: Some( + "Definition of the timer ID type.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/touch.rs b/vendor/sdl3-sys/src/metadata/generated/touch.rs new file mode 100644 index 00000000..89532bb8 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/touch.rs @@ -0,0 +1,97 @@ +//! Metadata for items in the `crate::touch` module + +use super::*; + +pub const METADATA_SDL_TouchID: Group = Group { + module: "touch", + kind: GroupKind::Id, + name: "SDL_TouchID", + short_name: "TouchID", + doc: Some( + "A unique ID for a touch device.\n\nThis ID is valid for the time the device is connected to the system, and is\nnever reused for the lifetime of the application.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_FingerID: Group = Group { + module: "touch", + kind: GroupKind::Id, + name: "SDL_FingerID", + short_name: "FingerID", + doc: Some( + "A unique ID for a single finger on a touch device.\n\nThis ID is valid for the time the finger (stylus, etc) is touching and will\nbe unique for all fingers currently in contact, so this ID tracks the\nlifetime of a single continuous touch. This value may represent an index, a\npointer, or some other unique ID, depending on the platform.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_TouchDeviceType: Group = Group { + module: "touch", + kind: GroupKind::Enum, + name: "SDL_TouchDeviceType", + short_name: "TouchDeviceType", + doc: Some( + "An enum that describes the type of a touch device.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_TOUCH_DEVICE_INVALID", + short_name: "INVALID", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_TOUCH_DEVICE_DIRECT", + short_name: "DIRECT", + doc: Some("touch screen with window-relative coordinates\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE", + short_name: "INDIRECT_ABSOLUTE", + doc: Some("trackpad with absolute device coordinates\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TOUCH_DEVICE_INDIRECT_RELATIVE", + short_name: "INDIRECT_RELATIVE", + doc: Some("trackpad with screen cursor-relative coordinates\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_Finger: Struct = Struct { + module: "touch", + kind: StructKind::Struct, + name: "SDL_Finger", + doc: Some( + "Data about a single finger in a multitouch event.\n\nEach touch event is a collection of fingers that are simultaneously in\ncontact with the touch device (so a \"touch\" can be a \"multitouch,\" in\nreality), and this struct reports details of the specific fingers.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetTouchFingers`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "id", + doc: Some("the finger ID\n"), + available_since: None, + ty: "SDL_FingerID", + }, + Field { + name: "x", + doc: Some("the x-axis location of the touch event, normalized (0...1)\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "y", + doc: Some("the y-axis location of the touch event, normalized (0...1)\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "pressure", + doc: Some("the quantity of pressure applied, normalized (0...1)\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/tray.rs b/vendor/sdl3-sys/src/metadata/generated/tray.rs new file mode 100644 index 00000000..b6d4b773 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/tray.rs @@ -0,0 +1,46 @@ +//! Metadata for items in the `crate::tray` module + +use super::*; + +pub const METADATA_SDL_TrayEntryFlags: Group = Group { + module: "tray", + kind: GroupKind::Flags, + name: "SDL_TrayEntryFlags", + short_name: "TrayEntryFlags", + doc: Some( + "Flags that control the creation of system tray entries.\n\nSome of these flags are required; exactly one of them must be specified at\nthe time a tray entry is created. Other flags are optional; zero or more of\nthose can be OR'ed together with the required flag.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_InsertTrayEntryAt`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_TRAYENTRY_BUTTON", + short_name: "BUTTON", + doc: Some("Make the entry a simple button. Required.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRAYENTRY_CHECKBOX", + short_name: "CHECKBOX", + doc: Some("Make the entry a checkbox. Required.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRAYENTRY_SUBMENU", + short_name: "SUBMENU", + doc: Some("Prepare the entry to have a submenu. Required\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRAYENTRY_DISABLED", + short_name: "DISABLED", + doc: Some("Make the entry disabled. Optional.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_TRAYENTRY_CHECKED", + short_name: "CHECKED", + doc: Some("Make the entry checked. This is valid only for checkboxes. Optional.\n"), + available_since: None, + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/version.rs b/vendor/sdl3-sys/src/metadata/generated/version.rs new file mode 100644 index 00000000..4b4c5c98 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/version.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::version` module + +use super::*; diff --git a/vendor/sdl3-sys/src/metadata/generated/video.rs b/vendor/sdl3-sys/src/metadata/generated/video.rs new file mode 100644 index 00000000..9afdc91b --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/video.rs @@ -0,0 +1,1542 @@ +//! Metadata for items in the `crate::video` module + +use super::*; + +pub const METADATA_SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER", + short_name: "GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER", + value: crate::video::SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, + ty: PropertyType::POINTER, + doc: Some( + "The pointer to the global `wl_display` object used by the Wayland video\nbackend.\n\nCan be set before the video subsystem is initialized to import an external\n`wl_display` object from an application or toolkit for use in SDL, or read\nafter initialization to export the `wl_display` used by the Wayland video\nbackend. Setting this property after the video subsystem has been\ninitialized has no effect, and reading it when the video subsystem is\nuninitialized will either return the user provided value, if one was set\nprior to initialization, or NULL. See docs/README-wayland.md for more\ninformation.\n\n## Availability\nThis macro is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), +}; +pub const METADATA_SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN", + short_name: "DISPLAY_HDR_ENABLED_BOOLEAN", + value: crate::video::SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER", + short_name: "DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER", + value: crate::video::SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER", + short_name: "DISPLAY_WAYLAND_WL_OUTPUT_POINTER", + value: crate::video::SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER", + short_name: "DISPLAY_WINDOWS_HMONITOR_POINTER", + value: crate::video::SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN", + short_name: "WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN", + short_name: "WINDOW_CREATE_BORDERLESS_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN", + short_name: "WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN", + short_name: "WINDOW_CREATE_FOCUSABLE_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN", + short_name: "WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER", + short_name: "WINDOW_CREATE_FLAGS_NUMBER", + value: crate::video::SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN", + short_name: "WINDOW_CREATE_FULLSCREEN_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER", + short_name: "WINDOW_CREATE_HEIGHT_NUMBER", + value: crate::video::SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN", + short_name: "WINDOW_CREATE_HIDDEN_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN", + short_name: "WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN", + short_name: "WINDOW_CREATE_MAXIMIZED_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN", + short_name: "WINDOW_CREATE_MENU_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN", + short_name: "WINDOW_CREATE_METAL_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN", + short_name: "WINDOW_CREATE_MINIMIZED_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN", + short_name: "WINDOW_CREATE_MODAL_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN", + short_name: "WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN", + short_name: "WINDOW_CREATE_OPENGL_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_PARENT_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_PARENT_POINTER", + short_name: "WINDOW_CREATE_PARENT_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_PARENT_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN", + short_name: "WINDOW_CREATE_RESIZABLE_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_TITLE_STRING: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_TITLE_STRING", + short_name: "WINDOW_CREATE_TITLE_STRING", + value: crate::video::SDL_PROP_WINDOW_CREATE_TITLE_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN", + short_name: "WINDOW_CREATE_TRANSPARENT_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN", + short_name: "WINDOW_CREATE_TOOLTIP_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN", + short_name: "WINDOW_CREATE_UTILITY_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN", + short_name: "WINDOW_CREATE_VULKAN_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER", + short_name: "WINDOW_CREATE_WIDTH_NUMBER", + value: crate::video::SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_X_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_X_NUMBER", + short_name: "WINDOW_CREATE_X_NUMBER", + value: crate::video::SDL_PROP_WINDOW_CREATE_X_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_Y_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_Y_NUMBER", + short_name: "WINDOW_CREATE_Y_NUMBER", + value: crate::video::SDL_PROP_WINDOW_CREATE_Y_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER", + short_name: "WINDOW_CREATE_COCOA_WINDOW_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER", + short_name: "WINDOW_CREATE_COCOA_VIEW_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER", + short_name: "WINDOW_CREATE_WINDOWSCENE_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN: Property = + Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN", + short_name: "WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, + }; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN", + short_name: "WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER", + short_name: "WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER", + short_name: "WINDOW_CREATE_WIN32_HWND_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER", + short_name: "WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER", + value: crate::video::SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER", + short_name: "WINDOW_CREATE_X11_WINDOW_NUMBER", + value: crate::video::SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING", + short_name: "WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING", + value: crate::video::SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING", + short_name: "WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING", + value: crate::video::SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_SHAPE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_SHAPE_POINTER", + short_name: "WINDOW_SHAPE_POINTER", + value: crate::video::SDL_PROP_WINDOW_SHAPE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN", + short_name: "WINDOW_HDR_ENABLED_BOOLEAN", + value: crate::video::SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN, + ty: PropertyType::BOOLEAN, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT", + short_name: "WINDOW_SDR_WHITE_LEVEL_FLOAT", + value: crate::video::SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT", + short_name: "WINDOW_HDR_HEADROOM_FLOAT", + value: crate::video::SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT, + ty: PropertyType::FLOAT, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER", + short_name: "WINDOW_ANDROID_WINDOW_POINTER", + value: crate::video::SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER", + short_name: "WINDOW_ANDROID_SURFACE_POINTER", + value: crate::video::SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER", + short_name: "WINDOW_UIKIT_WINDOW_POINTER", + value: crate::video::SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER", + short_name: "WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER", + value: crate::video::SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER", + short_name: "WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER", + value: crate::video::SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER", + short_name: "WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER", + value: crate::video::SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER", + short_name: "WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER", + value: crate::video::SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER", + short_name: "WINDOW_KMSDRM_DEVICE_INDEX_NUMBER", + value: crate::video::SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER", + short_name: "WINDOW_KMSDRM_DRM_FD_NUMBER", + value: crate::video::SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER", + short_name: "WINDOW_KMSDRM_GBM_DEVICE_POINTER", + value: crate::video::SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_COCOA_WINDOW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_COCOA_WINDOW_POINTER", + short_name: "WINDOW_COCOA_WINDOW_POINTER", + value: crate::video::SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER", + short_name: "WINDOW_COCOA_METAL_VIEW_TAG_NUMBER", + value: crate::video::SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER", + short_name: "WINDOW_OPENVR_OVERLAY_ID_NUMBER", + value: crate::video::SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER", + short_name: "WINDOW_VIVANTE_DISPLAY_POINTER", + value: crate::video::SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER", + short_name: "WINDOW_VIVANTE_WINDOW_POINTER", + value: crate::video::SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER", + short_name: "WINDOW_VIVANTE_SURFACE_POINTER", + value: crate::video::SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WIN32_HWND_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WIN32_HWND_POINTER", + short_name: "WINDOW_WIN32_HWND_POINTER", + value: crate::video::SDL_PROP_WINDOW_WIN32_HWND_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WIN32_HDC_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WIN32_HDC_POINTER", + short_name: "WINDOW_WIN32_HDC_POINTER", + value: crate::video::SDL_PROP_WINDOW_WIN32_HDC_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER", + short_name: "WINDOW_WIN32_INSTANCE_POINTER", + value: crate::video::SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER", + short_name: "WINDOW_WAYLAND_DISPLAY_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER", + short_name: "WINDOW_WAYLAND_SURFACE_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER", + short_name: "WINDOW_WAYLAND_VIEWPORT_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER", + short_name: "WINDOW_WAYLAND_EGL_WINDOW_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER", + short_name: "WINDOW_WAYLAND_XDG_SURFACE_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER", + short_name: "WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING", + short_name: "WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER", + short_name: "WINDOW_WAYLAND_XDG_POPUP_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER", + short_name: "WINDOW_WAYLAND_XDG_POSITIONER_POINTER", + value: crate::video::SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_X11_DISPLAY_POINTER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_X11_DISPLAY_POINTER", + short_name: "WINDOW_X11_DISPLAY_POINTER", + value: crate::video::SDL_PROP_WINDOW_X11_DISPLAY_POINTER, + ty: PropertyType::POINTER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_X11_SCREEN_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_X11_SCREEN_NUMBER", + short_name: "WINDOW_X11_SCREEN_NUMBER", + value: crate::video::SDL_PROP_WINDOW_X11_SCREEN_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_X11_WINDOW_NUMBER: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_X11_WINDOW_NUMBER", + short_name: "WINDOW_X11_WINDOW_NUMBER", + value: crate::video::SDL_PROP_WINDOW_X11_WINDOW_NUMBER, + ty: PropertyType::NUMBER, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING", + short_name: "WINDOW_EMSCRIPTEN_CANVAS_ID_STRING", + value: crate::video::SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: Property = Property { + module: "video", + name: "SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING", + short_name: "WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING", + value: crate::video::SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING, + ty: PropertyType::STRING, + doc: None, + available_since: None, +}; +pub const METADATA_SDL_DisplayID: Group = Group { + module: "video", + kind: GroupKind::Id, + name: "SDL_DisplayID", + short_name: "DisplayID", + doc: Some( + "This is a unique ID for a display for the time it is connected to the\nsystem, and is never reused for the lifetime of the application.\n\nIf the display is disconnected and reconnected, it will get a new ID.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_WindowID: Group = Group { + module: "video", + kind: GroupKind::Id, + name: "SDL_WindowID", + short_name: "WindowID", + doc: Some( + "This is a unique ID for a window.\n\nThe value 0 is an invalid ID.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[], +}; +pub const METADATA_SDL_SystemTheme: Group = Group { + module: "video", + kind: GroupKind::Enum, + name: "SDL_SystemTheme", + short_name: "SystemTheme", + doc: Some("System theme.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n"), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_SYSTEM_THEME_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("Unknown system theme\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_THEME_LIGHT", + short_name: "LIGHT", + doc: Some("Light colored system theme\n"), + available_since: None, + }, + GroupValue { + name: "SDL_SYSTEM_THEME_DARK", + short_name: "DARK", + doc: Some("Dark colored system theme\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_DisplayOrientation: Group = Group { + module: "video", + kind: GroupKind::Enum, + name: "SDL_DisplayOrientation", + short_name: "DisplayOrientation", + doc: Some( + "Display orientation values; the way a display is rotated.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_ORIENTATION_UNKNOWN", + short_name: "UNKNOWN", + doc: Some("The display orientation can't be determined\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ORIENTATION_LANDSCAPE", + short_name: "LANDSCAPE", + doc: Some( + "The display is in landscape mode, with the right side up, relative to portrait mode\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_ORIENTATION_LANDSCAPE_FLIPPED", + short_name: "LANDSCAPE_FLIPPED", + doc: Some( + "The display is in landscape mode, with the left side up, relative to portrait mode\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_ORIENTATION_PORTRAIT", + short_name: "PORTRAIT", + doc: Some("The display is in portrait mode\n"), + available_since: None, + }, + GroupValue { + name: "SDL_ORIENTATION_PORTRAIT_FLIPPED", + short_name: "PORTRAIT_FLIPPED", + doc: Some("The display is in portrait mode, upside down\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_WindowFlags: Group = Group { + module: "video", + kind: GroupKind::Flags, + name: "SDL_WindowFlags", + short_name: "WindowFlags", + doc: Some( + "The flags on a window.\n\nThese cover a lot of true/false, or on/off, window state. Some of it is\nimmutable after being set through [`SDL_CreateWindow()`], some of it can be\nchanged on existing windows by the app, and some of it might be altered by\nthe user or system outside of the app's control.\n\nWhen creating windows with [`SDL_WINDOW_RESIZABLE`], SDL will constrain\nresizable windows to the dimensions recommended by the compositor to fit it\nwithin the usable desktop space, although some compositors will do this\nautomatically without intervention as well. Use [`SDL_SetWindowResizable`]\nafter creation instead if you wish to create a window with a specific size.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetWindowFlags`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_WINDOW_FULLSCREEN", + short_name: "FULLSCREEN", + doc: Some("window is in fullscreen mode\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_OPENGL", + short_name: "OPENGL", + doc: Some("window usable with OpenGL context\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_OCCLUDED", + short_name: "OCCLUDED", + doc: Some("window is occluded\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_HIDDEN", + short_name: "HIDDEN", + doc: Some( + "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_BORDERLESS", + short_name: "BORDERLESS", + doc: Some("no window decoration\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_RESIZABLE", + short_name: "RESIZABLE", + doc: Some("window can be resized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MINIMIZED", + short_name: "MINIMIZED", + doc: Some("window is minimized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MAXIMIZED", + short_name: "MAXIMIZED", + doc: Some("window is maximized\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MOUSE_GRABBED", + short_name: "MOUSE_GRABBED", + doc: Some("window has grabbed mouse input\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_INPUT_FOCUS", + short_name: "INPUT_FOCUS", + doc: Some("window has input focus\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MOUSE_FOCUS", + short_name: "MOUSE_FOCUS", + doc: Some("window has mouse focus\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_EXTERNAL", + short_name: "EXTERNAL", + doc: Some("window not created by SDL\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MODAL", + short_name: "MODAL", + doc: Some("window is modal\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_HIGH_PIXEL_DENSITY", + short_name: "HIGH_PIXEL_DENSITY", + doc: Some("window uses high pixel density back buffer if possible\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MOUSE_CAPTURE", + short_name: "MOUSE_CAPTURE", + doc: Some("window has mouse captured (unrelated to MOUSE_GRABBED)\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_MOUSE_RELATIVE_MODE", + short_name: "MOUSE_RELATIVE_MODE", + doc: Some("window has relative mode enabled\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_ALWAYS_ON_TOP", + short_name: "ALWAYS_ON_TOP", + doc: Some("window should always be above others\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_UTILITY", + short_name: "UTILITY", + doc: Some( + "window should be treated as a utility window, not showing in the task bar and window list\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_TOOLTIP", + short_name: "TOOLTIP", + doc: Some( + "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_POPUP_MENU", + short_name: "POPUP_MENU", + doc: Some("window should be treated as a popup menu, requires a parent window\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_KEYBOARD_GRABBED", + short_name: "KEYBOARD_GRABBED", + doc: Some("window has grabbed keyboard input\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_FILL_DOCUMENT", + short_name: "FILL_DOCUMENT", + doc: Some("window is in fill-document mode (Emscripten only), since SDL 3.4.0\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_VULKAN", + short_name: "VULKAN", + doc: Some("window usable for Vulkan surface\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_METAL", + short_name: "METAL", + doc: Some("window usable for Metal view\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_TRANSPARENT", + short_name: "TRANSPARENT", + doc: Some("window with transparent buffer\n"), + available_since: None, + }, + GroupValue { + name: "SDL_WINDOW_NOT_FOCUSABLE", + short_name: "NOT_FOCUSABLE", + doc: Some("window should not be focusable\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_FlashOperation: Group = Group { + module: "video", + kind: GroupKind::Enum, + name: "SDL_FlashOperation", + short_name: "FlashOperation", + doc: Some( + "Window flash operation.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_FLASH_CANCEL", + short_name: "CANCEL", + doc: Some("Cancel any window flash state\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FLASH_BRIEFLY", + short_name: "BRIEFLY", + doc: Some("Flash the window briefly to get attention\n"), + available_since: None, + }, + GroupValue { + name: "SDL_FLASH_UNTIL_FOCUSED", + short_name: "UNTIL_FOCUSED", + doc: Some("Flash the window until it gets focus\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_ProgressState: Group = Group { + module: "video", + kind: GroupKind::Enum, + name: "SDL_ProgressState", + short_name: "ProgressState", + doc: Some( + "Window progress state\n\n## Availability\nThis enum is available since SDL 3.2.8.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 8)), + values: &[ + GroupValue { + name: "SDL_PROGRESS_STATE_INVALID", + short_name: "INVALID", + doc: Some("An invalid progress state indicating an error; check [`SDL_GetError()`]\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROGRESS_STATE_NONE", + short_name: "NONE", + doc: Some("No progress bar is shown\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROGRESS_STATE_INDETERMINATE", + short_name: "INDETERMINATE", + doc: Some("The progress bar is shown in a indeterminate state\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROGRESS_STATE_NORMAL", + short_name: "NORMAL", + doc: Some("The progress bar is shown in a normal state\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROGRESS_STATE_PAUSED", + short_name: "PAUSED", + doc: Some("The progress bar is shown in a paused state\n"), + available_since: None, + }, + GroupValue { + name: "SDL_PROGRESS_STATE_ERROR", + short_name: "ERROR", + doc: Some( + "The progress bar is shown in a state indicating the application had an error\n", + ), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GLAttr: Group = Group { + module: "video", + kind: GroupKind::Enum, + name: "SDL_GLAttr", + short_name: "GLAttr", + doc: Some( + "An enumeration of OpenGL configuration attributes.\n\nWhile you can set most OpenGL attributes normally, the attributes listed\nabove must be known before SDL creates the window that will be used with\nthe OpenGL context. These attributes are set and read with\n[`SDL_GL_SetAttribute()`] and [`SDL_GL_GetAttribute()`].\n\nIn some cases, these attributes are minimum requests; the GL does not\npromise to give you exactly what you asked for. It's possible to ask for a\n16-bit depth buffer and get a 24-bit one instead, for example, or to ask\nfor no stencil buffer and still have one available. Context creation should\nfail if the GL can't provide your requested attributes at a minimum, but\nyou should check to see exactly what you got.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GL_RED_SIZE", + short_name: "RED_SIZE", + doc: Some( + "the minimum number of bits for the red channel of the color buffer; defaults to 8.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_GREEN_SIZE", + short_name: "GREEN_SIZE", + doc: Some( + "the minimum number of bits for the green channel of the color buffer; defaults to 8.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_BLUE_SIZE", + short_name: "BLUE_SIZE", + doc: Some( + "the minimum number of bits for the blue channel of the color buffer; defaults to 8.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_ALPHA_SIZE", + short_name: "ALPHA_SIZE", + doc: Some( + "the minimum number of bits for the alpha channel of the color buffer; defaults to 8.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_BUFFER_SIZE", + short_name: "BUFFER_SIZE", + doc: Some("the minimum number of bits for frame buffer size; defaults to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_DOUBLEBUFFER", + short_name: "DOUBLEBUFFER", + doc: Some( + "whether the output is single or double buffered; defaults to double buffering on.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_DEPTH_SIZE", + short_name: "DEPTH_SIZE", + doc: Some("the minimum number of bits in the depth buffer; defaults to 16.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_STENCIL_SIZE", + short_name: "STENCIL_SIZE", + doc: Some("the minimum number of bits in the stencil buffer; defaults to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_ACCUM_RED_SIZE", + short_name: "ACCUM_RED_SIZE", + doc: Some( + "the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_ACCUM_GREEN_SIZE", + short_name: "ACCUM_GREEN_SIZE", + doc: Some( + "the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_ACCUM_BLUE_SIZE", + short_name: "ACCUM_BLUE_SIZE", + doc: Some( + "the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_ACCUM_ALPHA_SIZE", + short_name: "ACCUM_ALPHA_SIZE", + doc: Some( + "the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_STEREO", + short_name: "STEREO", + doc: Some("whether the output is stereo 3D; defaults to off.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_MULTISAMPLEBUFFERS", + short_name: "MULTISAMPLEBUFFERS", + doc: Some("the number of buffers used for multisample anti-aliasing; defaults to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_MULTISAMPLESAMPLES", + short_name: "MULTISAMPLESAMPLES", + doc: Some( + "the number of samples used around the current pixel used for multisample anti-aliasing.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_ACCELERATED_VISUAL", + short_name: "ACCELERATED_VISUAL", + doc: Some( + "set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_RETAINED_BACKING", + short_name: "RETAINED_BACKING", + doc: Some("not used (deprecated).\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_MAJOR_VERSION", + short_name: "CONTEXT_MAJOR_VERSION", + doc: Some("OpenGL context major version.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_MINOR_VERSION", + short_name: "CONTEXT_MINOR_VERSION", + doc: Some("OpenGL context minor version.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_FLAGS", + short_name: "CONTEXT_FLAGS", + doc: Some( + "some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_PROFILE_MASK", + short_name: "CONTEXT_PROFILE_MASK", + doc: Some( + "type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_SHARE_WITH_CURRENT_CONTEXT", + short_name: "SHARE_WITH_CURRENT_CONTEXT", + doc: Some("OpenGL context sharing; defaults to 0.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_FRAMEBUFFER_SRGB_CAPABLE", + short_name: "FRAMEBUFFER_SRGB_CAPABLE", + doc: Some( + "requests sRGB-capable visual if 1. Defaults to -1 (\"don't care\"). This is a request; GL drivers might not comply!\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_RELEASE_BEHAVIOR", + short_name: "CONTEXT_RELEASE_BEHAVIOR", + doc: Some( + "sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_RESET_NOTIFICATION", + short_name: "CONTEXT_RESET_NOTIFICATION", + doc: Some( + "set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION.\n", + ), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_NO_ERROR", + short_name: "CONTEXT_NO_ERROR", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_FLOATBUFFERS", + short_name: "FLOATBUFFERS", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_EGL_PLATFORM", + short_name: "EGL_PLATFORM", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GLProfile: Group = Group { + module: "video", + kind: GroupKind::Flags, + name: "SDL_GLProfile", + short_name: "GLProfile", + doc: Some( + "Possible values to be set for the [`SDL_GL_CONTEXT_PROFILE_MASK`] attribute.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GL_CONTEXT_PROFILE_CORE", + short_name: "CORE", + doc: Some("OpenGL Core Profile context\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_PROFILE_COMPATIBILITY", + short_name: "COMPATIBILITY", + doc: Some("OpenGL Compatibility Profile context\n"), + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_PROFILE_ES", + short_name: "ES", + doc: Some("GLX_CONTEXT_ES2_PROFILE_BIT_EXT\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GLContextFlag: Group = Group { + module: "video", + kind: GroupKind::Flags, + name: "SDL_GLContextFlag", + short_name: "GLContextFlag", + doc: Some( + "Possible flags to be set for the [`SDL_GL_CONTEXT_FLAGS`] attribute.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GL_CONTEXT_DEBUG_FLAG", + short_name: "DEBUG_FLAG", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG", + short_name: "FORWARD_COMPATIBLE_FLAG", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG", + short_name: "ROBUST_ACCESS_FLAG", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_RESET_ISOLATION_FLAG", + short_name: "RESET_ISOLATION_FLAG", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GLContextReleaseFlag: Group = Group { + module: "video", + kind: GroupKind::Flags, + name: "SDL_GLContextReleaseFlag", + short_name: "GLContextReleaseFlag", + doc: Some( + "Possible values to be set for the [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR`]\nattribute.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE", + short_name: "NONE", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH", + short_name: "FLUSH", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_GLContextResetNotification: Group = Group { + module: "video", + kind: GroupKind::Flags, + name: "SDL_GLContextResetNotification", + short_name: "GLContextResetNotification", + doc: Some( + "Possible values to be set [`SDL_GL_CONTEXT_RESET_NOTIFICATION`] attribute.\n\n## Availability\nThis datatype is available since SDL 3.2.0.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_GL_CONTEXT_RESET_NO_NOTIFICATION", + short_name: "NO_NOTIFICATION", + doc: None, + available_since: None, + }, + GroupValue { + name: "SDL_GL_CONTEXT_RESET_LOSE_CONTEXT", + short_name: "LOSE_CONTEXT", + doc: None, + available_since: None, + }, + ], +}; +pub const METADATA_SDL_HitTestResult: Group = Group { + module: "video", + kind: GroupKind::Enum, + name: "SDL_HitTestResult", + short_name: "HitTestResult", + doc: Some( + "Possible return values from the [`SDL_HitTest`] callback.\n\n## Thread safety\nThis function should only be called on the main thread.\n\n## Availability\nThis enum is available since SDL 3.2.0.\n\n## See also\n- [`SDL_HitTest`]\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + values: &[ + GroupValue { + name: "SDL_HITTEST_NORMAL", + short_name: "NORMAL", + doc: Some("Region is normal. No special properties.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_DRAGGABLE", + short_name: "DRAGGABLE", + doc: Some("Region can drag entire window.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_TOPLEFT", + short_name: "RESIZE_TOPLEFT", + doc: Some("Region is the resizable top-left corner border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_TOP", + short_name: "RESIZE_TOP", + doc: Some("Region is the resizable top border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_TOPRIGHT", + short_name: "RESIZE_TOPRIGHT", + doc: Some("Region is the resizable top-right corner border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_RIGHT", + short_name: "RESIZE_RIGHT", + doc: Some("Region is the resizable right border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_BOTTOMRIGHT", + short_name: "RESIZE_BOTTOMRIGHT", + doc: Some("Region is the resizable bottom-right corner border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_BOTTOM", + short_name: "RESIZE_BOTTOM", + doc: Some("Region is the resizable bottom border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_BOTTOMLEFT", + short_name: "RESIZE_BOTTOMLEFT", + doc: Some("Region is the resizable bottom-left corner border.\n"), + available_since: None, + }, + GroupValue { + name: "SDL_HITTEST_RESIZE_LEFT", + short_name: "RESIZE_LEFT", + doc: Some("Region is the resizable left border.\n"), + available_since: None, + }, + ], +}; +pub const METADATA_SDL_DisplayMode: Struct = Struct { + module: "video", + kind: StructKind::Struct, + name: "SDL_DisplayMode", + doc: Some( + "The structure that defines a display mode.\n\n## Availability\nThis struct is available since SDL 3.2.0.\n\n## See also\n- [`SDL_GetFullscreenDisplayModes`]\n- [`SDL_GetDesktopDisplayMode`]\n- [`SDL_GetCurrentDisplayMode`]\n- [`SDL_SetWindowFullscreenMode`]\n- [`SDL_GetWindowFullscreenMode`]\n\n## Notes for `sdl3-sys`\nThis struct can't be created manually. Use the corresponding SDL functions.\n", + ), + available_since: Some(SDL_VERSIONNUM(3, 2, 0)), + fields: &[ + Field { + name: "displayID", + doc: Some("the display this mode is associated with\n"), + available_since: None, + ty: "SDL_DisplayID", + }, + Field { + name: "format", + doc: Some("pixel format\n"), + available_since: None, + ty: "SDL_PixelFormat", + }, + Field { + name: "w", + doc: Some("width\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "h", + doc: Some("height\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "pixel_density", + doc: Some( + "scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels)\n", + ), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "refresh_rate", + doc: Some("refresh rate (or 0.0f for unspecified)\n"), + available_since: None, + ty: "::core::ffi::c_float", + }, + Field { + name: "refresh_rate_numerator", + doc: Some("precise refresh rate numerator (or 0 for unspecified)\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "refresh_rate_denominator", + doc: Some("precise refresh rate denominator\n"), + available_since: None, + ty: "::core::ffi::c_int", + }, + Field { + name: "internal", + doc: Some("Private\n"), + available_since: None, + ty: "*mut SDL_DisplayModeData", + }, + ], +}; diff --git a/vendor/sdl3-sys/src/metadata/generated/vulkan.rs b/vendor/sdl3-sys/src/metadata/generated/vulkan.rs new file mode 100644 index 00000000..4636e123 --- /dev/null +++ b/vendor/sdl3-sys/src/metadata/generated/vulkan.rs @@ -0,0 +1,3 @@ +//! Metadata for items in the `crate::vulkan` module + +use super::*;