//
// Generated by Brutal.Sdl.Generate; do not edit by hand.
#nullable enable
namespace Brutal.SdlApi
{
public readonly unsafe partial struct SdlCursor
{
///
/// Free a previously-created cursor.
///
///
///
/// Use this function to free cursor resources created with SDL_CreateCursor(),
/// SDL_CreateColorCursor() or SDL_CreateSystemCursor().
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public void Destroy()
{
if (IsNull())
{
return;
}
Sdl.Mouse.DestroyCursor(this);
}
///
/// Set the active cursor.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool Set() => Sdl.Mouse.SetCursor(this);
}
public readonly unsafe partial struct SdlGamepad
{
///
/// Close a gamepad previously opened with SDL_OpenGamepad().
///
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public void Close()
{
if (IsNull())
{
return;
}
Sdl.Gamepad.CloseGamepad(this);
}
///
/// Check if a gamepad has been opened and is currently connected.
///
///
/// true if the gamepad has been opened and is currently connected, or
/// false if not.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Connected() => Sdl.Gamepad.GamepadConnected(this);
///
/// Query whether a gamepad has a given axis.
///
/// an axis enum value (an SDL_GamepadAxis value).
/// true if the gamepad has this axis, false otherwise.
///
///
/// This merely reports whether the gamepad's mapping defined this axis, as
/// that is all the information SDL has about the physical device.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool HasAxis(SdlGamepadAxis axis) => Sdl.Gamepad.GamepadHasAxis(this, axis);
///
/// Query whether a gamepad has a given button.
///
/// a button enum value (an SDL_GamepadButton value).
/// true if the gamepad has this button, false otherwise.
///
///
/// This merely reports whether the gamepad's mapping defined this button, as
/// that is all the information SDL has about the physical device.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool HasButton(SdlGamepadButton button) => Sdl.Gamepad.GamepadHasButton(this, button);
///
/// Return whether a gamepad has a particular sensor.
///
/// the type of sensor to query.
/// true if the sensor exists, false otherwise.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool HasSensor(SdlSensorType type) => Sdl.Gamepad.GamepadHasSensor(this, type);
///
/// Query whether sensor data reporting is enabled for a gamepad.
///
/// the type of sensor to query.
/// true if the sensor is enabled, false otherwise.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SensorEnabled(SdlSensorType type) => Sdl.Gamepad.GamepadSensorEnabled(this, type);
///
/// Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
///
/// an axis on the gamepad.
/// the sfSymbolsName or NULL if the name can't be found.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetAppleSFSymbolsNameForAxis(SdlGamepadAxis axis) =>
Sdl.Gamepad.GetGamepadAppleSFSymbolsNameForAxis(this, axis);
///
/// Return the sfSymbolsName for a given button on a gamepad on Apple
/// platforms.
///
/// a button on the gamepad.
/// the sfSymbolsName or NULL if the name can't be found.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetAppleSFSymbolsNameForButton(SdlGamepadButton button) =>
Sdl.Gamepad.GetGamepadAppleSFSymbolsNameForButton(this, button);
///
/// Get the current state of an axis control on a gamepad.
///
/// an axis index (one of the SDL_GamepadAxis values).
/// axis state.
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public short GetAxis(SdlGamepadAxis axis) => Sdl.Gamepad.GetGamepadAxis(this, axis);
///
/// Ergonomic wrapper over SDL_GetGamepadBindings.
///
/// The SDL call failed; the message carries the SDL_GetError
/// text.
///
/// SDL returns a freshly SDL_malloc'd buffer for this call; the returned array is a managed copy, and
/// the native buffer is freed with SDL_free before this method returns.
///
public SdlGamepadBinding[] GetBindings() => Sdl.Gamepad.GetGamepadBindings(this);
///
/// Get the current state of a button on a gamepad.
///
/// a button index (one of the SDL_GamepadButton values).
/// true if the button is pressed, false otherwise.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetButton(SdlGamepadButton button) => Sdl.Gamepad.GetGamepadButton(this, button);
///
/// Get the label of a button on a gamepad.
///
/// a button index (one of the SDL_GamepadButton values).
/// the SDL_GamepadButtonLabel enum corresponding to the button label.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public SdlGamepadButtonLabel GetButtonLabel(SdlGamepadButton button) =>
Sdl.Gamepad.GetGamepadButtonLabel(this, button);
///
/// Get the connection state of a gamepad.
///
///
/// the connection state on success or
/// SDL_JOYSTICK_CONNECTION_INVALID on failure; call SDL_GetError()
/// for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public SdlJoystickConnectionState GetConnectionState() => Sdl.Gamepad.GetGamepadConnectionState(this);
///
/// Get the firmware version of an opened gamepad, if available.
///
/// the gamepad firmware version, or zero if unavailable.
///
///
/// If the firmware version isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public ushort GetFirmwareVersion() => Sdl.Gamepad.GetGamepadFirmwareVersion(this);
///
/// Get the instance ID of an opened gamepad.
///
///
/// the instance ID of the specified gamepad on success or 0 on
/// failure; call SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetID() => Sdl.Gamepad.GetGamepadID(this);
///
/// Ergonomic wrapper over SDL_GetGamepadJoystick.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlJoystick GetJoystick() => Sdl.Gamepad.GetGamepadJoystick(this);
///
/// Get the implementation-dependent name for an opened gamepad.
///
///
/// the implementation dependent name for the gamepad, or NULL if
/// there is no name or the identifier passed is invalid.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetName() => Sdl.Gamepad.GetGamepadName(this);
///
/// Get the implementation-dependent path for an opened gamepad.
///
///
/// the implementation dependent path for the gamepad, or NULL if
/// there is no path or the identifier passed is invalid.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetPath() => Sdl.Gamepad.GetGamepadPath(this);
///
/// Get the player index of an opened gamepad.
///
/// the player index for gamepad, or -1 if it's not available.
///
///
/// For XInput gamepads this returns the XInput user index.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public int GetPlayerIndex() => Sdl.Gamepad.GetGamepadPlayerIndex(this);
///
/// Get the battery state of a gamepad.
///
///
/// 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.
///
/// the current battery state.
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public SdlPowerState GetPowerInfo(out int percent) => Sdl.Gamepad.GetGamepadPowerInfo(this, out percent);
///
/// Get the USB product ID of an opened gamepad, if available.
///
/// the USB product ID, or zero if unavailable.
///
///
/// If the product ID isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public ushort GetProduct() => Sdl.Gamepad.GetGamepadProduct(this);
///
/// Get the product version of an opened gamepad, if available.
///
/// the USB product version, or zero if unavailable.
///
///
/// If the product version isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public ushort GetProductVersion() => Sdl.Gamepad.GetGamepadProductVersion(this);
///
/// Get the properties associated with an opened gamepad.
///
///
/// a valid property ID on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// 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
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetProperties() => Sdl.Gamepad.GetGamepadProperties(this);
///
/// Get the current state of a gamepad sensor.
///
/// the type of sensor to query.
/// a pointer filled with the current sensor state.
/// the number of values to write to data.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool GetSensorData(SdlSensorType type, float* data, int num_values) =>
Sdl.Gamepad.GetGamepadSensorData(this, type, data, num_values);
///
/// Get the data rate (number of events per second) of a gamepad sensor.
///
/// the type of sensor to query.
/// the data rate, or 0.0f if the data rate is not available.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public float GetSensorDataRate(SdlSensorType type) => Sdl.Gamepad.GetGamepadSensorDataRate(this, type);
///
/// Get the serial number of an opened gamepad, if available.
///
/// the serial number, or NULL if unavailable.
///
///
/// Returns the serial number of the gamepad, or NULL if it is not available.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public string? GetSerial() => Sdl.Gamepad.GetGamepadSerial(this);
///
/// Get the Steam Input handle of an opened gamepad, if available.
///
/// the gamepad handle, or 0 if unavailable.
///
///
/// Returns an InputHandle_t for the gamepad that can be used with Steam Input
/// API: https://partner.steamgames.com/doc/api/ISteamInput
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public ulong GetSteamHandle() => Sdl.Gamepad.GetGamepadSteamHandle(this);
///
/// Get the type of an opened gamepad.
///
///
/// the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not
/// available.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public SdlGamepadType GetGamepadType() => Sdl.Gamepad.GetGamepadType(this);
///
/// Get the USB vendor ID of an opened gamepad, if available.
///
/// the USB vendor ID, or zero if unavailable.
///
///
/// If the vendor ID isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public ushort GetVendor() => Sdl.Gamepad.GetGamepadVendor(this);
///
/// Get the number of supported simultaneous fingers on a touchpad on a game
/// gamepad.
///
/// a touchpad.
/// number of supported simultaneous fingers.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public int GetNumTouchpadFingers(int touchpad) => Sdl.Gamepad.GetNumGamepadTouchpadFingers(this, touchpad);
///
/// Get the number of touchpads on a gamepad.
///
/// number of touchpads.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public int GetNumTouchpads() => Sdl.Gamepad.GetNumGamepadTouchpads(this);
///
/// Get the type of an opened gamepad, ignoring any mapping override.
///
///
/// the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not
/// available.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public SdlGamepadType GetRealType() => Sdl.Gamepad.GetRealGamepadType(this);
///
/// Start a rumble effect on a gamepad.
///
///
/// the intensity of the low frequency (left)
/// rumble motor, from 0 to 0xFFFF.
///
///
/// the intensity of the high frequency (right)
/// rumble motor, from 0 to 0xFFFF.
///
/// the duration of the rumble effect, in milliseconds.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Rumble(ushort low_frequency_rumble, ushort high_frequency_rumble, uint duration_ms) =>
Sdl.Gamepad.RumbleGamepad(this, low_frequency_rumble, high_frequency_rumble, duration_ms);
///
/// Start a rumble effect in the gamepad's triggers.
///
///
/// the intensity of the left trigger rumble motor, from 0
/// to 0xFFFF.
///
///
/// the intensity of the right trigger rumble motor, from 0
/// to 0xFFFF.
///
/// the duration of the rumble effect, in milliseconds.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RumbleTriggers(ushort left_rumble, ushort right_rumble, uint duration_ms) =>
Sdl.Gamepad.RumbleGamepadTriggers(this, left_rumble, right_rumble, duration_ms);
///
/// Send a gamepad specific effect packet.
///
/// the data to send to the gamepad.
/// the size of the data to send to the gamepad.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool SendEffect(void* data, int size) => Sdl.Gamepad.SendGamepadEffect(this, data, size);
///
/// Update a gamepad's LED color.
///
/// the intensity of the red LED.
/// the intensity of the green LED.
/// the intensity of the blue LED.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool SetLED(byte red, byte green, byte blue) => Sdl.Gamepad.SetGamepadLED(this, red, green, blue);
///
/// Set the player index of an opened gamepad.
///
///
/// player index to assign to this gamepad, or -1 to clear
/// the player index and turn off player LEDs.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetPlayerIndex(int player_index) => Sdl.Gamepad.SetGamepadPlayerIndex(this, player_index);
///
/// Set whether data reporting for a gamepad sensor is enabled.
///
/// the type of sensor to enable/disable.
/// whether data reporting should be enabled.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetSensorEnabled(SdlSensorType type, bool enabled) =>
Sdl.Gamepad.SetGamepadSensorEnabled(this, type, enabled);
}
public readonly unsafe partial struct SdlGpuDevice
{
///
/// Ergonomic wrapper over SDL_CreateGPURenderer. Throws instead of returning a null handle on failure.
///
///
/// the window where rendering is displayed, or NULL to create an
/// offscreen renderer.
///
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlRenderer CreateGpuRenderer(SdlWindow window) => Sdl.Render.CreateGpuRenderer(this, window);
}
public readonly unsafe partial struct SdlJoystick
{
///
/// Close a joystick previously opened with SDL_OpenJoystick().
///
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public void Close()
{
if (IsNull())
{
return;
}
Sdl.Joystick.CloseJoystick(this);
}
///
/// Get the current state of an axis control on a joystick.
///
/// the axis to query; the axis indices start at index 0.
///
/// a 16-bit signed integer representing the current position of the
/// axis or 0 on failure; call SDL_GetError() for more information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public short GetAxis(int axis) => Sdl.Joystick.GetJoystickAxis(this, axis);
///
/// Get the initial state of an axis control on a joystick.
///
/// the axis to query; the axis indices start at index 0.
/// upon return, the initial value is supplied here.
/// true if this axis has any initial value, or false if not.
///
///
/// The state is a value ranging from -32768 to 32767.
///
///
/// The axis indices start at index 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool GetAxisInitialState(int axis, out short state) =>
Sdl.Joystick.GetJoystickAxisInitialState(this, axis, out state);
///
/// Get the ball axis change since the last poll.
///
/// the ball index to query; ball indices start at index 0.
/// stores the difference in the x axis position since the last poll.
/// stores the difference in the y axis position since the last poll.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetBall(int ball, out int dx, out int dy) =>
Sdl.Joystick.GetJoystickBall(this, ball, out dx, out dy);
///
/// Get the current state of a button on a joystick.
///
///
/// the button index to get the state from; indices start at
/// index 0.
///
/// true if the button is pressed, false otherwise.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetButton(int button) => Sdl.Joystick.GetJoystickButton(this, button);
///
/// Get the connection state of a joystick.
///
///
/// the connection state on success or
/// SDL_JOYSTICK_CONNECTION_INVALID on failure; call SDL_GetError()
/// for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public SdlJoystickConnectionState GetConnectionState() => Sdl.Joystick.GetJoystickConnectionState(this);
///
/// Get the firmware version of an opened joystick, if available.
///
///
/// the firmware version of the selected joystick, or 0 if
/// unavailable.
///
///
///
/// If the firmware version isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public ushort GetFirmwareVersion() => Sdl.Joystick.GetJoystickFirmwareVersion(this);
///
/// Get the implementation-dependent GUID for the joystick.
///
///
/// the GUID of the given joystick. If called on an invalid index,
/// this function returns a zero GUID; call SDL_GetError() for more
/// information.
///
///
///
/// This function requires an open joystick.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public SdlGuid GetGuid() => Sdl.Joystick.GetJoystickGuid(this);
///
/// Get the current state of a POV hat on a joystick.
///
/// the hat index to get the state from; indices start at index 0.
/// the current hat position.
///
///
/// The returned value will be one of the SDL_HAT_* values.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public byte GetHat(int hat) => Sdl.Joystick.GetJoystickHat(this, hat);
///
/// Get the instance ID of an opened joystick.
///
///
/// the instance ID of the specified joystick on success or 0 on
/// failure; call SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetID() => Sdl.Joystick.GetJoystickID(this);
///
/// Get the implementation dependent name of a joystick.
///
///
/// the name of the selected joystick. If no name can be found, this
/// function returns NULL; call SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetName() => Sdl.Joystick.GetJoystickName(this);
///
/// Get the implementation dependent path of a joystick.
///
///
/// the path of the selected joystick. If no path can be found, this
/// function returns NULL; call SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetPath() => Sdl.Joystick.GetJoystickPath(this);
///
/// Get the player index of an opened joystick.
///
/// the player index, or -1 if it's not available.
///
///
/// For XInput controllers this returns the XInput user index. Many joysticks
/// will not be able to supply this information.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public int GetPlayerIndex() => Sdl.Joystick.GetJoystickPlayerIndex(this);
///
/// Get the battery state of a joystick.
///
///
/// 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.
///
///
/// the current battery state or SDL_POWERSTATE_ERROR on failure;
/// call SDL_GetError() for more information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public SdlPowerState GetPowerInfo(out int percent) => Sdl.Joystick.GetJoystickPowerInfo(this, out percent);
///
/// Get the USB product ID of an opened joystick, if available.
///
/// the USB product ID of the selected joystick, or 0 if unavailable.
///
///
/// If the product ID isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public ushort GetProduct() => Sdl.Joystick.GetJoystickProduct(this);
///
/// Get the product version of an opened joystick, if available.
///
/// the product version of the selected joystick, or 0 if unavailable.
///
///
/// If the product version isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public ushort GetProductVersion() => Sdl.Joystick.GetJoystickProductVersion(this);
///
/// Get the properties associated with a joystick.
///
///
/// a valid property ID on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// 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
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetProperties() => Sdl.Joystick.GetJoystickProperties(this);
///
/// Get the serial number of an opened joystick, if available.
///
///
/// the serial number of the selected joystick, or NULL if
/// unavailable.
///
///
///
/// Returns the serial number of the joystick, or NULL if it is not available.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public string? GetSerial() => Sdl.Joystick.GetJoystickSerial(this);
///
/// Get the type of an opened joystick.
///
/// the SDL_JoystickType of the selected joystick.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public SdlJoystickType GetJoystickType() => Sdl.Joystick.GetJoystickType(this);
///
/// Get the USB vendor ID of an opened joystick, if available.
///
/// the USB vendor ID of the selected joystick, or 0 if unavailable.
///
///
/// If the vendor ID isn't available this function returns 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public ushort GetVendor() => Sdl.Joystick.GetJoystickVendor(this);
///
/// Get the number of general axis controls on a joystick.
///
///
/// the number of axis controls/number of axes on success or -1 on
/// failure; call SDL_GetError() for more information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public int GetNumAxes() => Sdl.Joystick.GetNumJoystickAxes(this);
///
/// Get the number of trackballs on a joystick.
///
///
/// the number of trackballs on success or -1 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// Joystick trackballs have only relative motion events associated with them
/// and their state cannot be polled.
///
///
/// Most joysticks do not have trackballs.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public int GetNumBalls() => Sdl.Joystick.GetNumJoystickBalls(this);
///
/// Get the number of buttons on a joystick.
///
///
/// the number of buttons on success or -1 on failure; call
/// SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public int GetNumButtons() => Sdl.Joystick.GetNumJoystickButtons(this);
///
/// Get the number of POV hats on a joystick.
///
///
/// the number of POV hats on success or -1 on failure; call
/// SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public int GetNumHats() => Sdl.Joystick.GetNumJoystickHats(this);
///
/// Get the status of a specified joystick.
///
///
/// true if the joystick has been opened, false if it has not; call
/// SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Connected() => Sdl.Joystick.JoystickConnected(this);
///
/// Start a rumble effect.
///
///
/// the intensity of the low frequency (left)
/// rumble motor, from 0 to 0xFFFF.
///
///
/// the intensity of the high frequency (right)
/// rumble motor, from 0 to 0xFFFF.
///
/// the duration of the rumble effect, in milliseconds.
/// true, or false if rumble isn't supported on this joystick.
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Rumble(ushort low_frequency_rumble, ushort high_frequency_rumble, uint duration_ms) =>
Sdl.Joystick.RumbleJoystick(this, low_frequency_rumble, high_frequency_rumble, duration_ms);
///
/// Start a rumble effect in the joystick's triggers.
///
///
/// the intensity of the left trigger rumble motor, from 0
/// to 0xFFFF.
///
///
/// the intensity of the right trigger rumble motor, from 0
/// to 0xFFFF.
///
/// the duration of the rumble effect, in milliseconds.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RumbleTriggers(ushort left_rumble, ushort right_rumble, uint duration_ms) =>
Sdl.Joystick.RumbleJoystickTriggers(this, left_rumble, right_rumble, duration_ms);
///
/// Send a joystick specific effect packet.
///
/// the data to send to the joystick.
/// the size of the data to send to the joystick.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool SendEffect(void* data, int size) => Sdl.Joystick.SendJoystickEffect(this, data, size);
///
/// Send a sensor update for an opened virtual joystick.
///
/// the type of the sensor on the virtual joystick to update.
///
/// a 64-bit timestamp in nanoseconds associated with
/// the sensor reading.
///
/// the data associated with the sensor reading.
/// the number of values pointed to by data.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
///
public bool SendVirtualSensorData(SdlSensorType type, ulong sensor_timestamp, float* data, int num_values) =>
Sdl.Joystick.SendJoystickVirtualSensorData(this, type, sensor_timestamp, data, num_values);
///
/// Update a joystick's LED color.
///
/// the intensity of the red LED.
/// the intensity of the green LED.
/// the intensity of the blue LED.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool SetLED(byte red, byte green, byte blue) => Sdl.Joystick.SetJoystickLED(this, red, green, blue);
///
/// Set the player index of an opened joystick.
///
///
/// player index to assign to this joystick, or -1 to clear
/// the player index and turn off player LEDs.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetPlayerIndex(int player_index) => Sdl.Joystick.SetJoystickPlayerIndex(this, player_index);
///
/// Set the state of an axis on an opened virtual joystick.
///
/// the index of the axis on the virtual joystick to update.
/// the new value for the specified axis.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool SetVirtualAxis(int axis, short value) => Sdl.Joystick.SetJoystickVirtualAxis(this, axis, value);
///
/// Generate ball motion on an opened virtual joystick.
///
/// the index of the ball on the virtual joystick to update.
/// the relative motion on the X axis.
/// the relative motion on the Y axis.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool SetVirtualBall(int ball, short xrel, short yrel) =>
Sdl.Joystick.SetJoystickVirtualBall(this, ball, xrel, yrel);
///
/// Set the state of a button on an opened virtual joystick.
///
/// the index of the button on the virtual joystick to update.
/// true if the button is pressed, false otherwise.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool SetVirtualButton(int button, bool down) =>
Sdl.Joystick.SetJoystickVirtualButton(this, button, down);
///
/// Set the state of a hat on an opened virtual joystick.
///
/// the index of the hat on the virtual joystick to update.
/// the new value for the specified hat.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool SetVirtualHat(int hat, byte value) => Sdl.Joystick.SetJoystickVirtualHat(this, hat, value);
///
/// Set touchpad finger state on an opened virtual joystick.
///
///
/// the index of the touchpad on the virtual joystick to
/// update.
///
/// the index of the finger on the touchpad to set.
/// true if the finger is pressed, false if the finger is released.
///
/// the x coordinate of the finger on the touchpad, normalized 0 to 1,
/// with the origin in the upper left.
///
///
/// the y coordinate of the finger on the touchpad, normalized 0 to 1,
/// with the origin in the upper left.
///
/// the pressure of the finger.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool SetVirtualTouchpad(int touchpad, int finger, bool down, float x, float y, float pressure) =>
Sdl.Joystick.SetJoystickVirtualTouchpad(this, touchpad, finger, down, x, y, pressure);
}
public readonly unsafe partial struct SdlRenderer
{
///
/// Add a set of synchronization semaphores for the current frame.
///
/// the VkPipelineStageFlags for the wait.
///
/// a VkSempahore to wait on before rendering the current
/// frame, or 0 if not needed.
///
///
/// a VkSempahore that SDL will signal when rendering
/// for the current frame is complete, or 0 if not
/// needed.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// It is NOT safe to call this function from two threads at
/// once.
///
///
/// This function is available since SDL 3.2.0.
///
public bool AddVulkanRenderSemaphores(uint wait_stage_mask, long wait_semaphore, long signal_semaphore) =>
Sdl.Render.AddVulkanRenderSemaphores(this, wait_stage_mask, wait_semaphore, signal_semaphore);
///
/// Convert the coordinates in an event to render coordinates.
///
/// the event to modify.
///
/// true if the event is converted or doesn't need conversion, or
/// false on failure; call SDL_GetError() for more information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool ConvertEventToRenderCoordinates(SdlEvent* @event) =>
Sdl.Render.ConvertEventToRenderCoordinates(this, @event);
///
/// Create custom GPU render state.
///
/// a struct describing the GPU render state to create.
///
/// a custom GPU render state or NULL on failure; call SDL_GetError()
/// for more information.
///
///
/// This function should be called on the thread that created the
/// renderer.
///
///
/// This function is available since SDL 3.4.0.
///
///
///
///
public nint CreateGpuRenderState(SdlGpuRenderStateCreateInfo* createinfo) =>
Sdl.Render.CreateGpuRenderState(this, createinfo);
///
/// Ergonomic wrapper over SDL_CreateTexture. Throws instead of returning a null handle on failure.
///
/// one of the enumerated values in SDL_PixelFormat.
/// one of the enumerated values in SDL_TextureAccess.
/// the width of the texture in pixels.
/// the height of the texture in pixels.
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlTexture CreateTexture(SdlPixelFormat format, SdlTextureAccess access, int w, int h) =>
Sdl.Render.CreateTexture(this, format, access, w, h);
///
/// Ergonomic wrapper over SDL_CreateTextureFromSurface. Throws instead of returning a null handle on
/// failure.
///
///
/// the SDL_Surface structure containing pixel data used to fill
/// the texture.
///
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlTexture CreateTextureFromSurface(SdlSurface* surface) =>
Sdl.Render.CreateTextureFromSurface(this, surface);
///
/// Ergonomic wrapper over SDL_CreateTextureWithProperties. Throws instead of returning a null handle
/// on failure.
///
/// the properties to use.
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlTexture CreateTextureWithProperties(uint props) =>
Sdl.Render.CreateTextureWithProperties(this, props);
///
/// Destroy the rendering context for a window and free all associated
/// textures.
///
///
///
/// This should be called before destroying the associated window.
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public void Destroy()
{
if (IsNull())
{
return;
}
Sdl.Render.DestroyRenderer(this);
}
///
/// Force the rendering context to flush any pending commands and state.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Flush() => Sdl.Render.FlushRenderer(this);
///
/// Get the current output size in pixels of a rendering context.
///
/// a pointer filled in with the current width.
/// a pointer filled in with the current height.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetCurrentRenderOutputSize(out int w, out int h) =>
Sdl.Render.GetCurrentRenderOutputSize(this, out w, out h);
///
/// Get default texture scale mode of the given renderer.
///
///
/// a SDL_ScaleMode filled with current default scale mode.
/// See SDL_SetDefaultTextureScaleMode() for the meaning of
/// the value.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
public bool GetDefaultTextureScaleMode(out SdlScaleMode scale_mode) =>
Sdl.Render.GetDefaultTextureScaleMode(this, out scale_mode);
///
/// Ergonomic wrapper over SDL_GetGPURendererDevice.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlGpuDevice GetGpuDevice() => Sdl.Render.GetGpuRendererDevice(this);
///
/// Get the clip rectangle for the current target.
///
///
/// an SDL_Rect structure filled in with the current clipping area
/// or an empty rectangle if clipping is disabled.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Each render target has its own clip rectangle. This function gets the
/// cliprect for the current render target.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetRenderClipRect(SdlRect* rect) => Sdl.Render.GetRenderClipRect(this, rect);
///
/// Get the color scale used for render operations.
///
/// a pointer filled in with the current color scale value.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderColorScale(out float scale) => Sdl.Render.GetRenderColorScale(this, out scale);
///
/// Get the blend mode used for drawing operations.
///
/// a pointer filled in with the current SDL_BlendMode.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderDrawBlendMode(uint* blendMode) => Sdl.Render.GetRenderDrawBlendMode(this, blendMode);
///
/// Get the color used for drawing operations (Rect, Line and Clear).
///
///
/// a pointer filled in with the red value used to draw on the
/// rendering target.
///
///
/// a pointer filled in with the green value used to draw on the
/// rendering target.
///
///
/// a pointer filled in with the blue value used to draw on the
/// rendering target.
///
///
/// a pointer filled in with the alpha value used to draw on the
/// rendering target; usually SDL_ALPHA_OPAQUE (255).
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetRenderDrawColor(out byte r, out byte g, out byte b, out byte a) =>
Sdl.Render.GetRenderDrawColor(this, out r, out g, out b, out a);
///
/// Get the color used for drawing operations (Rect, Line and Clear).
///
///
/// a pointer filled in with the red value used to draw on the
/// rendering target.
///
///
/// a pointer filled in with the green value used to draw on the
/// rendering target.
///
///
/// a pointer filled in with the blue value used to draw on the
/// rendering target.
///
///
/// a pointer filled in with the alpha value used to draw on the
/// rendering target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetRenderDrawColorFloat(out float r, out float g, out float b, out float a) =>
Sdl.Render.GetRenderDrawColorFloat(this, out r, out g, out b, out a);
///
/// Get device independent resolution and presentation mode for rendering.
///
/// an int filled with the logical presentation width.
/// an int filled with the logical presentation height.
///
/// a variable filled with the logical presentation mode being
/// used.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderLogicalPresentation(out int w, out int h, out SdlRendererLogicalPresentation mode) =>
Sdl.Render.GetRenderLogicalPresentation(this, out w, out h, out mode);
///
/// Get the final presentation rectangle for rendering.
///
///
/// a pointer filled in with the final presentation rectangle, may
/// be NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderLogicalPresentationRect(SdlFRect* rect) =>
Sdl.Render.GetRenderLogicalPresentationRect(this, rect);
///
/// Get the output size in pixels of a rendering context.
///
/// a pointer filled in with the width in pixels.
/// a pointer filled in with the height in pixels.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderOutputSize(out int w, out int h) => Sdl.Render.GetRenderOutputSize(this, out w, out h);
///
/// Get the safe area for rendering within the current viewport.
///
///
/// a pointer filled in with the area that is safe for interactive
/// content.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool GetRenderSafeArea(SdlRect* rect) => Sdl.Render.GetRenderSafeArea(this, rect);
///
/// Get the drawing scale for the current target.
///
/// a pointer filled in with the horizontal scaling factor.
/// a pointer filled in with the vertical scaling factor.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Each render target has its own scale. This function gets the scale for the
/// current render target.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderScale(out float scaleX, out float scaleY) =>
Sdl.Render.GetRenderScale(this, out scaleX, out scaleY);
///
/// Ergonomic wrapper over SDL_GetRenderTarget.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlTexture GetRenderTarget() => Sdl.Render.GetRenderTarget(this);
///
/// Get the texture addressing mode used in SDL_RenderGeometry().
///
///
/// a pointer filled in with the SDL_TextureAddressMode to use
/// for horizontal texture coordinates in SDL_RenderGeometry(),
/// may be NULL.
///
///
/// a pointer filled in with the SDL_TextureAddressMode to use
/// for vertical texture coordinates in SDL_RenderGeometry(), may
/// be NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
public bool GetRenderTextureAddressMode(out SdlTextureAddressMode u_mode, out SdlTextureAddressMode v_mode) =>
Sdl.Render.GetRenderTextureAddressMode(this, out u_mode, out v_mode);
///
/// Get VSync of the given renderer.
///
///
/// an int filled with the current vertical refresh sync interval.
/// See SDL_SetRenderVSync() for the meaning of the value.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRenderVSync(out int vsync) => Sdl.Render.GetRenderVSync(this, out vsync);
///
/// Get the drawing area for the current target.
///
/// an SDL_Rect structure filled in with the current drawing area.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Each render target has its own viewport. This function gets the viewport
/// for the current render target.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetRenderViewport(SdlRect* rect) => Sdl.Render.GetRenderViewport(this, rect);
///
/// Ergonomic wrapper over SDL_GetRenderWindow.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlWindow GetRenderWindow() => Sdl.Render.GetRenderWindow(this);
///
/// Get the name of a renderer.
///
///
/// the name of the selected renderer, or NULL on failure; call
/// SDL_GetError() for more information.
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public string? GetName() => Sdl.Render.GetRendererName(this);
///
/// Get the properties associated with a renderer.
///
///
/// a valid property ID on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// 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
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetProperties() => Sdl.Render.GetRendererProperties(this);
///
/// Clear the current rendering target with the drawing color.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderClear() => Sdl.Render.RenderClear(this);
///
/// Get whether clipping is enabled on the given render target.
///
///
/// true if clipping is enabled or false if not; call SDL_GetError()
/// for more information.
///
///
///
/// Each render target has its own clip rectangle. This function checks the
/// cliprect for the current render target.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderClipEnabled() => Sdl.Render.RenderClipEnabled(this);
///
/// Get a point in render coordinates when given a point in window coordinates.
///
/// the x coordinate in window coordinates.
/// the y coordinate in window coordinates.
/// a pointer filled with the x coordinate in render coordinates.
/// a pointer filled with the y coordinate in render coordinates.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This takes into account several states:
///
///
/// - The window dimensions.
/// - The logical presentation settings (SDL_SetRenderLogicalPresentation)
/// - The scale (SDL_SetRenderScale)
/// - The viewport (SDL_SetRenderViewport)
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderCoordinatesFromWindow(float window_x, float window_y, out float x, out float y) =>
Sdl.Render.RenderCoordinatesFromWindow(this, window_x, window_y, out x, out y);
///
/// Get a point in window coordinates when given a point in render coordinates.
///
/// the x coordinate in render coordinates.
/// the y coordinate in render coordinates.
///
/// a pointer filled with the x coordinate in window
/// coordinates.
///
///
/// a pointer filled with the y coordinate in window
/// coordinates.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This takes into account several states:
///
///
/// - The window dimensions.
/// - The logical presentation settings (SDL_SetRenderLogicalPresentation)
/// - The scale (SDL_SetRenderScale)
/// - The viewport (SDL_SetRenderViewport)
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool RenderCoordinatesToWindow(float x, float y, out float window_x, out float window_y) =>
Sdl.Render.RenderCoordinatesToWindow(this, x, y, out window_x, out window_y);
///
/// Draw debug text to an SDL_Renderer.
///
/// the x coordinate where the top-left corner of the text will draw.
/// the y coordinate where the top-left corner of the text will draw.
/// the string to render.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool RenderDebugText(float x, float y, string str) => Sdl.Render.RenderDebugText(this, x, y, str);
///
/// Fill a rectangle on the current rendering target with the drawing color at
/// subpixel precision.
///
///
/// a pointer to the destination rectangle, or NULL for the entire
/// rendering target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderFillRect(SdlFRect* rect) => Sdl.Render.RenderFillRect(this, rect);
///
/// Fill some number of rectangles on the current rendering target with the
/// drawing color at subpixel precision.
///
/// a pointer to an array of destination rectangles.
/// the number of rectangles.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderFillRects(SdlFRect* rects, int count) => Sdl.Render.RenderFillRects(this, rects, count);
///
/// 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).
///
/// (optional) The SDL texture to use.
/// vertices.
/// number of vertices.
///
/// (optional) An array of integer indices into the 'vertices'
/// array, if NULL all vertices will be rendered in sequential
/// order.
///
/// number of indices.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderGeometry(
SdlTexture texture,
SdlVertex* vertices,
int num_vertices,
int* indices,
int num_indices
) => Sdl.Render.RenderGeometry(this, texture, vertices, num_vertices, indices, num_indices);
///
/// 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).
///
/// (optional) The SDL texture to use.
/// vertex positions.
/// byte size to move from one element to the next element.
/// vertex colors (as SDL_FColor).
/// byte size to move from one element to the next element.
/// vertex normalized texture coordinates.
/// byte size to move from one element to the next element.
/// number of vertices.
///
/// (optional) An array of indices into the 'vertices' arrays,
/// if NULL all vertices will be rendered in sequential order.
///
/// number of indices.
/// index size: 1 (byte), 2 (short), 4 (int).
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderGeometryRaw(
SdlTexture texture,
float* xy,
int xy_stride,
SdlFColor* color,
int color_stride,
float* uv,
int uv_stride,
int num_vertices,
void* indices,
int num_indices,
int size_indices
) =>
Sdl.Render.RenderGeometryRaw(
this,
texture,
xy,
xy_stride,
color,
color_stride,
uv,
uv_stride,
num_vertices,
indices,
num_indices,
size_indices
);
///
/// Draw a line on the current rendering target at subpixel precision.
///
/// the x coordinate of the start point.
/// the y coordinate of the start point.
/// the x coordinate of the end point.
/// the y coordinate of the end point.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderLine(float x1, float y1, float x2, float y2) => Sdl.Render.RenderLine(this, x1, y1, x2, y2);
///
/// Draw a series of connected lines on the current rendering target at
/// subpixel precision.
///
/// the points along the lines.
/// the number of points, drawing count-1 lines.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderLines(SdlFPoint* points, int count) => Sdl.Render.RenderLines(this, points, count);
///
/// Draw a point on the current rendering target at subpixel precision.
///
/// the x coordinate of the point.
/// the y coordinate of the point.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderPoint(float x, float y) => Sdl.Render.RenderPoint(this, x, y);
///
/// Draw multiple points on the current rendering target at subpixel precision.
///
/// the points to draw.
/// the number of points to draw.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderPoints(SdlFPoint* points, int count) => Sdl.Render.RenderPoints(this, points, count);
///
/// Update the screen with any rendering performed since the previous call.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
///
///
///
///
///
///
///
///
public bool RenderPresent() => Sdl.Render.RenderPresent(this);
///
/// Draw a rectangle on the current rendering target at subpixel precision.
///
///
/// a pointer to the destination rectangle, or NULL to outline the
/// entire rendering target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderRect(SdlFRect* rect) => Sdl.Render.RenderRect(this, rect);
///
/// Draw some number of rectangles on the current rendering target at subpixel
/// precision.
///
/// a pointer to an array of destination rectangles.
/// the number of rectangles.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderRects(SdlFRect* rects, int count) => Sdl.Render.RenderRects(this, rects, count);
///
/// Copy a portion of the texture to the current rendering target at subpixel
/// precision.
///
/// the source texture.
///
/// a pointer to the source rectangle, or NULL for the entire
/// texture.
///
///
/// a pointer to the destination rectangle, or NULL for the
/// entire rendering target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderTexture(SdlTexture texture, SdlFRect* srcrect, SdlFRect* dstrect) =>
Sdl.Render.RenderTexture(this, texture, srcrect, dstrect);
///
/// Perform a scaled copy using the 9-grid algorithm to the current rendering
/// target at subpixel precision.
///
/// the source texture.
///
/// the SDL_Rect structure representing the rectangle to be used
/// for the 9-grid, or NULL to use the entire texture.
///
/// the width, in pixels, of the left corners in srcrect.
/// the width, in pixels, of the right corners in srcrect.
/// the height, in pixels, of the top corners in srcrect.
///
/// the height, in pixels, of the bottom corners in
/// srcrect.
///
///
/// the scale used to transform the corner of srcrect into the
/// corner of dstrect, or 0.0f for an unscaled copy.
///
///
/// a pointer to the destination rectangle, or NULL for the
/// entire rendering target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderTexture9Grid(
SdlTexture texture,
SdlFRect* srcrect,
float left_width,
float right_width,
float top_height,
float bottom_height,
float scale,
SdlFRect* dstrect
) =>
Sdl.Render.RenderTexture9Grid(
this,
texture,
srcrect,
left_width,
right_width,
top_height,
bottom_height,
scale,
dstrect
);
///
/// Perform a scaled copy using the 9-grid algorithm to the current rendering
/// target at subpixel precision.
///
/// the source texture.
///
/// the SDL_Rect structure representing the rectangle to be used
/// for the 9-grid, or NULL to use the entire texture.
///
/// the width, in pixels, of the left corners in srcrect.
/// the width, in pixels, of the right corners in srcrect.
/// the height, in pixels, of the top corners in srcrect.
///
/// the height, in pixels, of the bottom corners in
/// srcrect.
///
///
/// the scale used to transform the corner of srcrect into the
/// corner of dstrect, or 0.0f for an unscaled copy.
///
///
/// a pointer to the destination rectangle, or NULL for the
/// entire rendering target.
///
///
/// 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.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
///
public bool RenderTexture9GridTiled(
SdlTexture texture,
SdlFRect* srcrect,
float left_width,
float right_width,
float top_height,
float bottom_height,
float scale,
SdlFRect* dstrect,
float tileScale
) =>
Sdl.Render.RenderTexture9GridTiled(
this,
texture,
srcrect,
left_width,
right_width,
top_height,
bottom_height,
scale,
dstrect,
tileScale
);
///
/// Copy a portion of the source texture to the current rendering target, with
/// affine transform, at subpixel precision.
///
/// the source texture.
///
/// a pointer to the source rectangle, or NULL for the entire
/// texture.
///
///
/// 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.
///
///
/// 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.
///
///
/// 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.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// You may only call this function from the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderTextureAffine(
SdlTexture texture,
SdlFRect* srcrect,
SdlFPoint* origin,
SdlFPoint* right,
SdlFPoint* down
) => Sdl.Render.RenderTextureAffine(this, texture, srcrect, origin, right, down);
///
/// Copy a portion of the source texture to the current rendering target, with
/// rotation and flipping, at subpixel precision.
///
/// the source texture.
///
/// a pointer to the source rectangle, or NULL for the entire
/// texture.
///
///
/// a pointer to the destination rectangle, or NULL for the
/// entire rendering target.
///
///
/// an angle in degrees that indicates the rotation that will be
/// applied to dstrect, rotating it in a clockwise direction.
///
///
/// 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).
///
///
/// an SDL_FlipMode value stating which flipping actions should be
/// performed on the texture.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderTextureRotated(
SdlTexture texture,
SdlFRect* srcrect,
SdlFRect* dstrect,
double angle,
SdlFPoint* center,
SdlFlipMode flip
) => Sdl.Render.RenderTextureRotated(this, texture, srcrect, dstrect, angle, center, flip);
///
/// Tile a portion of the texture to the current rendering target at subpixel
/// precision.
///
/// the source texture.
///
/// a pointer to the source rectangle, or NULL for the entire
/// texture.
///
///
/// the scale used to transform srcrect into the destination
/// rectangle, e.g. a 32x32 texture with a scale of 2 would fill
/// 64x64 tiles.
///
///
/// a pointer to the destination rectangle, or NULL for the
/// entire rendering target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// The pixels in srcrect will be repeated as many times as needed to
/// completely fill dstrect.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool RenderTextureTiled(SdlTexture texture, SdlFRect* srcrect, float scale, SdlFRect* dstrect) =>
Sdl.Render.RenderTextureTiled(this, texture, srcrect, scale, dstrect);
///
/// Return whether an explicit rectangle was set as the viewport.
///
///
/// true if the viewport was set to a specific rectangle, or false if
/// it was set to NULL (the entire target).
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool RenderViewportSet() => Sdl.Render.RenderViewportSet(this);
///
/// Set default scale mode for new textures for given renderer.
///
/// the scale mode to change to for new textures.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// When a renderer is created, scale_mode defaults to SDL_SCALEMODE_LINEAR.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
public bool SetDefaultTextureScaleMode(SdlScaleMode scale_mode) =>
Sdl.Render.SetDefaultTextureScaleMode(this, scale_mode);
///
/// Set custom GPU render state.
///
/// the state to to use, or NULL to clear custom GPU render state.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This function sets custom GPU render state for subsequent draw calls. This
/// allows using custom shaders with the GPU renderer.
///
///
///
/// This function should be called on the thread that created the
/// renderer.
///
///
/// This function is available since SDL 3.4.0.
///
public bool SetGpuRenderState(nint state) => Sdl.Render.SetGpuRenderState(this, state);
///
/// Set the clip rectangle for rendering on the specified target.
///
///
/// an SDL_Rect structure representing the clip area, relative to
/// the viewport, or NULL to disable clipping.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Each render target has its own clip rectangle. This function sets the
/// cliprect for the current render target.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetRenderClipRect(SdlRect* rect) => Sdl.Render.SetRenderClipRect(this, rect);
///
/// Set the color scale used for render operations.
///
/// the color scale value.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetRenderColorScale(float scale) => Sdl.Render.SetRenderColorScale(this, scale);
///
/// Set the blend mode used for drawing operations (Fill and Line).
///
/// the SDL_BlendMode to use for blending.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// If the blend mode is not supported, the closest supported mode is chosen.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetRenderDrawBlendMode(uint blendMode) => Sdl.Render.SetRenderDrawBlendMode(this, blendMode);
///
/// Set the color used for drawing operations.
///
/// the red value used to draw on the rendering target.
/// the green value used to draw on the rendering target.
/// the blue value used to draw on the rendering target.
///
/// 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.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Set the color for drawing or filling rectangles, lines, and points, and for
/// SDL_RenderClear().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetRenderDrawColor(byte r, byte g, byte b, byte a) =>
Sdl.Render.SetRenderDrawColor(this, r, g, b, a);
///
/// Set the color used for drawing operations (Rect, Line and Clear).
///
/// the red value used to draw on the rendering target.
/// the green value used to draw on the rendering target.
/// the blue value used to draw on the rendering target.
///
/// the alpha value used to draw on the rendering target. Use
/// SDL_SetRenderDrawBlendMode to specify how the alpha channel is
/// used.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Set the color for drawing or filling rectangles, lines, and points, and for
/// SDL_RenderClear().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetRenderDrawColorFloat(float r, float g, float b, float a) =>
Sdl.Render.SetRenderDrawColorFloat(this, r, g, b, a);
///
/// Set a device-independent resolution and presentation mode for rendering.
///
/// the width of the logical resolution.
/// the height of the logical resolution.
/// the presentation mode used.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetRenderLogicalPresentation(int w, int h, SdlRendererLogicalPresentation mode) =>
Sdl.Render.SetRenderLogicalPresentation(this, w, h, mode);
///
/// Set the drawing scale for rendering on the current target.
///
/// the horizontal scaling factor.
/// the vertical scaling factor.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetRenderScale(float scaleX, float scaleY) => Sdl.Render.SetRenderScale(this, scaleX, scaleY);
///
/// Set a texture as the current rendering target.
///
///
/// the targeted texture, which must be created with the
/// SDL_TEXTUREACCESS_TARGET flag, or NULL to render to the
/// window instead of a texture.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetRenderTarget(SdlTexture texture) => Sdl.Render.SetRenderTarget(this, texture);
///
/// Set the texture addressing mode used in SDL_RenderGeometry().
///
///
/// the SDL_TextureAddressMode to use for horizontal texture
/// coordinates in SDL_RenderGeometry().
///
///
/// the SDL_TextureAddressMode to use for vertical texture
/// coordinates in SDL_RenderGeometry().
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
///
///
public bool SetRenderTextureAddressMode(SdlTextureAddressMode u_mode, SdlTextureAddressMode v_mode) =>
Sdl.Render.SetRenderTextureAddressMode(this, u_mode, v_mode);
///
/// Toggle VSync of the given renderer.
///
/// the vertical refresh sync interval.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetRenderVSync(int vsync) => Sdl.Render.SetRenderVSync(this, vsync);
///
/// Set the drawing area for rendering on the current target.
///
///
/// the SDL_Rect structure representing the drawing area, or NULL
/// to set the viewport to the entire target.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetRenderViewport(SdlRect* rect) => Sdl.Render.SetRenderViewport(this, rect);
}
public readonly unsafe partial struct SdlTexture
{
///
/// Destroy the specified texture.
///
///
///
/// Passing NULL or an otherwise invalid texture will set the SDL error message
/// to "Invalid texture".
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public void Destroy()
{
if (IsNull())
{
return;
}
Sdl.Render.DestroyTexture(this);
}
///
/// Ergonomic wrapper over SDL_GetRendererFromTexture.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlRenderer GetRendererFromTexture() => Sdl.Render.GetRendererFromTexture(this);
///
/// Get the additional alpha value multiplied into render copy operations.
///
/// a pointer filled in with the current alpha value.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool GetAlphaMod(out byte alpha) => Sdl.Render.GetTextureAlphaMod(this, out alpha);
///
/// Get the additional alpha value multiplied into render copy operations.
///
/// a pointer filled in with the current alpha value.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool GetAlphaModFloat(out float alpha) => Sdl.Render.GetTextureAlphaModFloat(this, out alpha);
///
/// Get the blend mode used for texture copy operations.
///
/// a pointer filled in with the current SDL_BlendMode.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetBlendMode(uint* blendMode) => Sdl.Render.GetTextureBlendMode(this, blendMode);
///
/// Get the additional color value multiplied into render copy operations.
///
/// a pointer filled in with the current red color value.
/// a pointer filled in with the current green color value.
/// a pointer filled in with the current blue color value.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool GetColorMod(out byte r, out byte g, out byte b) =>
Sdl.Render.GetTextureColorMod(this, out r, out g, out b);
///
/// Get the additional color value multiplied into render copy operations.
///
/// a pointer filled in with the current red color value.
/// a pointer filled in with the current green color value.
/// a pointer filled in with the current blue color value.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool GetColorModFloat(out float r, out float g, out float b) =>
Sdl.Render.GetTextureColorModFloat(this, out r, out g, out b);
///
/// Get the properties associated with a texture.
///
///
/// a valid property ID on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// 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
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetProperties() => Sdl.Render.GetTextureProperties(this);
///
/// Get the scale mode used for texture scale operations.
///
/// a pointer filled in with the current scale mode.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetScaleMode(out SdlScaleMode scaleMode) => Sdl.Render.GetTextureScaleMode(this, out scaleMode);
///
/// Get the size of a texture, as floating point values.
///
///
/// a pointer filled in with the width of the texture in pixels. This
/// argument can be NULL if you don't need this information.
///
///
/// a pointer filled in with the height of the texture in pixels. This
/// argument can be NULL if you don't need this information.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool GetSize(out float w, out float h) => Sdl.Render.GetTextureSize(this, out w, out h);
///
/// Lock a portion of the texture for write-only pixel access.
///
///
/// an SDL_Rect structure representing the area to lock for access;
/// NULL to lock the entire texture.
///
///
/// this is filled in with a pointer to the locked pixels,
/// appropriately offset by the locked area.
///
///
/// this is filled in with the pitch of the locked pixels; the
/// pitch is the length of one row in bytes.
///
///
/// 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.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool Lock(SdlRect* rect, void** pixels, out int pitch) =>
Sdl.Render.LockTexture(this, rect, pixels, out pitch);
///
/// Lock a portion of the texture for write-only pixel access, and expose
/// it as a SDL surface.
///
///
/// a pointer to the rectangle to lock for access. If the rect is
/// NULL, the entire texture will be locked.
///
///
/// a pointer to an SDL surface of size rect. Don't assume
/// any specific pixel content.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool LockToSurface(SdlRect* rect, SdlSurface** surface) =>
Sdl.Render.LockTextureToSurface(this, rect, surface);
///
/// Set an additional alpha value multiplied into render copy operations.
///
/// the source alpha value multiplied into copy operations.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetAlphaMod(byte alpha) => Sdl.Render.SetTextureAlphaMod(this, alpha);
///
/// Set an additional alpha value multiplied into render copy operations.
///
/// the source alpha value multiplied into copy operations.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetAlphaModFloat(float alpha) => Sdl.Render.SetTextureAlphaModFloat(this, alpha);
///
/// Set the blend mode for a texture, used by SDL_RenderTexture().
///
/// the SDL_BlendMode to use for texture blending.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// If the blend mode is not supported, the closest supported mode is chosen
/// and this function returns false.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetBlendMode(uint blendMode) => Sdl.Render.SetTextureBlendMode(this, blendMode);
///
/// Set an additional color value multiplied into render copy operations.
///
/// the red color value multiplied into copy operations.
/// the green color value multiplied into copy operations.
/// the blue color value multiplied into copy operations.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetColorMod(byte r, byte g, byte b) => Sdl.Render.SetTextureColorMod(this, r, g, b);
///
/// Set an additional color value multiplied into render copy operations.
///
/// the red color value multiplied into copy operations.
/// the green color value multiplied into copy operations.
/// the blue color value multiplied into copy operations.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetColorModFloat(float r, float g, float b) => Sdl.Render.SetTextureColorModFloat(this, r, g, b);
///
/// Set the palette used by a texture.
///
/// the SDL_Palette structure to use.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
///
public bool SetPalette(SdlPalette* palette) => Sdl.Render.SetTexturePalette(this, palette);
///
/// Set the scale mode used for texture scale operations.
///
/// the SDL_ScaleMode to use for texture scaling.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// The default texture scale mode is SDL_SCALEMODE_LINEAR.
///
///
/// If the scale mode is not supported, the closest supported mode is chosen.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetScaleMode(SdlScaleMode scaleMode) => Sdl.Render.SetTextureScaleMode(this, scaleMode);
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public void Unlock() => Sdl.Render.UnlockTexture(this);
///
/// Update a rectangle within a planar NV12 or NV21 texture with new pixels.
///
///
/// a pointer to the rectangle of pixels to update, or NULL to
/// update the entire texture.
///
/// the raw pixel data for the Y plane.
///
/// the number of bytes between rows of pixel data for the Y
/// plane.
///
/// the raw pixel data for the UV plane.
///
/// the number of bytes between rows of pixel data for the UV
/// plane.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool UpdateNV(SdlRect* rect, byte* Yplane, int Ypitch, byte* UVplane, int UVpitch) =>
Sdl.Render.UpdateNVTexture(this, rect, Yplane, Ypitch, UVplane, UVpitch);
///
/// Update the given texture rectangle with new pixel data.
///
///
/// an SDL_Rect structure representing the area to update, or NULL
/// to update the entire texture.
///
/// the raw pixel data in the format of the texture.
///
/// the number of bytes in a row of pixel data, including padding
/// between lines.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool Update(SdlRect* rect, void* pixels, int pitch) =>
Sdl.Render.UpdateTexture(this, rect, pixels, pitch);
///
/// Update a rectangle within a planar YV12 or IYUV texture with new pixel
/// data.
///
///
/// a pointer to the rectangle of pixels to update, or NULL to
/// update the entire texture.
///
/// the raw pixel data for the Y plane.
///
/// the number of bytes between rows of pixel data for the Y
/// plane.
///
/// the raw pixel data for the U plane.
///
/// the number of bytes between rows of pixel data for the U
/// plane.
///
/// the raw pixel data for the V plane.
///
/// the number of bytes between rows of pixel data for the V
/// plane.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool UpdateYUV(
SdlRect* rect,
byte* Yplane,
int Ypitch,
byte* Uplane,
int Upitch,
byte* Vplane,
int Vpitch
) => Sdl.Render.UpdateYUVTexture(this, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
}
public readonly unsafe partial struct SdlWindow
{
///
/// Dismiss the composition window/IME without disabling the subsystem.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool ClearComposition() => Sdl.Keyboard.ClearComposition(this);
///
/// Ergonomic wrapper over SDL_CreatePopupWindow. Throws instead of returning a null handle on failure.
///
///
/// the x position of the popup window relative to the origin
/// of the parent.
///
///
/// the y position of the popup window relative to the origin
/// of the parent window.
///
/// the width of the window.
/// the height of the window.
///
/// SDL_WINDOW_TOOLTIP or SDL_WINDOW_POPUP_MENU, and zero or more
/// additional SDL_WindowFlags OR'd together.
///
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlWindow CreatePopup(int offset_x, int offset_y, int w, int h, SdlWindowFlags flags) =>
Sdl.Video.CreatePopupWindow(this, offset_x, offset_y, w, h, flags);
///
/// Ergonomic wrapper over SDL_CreateRenderer. Throws instead of returning a null handle on failure.
///
///
/// the name of the rendering driver to initialize, or NULL to let
/// SDL choose one.
///
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlRenderer CreateRenderer(string name) => Sdl.Render.CreateRenderer(this, name);
///
/// 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.
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public void Destroy()
{
if (IsNull())
{
return;
}
Sdl.Video.DestroyWindow(this);
}
///
/// Destroy the surface associated with the window.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool DestroySurface() => Sdl.Video.DestroyWindowSurface(this);
///
/// Request a window to demand attention from the user.
///
/// the operation to perform.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Flash(SdlFlashOperation operation) => Sdl.Video.FlashWindow(this, operation);
///
/// Create an OpenGL context for an OpenGL window, and make it current.
///
///
/// the OpenGL context associated with window or NULL on failure;
/// call SDL_GetError() for more information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public nint GLCreateContext() => Sdl.Video.GLCreateContext(this);
///
/// Set up an OpenGL context for rendering into an OpenGL window.
///
/// the OpenGL context to associate with the window.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// The context must have been created with a compatible window.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GLMakeCurrent(nint context) => Sdl.Video.GLMakeCurrent(this, context);
///
/// Update a window with OpenGL rendering.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool GLSwap() => Sdl.Video.GLSwapWindow(this);
///
/// Get the display associated with a window.
///
///
/// the instance ID of the display containing the center of the window
/// on success or 0 on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public uint GetDisplayForWindow() => Sdl.Video.GetDisplayForWindow(this);
///
/// Ergonomic wrapper over SDL_GetRenderer.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlRenderer GetRenderer() => Sdl.Render.GetRenderer(this);
///
/// Get the area used to type Unicode text input.
///
///
/// a pointer to an SDL_Rect filled in with the text input area,
/// may be NULL.
///
///
/// a pointer to the offset of the current cursor location
/// relative to rect->x, may be NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This returns the values previously set by SDL_SetTextInputArea().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetTextInputArea(SdlRect* rect, out int cursor) =>
Sdl.Keyboard.GetTextInputArea(this, rect, out cursor);
///
/// Get the aspect ratio of a window's client area.
///
///
/// a pointer filled in with the minimum aspect ratio of the
/// window, may be NULL.
///
///
/// a pointer filled in with the maximum aspect ratio of the
/// window, may be NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetAspectRatio(out float min_aspect, out float max_aspect) =>
Sdl.Video.GetWindowAspectRatio(this, out min_aspect, out max_aspect);
///
/// Get the size of a window's borders (decorations) around the client area.
///
///
/// pointer to variable for storing the size of the top border; NULL
/// is permitted.
///
///
/// pointer to variable for storing the size of the left border;
/// NULL is permitted.
///
///
/// pointer to variable for storing the size of the bottom
/// border; NULL is permitted.
///
///
/// pointer to variable for storing the size of the right border;
/// NULL is permitted.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetBordersSize(out int top, out int left, out int bottom, out int right) =>
Sdl.Video.GetWindowBordersSize(this, out top, out left, out bottom, out right);
///
/// Get the content display scale relative to a window's pixel size.
///
///
/// the display scale, or 0.0f on failure; call SDL_GetError() for
/// more information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public float GetDisplayScale() => Sdl.Video.GetWindowDisplayScale(this);
///
/// Get the window flags.
///
/// a mask of the SDL_WindowFlags associated with window.
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
///
///
///
///
public SdlWindowFlags GetFlags() => Sdl.Video.GetWindowFlags(this);
///
/// Ergonomic wrapper over SDL_GetWindowICCProfile.
///
/// The SDL call failed; the message carries the SDL_GetError
/// text.
///
/// SDL returns a freshly SDL_malloc'd buffer for this call; the returned array is a managed copy, and
/// the native buffer is freed with SDL_free before this method returns.
///
public byte[] GetICCProfile() => Sdl.Video.GetWindowICCProfile(this);
///
/// Get the numeric ID of a window.
///
///
/// the ID of the window on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// The numeric ID is what SDL_WindowEvent references, and is necessary to map
/// these events to specific SDL_Window objects.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public uint GetID() => Sdl.Video.GetWindowID(this);
///
/// Get a window's keyboard grab mode.
///
/// true if keyboard is grabbed, and false otherwise.
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetKeyboardGrab() => Sdl.Video.GetWindowKeyboardGrab(this);
///
/// Get the maximum size of a window's client area.
///
///
/// a pointer filled in with the maximum width of the window, may be
/// NULL.
///
///
/// a pointer filled in with the maximum height of the window, may be
/// NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetMaximumSize(out int w, out int h) => Sdl.Video.GetWindowMaximumSize(this, out w, out h);
///
/// Get the minimum size of a window's client area.
///
///
/// a pointer filled in with the minimum width of the window, may be
/// NULL.
///
///
/// a pointer filled in with the minimum height of the window, may be
/// NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetMinimumSize(out int w, out int h) => Sdl.Video.GetWindowMinimumSize(this, out w, out h);
///
/// Get a window's mouse grab mode.
///
/// true if mouse is grabbed, and false otherwise.
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool GetMouseGrab() => Sdl.Video.GetWindowMouseGrab(this);
///
/// Get the opacity of a window.
///
///
/// the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on
/// failure; call SDL_GetError() for more information.
///
///
///
/// If transparency isn't supported on this platform, opacity will be returned
/// as 1.0f without error.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public float GetOpacity() => Sdl.Video.GetWindowOpacity(this);
///
/// Ergonomic wrapper over SDL_GetWindowParent.
///
///
/// Borrowed handle: the returned handle is owned by SDL (or by another object) and must not be
/// disposed. Do not call on it; doing so would free a resource this
/// call does not own. A null handle is returned on failure.
///
public SdlWindow GetParent() => Sdl.Video.GetWindowParent(this);
///
/// Get the pixel density of a window.
///
///
/// the pixel density or 0.0f on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public float GetPixelDensity() => Sdl.Video.GetWindowPixelDensity(this);
///
/// Get the pixel format associated with the window.
///
///
/// the pixel format of the window on success or
/// SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public SdlPixelFormat GetPixelFormat() => Sdl.Video.GetWindowPixelFormat(this);
///
/// Get the position of a window.
///
///
/// a pointer filled in with the x position of the window, may be
/// NULL.
///
///
/// a pointer filled in with the y position of the window, may be
/// NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetPosition(out int x, out int y) => Sdl.Video.GetWindowPosition(this, out x, out y);
///
/// Get the state of the progress bar for the given window’s taskbar icon.
///
///
/// the progress state, or SDL_PROGRESS_STATE_INVALID on failure;
/// call SDL_GetError() for more information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
public SdlProgressState GetProgressState() => Sdl.Video.GetWindowProgressState(this);
///
/// Get the value of the progress bar for the given window’s taskbar icon.
///
///
/// the progress value in the range of [0.0f - 1.0f], or -1.0f on
/// failure; call SDL_GetError() for more information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
public float GetProgressValue() => Sdl.Video.GetWindowProgressValue(this);
///
/// Get the properties associated with a window.
///
///
/// a valid property ID on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// 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
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public uint GetProperties() => Sdl.Video.GetWindowProperties(this);
///
/// Query whether relative mouse mode is enabled for a window.
///
/// true if relative mode is enabled for a window or false otherwise.
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetRelativeMouseMode() => Sdl.Mouse.GetWindowRelativeMouseMode(this);
///
/// Get the safe area for this window.
///
///
/// a pointer filled in with the client area that is safe for
/// interactive content.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool GetSafeArea(SdlRect* rect) => Sdl.Video.GetWindowSafeArea(this, rect);
///
/// Get the size of a window's client area.
///
/// a pointer filled in with the width of the window, may be NULL.
/// a pointer filled in with the height of the window, may be NULL.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool GetSize(out int w, out int h) => Sdl.Video.GetWindowSize(this, out w, out h);
///
/// Get the size of a window's client area, in pixels.
///
///
/// a pointer to variable for storing the width in pixels, may be
/// NULL.
///
///
/// a pointer to variable for storing the height in pixels, may be
/// NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool GetSizeInPixels(out int w, out int h) => Sdl.Video.GetWindowSizeInPixels(this, out w, out h);
///
/// Get VSync for the window surface.
///
///
/// an int filled with the current vertical refresh sync interval.
/// See SDL_SetWindowSurfaceVSync() for the meaning of the value.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool GetSurfaceVSync(out int vsync) => Sdl.Video.GetWindowSurfaceVSync(this, out vsync);
///
/// Get the title of a window.
///
///
/// the title of the window in UTF-8 format or "" if there is no
/// title.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public string? GetTitle() => Sdl.Video.GetWindowTitle(this);
///
/// Hide a window.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool Hide() => Sdl.Video.HideWindow(this);
///
/// Request that the window be made as large as possible.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool Maximize() => Sdl.Video.MaximizeWindow(this);
///
/// Request that the window be minimized to an iconic representation.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool Minimize() => Sdl.Video.MinimizeWindow(this);
///
/// Request that a window be raised above other windows and gain the input
/// focus.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool Raise() => Sdl.Video.RaiseWindow(this);
///
/// Request that the size and position of a minimized or maximized window be
/// restored.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool Restore() => Sdl.Video.RestoreWindow(this);
///
/// Check whether the screen keyboard is shown for given window.
///
/// true if screen keyboard is shown or false if not.
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool ScreenKeyboardShown() => Sdl.Keyboard.ScreenKeyboardShown(this);
///
/// Set the area used to type Unicode text input.
///
///
/// the SDL_Rect representing the text input area, in window
/// coordinates, or NULL to clear it.
///
///
/// the offset of the current cursor location relative to
/// rect->x, in window coordinates.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Native input methods may place a window with word suggestions near the
/// cursor, without covering the text being entered.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetTextInputArea(SdlRect* rect, int cursor) => Sdl.Keyboard.SetTextInputArea(this, rect, cursor);
///
/// Set the window to always be above the others.
///
/// true to set the window always on top, false to disable.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetAlwaysOnTop(bool on_top) => Sdl.Video.SetWindowAlwaysOnTop(this, on_top);
///
/// Request that the aspect ratio of a window's client area be set.
///
///
/// the minimum aspect ratio of the window, or 0.0f for no
/// limit.
///
///
/// the maximum aspect ratio of the window, or 0.0f for no
/// limit.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetAspectRatio(float min_aspect, float max_aspect) =>
Sdl.Video.SetWindowAspectRatio(this, min_aspect, max_aspect);
///
/// Set the border state of a window.
///
/// false to remove border, true to add border.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetBordered(bool bordered) => Sdl.Video.SetWindowBordered(this, bordered);
///
/// Set the window to fill the current document space (Emscripten only).
///
/// true to set the window to fill the document, false to disable.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
///
public bool SetFillDocument(bool fill) => Sdl.Video.SetWindowFillDocument(this, fill);
///
/// Set whether the window may have input focus.
///
/// true to allow input focus, false to not allow input focus.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool SetFocusable(bool focusable) => Sdl.Video.SetWindowFocusable(this, focusable);
///
/// Request that the window's fullscreen state be changed.
///
/// true for fullscreen mode, false for windowed mode.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetFullscreen(bool fullscreen) => Sdl.Video.SetWindowFullscreen(this, fullscreen);
///
/// Set the display mode to use when a window is visible and fullscreen.
///
///
/// 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.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetFullscreenMode(SdlDisplayMode* mode) => Sdl.Video.SetWindowFullscreenMode(this, mode);
///
/// Set the icon for a window.
///
/// an SDL_Surface structure containing the icon for the window.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetIcon(SdlSurface* icon) => Sdl.Video.SetWindowIcon(this, icon);
///
/// Set a window's keyboard grab mode.
///
/// this is true to grab keyboard, and false to release.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetKeyboardGrab(bool grabbed) => Sdl.Video.SetWindowKeyboardGrab(this, grabbed);
///
/// Set the maximum size of a window's client area.
///
/// the maximum width of the window, or 0 for no limit.
/// the maximum height of the window, or 0 for no limit.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetMaximumSize(int max_w, int max_h) => Sdl.Video.SetWindowMaximumSize(this, max_w, max_h);
///
/// Set the minimum size of a window's client area.
///
/// the minimum width of the window, or 0 for no limit.
/// the minimum height of the window, or 0 for no limit.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetMinimumSize(int min_w, int min_h) => Sdl.Video.SetWindowMinimumSize(this, min_w, min_h);
///
/// Toggle the state of the window as modal.
///
/// true to toggle modal status on, false to toggle it off.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetModal(bool modal) => Sdl.Video.SetWindowModal(this, modal);
///
/// Set a window's mouse grab mode.
///
/// this is true to grab mouse, and false to release.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Mouse grab confines the mouse cursor to the window.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetMouseGrab(bool grabbed) => Sdl.Video.SetWindowMouseGrab(this, grabbed);
///
/// Confines the cursor to the specified area of a window.
///
///
/// a rectangle area in window-relative coordinates. If NULL the
/// barrier for the specified window will be destroyed.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Note that this does NOT grab the cursor, it only defines the area a cursor
/// is restricted to when the window has mouse focus.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetMouseRect(SdlRect* rect) => Sdl.Video.SetWindowMouseRect(this, rect);
///
/// Set the opacity for a window.
///
/// the opacity value (0.0f - transparent, 1.0f - opaque).
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetOpacity(float opacity) => Sdl.Video.SetWindowOpacity(this, opacity);
///
/// Set the window as a child of a parent window.
///
/// the new parent window for the child window.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetParent(SdlWindow parent) => Sdl.Video.SetWindowParent(this, parent);
///
/// Request that the window's position be set.
///
///
/// the x coordinate of the window, or SDL_WINDOWPOS_CENTERED or
/// SDL_WINDOWPOS_UNDEFINED.
///
///
/// the y coordinate of the window, or SDL_WINDOWPOS_CENTERED or
/// SDL_WINDOWPOS_UNDEFINED.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool SetPosition(int x, int y) => Sdl.Video.SetWindowPosition(this, x, y);
///
/// Sets the state of the progress bar for the given window’s taskbar icon.
///
///
/// the progress state. SDL_PROGRESS_STATE_NONE stops displaying
/// the progress bar.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
public bool SetProgressState(SdlProgressState state) => Sdl.Video.SetWindowProgressState(this, state);
///
/// Sets the value of the progress bar for the given window’s taskbar icon.
///
///
/// the progress value in the range of [0.0f - 1.0f]. If the value
/// is outside the valid range, it gets clamped.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.4.0.
///
public bool SetProgressValue(float value) => Sdl.Video.SetWindowProgressValue(this, value);
///
/// Set relative mouse mode for a window.
///
/// true to enable relative mode, false to disable.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetRelativeMouseMode(bool enabled) => Sdl.Mouse.SetWindowRelativeMouseMode(this, enabled);
///
/// Set the user-resizable state of a window.
///
/// true to allow resizing, false to disallow.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetResizable(bool resizable) => Sdl.Video.SetWindowResizable(this, resizable);
///
/// Set the shape of a transparent window.
///
///
/// the surface representing the shape of the window, or NULL to
/// remove any current shape.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool SetShape(SdlSurface* shape) => Sdl.Video.SetWindowShape(this, shape);
///
/// Request that the size of a window's client area be set.
///
/// the width of the window, must be > 0.
/// the height of the window, must be > 0.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
public bool SetSize(int w, int h) => Sdl.Video.SetWindowSize(this, w, h);
///
/// Toggle VSync for the window surface.
///
/// the vertical refresh sync interval.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetSurfaceVSync(int vsync) => Sdl.Video.SetWindowSurfaceVSync(this, vsync);
///
/// Set the title of a window.
///
/// the desired window title in UTF-8 format.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This string is expected to be in UTF-8 encoding.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool SetTitle(string title) => Sdl.Video.SetWindowTitle(this, title);
///
/// Show a window.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool Show() => Sdl.Video.ShowWindow(this);
///
/// Display the system-level window menu.
///
///
/// the x coordinate of the menu, relative to the origin (top-left) of
/// the client area.
///
///
/// the y coordinate of the menu, relative to the origin (top-left) of
/// the client area.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
public bool ShowSystemMenu(int x, int y) => Sdl.Video.ShowWindowSystemMenu(this, x, y);
///
/// Start accepting Unicode text input events in a window.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool StartTextInput() => Sdl.Keyboard.StartTextInput(this);
///
/// Start accepting Unicode text input events in a window, with properties
/// describing the input.
///
/// the properties to use.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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
/// https://developer.android.com/reference/android/text/InputType
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
public bool StartTextInputWithProperties(uint props) => Sdl.Keyboard.StartTextInputWithProperties(this, props);
///
/// Stop receiving any text input events in a window.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// If SDL_StartTextInput() showed the screen keyboard, this function will hide
/// it.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool StopTextInput() => Sdl.Keyboard.StopTextInput(this);
///
/// Block until any pending window state is finalized.
///
///
/// true on success or false if the operation timed out before the
/// window was in the requested state.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
///
///
///
///
public bool Sync() => Sdl.Video.SyncWindow(this);
///
/// Check whether or not Unicode text input events are enabled for a window.
///
/// true if text input events are enabled else false.
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool TextInputActive() => Sdl.Keyboard.TextInputActive(this);
///
/// Copy the window surface to the screen.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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().
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool UpdateSurface() => Sdl.Video.UpdateWindowSurface(this);
///
/// Copy areas of the window surface to the screen.
///
///
/// an array of SDL_Rect structures representing areas of the
/// surface to copy, in pixels.
///
/// the number of rectangles.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
///
public bool UpdateSurfaceRects(SdlRect* rects, int numrects) =>
Sdl.Video.UpdateWindowSurfaceRects(this, rects, numrects);
///
/// Move the mouse cursor to the given position within the window.
///
/// the x coordinate within the window.
/// the y coordinate 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.
///
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public void WarpMouseInWindow(float x, float y) => Sdl.Mouse.WarpMouseInWindow(this, x, y);
///
/// Return whether the window has a surface associated with it.
///
///
/// true if there is a surface associated with the window, or false
/// otherwise.
///
///
/// This function should only be called on the main thread.
///
///
/// This function is available since SDL 3.2.0.
///
///
public bool HasSurface() => Sdl.Video.WindowHasSurface(this);
}
}