mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
6651 lines
298 KiB
C#
6651 lines
298 KiB
C#
// <auto-generated/>
|
||
// Generated by Brutal.Sdl.Generate; do not edit by hand.
|
||
#nullable enable
|
||
|
||
namespace Brutal.SdlApi
|
||
{
|
||
public readonly unsafe partial struct SdlCursor
|
||
{
|
||
/// <summary>
|
||
/// Free a previously-created cursor.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Use this function to free cursor resources created with SDL_CreateCursor(),
|
||
/// SDL_CreateColorCursor() or SDL_CreateSystemCursor().
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateAnimatedCursor"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateColorCursor"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateCursor"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateSystemCursor"/>
|
||
public void Destroy()
|
||
{
|
||
if (IsNull())
|
||
{
|
||
return;
|
||
}
|
||
Sdl.Mouse.DestroyCursor(this);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Set the active cursor.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetCursor"/>
|
||
public bool Set() => Sdl.Mouse.SetCursor(this);
|
||
}
|
||
|
||
public readonly unsafe partial struct SdlGamepad
|
||
{
|
||
/// <summary>
|
||
/// Close a gamepad previously opened with SDL_OpenGamepad().
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.OpenGamepad"/>
|
||
public void Close()
|
||
{
|
||
if (IsNull())
|
||
{
|
||
return;
|
||
}
|
||
Sdl.Gamepad.CloseGamepad(this);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Check if a gamepad has been opened and is currently connected.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true if the gamepad has been opened and is currently connected, or
|
||
/// false if not.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool Connected() => Sdl.Gamepad.GamepadConnected(this);
|
||
|
||
/// <summary>
|
||
/// Query whether a gamepad has a given axis.
|
||
/// </summary>
|
||
/// <param name="axis">an axis enum value (an SDL_GamepadAxis value).</param>
|
||
/// <returns>true if the gamepad has this axis, false otherwise.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This merely reports whether the gamepad's mapping defined this axis, as
|
||
/// that is all the information SDL has about the physical device.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GamepadHasButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadAxis"/>
|
||
public bool HasAxis(SdlGamepadAxis axis) => Sdl.Gamepad.GamepadHasAxis(this, axis);
|
||
|
||
/// <summary>
|
||
/// Query whether a gamepad has a given button.
|
||
/// </summary>
|
||
/// <param name="button">a button enum value (an SDL_GamepadButton value).</param>
|
||
/// <returns>true if the gamepad has this button, false otherwise.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This merely reports whether the gamepad's mapping defined this button, as
|
||
/// that is all the information SDL has about the physical device.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GamepadHasAxis"/>
|
||
public bool HasButton(SdlGamepadButton button) => Sdl.Gamepad.GamepadHasButton(this, button);
|
||
|
||
/// <summary>
|
||
/// Return whether a gamepad has a particular sensor.
|
||
/// </summary>
|
||
/// <param name="type">the type of sensor to query.</param>
|
||
/// <returns>true if the sensor exists, false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadSensorData"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadSensorDataRate"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetGamepadSensorEnabled"/>
|
||
public bool HasSensor(SdlSensorType type) => Sdl.Gamepad.GamepadHasSensor(this, type);
|
||
|
||
/// <summary>
|
||
/// Query whether sensor data reporting is enabled for a gamepad.
|
||
/// </summary>
|
||
/// <param name="type">the type of sensor to query.</param>
|
||
/// <returns>true if the sensor is enabled, false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetGamepadSensorEnabled"/>
|
||
public bool SensorEnabled(SdlSensorType type) => Sdl.Gamepad.GamepadSensorEnabled(this, type);
|
||
|
||
/// <summary>
|
||
/// Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
|
||
/// </summary>
|
||
/// <param name="axis">an axis on the gamepad.</param>
|
||
/// <returns>the sfSymbolsName or NULL if the name can't be found.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadAppleSFSymbolsNameForButton"/>
|
||
public string? GetAppleSFSymbolsNameForAxis(SdlGamepadAxis axis) =>
|
||
Sdl.Gamepad.GetGamepadAppleSFSymbolsNameForAxis(this, axis);
|
||
|
||
/// <summary>
|
||
/// Return the sfSymbolsName for a given button on a gamepad on Apple
|
||
/// platforms.
|
||
/// </summary>
|
||
/// <param name="button">a button on the gamepad.</param>
|
||
/// <returns>the sfSymbolsName or NULL if the name can't be found.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadAppleSFSymbolsNameForAxis"/>
|
||
public string? GetAppleSFSymbolsNameForButton(SdlGamepadButton button) =>
|
||
Sdl.Gamepad.GetGamepadAppleSFSymbolsNameForButton(this, button);
|
||
|
||
/// <summary>
|
||
/// Get the current state of an axis control on a gamepad.
|
||
/// </summary>
|
||
/// <param name="axis">an axis index (one of the SDL_GamepadAxis values).</param>
|
||
/// <returns>axis state.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The axis indices start at index 0.
|
||
/// </para>
|
||
/// <para>
|
||
/// For thumbsticks, the state is a value ranging from -32768 (up/left) to
|
||
/// 32767 (down/right).
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GamepadHasAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadButton"/>
|
||
public short GetAxis(SdlGamepadAxis axis) => Sdl.Gamepad.GetGamepadAxis(this, axis);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetGamepadBindings</c>.
|
||
/// </summary>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
/// <remarks>
|
||
/// SDL returns a freshly <c>SDL_malloc</c>'d buffer for this call; the returned array is a managed copy, and
|
||
/// the native buffer is freed with <c>SDL_free</c> before this method returns.
|
||
/// </remarks>
|
||
public SdlGamepadBinding[] GetBindings() => Sdl.Gamepad.GetGamepadBindings(this);
|
||
|
||
/// <summary>
|
||
/// Get the current state of a button on a gamepad.
|
||
/// </summary>
|
||
/// <param name="button">a button index (one of the SDL_GamepadButton values).</param>
|
||
/// <returns>true if the button is pressed, false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GamepadHasButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadAxis"/>
|
||
public bool GetButton(SdlGamepadButton button) => Sdl.Gamepad.GetGamepadButton(this, button);
|
||
|
||
/// <summary>
|
||
/// Get the label of a button on a gamepad.
|
||
/// </summary>
|
||
/// <param name="button">a button index (one of the SDL_GamepadButton values).</param>
|
||
/// <returns>the SDL_GamepadButtonLabel enum corresponding to the button label.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadButtonLabelForType"/>
|
||
public SdlGamepadButtonLabel GetButtonLabel(SdlGamepadButton button) =>
|
||
Sdl.Gamepad.GetGamepadButtonLabel(this, button);
|
||
|
||
/// <summary>
|
||
/// Get the connection state of a gamepad.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the connection state on success or
|
||
/// <c>SDL_JOYSTICK_CONNECTION_INVALID</c> on failure; call SDL_GetError()
|
||
/// for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public SdlJoystickConnectionState GetConnectionState() => Sdl.Gamepad.GetGamepadConnectionState(this);
|
||
|
||
/// <summary>
|
||
/// Get the firmware version of an opened gamepad, if available.
|
||
/// </summary>
|
||
/// <returns>the gamepad firmware version, or zero if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the firmware version isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public ushort GetFirmwareVersion() => Sdl.Gamepad.GetGamepadFirmwareVersion(this);
|
||
|
||
/// <summary>
|
||
/// Get the instance ID of an opened gamepad.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the instance ID of the specified gamepad on success or 0 on
|
||
/// failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetID() => Sdl.Gamepad.GetGamepadID(this);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetGamepadJoystick</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlJoystick GetJoystick() => Sdl.Gamepad.GetGamepadJoystick(this);
|
||
|
||
/// <summary>
|
||
/// Get the implementation-dependent name for an opened gamepad.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the implementation dependent name for the gamepad, or NULL if
|
||
/// there is no name or the identifier passed is invalid.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadNameForID"/>
|
||
public string? GetName() => Sdl.Gamepad.GetGamepadName(this);
|
||
|
||
/// <summary>
|
||
/// Get the implementation-dependent path for an opened gamepad.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the implementation dependent path for the gamepad, or NULL if
|
||
/// there is no path or the identifier passed is invalid.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadPathForID"/>
|
||
public string? GetPath() => Sdl.Gamepad.GetGamepadPath(this);
|
||
|
||
/// <summary>
|
||
/// Get the player index of an opened gamepad.
|
||
/// </summary>
|
||
/// <returns>the player index for gamepad, or -1 if it's not available.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// For XInput gamepads this returns the XInput user index.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetGamepadPlayerIndex"/>
|
||
public int GetPlayerIndex() => Sdl.Gamepad.GetGamepadPlayerIndex(this);
|
||
|
||
/// <summary>
|
||
/// Get the battery state of a gamepad.
|
||
/// </summary>
|
||
/// <param name="percent">
|
||
/// a pointer filled in with the percentage of battery life
|
||
/// left, between 0 and 100, or NULL to ignore. This will be
|
||
/// filled in with -1 we can't determine a value or there is no
|
||
/// battery.
|
||
/// </param>
|
||
/// <returns>the current battery state.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public SdlPowerState GetPowerInfo(out int percent) => Sdl.Gamepad.GetGamepadPowerInfo(this, out percent);
|
||
|
||
/// <summary>
|
||
/// Get the USB product ID of an opened gamepad, if available.
|
||
/// </summary>
|
||
/// <returns>the USB product ID, or zero if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the product ID isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadProductForID"/>
|
||
public ushort GetProduct() => Sdl.Gamepad.GetGamepadProduct(this);
|
||
|
||
/// <summary>
|
||
/// Get the product version of an opened gamepad, if available.
|
||
/// </summary>
|
||
/// <returns>the USB product version, or zero if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the product version isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadProductVersionForID"/>
|
||
public ushort GetProductVersion() => Sdl.Gamepad.GetGamepadProductVersion(this);
|
||
|
||
/// <summary>
|
||
/// Get the properties associated with an opened gamepad.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// a valid property ID on success or 0 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// These properties are shared with the underlying joystick object.
|
||
/// </para>
|
||
/// <para>
|
||
/// The following read-only properties are provided by SDL:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN</c>: true if this gamepad has an LED
|
||
/// that has adjustable brightness
|
||
/// - <c>SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN</c>: true if this gamepad has an LED
|
||
/// that has adjustable color
|
||
/// - <c>SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN</c>: true if this gamepad has a
|
||
/// player LED
|
||
/// - <c>SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN</c>: true if this gamepad has
|
||
/// left/right rumble
|
||
/// - <c>SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN</c>: true if this gamepad has
|
||
/// simple trigger rumble
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetProperties() => Sdl.Gamepad.GetGamepadProperties(this);
|
||
|
||
/// <summary>
|
||
/// Get the current state of a gamepad sensor.
|
||
/// </summary>
|
||
/// <param name="type">the type of sensor to query.</param>
|
||
/// <param name="data">a pointer filled with the current sensor state.</param>
|
||
/// <param name="num_values">the number of values to write to data.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool GetSensorData(SdlSensorType type, float* data, int num_values) =>
|
||
Sdl.Gamepad.GetGamepadSensorData(this, type, data, num_values);
|
||
|
||
/// <summary>
|
||
/// Get the data rate (number of events per second) of a gamepad sensor.
|
||
/// </summary>
|
||
/// <param name="type">the type of sensor to query.</param>
|
||
/// <returns>the data rate, or 0.0f if the data rate is not available.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public float GetSensorDataRate(SdlSensorType type) => Sdl.Gamepad.GetGamepadSensorDataRate(this, type);
|
||
|
||
/// <summary>
|
||
/// Get the serial number of an opened gamepad, if available.
|
||
/// </summary>
|
||
/// <returns>the serial number, or NULL if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Returns the serial number of the gamepad, or NULL if it is not available.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public string? GetSerial() => Sdl.Gamepad.GetGamepadSerial(this);
|
||
|
||
/// <summary>
|
||
/// Get the Steam Input handle of an opened gamepad, if available.
|
||
/// </summary>
|
||
/// <returns>the gamepad handle, or 0 if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Returns an InputHandle_t for the gamepad that can be used with Steam Input
|
||
/// API: https://partner.steamgames.com/doc/api/ISteamInput
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public ulong GetSteamHandle() => Sdl.Gamepad.GetGamepadSteamHandle(this);
|
||
|
||
/// <summary>
|
||
/// Get the type of an opened gamepad.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not
|
||
/// available.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadTypeForID"/>
|
||
public SdlGamepadType GetGamepadType() => Sdl.Gamepad.GetGamepadType(this);
|
||
|
||
/// <summary>
|
||
/// Get the USB vendor ID of an opened gamepad, if available.
|
||
/// </summary>
|
||
/// <returns>the USB vendor ID, or zero if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the vendor ID isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadVendorForID"/>
|
||
public ushort GetVendor() => Sdl.Gamepad.GetGamepadVendor(this);
|
||
|
||
/// <summary>
|
||
/// Get the number of supported simultaneous fingers on a touchpad on a game
|
||
/// gamepad.
|
||
/// </summary>
|
||
/// <param name="touchpad">a touchpad.</param>
|
||
/// <returns>number of supported simultaneous fingers.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadTouchpadFinger"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumGamepadTouchpads"/>
|
||
public int GetNumTouchpadFingers(int touchpad) => Sdl.Gamepad.GetNumGamepadTouchpadFingers(this, touchpad);
|
||
|
||
/// <summary>
|
||
/// Get the number of touchpads on a gamepad.
|
||
/// </summary>
|
||
/// <returns>number of touchpads.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumGamepadTouchpadFingers"/>
|
||
public int GetNumTouchpads() => Sdl.Gamepad.GetNumGamepadTouchpads(this);
|
||
|
||
/// <summary>
|
||
/// Get the type of an opened gamepad, ignoring any mapping override.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not
|
||
/// available.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRealGamepadTypeForID"/>
|
||
public SdlGamepadType GetRealType() => Sdl.Gamepad.GetRealGamepadType(this);
|
||
|
||
/// <summary>
|
||
/// Start a rumble effect on a gamepad.
|
||
/// </summary>
|
||
/// <param name="low_frequency_rumble">
|
||
/// the intensity of the low frequency (left)
|
||
/// rumble motor, from 0 to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="high_frequency_rumble">
|
||
/// the intensity of the high frequency (right)
|
||
/// rumble motor, from 0 to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="duration_ms">the duration of the rumble effect, in milliseconds.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each call to this function cancels any previous rumble effect, and calling
|
||
/// it with 0 intensity stops any rumbling.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function requires you to process SDL events or call
|
||
/// SDL_UpdateJoysticks() to update rumble state.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Start a rumble effect in the gamepad's triggers.
|
||
/// </summary>
|
||
/// <param name="left_rumble">
|
||
/// the intensity of the left trigger rumble motor, from 0
|
||
/// to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="right_rumble">
|
||
/// the intensity of the right trigger rumble motor, from 0
|
||
/// to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="duration_ms">the duration of the rumble effect, in milliseconds.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each call to this function cancels any previous trigger rumble effect, and
|
||
/// calling it with 0 intensity stops any rumbling.
|
||
/// </para>
|
||
/// <para>
|
||
/// Note that this is rumbling of the <em>triggers</em> 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function requires you to process SDL events or call
|
||
/// SDL_UpdateJoysticks() to update rumble state.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RumbleGamepad"/>
|
||
public bool RumbleTriggers(ushort left_rumble, ushort right_rumble, uint duration_ms) =>
|
||
Sdl.Gamepad.RumbleGamepadTriggers(this, left_rumble, right_rumble, duration_ms);
|
||
|
||
/// <summary>
|
||
/// Send a gamepad specific effect packet.
|
||
/// </summary>
|
||
/// <param name="data">the data to send to the gamepad.</param>
|
||
/// <param name="size">the size of the data to send to the gamepad.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool SendEffect(void* data, int size) => Sdl.Gamepad.SendGamepadEffect(this, data, size);
|
||
|
||
/// <summary>
|
||
/// Update a gamepad's LED color.
|
||
/// </summary>
|
||
/// <param name="red">the intensity of the red LED.</param>
|
||
/// <param name="green">the intensity of the green LED.</param>
|
||
/// <param name="blue">the intensity of the blue LED.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// An example of a joystick LED is the light on the back of a PlayStation 4's
|
||
/// DualShock 4 controller.
|
||
/// </para>
|
||
/// <para>
|
||
/// For gamepads with a single color LED, the maximum of the RGB values will be
|
||
/// used as the LED brightness.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool SetLED(byte red, byte green, byte blue) => Sdl.Gamepad.SetGamepadLED(this, red, green, blue);
|
||
|
||
/// <summary>
|
||
/// Set the player index of an opened gamepad.
|
||
/// </summary>
|
||
/// <param name="player_index">
|
||
/// player index to assign to this gamepad, or -1 to clear
|
||
/// the player index and turn off player LEDs.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGamepadPlayerIndex"/>
|
||
public bool SetPlayerIndex(int player_index) => Sdl.Gamepad.SetGamepadPlayerIndex(this, player_index);
|
||
|
||
/// <summary>
|
||
/// Set whether data reporting for a gamepad sensor is enabled.
|
||
/// </summary>
|
||
/// <param name="type">the type of sensor to enable/disable.</param>
|
||
/// <param name="enabled">whether data reporting should be enabled.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GamepadHasSensor"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GamepadSensorEnabled"/>
|
||
public bool SetSensorEnabled(SdlSensorType type, bool enabled) =>
|
||
Sdl.Gamepad.SetGamepadSensorEnabled(this, type, enabled);
|
||
}
|
||
|
||
public readonly unsafe partial struct SdlGpuDevice
|
||
{
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_CreateGPURenderer</c>. Throws instead of returning a null handle on failure.
|
||
/// </summary>
|
||
/// <param name="window">
|
||
/// the window where rendering is displayed, or NULL to create an
|
||
/// offscreen renderer.
|
||
/// </param>
|
||
/// <returns>The created handle (never a null handle).</returns>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
public SdlRenderer CreateGpuRenderer(SdlWindow window) => Sdl.Render.CreateGpuRenderer(this, window);
|
||
}
|
||
|
||
public readonly unsafe partial struct SdlJoystick
|
||
{
|
||
/// <summary>
|
||
/// Close a joystick previously opened with SDL_OpenJoystick().
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.OpenJoystick"/>
|
||
public void Close()
|
||
{
|
||
if (IsNull())
|
||
{
|
||
return;
|
||
}
|
||
Sdl.Joystick.CloseJoystick(this);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Get the current state of an axis control on a joystick.
|
||
/// </summary>
|
||
/// <param name="axis">the axis to query; the axis indices start at index 0.</param>
|
||
/// <returns>
|
||
/// a 16-bit signed integer representing the current position of the
|
||
/// axis or 0 on failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickAxes"/>
|
||
public short GetAxis(int axis) => Sdl.Joystick.GetJoystickAxis(this, axis);
|
||
|
||
/// <summary>
|
||
/// Get the initial state of an axis control on a joystick.
|
||
/// </summary>
|
||
/// <param name="axis">the axis to query; the axis indices start at index 0.</param>
|
||
/// <param name="state">upon return, the initial value is supplied here.</param>
|
||
/// <returns>true if this axis has any initial value, or false if not.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The state is a value ranging from -32768 to 32767.
|
||
/// </para>
|
||
/// <para>
|
||
/// The axis indices start at index 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool GetAxisInitialState(int axis, out short state) =>
|
||
Sdl.Joystick.GetJoystickAxisInitialState(this, axis, out state);
|
||
|
||
/// <summary>
|
||
/// Get the ball axis change since the last poll.
|
||
/// </summary>
|
||
/// <param name="ball">the ball index to query; ball indices start at index 0.</param>
|
||
/// <param name="dx">stores the difference in the x axis position since the last poll.</param>
|
||
/// <param name="dy">stores the difference in the y axis position since the last poll.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Trackballs can only return relative motion since the last call to
|
||
/// SDL_GetJoystickBall(), these motion deltas are placed into <c>dx</c> and <c>dy</c>.
|
||
/// </para>
|
||
/// <para>
|
||
/// Most joysticks do not have trackballs.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickBalls"/>
|
||
public bool GetBall(int ball, out int dx, out int dy) =>
|
||
Sdl.Joystick.GetJoystickBall(this, ball, out dx, out dy);
|
||
|
||
/// <summary>
|
||
/// Get the current state of a button on a joystick.
|
||
/// </summary>
|
||
/// <param name="button">
|
||
/// the button index to get the state from; indices start at
|
||
/// index 0.
|
||
/// </param>
|
||
/// <returns>true if the button is pressed, false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickButtons"/>
|
||
public bool GetButton(int button) => Sdl.Joystick.GetJoystickButton(this, button);
|
||
|
||
/// <summary>
|
||
/// Get the connection state of a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the connection state on success or
|
||
/// <c>SDL_JOYSTICK_CONNECTION_INVALID</c> on failure; call SDL_GetError()
|
||
/// for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public SdlJoystickConnectionState GetConnectionState() => Sdl.Joystick.GetJoystickConnectionState(this);
|
||
|
||
/// <summary>
|
||
/// Get the firmware version of an opened joystick, if available.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the firmware version of the selected joystick, or 0 if
|
||
/// unavailable.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the firmware version isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public ushort GetFirmwareVersion() => Sdl.Joystick.GetJoystickFirmwareVersion(this);
|
||
|
||
/// <summary>
|
||
/// Get the implementation-dependent GUID for the joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the GUID of the given joystick. If called on an invalid index,
|
||
/// this function returns a zero GUID; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This function requires an open joystick.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickGuidForID"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GuidToString"/>
|
||
public SdlGuid GetGuid() => Sdl.Joystick.GetJoystickGuid(this);
|
||
|
||
/// <summary>
|
||
/// Get the current state of a POV hat on a joystick.
|
||
/// </summary>
|
||
/// <param name="hat">the hat index to get the state from; indices start at index 0.</param>
|
||
/// <returns>the current hat position.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The returned value will be one of the <c>SDL_HAT_*</c> values.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickHats"/>
|
||
public byte GetHat(int hat) => Sdl.Joystick.GetJoystickHat(this, hat);
|
||
|
||
/// <summary>
|
||
/// Get the instance ID of an opened joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the instance ID of the specified joystick on success or 0 on
|
||
/// failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetID() => Sdl.Joystick.GetJoystickID(this);
|
||
|
||
/// <summary>
|
||
/// Get the implementation dependent name of a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the name of the selected joystick. If no name can be found, this
|
||
/// function returns NULL; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickNameForID"/>
|
||
public string? GetName() => Sdl.Joystick.GetJoystickName(this);
|
||
|
||
/// <summary>
|
||
/// Get the implementation dependent path of a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the path of the selected joystick. If no path can be found, this
|
||
/// function returns NULL; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickPathForID"/>
|
||
public string? GetPath() => Sdl.Joystick.GetJoystickPath(this);
|
||
|
||
/// <summary>
|
||
/// Get the player index of an opened joystick.
|
||
/// </summary>
|
||
/// <returns>the player index, or -1 if it's not available.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// For XInput controllers this returns the XInput user index. Many joysticks
|
||
/// will not be able to supply this information.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickPlayerIndex"/>
|
||
public int GetPlayerIndex() => Sdl.Joystick.GetJoystickPlayerIndex(this);
|
||
|
||
/// <summary>
|
||
/// Get the battery state of a joystick.
|
||
/// </summary>
|
||
/// <param name="percent">
|
||
/// a pointer filled in with the percentage of battery life
|
||
/// left, between 0 and 100, or NULL to ignore. This will be
|
||
/// filled in with -1 we can't determine a value or there is no
|
||
/// battery.
|
||
/// </param>
|
||
/// <returns>
|
||
/// the current battery state or <c>SDL_POWERSTATE_ERROR</c> on failure;
|
||
/// call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public SdlPowerState GetPowerInfo(out int percent) => Sdl.Joystick.GetJoystickPowerInfo(this, out percent);
|
||
|
||
/// <summary>
|
||
/// Get the USB product ID of an opened joystick, if available.
|
||
/// </summary>
|
||
/// <returns>the USB product ID of the selected joystick, or 0 if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the product ID isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickProductForID"/>
|
||
public ushort GetProduct() => Sdl.Joystick.GetJoystickProduct(this);
|
||
|
||
/// <summary>
|
||
/// Get the product version of an opened joystick, if available.
|
||
/// </summary>
|
||
/// <returns>the product version of the selected joystick, or 0 if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the product version isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickProductVersionForID"/>
|
||
public ushort GetProductVersion() => Sdl.Joystick.GetJoystickProductVersion(this);
|
||
|
||
/// <summary>
|
||
/// Get the properties associated with a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// a valid property ID on success or 0 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The following read-only properties are provided by SDL:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN</c>: true if this joystick has an
|
||
/// LED that has adjustable brightness
|
||
/// - <c>SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN</c>: true if this joystick has an LED
|
||
/// that has adjustable color
|
||
/// - <c>SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN</c>: true if this joystick has a
|
||
/// player LED
|
||
/// - <c>SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN</c>: true if this joystick has
|
||
/// left/right rumble
|
||
/// - <c>SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN</c>: true if this joystick has
|
||
/// simple trigger rumble
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetProperties() => Sdl.Joystick.GetJoystickProperties(this);
|
||
|
||
/// <summary>
|
||
/// Get the serial number of an opened joystick, if available.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the serial number of the selected joystick, or NULL if
|
||
/// unavailable.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Returns the serial number of the joystick, or NULL if it is not available.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public string? GetSerial() => Sdl.Joystick.GetJoystickSerial(this);
|
||
|
||
/// <summary>
|
||
/// Get the type of an opened joystick.
|
||
/// </summary>
|
||
/// <returns>the SDL_JoystickType of the selected joystick.</returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickTypeForID"/>
|
||
public SdlJoystickType GetJoystickType() => Sdl.Joystick.GetJoystickType(this);
|
||
|
||
/// <summary>
|
||
/// Get the USB vendor ID of an opened joystick, if available.
|
||
/// </summary>
|
||
/// <returns>the USB vendor ID of the selected joystick, or 0 if unavailable.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the vendor ID isn't available this function returns 0.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickVendorForID"/>
|
||
public ushort GetVendor() => Sdl.Joystick.GetJoystickVendor(this);
|
||
|
||
/// <summary>
|
||
/// Get the number of general axis controls on a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the number of axis controls/number of axes on success or -1 on
|
||
/// failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickBalls"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickButtons"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickHats"/>
|
||
public int GetNumAxes() => Sdl.Joystick.GetNumJoystickAxes(this);
|
||
|
||
/// <summary>
|
||
/// Get the number of trackballs on a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the number of trackballs on success or -1 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Joystick trackballs have only relative motion events associated with them
|
||
/// and their state cannot be polled.
|
||
/// </para>
|
||
/// <para>
|
||
/// Most joysticks do not have trackballs.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickBall"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickAxes"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickButtons"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickHats"/>
|
||
public int GetNumBalls() => Sdl.Joystick.GetNumJoystickBalls(this);
|
||
|
||
/// <summary>
|
||
/// Get the number of buttons on a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the number of buttons on success or -1 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickAxes"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickBalls"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickHats"/>
|
||
public int GetNumButtons() => Sdl.Joystick.GetNumJoystickButtons(this);
|
||
|
||
/// <summary>
|
||
/// Get the number of POV hats on a joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the number of POV hats on success or -1 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickHat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickAxes"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickBalls"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetNumJoystickButtons"/>
|
||
public int GetNumHats() => Sdl.Joystick.GetNumJoystickHats(this);
|
||
|
||
/// <summary>
|
||
/// Get the status of a specified joystick.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true if the joystick has been opened, false if it has not; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool Connected() => Sdl.Joystick.JoystickConnected(this);
|
||
|
||
/// <summary>
|
||
/// Start a rumble effect.
|
||
/// </summary>
|
||
/// <param name="low_frequency_rumble">
|
||
/// the intensity of the low frequency (left)
|
||
/// rumble motor, from 0 to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="high_frequency_rumble">
|
||
/// the intensity of the high frequency (right)
|
||
/// rumble motor, from 0 to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="duration_ms">the duration of the rumble effect, in milliseconds.</param>
|
||
/// <returns>true, or false if rumble isn't supported on this joystick.</returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each call to this function cancels any previous rumble effect, and calling
|
||
/// it with 0 intensity stops any rumbling.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function requires you to process SDL events or call
|
||
/// SDL_UpdateJoysticks() to update rumble state.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Start a rumble effect in the joystick's triggers.
|
||
/// </summary>
|
||
/// <param name="left_rumble">
|
||
/// the intensity of the left trigger rumble motor, from 0
|
||
/// to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="right_rumble">
|
||
/// the intensity of the right trigger rumble motor, from 0
|
||
/// to 0xFFFF.
|
||
/// </param>
|
||
/// <param name="duration_ms">the duration of the rumble effect, in milliseconds.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each call to this function cancels any previous trigger rumble effect, and
|
||
/// calling it with 0 intensity stops any rumbling.
|
||
/// </para>
|
||
/// <para>
|
||
/// Note that this is rumbling of the <em>triggers</em> 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function requires you to process SDL events or call
|
||
/// SDL_UpdateJoysticks() to update rumble state.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RumbleJoystick"/>
|
||
public bool RumbleTriggers(ushort left_rumble, ushort right_rumble, uint duration_ms) =>
|
||
Sdl.Joystick.RumbleJoystickTriggers(this, left_rumble, right_rumble, duration_ms);
|
||
|
||
/// <summary>
|
||
/// Send a joystick specific effect packet.
|
||
/// </summary>
|
||
/// <param name="data">the data to send to the joystick.</param>
|
||
/// <param name="size">the size of the data to send to the joystick.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool SendEffect(void* data, int size) => Sdl.Joystick.SendJoystickEffect(this, data, size);
|
||
|
||
/// <summary>
|
||
/// Send a sensor update for an opened virtual joystick.
|
||
/// </summary>
|
||
/// <param name="type">the type of the sensor on the virtual joystick to update.</param>
|
||
/// <param name="sensor_timestamp">
|
||
/// a 64-bit timestamp in nanoseconds associated with
|
||
/// the sensor reading.
|
||
/// </param>
|
||
/// <param name="data">the data associated with the sensor reading.</param>
|
||
/// <param name="num_values">the number of values pointed to by <c>data</c>.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualBall"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualHat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualTouchpad"/>
|
||
public bool SendVirtualSensorData(SdlSensorType type, ulong sensor_timestamp, float* data, int num_values) =>
|
||
Sdl.Joystick.SendJoystickVirtualSensorData(this, type, sensor_timestamp, data, num_values);
|
||
|
||
/// <summary>
|
||
/// Update a joystick's LED color.
|
||
/// </summary>
|
||
/// <param name="red">the intensity of the red LED.</param>
|
||
/// <param name="green">the intensity of the green LED.</param>
|
||
/// <param name="blue">the intensity of the blue LED.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// An example of a joystick LED is the light on the back of a PlayStation 4's
|
||
/// DualShock 4 controller.
|
||
/// </para>
|
||
/// <para>
|
||
/// For joysticks with a single color LED, the maximum of the RGB values will
|
||
/// be used as the LED brightness.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool SetLED(byte red, byte green, byte blue) => Sdl.Joystick.SetJoystickLED(this, red, green, blue);
|
||
|
||
/// <summary>
|
||
/// Set the player index of an opened joystick.
|
||
/// </summary>
|
||
/// <param name="player_index">
|
||
/// player index to assign to this joystick, or -1 to clear
|
||
/// the player index and turn off player LEDs.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetJoystickPlayerIndex"/>
|
||
public bool SetPlayerIndex(int player_index) => Sdl.Joystick.SetJoystickPlayerIndex(this, player_index);
|
||
|
||
/// <summary>
|
||
/// Set the state of an axis on an opened virtual joystick.
|
||
/// </summary>
|
||
/// <param name="axis">the index of the axis on the virtual joystick to update.</param>
|
||
/// <param name="value">the new value for the specified axis.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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
|
||
/// <c>SDL_JOYSTICK_AXIS_MIN</c>.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualBall"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualHat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualTouchpad"/>
|
||
public bool SetVirtualAxis(int axis, short value) => Sdl.Joystick.SetJoystickVirtualAxis(this, axis, value);
|
||
|
||
/// <summary>
|
||
/// Generate ball motion on an opened virtual joystick.
|
||
/// </summary>
|
||
/// <param name="ball">the index of the ball on the virtual joystick to update.</param>
|
||
/// <param name="xrel">the relative motion on the X axis.</param>
|
||
/// <param name="yrel">the relative motion on the Y axis.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualHat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualTouchpad"/>
|
||
public bool SetVirtualBall(int ball, short xrel, short yrel) =>
|
||
Sdl.Joystick.SetJoystickVirtualBall(this, ball, xrel, yrel);
|
||
|
||
/// <summary>
|
||
/// Set the state of a button on an opened virtual joystick.
|
||
/// </summary>
|
||
/// <param name="button">the index of the button on the virtual joystick to update.</param>
|
||
/// <param name="down">true if the button is pressed, false otherwise.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualBall"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualHat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualTouchpad"/>
|
||
public bool SetVirtualButton(int button, bool down) =>
|
||
Sdl.Joystick.SetJoystickVirtualButton(this, button, down);
|
||
|
||
/// <summary>
|
||
/// Set the state of a hat on an opened virtual joystick.
|
||
/// </summary>
|
||
/// <param name="hat">the index of the hat on the virtual joystick to update.</param>
|
||
/// <param name="value">the new value for the specified hat.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualBall"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualTouchpad"/>
|
||
public bool SetVirtualHat(int hat, byte value) => Sdl.Joystick.SetJoystickVirtualHat(this, hat, value);
|
||
|
||
/// <summary>
|
||
/// Set touchpad finger state on an opened virtual joystick.
|
||
/// </summary>
|
||
/// <param name="touchpad">
|
||
/// the index of the touchpad on the virtual joystick to
|
||
/// update.
|
||
/// </param>
|
||
/// <param name="finger">the index of the finger on the touchpad to set.</param>
|
||
/// <param name="down">true if the finger is pressed, false if the finger is released.</param>
|
||
/// <param name="x">
|
||
/// the x coordinate of the finger on the touchpad, normalized 0 to 1,
|
||
/// with the origin in the upper left.
|
||
/// </param>
|
||
/// <param name="y">
|
||
/// the y coordinate of the finger on the touchpad, normalized 0 to 1,
|
||
/// with the origin in the upper left.
|
||
/// </param>
|
||
/// <param name="pressure">the pressure of the finger.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualAxis"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualButton"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualBall"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetJoystickVirtualHat"/>
|
||
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
|
||
{
|
||
/// <summary>
|
||
/// Add a set of synchronization semaphores for the current frame.
|
||
/// </summary>
|
||
/// <param name="wait_stage_mask">the VkPipelineStageFlags for the wait.</param>
|
||
/// <param name="wait_semaphore">
|
||
/// a VkSempahore to wait on before rendering the current
|
||
/// frame, or 0 if not needed.
|
||
/// </param>
|
||
/// <param name="signal_semaphore">
|
||
/// a VkSempahore that SDL will signal when rendering
|
||
/// for the current frame is complete, or 0 if not
|
||
/// needed.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The Vulkan renderer will wait for <c>wait_semaphore</c> before submitting
|
||
/// rendering commands and signal <c>signal_semaphore</c> after rendering commands
|
||
/// are complete for this frame.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is <b>NOT</b> safe to call this function from two threads at
|
||
/// once.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool AddVulkanRenderSemaphores(uint wait_stage_mask, long wait_semaphore, long signal_semaphore) =>
|
||
Sdl.Render.AddVulkanRenderSemaphores(this, wait_stage_mask, wait_semaphore, signal_semaphore);
|
||
|
||
/// <summary>
|
||
/// Convert the coordinates in an event to render coordinates.
|
||
/// </summary>
|
||
/// <param name="event">the event to modify.</param>
|
||
/// <returns>
|
||
/// true if the event is converted or doesn't need conversion, or
|
||
/// false on failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This takes into account several states:
|
||
/// </para>
|
||
/// <para>
|
||
/// - The window dimensions.
|
||
/// - The logical presentation settings (SDL_SetRenderLogicalPresentation)
|
||
/// - The scale (SDL_SetRenderScale)
|
||
/// - The viewport (SDL_SetRenderViewport)
|
||
/// </para>
|
||
/// <para>
|
||
/// Various event types are converted with this function: mouse, touch, pen,
|
||
/// etc.
|
||
/// </para>
|
||
/// <para>
|
||
/// Touch coordinates are converted from normalized coordinates in the window
|
||
/// to non-normalized rendering coordinates.
|
||
/// </para>
|
||
/// <para>
|
||
/// Relative mouse coordinates (xrel and yrel event fields) are <em>also</em>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Once converted, coordinates may be outside the rendering area.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderCoordinatesFromWindow"/>
|
||
public bool ConvertEventToRenderCoordinates(SdlEvent* @event) =>
|
||
Sdl.Render.ConvertEventToRenderCoordinates(this, @event);
|
||
|
||
/// <summary>
|
||
/// Create custom GPU render state.
|
||
/// </summary>
|
||
/// <param name="createinfo">a struct describing the GPU render state to create.</param>
|
||
/// <returns>
|
||
/// a custom GPU render state or NULL on failure; call SDL_GetError()
|
||
/// for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should be called on the thread that created the
|
||
/// renderer.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetGpuRenderStateFragmentUniforms"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetGpuRenderState"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.DestroyGpuRenderState"/>
|
||
public nint CreateGpuRenderState(SdlGpuRenderStateCreateInfo* createinfo) =>
|
||
Sdl.Render.CreateGpuRenderState(this, createinfo);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_CreateTexture</c>. Throws instead of returning a null handle on failure.
|
||
/// </summary>
|
||
/// <param name="format">one of the enumerated values in SDL_PixelFormat.</param>
|
||
/// <param name="access">one of the enumerated values in SDL_TextureAccess.</param>
|
||
/// <param name="w">the width of the texture in pixels.</param>
|
||
/// <param name="h">the height of the texture in pixels.</param>
|
||
/// <returns>The created handle (never a null handle).</returns>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
public SdlTexture CreateTexture(SdlPixelFormat format, SdlTextureAccess access, int w, int h) =>
|
||
Sdl.Render.CreateTexture(this, format, access, w, h);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_CreateTextureFromSurface</c>. Throws instead of returning a null handle on
|
||
/// failure.
|
||
/// </summary>
|
||
/// <param name="surface">
|
||
/// the SDL_Surface structure containing pixel data used to fill
|
||
/// the texture.
|
||
/// </param>
|
||
/// <returns>The created handle (never a null handle).</returns>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
public SdlTexture CreateTextureFromSurface(SdlSurface* surface) =>
|
||
Sdl.Render.CreateTextureFromSurface(this, surface);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_CreateTextureWithProperties</c>. Throws instead of returning a null handle
|
||
/// on failure.
|
||
/// </summary>
|
||
/// <param name="props">the properties to use.</param>
|
||
/// <returns>The created handle (never a null handle).</returns>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
public SdlTexture CreateTextureWithProperties(uint props) =>
|
||
Sdl.Render.CreateTextureWithProperties(this, props);
|
||
|
||
/// <summary>
|
||
/// Destroy the rendering context for a window and free all associated
|
||
/// textures.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This should be called before destroying the associated window.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateRenderer"/>
|
||
public void Destroy()
|
||
{
|
||
if (IsNull())
|
||
{
|
||
return;
|
||
}
|
||
Sdl.Render.DestroyRenderer(this);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Force the rendering context to flush any pending commands and state.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// In all other cases, you can ignore this function.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool Flush() => Sdl.Render.FlushRenderer(this);
|
||
|
||
/// <summary>
|
||
/// Get the current output size in pixels of a rendering context.
|
||
/// </summary>
|
||
/// <param name="w">a pointer filled in with the current width.</param>
|
||
/// <param name="h">a pointer filled in with the current height.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If a rendering target is active, this will return the size of the rendering
|
||
/// target in pixels, otherwise return the value of SDL_GetRenderOutputSize().
|
||
/// </para>
|
||
/// <para>
|
||
/// Rendering target or not, the output will be adjusted by the current logical
|
||
/// presentation state, dictated by SDL_SetRenderLogicalPresentation().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderOutputSize"/>
|
||
public bool GetCurrentRenderOutputSize(out int w, out int h) =>
|
||
Sdl.Render.GetCurrentRenderOutputSize(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Get default texture scale mode of the given renderer.
|
||
/// </summary>
|
||
/// <param name="scale_mode">
|
||
/// a SDL_ScaleMode filled with current default scale mode.
|
||
/// See SDL_SetDefaultTextureScaleMode() for the meaning of
|
||
/// the value.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetDefaultTextureScaleMode"/>
|
||
public bool GetDefaultTextureScaleMode(out SdlScaleMode scale_mode) =>
|
||
Sdl.Render.GetDefaultTextureScaleMode(this, out scale_mode);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetGPURendererDevice</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlGpuDevice GetGpuDevice() => Sdl.Render.GetGpuRendererDevice(this);
|
||
|
||
/// <summary>
|
||
/// Get the clip rectangle for the current target.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// an SDL_Rect structure filled in with the current clipping area
|
||
/// or an empty rectangle if clipping is disabled.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each render target has its own clip rectangle. This function gets the
|
||
/// cliprect for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderClipEnabled"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderClipRect"/>
|
||
public bool GetRenderClipRect(SdlRect* rect) => Sdl.Render.GetRenderClipRect(this, rect);
|
||
|
||
/// <summary>
|
||
/// Get the color scale used for render operations.
|
||
/// </summary>
|
||
/// <param name="scale">a pointer filled in with the current color scale value.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderColorScale"/>
|
||
public bool GetRenderColorScale(out float scale) => Sdl.Render.GetRenderColorScale(this, out scale);
|
||
|
||
/// <summary>
|
||
/// Get the blend mode used for drawing operations.
|
||
/// </summary>
|
||
/// <param name="blendMode">a pointer filled in with the current SDL_BlendMode.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawBlendMode"/>
|
||
public bool GetRenderDrawBlendMode(uint* blendMode) => Sdl.Render.GetRenderDrawBlendMode(this, blendMode);
|
||
|
||
/// <summary>
|
||
/// Get the color used for drawing operations (Rect, Line and Clear).
|
||
/// </summary>
|
||
/// <param name="r">
|
||
/// a pointer filled in with the red value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <param name="g">
|
||
/// a pointer filled in with the green value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <param name="b">
|
||
/// a pointer filled in with the blue value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <param name="a">
|
||
/// a pointer filled in with the alpha value used to draw on the
|
||
/// rendering target; usually <c>SDL_ALPHA_OPAQUE</c> (255).
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderDrawColorFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawColor"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Get the color used for drawing operations (Rect, Line and Clear).
|
||
/// </summary>
|
||
/// <param name="r">
|
||
/// a pointer filled in with the red value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <param name="g">
|
||
/// a pointer filled in with the green value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <param name="b">
|
||
/// a pointer filled in with the blue value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <param name="a">
|
||
/// a pointer filled in with the alpha value used to draw on the
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawColorFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderDrawColor"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Get device independent resolution and presentation mode for rendering.
|
||
/// </summary>
|
||
/// <param name="w">an int filled with the logical presentation width.</param>
|
||
/// <param name="h">an int filled with the logical presentation height.</param>
|
||
/// <param name="mode">
|
||
/// a variable filled with the logical presentation mode being
|
||
/// used.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This function gets the width and height of the logical rendering output, or
|
||
/// 0 if a logical resolution is not enabled.
|
||
/// </para>
|
||
/// <para>
|
||
/// Each render target has its own logical presentation state. This function
|
||
/// gets the state for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderLogicalPresentation"/>
|
||
public bool GetRenderLogicalPresentation(out int w, out int h, out SdlRendererLogicalPresentation mode) =>
|
||
Sdl.Render.GetRenderLogicalPresentation(this, out w, out h, out mode);
|
||
|
||
/// <summary>
|
||
/// Get the final presentation rectangle for rendering.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer filled in with the final presentation rectangle, may
|
||
/// be NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Each render target has its own logical presentation state. This function
|
||
/// gets the rectangle for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderLogicalPresentation"/>
|
||
public bool GetRenderLogicalPresentationRect(SdlFRect* rect) =>
|
||
Sdl.Render.GetRenderLogicalPresentationRect(this, rect);
|
||
|
||
/// <summary>
|
||
/// Get the output size in pixels of a rendering context.
|
||
/// </summary>
|
||
/// <param name="w">a pointer filled in with the width in pixels.</param>
|
||
/// <param name="h">a pointer filled in with the height in pixels.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This returns the true output size in pixels, ignoring any render targets or
|
||
/// logical size and presentation.
|
||
/// </para>
|
||
/// <para>
|
||
/// For the output size of the current rendering target, with logical size
|
||
/// adjustments, use SDL_GetCurrentRenderOutputSize() instead.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetCurrentRenderOutputSize"/>
|
||
public bool GetRenderOutputSize(out int w, out int h) => Sdl.Render.GetRenderOutputSize(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Get the safe area for rendering within the current viewport.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer filled in with the area that is safe for interactive
|
||
/// content.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool GetRenderSafeArea(SdlRect* rect) => Sdl.Render.GetRenderSafeArea(this, rect);
|
||
|
||
/// <summary>
|
||
/// Get the drawing scale for the current target.
|
||
/// </summary>
|
||
/// <param name="scaleX">a pointer filled in with the horizontal scaling factor.</param>
|
||
/// <param name="scaleY">a pointer filled in with the vertical scaling factor.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each render target has its own scale. This function gets the scale for the
|
||
/// current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderScale"/>
|
||
public bool GetRenderScale(out float scaleX, out float scaleY) =>
|
||
Sdl.Render.GetRenderScale(this, out scaleX, out scaleY);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetRenderTarget</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlTexture GetRenderTarget() => Sdl.Render.GetRenderTarget(this);
|
||
|
||
/// <summary>
|
||
/// Get the texture addressing mode used in SDL_RenderGeometry().
|
||
/// </summary>
|
||
/// <param name="u_mode">
|
||
/// a pointer filled in with the SDL_TextureAddressMode to use
|
||
/// for horizontal texture coordinates in SDL_RenderGeometry(),
|
||
/// may be NULL.
|
||
/// </param>
|
||
/// <param name="v_mode">
|
||
/// a pointer filled in with the SDL_TextureAddressMode to use
|
||
/// for vertical texture coordinates in SDL_RenderGeometry(), may
|
||
/// be NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderTextureAddressMode"/>
|
||
public bool GetRenderTextureAddressMode(out SdlTextureAddressMode u_mode, out SdlTextureAddressMode v_mode) =>
|
||
Sdl.Render.GetRenderTextureAddressMode(this, out u_mode, out v_mode);
|
||
|
||
/// <summary>
|
||
/// Get VSync of the given renderer.
|
||
/// </summary>
|
||
/// <param name="vsync">
|
||
/// an int filled with the current vertical refresh sync interval.
|
||
/// See SDL_SetRenderVSync() for the meaning of the value.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderVSync"/>
|
||
public bool GetRenderVSync(out int vsync) => Sdl.Render.GetRenderVSync(this, out vsync);
|
||
|
||
/// <summary>
|
||
/// Get the drawing area for the current target.
|
||
/// </summary>
|
||
/// <param name="rect">an SDL_Rect structure filled in with the current drawing area.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each render target has its own viewport. This function gets the viewport
|
||
/// for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderViewportSet"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderViewport"/>
|
||
public bool GetRenderViewport(SdlRect* rect) => Sdl.Render.GetRenderViewport(this, rect);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetRenderWindow</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlWindow GetRenderWindow() => Sdl.Render.GetRenderWindow(this);
|
||
|
||
/// <summary>
|
||
/// Get the name of a renderer.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the name of the selected renderer, or NULL on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateRenderer"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateRendererWithProperties"/>
|
||
public string? GetName() => Sdl.Render.GetRendererName(this);
|
||
|
||
/// <summary>
|
||
/// Get the properties associated with a renderer.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// a valid property ID on success or 0 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The following read-only properties are provided by SDL:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_RENDERER_NAME_STRING</c>: the name of the rendering driver
|
||
/// - <c>SDL_PROP_RENDERER_WINDOW_POINTER</c>: the window where rendering is
|
||
/// displayed, if any
|
||
/// - <c>SDL_PROP_RENDERER_SURFACE_POINTER</c>: the surface where rendering is
|
||
/// displayed, if this is a software renderer without a window
|
||
/// - <c>SDL_PROP_RENDERER_VSYNC_NUMBER</c>: the current vsync setting
|
||
/// - <c>SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER</c>: the maximum texture width
|
||
/// and height
|
||
/// - <c>SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER</c>: a (const SDL_PixelFormat *)
|
||
/// array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN,
|
||
/// representing the available texture formats for this renderer.
|
||
/// - <c>SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN</c>: true if the renderer
|
||
/// supports SDL_TEXTURE_ADDRESS_WRAP on non-power-of-two textures.
|
||
/// - <c>SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER</c>: an SDL_Colorspace value
|
||
/// describing the colorspace for output to the display, defaults to
|
||
/// SDL_COLORSPACE_SRGB.
|
||
/// - <c>SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN</c>: 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.
|
||
/// - <c>SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT</c>: 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.
|
||
/// - <c>SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT</c>: 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// With the direct3d renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_RENDERER_D3D9_DEVICE_POINTER</c>: the IDirect3DDevice9 associated
|
||
/// with the renderer
|
||
/// </para>
|
||
/// <para>
|
||
/// With the direct3d11 renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_RENDERER_D3D11_DEVICE_POINTER</c>: the ID3D11Device associated
|
||
/// with the renderer
|
||
/// - <c>SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER</c>: the IDXGISwapChain1
|
||
/// associated with the renderer. This may change when the window is resized.
|
||
/// </para>
|
||
/// <para>
|
||
/// With the direct3d12 renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_RENDERER_D3D12_DEVICE_POINTER</c>: the ID3D12Device associated
|
||
/// with the renderer
|
||
/// - <c>SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER</c>: the IDXGISwapChain4
|
||
/// associated with the renderer.
|
||
/// - <c>SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER</c>: the ID3D12CommandQueue
|
||
/// associated with the renderer
|
||
/// </para>
|
||
/// <para>
|
||
/// With the vulkan renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER</c>: the VkInstance associated
|
||
/// with the renderer
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER</c>: the VkSurfaceKHR associated
|
||
/// with the renderer
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER</c>: the VkPhysicalDevice
|
||
/// associated with the renderer
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER</c>: the VkDevice associated with
|
||
/// the renderer
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER</c>: the queue
|
||
/// family index used for rendering
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER</c>: the queue
|
||
/// family index used for presentation
|
||
/// - <c>SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER</c>: the number of
|
||
/// swapchain images, or potential frames in flight, used by the Vulkan
|
||
/// renderer
|
||
/// </para>
|
||
/// <para>
|
||
/// With the gpu renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_RENDERER_GPU_DEVICE_POINTER</c>: the SDL_GPUDevice associated with
|
||
/// the renderer
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetProperties() => Sdl.Render.GetRendererProperties(this);
|
||
|
||
/// <summary>
|
||
/// Clear the current rendering target with the drawing color.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawColor"/>
|
||
public bool RenderClear() => Sdl.Render.RenderClear(this);
|
||
|
||
/// <summary>
|
||
/// Get whether clipping is enabled on the given render target.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true if clipping is enabled or false if not; call SDL_GetError()
|
||
/// for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each render target has its own clip rectangle. This function checks the
|
||
/// cliprect for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderClipRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderClipRect"/>
|
||
public bool RenderClipEnabled() => Sdl.Render.RenderClipEnabled(this);
|
||
|
||
/// <summary>
|
||
/// Get a point in render coordinates when given a point in window coordinates.
|
||
/// </summary>
|
||
/// <param name="window_x">the x coordinate in window coordinates.</param>
|
||
/// <param name="window_y">the y coordinate in window coordinates.</param>
|
||
/// <param name="x">a pointer filled with the x coordinate in render coordinates.</param>
|
||
/// <param name="y">a pointer filled with the y coordinate in render coordinates.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This takes into account several states:
|
||
/// </para>
|
||
/// <para>
|
||
/// - The window dimensions.
|
||
/// - The logical presentation settings (SDL_SetRenderLogicalPresentation)
|
||
/// - The scale (SDL_SetRenderScale)
|
||
/// - The viewport (SDL_SetRenderViewport)
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderLogicalPresentation"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderScale"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Get a point in window coordinates when given a point in render coordinates.
|
||
/// </summary>
|
||
/// <param name="x">the x coordinate in render coordinates.</param>
|
||
/// <param name="y">the y coordinate in render coordinates.</param>
|
||
/// <param name="window_x">
|
||
/// a pointer filled with the x coordinate in window
|
||
/// coordinates.
|
||
/// </param>
|
||
/// <param name="window_y">
|
||
/// a pointer filled with the y coordinate in window
|
||
/// coordinates.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This takes into account several states:
|
||
/// </para>
|
||
/// <para>
|
||
/// - The window dimensions.
|
||
/// - The logical presentation settings (SDL_SetRenderLogicalPresentation)
|
||
/// - The scale (SDL_SetRenderScale)
|
||
/// - The viewport (SDL_SetRenderViewport)
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderLogicalPresentation"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderScale"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderViewport"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Draw debug text to an SDL_Renderer.
|
||
/// </summary>
|
||
/// <param name="x">the x coordinate where the top-left corner of the text will draw.</param>
|
||
/// <param name="y">the y coordinate where the top-left corner of the text will draw.</param>
|
||
/// <param name="str">the string to render.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Among these limitations:
|
||
/// </para>
|
||
/// <para>
|
||
/// - 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// For serious text rendering, there are several good options, such as
|
||
/// SDL_ttf, stb_truetype, or other external libraries.
|
||
/// </para>
|
||
/// <para>
|
||
/// On first use, this will create an internal texture for rendering glyphs.
|
||
/// This texture will live until the renderer is destroyed.
|
||
/// </para>
|
||
/// <para>
|
||
/// The text is drawn in the color specified by SDL_SetRenderDrawColor().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool RenderDebugText(float x, float y, string str) => Sdl.Render.RenderDebugText(this, x, y, str);
|
||
|
||
/// <summary>
|
||
/// Fill a rectangle on the current rendering target with the drawing color at
|
||
/// subpixel precision.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer to the destination rectangle, or NULL for the entire
|
||
/// rendering target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderFillRects"/>
|
||
public bool RenderFillRect(SdlFRect* rect) => Sdl.Render.RenderFillRect(this, rect);
|
||
|
||
/// <summary>
|
||
/// Fill some number of rectangles on the current rendering target with the
|
||
/// drawing color at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="rects">a pointer to an array of destination rectangles.</param>
|
||
/// <param name="count">the number of rectangles.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderFillRect"/>
|
||
public bool RenderFillRects(SdlFRect* rects, int count) => Sdl.Render.RenderFillRects(this, rects, count);
|
||
|
||
/// <summary>
|
||
/// 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).
|
||
/// </summary>
|
||
/// <param name="texture">(optional) The SDL texture to use.</param>
|
||
/// <param name="vertices">vertices.</param>
|
||
/// <param name="num_vertices">number of vertices.</param>
|
||
/// <param name="indices">
|
||
/// (optional) An array of integer indices into the 'vertices'
|
||
/// array, if NULL all vertices will be rendered in sequential
|
||
/// order.
|
||
/// </param>
|
||
/// <param name="num_indices">number of indices.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderGeometryRaw"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderTextureAddressMode"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// 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).
|
||
/// </summary>
|
||
/// <param name="texture">(optional) The SDL texture to use.</param>
|
||
/// <param name="xy">vertex positions.</param>
|
||
/// <param name="xy_stride">byte size to move from one element to the next element.</param>
|
||
/// <param name="color">vertex colors (as SDL_FColor).</param>
|
||
/// <param name="color_stride">byte size to move from one element to the next element.</param>
|
||
/// <param name="uv">vertex normalized texture coordinates.</param>
|
||
/// <param name="uv_stride">byte size to move from one element to the next element.</param>
|
||
/// <param name="num_vertices">number of vertices.</param>
|
||
/// <param name="indices">
|
||
/// (optional) An array of indices into the 'vertices' arrays,
|
||
/// if NULL all vertices will be rendered in sequential order.
|
||
/// </param>
|
||
/// <param name="num_indices">number of indices.</param>
|
||
/// <param name="size_indices">index size: 1 (byte), 2 (short), 4 (int).</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderGeometry"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderTextureAddressMode"/>
|
||
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
|
||
);
|
||
|
||
/// <summary>
|
||
/// Draw a line on the current rendering target at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="x1">the x coordinate of the start point.</param>
|
||
/// <param name="y1">the y coordinate of the start point.</param>
|
||
/// <param name="x2">the x coordinate of the end point.</param>
|
||
/// <param name="y2">the y coordinate of the end point.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderLines"/>
|
||
public bool RenderLine(float x1, float y1, float x2, float y2) => Sdl.Render.RenderLine(this, x1, y1, x2, y2);
|
||
|
||
/// <summary>
|
||
/// Draw a series of connected lines on the current rendering target at
|
||
/// subpixel precision.
|
||
/// </summary>
|
||
/// <param name="points">the points along the lines.</param>
|
||
/// <param name="count">the number of points, drawing count-1 lines.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderLine"/>
|
||
public bool RenderLines(SdlFPoint* points, int count) => Sdl.Render.RenderLines(this, points, count);
|
||
|
||
/// <summary>
|
||
/// Draw a point on the current rendering target at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="x">the x coordinate of the point.</param>
|
||
/// <param name="y">the y coordinate of the point.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderPoints"/>
|
||
public bool RenderPoint(float x, float y) => Sdl.Render.RenderPoint(this, x, y);
|
||
|
||
/// <summary>
|
||
/// Draw multiple points on the current rendering target at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="points">the points to draw.</param>
|
||
/// <param name="count">the number of points to draw.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderPoint"/>
|
||
public bool RenderPoints(SdlFPoint* points, int count) => Sdl.Render.RenderPoints(this, points, count);
|
||
|
||
/// <summary>
|
||
/// Update the screen with any rendering performed since the previous call.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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 <em>present</em> the composed backbuffer to the screen as a
|
||
/// complete picture.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Please note, that in case of rendering to a texture - there is <b>no need</b>
|
||
/// to call <c>SDL_RenderPresent</c> 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 <c>SDL_SetRenderTarget(renderer, NULL)</c> afterwards, as
|
||
/// textures by themselves do not have a concept of backbuffers. Calling
|
||
/// SDL_RenderPresent while rendering to a texture will fail.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateRenderer"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderClear"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderFillRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderFillRects"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderLine"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderLines"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderPoint"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderPoints"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderRects"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawBlendMode"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawColor"/>
|
||
public bool RenderPresent() => Sdl.Render.RenderPresent(this);
|
||
|
||
/// <summary>
|
||
/// Draw a rectangle on the current rendering target at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer to the destination rectangle, or NULL to outline the
|
||
/// entire rendering target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderRects"/>
|
||
public bool RenderRect(SdlFRect* rect) => Sdl.Render.RenderRect(this, rect);
|
||
|
||
/// <summary>
|
||
/// Draw some number of rectangles on the current rendering target at subpixel
|
||
/// precision.
|
||
/// </summary>
|
||
/// <param name="rects">a pointer to an array of destination rectangles.</param>
|
||
/// <param name="count">the number of rectangles.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderRect"/>
|
||
public bool RenderRects(SdlFRect* rects, int count) => Sdl.Render.RenderRects(this, rects, count);
|
||
|
||
/// <summary>
|
||
/// Copy a portion of the texture to the current rendering target at subpixel
|
||
/// precision.
|
||
/// </summary>
|
||
/// <param name="texture">the source texture.</param>
|
||
/// <param name="srcrect">
|
||
/// a pointer to the source rectangle, or NULL for the entire
|
||
/// texture.
|
||
/// </param>
|
||
/// <param name="dstrect">
|
||
/// a pointer to the destination rectangle, or NULL for the
|
||
/// entire rendering target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTextureRotated"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTextureTiled"/>
|
||
public bool RenderTexture(SdlTexture texture, SdlFRect* srcrect, SdlFRect* dstrect) =>
|
||
Sdl.Render.RenderTexture(this, texture, srcrect, dstrect);
|
||
|
||
/// <summary>
|
||
/// Perform a scaled copy using the 9-grid algorithm to the current rendering
|
||
/// target at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="texture">the source texture.</param>
|
||
/// <param name="srcrect">
|
||
/// the SDL_Rect structure representing the rectangle to be used
|
||
/// for the 9-grid, or NULL to use the entire texture.
|
||
/// </param>
|
||
/// <param name="left_width">the width, in pixels, of the left corners in <c>srcrect</c>.</param>
|
||
/// <param name="right_width">the width, in pixels, of the right corners in <c>srcrect</c>.</param>
|
||
/// <param name="top_height">the height, in pixels, of the top corners in <c>srcrect</c>.</param>
|
||
/// <param name="bottom_height">
|
||
/// the height, in pixels, of the bottom corners in
|
||
/// <c>srcrect</c>.
|
||
/// </param>
|
||
/// <param name="scale">
|
||
/// the scale used to transform the corner of <c>srcrect</c> into the
|
||
/// corner of <c>dstrect</c>, or 0.0f for an unscaled copy.
|
||
/// </param>
|
||
/// <param name="dstrect">
|
||
/// a pointer to the destination rectangle, or NULL for the
|
||
/// entire rendering target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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 <c>scale</c> and fit into
|
||
/// the corners of the destination rectangle. The sides and center are then
|
||
/// stretched into place to cover the remaining destination rectangle.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture9GridTiled"/>
|
||
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
|
||
);
|
||
|
||
/// <summary>
|
||
/// Perform a scaled copy using the 9-grid algorithm to the current rendering
|
||
/// target at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="texture">the source texture.</param>
|
||
/// <param name="srcrect">
|
||
/// the SDL_Rect structure representing the rectangle to be used
|
||
/// for the 9-grid, or NULL to use the entire texture.
|
||
/// </param>
|
||
/// <param name="left_width">the width, in pixels, of the left corners in <c>srcrect</c>.</param>
|
||
/// <param name="right_width">the width, in pixels, of the right corners in <c>srcrect</c>.</param>
|
||
/// <param name="top_height">the height, in pixels, of the top corners in <c>srcrect</c>.</param>
|
||
/// <param name="bottom_height">
|
||
/// the height, in pixels, of the bottom corners in
|
||
/// <c>srcrect</c>.
|
||
/// </param>
|
||
/// <param name="scale">
|
||
/// the scale used to transform the corner of <c>srcrect</c> into the
|
||
/// corner of <c>dstrect</c>, or 0.0f for an unscaled copy.
|
||
/// </param>
|
||
/// <param name="dstrect">
|
||
/// a pointer to the destination rectangle, or NULL for the
|
||
/// entire rendering target.
|
||
/// </param>
|
||
/// <param name="tileScale">
|
||
/// the scale used to transform the borders and center of
|
||
/// <c>srcrect</c> into the borders and middle of <c>dstrect</c>, or
|
||
/// 1.0f for an unscaled copy.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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 <c>scale</c> and fit into
|
||
/// the corners of the destination rectangle. The sides and center are then
|
||
/// tiled into place to cover the remaining destination rectangle.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture9Grid"/>
|
||
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
|
||
);
|
||
|
||
/// <summary>
|
||
/// Copy a portion of the source texture to the current rendering target, with
|
||
/// affine transform, at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="texture">the source texture.</param>
|
||
/// <param name="srcrect">
|
||
/// a pointer to the source rectangle, or NULL for the entire
|
||
/// texture.
|
||
/// </param>
|
||
/// <param name="origin">
|
||
/// a pointer to a point indicating where the top-left corner of
|
||
/// srcrect should be mapped to, or NULL for the rendering
|
||
/// target's origin.
|
||
/// </param>
|
||
/// <param name="right">
|
||
/// a pointer to a point indicating where the top-right corner of
|
||
/// srcrect should be mapped to, or NULL for the rendering
|
||
/// target's top-right corner.
|
||
/// </param>
|
||
/// <param name="down">
|
||
/// a pointer to a point indicating where the bottom-left corner of
|
||
/// srcrect should be mapped to, or NULL for the rendering target's
|
||
/// bottom-left corner.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// You may only call this function from the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture"/>
|
||
public bool RenderTextureAffine(
|
||
SdlTexture texture,
|
||
SdlFRect* srcrect,
|
||
SdlFPoint* origin,
|
||
SdlFPoint* right,
|
||
SdlFPoint* down
|
||
) => Sdl.Render.RenderTextureAffine(this, texture, srcrect, origin, right, down);
|
||
|
||
/// <summary>
|
||
/// Copy a portion of the source texture to the current rendering target, with
|
||
/// rotation and flipping, at subpixel precision.
|
||
/// </summary>
|
||
/// <param name="texture">the source texture.</param>
|
||
/// <param name="srcrect">
|
||
/// a pointer to the source rectangle, or NULL for the entire
|
||
/// texture.
|
||
/// </param>
|
||
/// <param name="dstrect">
|
||
/// a pointer to the destination rectangle, or NULL for the
|
||
/// entire rendering target.
|
||
/// </param>
|
||
/// <param name="angle">
|
||
/// an angle in degrees that indicates the rotation that will be
|
||
/// applied to dstrect, rotating it in a clockwise direction.
|
||
/// </param>
|
||
/// <param name="center">
|
||
/// a pointer to a point indicating the point around which
|
||
/// dstrect will be rotated (if NULL, rotation will be done
|
||
/// around dstrect.w/2, dstrect.h/2).
|
||
/// </param>
|
||
/// <param name="flip">
|
||
/// an SDL_FlipMode value stating which flipping actions should be
|
||
/// performed on the texture.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Tile a portion of the texture to the current rendering target at subpixel
|
||
/// precision.
|
||
/// </summary>
|
||
/// <param name="texture">the source texture.</param>
|
||
/// <param name="srcrect">
|
||
/// a pointer to the source rectangle, or NULL for the entire
|
||
/// texture.
|
||
/// </param>
|
||
/// <param name="scale">
|
||
/// the scale used to transform srcrect into the destination
|
||
/// rectangle, e.g. a 32x32 texture with a scale of 2 would fill
|
||
/// 64x64 tiles.
|
||
/// </param>
|
||
/// <param name="dstrect">
|
||
/// a pointer to the destination rectangle, or NULL for the
|
||
/// entire rendering target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The pixels in <c>srcrect</c> will be repeated as many times as needed to
|
||
/// completely fill <c>dstrect</c>.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderTexture"/>
|
||
public bool RenderTextureTiled(SdlTexture texture, SdlFRect* srcrect, float scale, SdlFRect* dstrect) =>
|
||
Sdl.Render.RenderTextureTiled(this, texture, srcrect, scale, dstrect);
|
||
|
||
/// <summary>
|
||
/// Return whether an explicit rectangle was set as the viewport.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true if the viewport was set to a specific rectangle, or false if
|
||
/// it was set to NULL (the entire target).
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This is useful if you're saving and restoring the viewport and want to know
|
||
/// whether you should restore a specific rectangle or NULL.
|
||
/// </para>
|
||
/// <para>
|
||
/// Each render target has its own viewport. This function checks the viewport
|
||
/// for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderViewport"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderViewport"/>
|
||
public bool RenderViewportSet() => Sdl.Render.RenderViewportSet(this);
|
||
|
||
/// <summary>
|
||
/// Set default scale mode for new textures for given renderer.
|
||
/// </summary>
|
||
/// <param name="scale_mode">the scale mode to change to for new textures.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// When a renderer is created, scale_mode defaults to SDL_SCALEMODE_LINEAR.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetDefaultTextureScaleMode"/>
|
||
public bool SetDefaultTextureScaleMode(SdlScaleMode scale_mode) =>
|
||
Sdl.Render.SetDefaultTextureScaleMode(this, scale_mode);
|
||
|
||
/// <summary>
|
||
/// Set custom GPU render state.
|
||
/// </summary>
|
||
/// <param name="state">the state to to use, or NULL to clear custom GPU render state.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This function sets custom GPU render state for subsequent draw calls. This
|
||
/// allows using custom shaders with the GPU renderer.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should be called on the thread that created the
|
||
/// renderer.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
public bool SetGpuRenderState(nint state) => Sdl.Render.SetGpuRenderState(this, state);
|
||
|
||
/// <summary>
|
||
/// Set the clip rectangle for rendering on the specified target.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// an SDL_Rect structure representing the clip area, relative to
|
||
/// the viewport, or NULL to disable clipping.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Each render target has its own clip rectangle. This function sets the
|
||
/// cliprect for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderClipRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderClipEnabled"/>
|
||
public bool SetRenderClipRect(SdlRect* rect) => Sdl.Render.SetRenderClipRect(this, rect);
|
||
|
||
/// <summary>
|
||
/// Set the color scale used for render operations.
|
||
/// </summary>
|
||
/// <param name="scale">the color scale value.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// The color scale does not affect the alpha channel, only the color
|
||
/// brightness.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderColorScale"/>
|
||
public bool SetRenderColorScale(float scale) => Sdl.Render.SetRenderColorScale(this, scale);
|
||
|
||
/// <summary>
|
||
/// Set the blend mode used for drawing operations (Fill and Line).
|
||
/// </summary>
|
||
/// <param name="blendMode">the SDL_BlendMode to use for blending.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the blend mode is not supported, the closest supported mode is chosen.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderDrawBlendMode"/>
|
||
public bool SetRenderDrawBlendMode(uint blendMode) => Sdl.Render.SetRenderDrawBlendMode(this, blendMode);
|
||
|
||
/// <summary>
|
||
/// Set the color used for drawing operations.
|
||
/// </summary>
|
||
/// <param name="r">the red value used to draw on the rendering target.</param>
|
||
/// <param name="g">the green value used to draw on the rendering target.</param>
|
||
/// <param name="b">the blue value used to draw on the rendering target.</param>
|
||
/// <param name="a">
|
||
/// the alpha value used to draw on the rendering target; usually
|
||
/// <c>SDL_ALPHA_OPAQUE</c> (255). Use SDL_SetRenderDrawBlendMode to
|
||
/// specify how the alpha channel is used.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Set the color for drawing or filling rectangles, lines, and points, and for
|
||
/// SDL_RenderClear().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderDrawColor"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawColorFloat"/>
|
||
public bool SetRenderDrawColor(byte r, byte g, byte b, byte a) =>
|
||
Sdl.Render.SetRenderDrawColor(this, r, g, b, a);
|
||
|
||
/// <summary>
|
||
/// Set the color used for drawing operations (Rect, Line and Clear).
|
||
/// </summary>
|
||
/// <param name="r">the red value used to draw on the rendering target.</param>
|
||
/// <param name="g">the green value used to draw on the rendering target.</param>
|
||
/// <param name="b">the blue value used to draw on the rendering target.</param>
|
||
/// <param name="a">
|
||
/// the alpha value used to draw on the rendering target. Use
|
||
/// SDL_SetRenderDrawBlendMode to specify how the alpha channel is
|
||
/// used.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Set the color for drawing or filling rectangles, lines, and points, and for
|
||
/// SDL_RenderClear().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderDrawColorFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetRenderDrawColor"/>
|
||
public bool SetRenderDrawColorFloat(float r, float g, float b, float a) =>
|
||
Sdl.Render.SetRenderDrawColorFloat(this, r, g, b, a);
|
||
|
||
/// <summary>
|
||
/// Set a device-independent resolution and presentation mode for rendering.
|
||
/// </summary>
|
||
/// <param name="w">the width of the logical resolution.</param>
|
||
/// <param name="h">the height of the logical resolution.</param>
|
||
/// <param name="mode">the presentation mode used.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// You can convert coordinates in an event into rendering coordinates using
|
||
/// SDL_ConvertEventToRenderCoordinates().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.ConvertEventToRenderCoordinates"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderLogicalPresentation"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderLogicalPresentationRect"/>
|
||
public bool SetRenderLogicalPresentation(int w, int h, SdlRendererLogicalPresentation mode) =>
|
||
Sdl.Render.SetRenderLogicalPresentation(this, w, h, mode);
|
||
|
||
/// <summary>
|
||
/// Set the drawing scale for rendering on the current target.
|
||
/// </summary>
|
||
/// <param name="scaleX">the horizontal scaling factor.</param>
|
||
/// <param name="scaleY">the vertical scaling factor.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Each render target has its own scale. This function sets the scale for the
|
||
/// current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderScale"/>
|
||
public bool SetRenderScale(float scaleX, float scaleY) => Sdl.Render.SetRenderScale(this, scaleX, scaleY);
|
||
|
||
/// <summary>
|
||
/// Set a texture as the current rendering target.
|
||
/// </summary>
|
||
/// <param name="texture">
|
||
/// the targeted texture, which must be created with the
|
||
/// <c>SDL_TEXTUREACCESS_TARGET</c> flag, or NULL to render to the
|
||
/// window instead of a texture.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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 <c>texture</c>.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderTarget"/>
|
||
public bool SetRenderTarget(SdlTexture texture) => Sdl.Render.SetRenderTarget(this, texture);
|
||
|
||
/// <summary>
|
||
/// Set the texture addressing mode used in SDL_RenderGeometry().
|
||
/// </summary>
|
||
/// <param name="u_mode">
|
||
/// the SDL_TextureAddressMode to use for horizontal texture
|
||
/// coordinates in SDL_RenderGeometry().
|
||
/// </param>
|
||
/// <param name="v_mode">
|
||
/// the SDL_TextureAddressMode to use for vertical texture
|
||
/// coordinates in SDL_RenderGeometry().
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderGeometry"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderGeometryRaw"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderTextureAddressMode"/>
|
||
public bool SetRenderTextureAddressMode(SdlTextureAddressMode u_mode, SdlTextureAddressMode v_mode) =>
|
||
Sdl.Render.SetRenderTextureAddressMode(this, u_mode, v_mode);
|
||
|
||
/// <summary>
|
||
/// Toggle VSync of the given renderer.
|
||
/// </summary>
|
||
/// <param name="vsync">the vertical refresh sync interval.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// When a renderer is created, vsync defaults to SDL_RENDERER_VSYNC_DISABLED.
|
||
/// </para>
|
||
/// <para>
|
||
/// The <c>vsync</c> 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderVSync"/>
|
||
public bool SetRenderVSync(int vsync) => Sdl.Render.SetRenderVSync(this, vsync);
|
||
|
||
/// <summary>
|
||
/// Set the drawing area for rendering on the current target.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// the SDL_Rect structure representing the drawing area, or NULL
|
||
/// to set the viewport to the entire target.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// The area's width and height must be >= 0.
|
||
/// </para>
|
||
/// <para>
|
||
/// Each render target has its own viewport. This function sets the viewport
|
||
/// for the current render target.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderViewport"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RenderViewportSet"/>
|
||
public bool SetRenderViewport(SdlRect* rect) => Sdl.Render.SetRenderViewport(this, rect);
|
||
}
|
||
|
||
public readonly unsafe partial struct SdlTexture
|
||
{
|
||
/// <summary>
|
||
/// Destroy the specified texture.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Passing NULL or an otherwise invalid texture will set the SDL error message
|
||
/// to "Invalid texture".
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateTextureFromSurface"/>
|
||
public void Destroy()
|
||
{
|
||
if (IsNull())
|
||
{
|
||
return;
|
||
}
|
||
Sdl.Render.DestroyTexture(this);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetRendererFromTexture</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlRenderer GetRendererFromTexture() => Sdl.Render.GetRendererFromTexture(this);
|
||
|
||
/// <summary>
|
||
/// Get the additional alpha value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="alpha">a pointer filled in with the current alpha value.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureAlphaModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureColorMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureAlphaMod"/>
|
||
public bool GetAlphaMod(out byte alpha) => Sdl.Render.GetTextureAlphaMod(this, out alpha);
|
||
|
||
/// <summary>
|
||
/// Get the additional alpha value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="alpha">a pointer filled in with the current alpha value.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureAlphaMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureColorModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureAlphaModFloat"/>
|
||
public bool GetAlphaModFloat(out float alpha) => Sdl.Render.GetTextureAlphaModFloat(this, out alpha);
|
||
|
||
/// <summary>
|
||
/// Get the blend mode used for texture copy operations.
|
||
/// </summary>
|
||
/// <param name="blendMode">a pointer filled in with the current SDL_BlendMode.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureBlendMode"/>
|
||
public bool GetBlendMode(uint* blendMode) => Sdl.Render.GetTextureBlendMode(this, blendMode);
|
||
|
||
/// <summary>
|
||
/// Get the additional color value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="r">a pointer filled in with the current red color value.</param>
|
||
/// <param name="g">a pointer filled in with the current green color value.</param>
|
||
/// <param name="b">a pointer filled in with the current blue color value.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureAlphaMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureColorModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureColorMod"/>
|
||
public bool GetColorMod(out byte r, out byte g, out byte b) =>
|
||
Sdl.Render.GetTextureColorMod(this, out r, out g, out b);
|
||
|
||
/// <summary>
|
||
/// Get the additional color value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="r">a pointer filled in with the current red color value.</param>
|
||
/// <param name="g">a pointer filled in with the current green color value.</param>
|
||
/// <param name="b">a pointer filled in with the current blue color value.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureAlphaModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureColorMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureColorModFloat"/>
|
||
public bool GetColorModFloat(out float r, out float g, out float b) =>
|
||
Sdl.Render.GetTextureColorModFloat(this, out r, out g, out b);
|
||
|
||
/// <summary>
|
||
/// Get the properties associated with a texture.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// a valid property ID on success or 0 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The following read-only properties are provided by SDL:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_COLORSPACE_NUMBER</c>: an SDL_Colorspace value describing
|
||
/// the texture colorspace.
|
||
/// - <c>SDL_PROP_TEXTURE_FORMAT_NUMBER</c>: one of the enumerated values in
|
||
/// SDL_PixelFormat.
|
||
/// - <c>SDL_PROP_TEXTURE_ACCESS_NUMBER</c>: one of the enumerated values in
|
||
/// SDL_TextureAccess.
|
||
/// - <c>SDL_PROP_TEXTURE_WIDTH_NUMBER</c>: the width of the texture in pixels.
|
||
/// - <c>SDL_PROP_TEXTURE_HEIGHT_NUMBER</c>: the height of the texture in pixels.
|
||
/// - <c>SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT</c>: 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.
|
||
/// - <c>SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT</c>: 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// With the direct3d11 renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER</c>: the ID3D11Texture2D associated
|
||
/// with the texture
|
||
/// - <c>SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER</c>: the ID3D11Texture2D
|
||
/// associated with the U plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER</c>: the ID3D11Texture2D
|
||
/// associated with the V plane of a YUV texture
|
||
/// </para>
|
||
/// <para>
|
||
/// With the direct3d12 renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER</c>: the ID3D12Resource associated
|
||
/// with the texture
|
||
/// - <c>SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER</c>: the ID3D12Resource associated
|
||
/// with the U plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER</c>: the ID3D12Resource associated
|
||
/// with the V plane of a YUV texture
|
||
/// </para>
|
||
/// <para>
|
||
/// With the vulkan renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER</c>: the VkImage associated with the
|
||
/// texture
|
||
/// </para>
|
||
/// <para>
|
||
/// With the opengl renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER</c>: the GLuint texture associated
|
||
/// with the texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER</c>: the GLuint texture
|
||
/// associated with the UV plane of an NV12 texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER</c>: the GLuint texture associated
|
||
/// with the U plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER</c>: the GLuint texture associated
|
||
/// with the V plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER</c>: the GLenum for the
|
||
/// texture target (<c>GL_TEXTURE_2D</c>, <c>GL_TEXTURE_RECTANGLE_ARB</c>, etc)
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT</c>: the texture coordinate width of
|
||
/// the texture (0.0 - 1.0)
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT</c>: the texture coordinate height of
|
||
/// the texture (0.0 - 1.0)
|
||
/// </para>
|
||
/// <para>
|
||
/// With the opengles2 renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER</c>: the GLuint texture
|
||
/// associated with the texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER</c>: the GLuint texture
|
||
/// associated with the UV plane of an NV12 texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER</c>: the GLuint texture
|
||
/// associated with the U plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER</c>: the GLuint texture
|
||
/// associated with the V plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER</c>: the GLenum for the
|
||
/// texture target (<c>GL_TEXTURE_2D</c>, <c>GL_TEXTURE_EXTERNAL_OES</c>, etc)
|
||
/// </para>
|
||
/// <para>
|
||
/// With the gpu renderer:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER</c>: the SDL_GPUTexture associated
|
||
/// with the texture
|
||
/// - <c>SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER</c>: the SDL_GPUTexture associated
|
||
/// with the UV plane of an NV12 texture
|
||
/// - <c>SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER</c>: the SDL_GPUTexture associated
|
||
/// with the U plane of a YUV texture
|
||
/// - <c>SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER</c>: the SDL_GPUTexture associated
|
||
/// with the V plane of a YUV texture
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// It is safe to call this function from any thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetProperties() => Sdl.Render.GetTextureProperties(this);
|
||
|
||
/// <summary>
|
||
/// Get the scale mode used for texture scale operations.
|
||
/// </summary>
|
||
/// <param name="scaleMode">a pointer filled in with the current scale mode.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureScaleMode"/>
|
||
public bool GetScaleMode(out SdlScaleMode scaleMode) => Sdl.Render.GetTextureScaleMode(this, out scaleMode);
|
||
|
||
/// <summary>
|
||
/// Get the size of a texture, as floating point values.
|
||
/// </summary>
|
||
/// <param name="w">
|
||
/// a pointer filled in with the width of the texture in pixels. This
|
||
/// argument can be NULL if you don't need this information.
|
||
/// </param>
|
||
/// <param name="h">
|
||
/// a pointer filled in with the height of the texture in pixels. This
|
||
/// argument can be NULL if you don't need this information.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool GetSize(out float w, out float h) => Sdl.Render.GetTextureSize(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Lock a portion of the texture for <b>write-only</b> pixel access.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// an SDL_Rect structure representing the area to lock for access;
|
||
/// NULL to lock the entire texture.
|
||
/// </param>
|
||
/// <param name="pixels">
|
||
/// this is filled in with a pointer to the locked pixels,
|
||
/// appropriately offset by the locked area.
|
||
/// </param>
|
||
/// <param name="pitch">
|
||
/// this is filled in with the pitch of the locked pixels; the
|
||
/// pitch is the length of one row in bytes.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false if the texture is not valid or was not
|
||
/// created with <c>SDL_TEXTUREACCESS_STREAMING</c>; call SDL_GetError()
|
||
/// for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// You must use SDL_UnlockTexture() to unlock the pixels and apply any
|
||
/// changes.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.LockTextureToSurface"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UnlockTexture"/>
|
||
public bool Lock(SdlRect* rect, void** pixels, out int pitch) =>
|
||
Sdl.Render.LockTexture(this, rect, pixels, out pitch);
|
||
|
||
/// <summary>
|
||
/// Lock a portion of the texture for <b>write-only</b> pixel access, and expose
|
||
/// it as a SDL surface.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer to the rectangle to lock for access. If the rect is
|
||
/// NULL, the entire texture will be locked.
|
||
/// </param>
|
||
/// <param name="surface">
|
||
/// a pointer to an SDL surface of size <b>rect</b>. Don't assume
|
||
/// any specific pixel content.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Besides providing an SDL_Surface instead of raw pixel data, this function
|
||
/// operates like SDL_LockTexture.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// You must use SDL_UnlockTexture() to unlock the pixels and apply any
|
||
/// changes.
|
||
/// </para>
|
||
/// <para>
|
||
/// The returned surface is freed internally after calling SDL_UnlockTexture()
|
||
/// or SDL_DestroyTexture(). The caller should not free it.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.LockTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UnlockTexture"/>
|
||
public bool LockToSurface(SdlRect* rect, SdlSurface** surface) =>
|
||
Sdl.Render.LockTextureToSurface(this, rect, surface);
|
||
|
||
/// <summary>
|
||
/// Set an additional alpha value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="alpha">the source alpha value multiplied into copy operations.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// When this texture is rendered, during the copy operation the source alpha
|
||
/// value is modulated by this alpha value according to the following formula:
|
||
/// </para>
|
||
/// <para>
|
||
/// <c>srcA = srcA * (alpha / 255)</c>
|
||
/// </para>
|
||
/// <para>
|
||
/// Alpha modulation is not always supported by the renderer; it will return
|
||
/// false if alpha modulation is not supported.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureAlphaMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureAlphaModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureColorMod"/>
|
||
public bool SetAlphaMod(byte alpha) => Sdl.Render.SetTextureAlphaMod(this, alpha);
|
||
|
||
/// <summary>
|
||
/// Set an additional alpha value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="alpha">the source alpha value multiplied into copy operations.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// When this texture is rendered, during the copy operation the source alpha
|
||
/// value is modulated by this alpha value according to the following formula:
|
||
/// </para>
|
||
/// <para>
|
||
/// <c>srcA = srcA * alpha</c>
|
||
/// </para>
|
||
/// <para>
|
||
/// Alpha modulation is not always supported by the renderer; it will return
|
||
/// false if alpha modulation is not supported.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureAlphaModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureAlphaMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureColorModFloat"/>
|
||
public bool SetAlphaModFloat(float alpha) => Sdl.Render.SetTextureAlphaModFloat(this, alpha);
|
||
|
||
/// <summary>
|
||
/// Set the blend mode for a texture, used by SDL_RenderTexture().
|
||
/// </summary>
|
||
/// <param name="blendMode">the SDL_BlendMode to use for texture blending.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the blend mode is not supported, the closest supported mode is chosen
|
||
/// and this function returns false.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureBlendMode"/>
|
||
public bool SetBlendMode(uint blendMode) => Sdl.Render.SetTextureBlendMode(this, blendMode);
|
||
|
||
/// <summary>
|
||
/// Set an additional color value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="r">the red color value multiplied into copy operations.</param>
|
||
/// <param name="g">the green color value multiplied into copy operations.</param>
|
||
/// <param name="b">the blue color value multiplied into copy operations.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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:
|
||
/// </para>
|
||
/// <para>
|
||
/// <c>srcC = srcC * (color / 255)</c>
|
||
/// </para>
|
||
/// <para>
|
||
/// Color modulation is not always supported by the renderer; it will return
|
||
/// false if color modulation is not supported.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureColorMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureAlphaMod"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureColorModFloat"/>
|
||
public bool SetColorMod(byte r, byte g, byte b) => Sdl.Render.SetTextureColorMod(this, r, g, b);
|
||
|
||
/// <summary>
|
||
/// Set an additional color value multiplied into render copy operations.
|
||
/// </summary>
|
||
/// <param name="r">the red color value multiplied into copy operations.</param>
|
||
/// <param name="g">the green color value multiplied into copy operations.</param>
|
||
/// <param name="b">the blue color value multiplied into copy operations.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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:
|
||
/// </para>
|
||
/// <para>
|
||
/// <c>srcC = srcC * color</c>
|
||
/// </para>
|
||
/// <para>
|
||
/// Color modulation is not always supported by the renderer; it will return
|
||
/// false if color modulation is not supported.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureColorModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureAlphaModFloat"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextureColorMod"/>
|
||
public bool SetColorModFloat(float r, float g, float b) => Sdl.Render.SetTextureColorModFloat(this, r, g, b);
|
||
|
||
/// <summary>
|
||
/// Set the palette used by a texture.
|
||
/// </summary>
|
||
/// <param name="palette">the SDL_Palette structure to use.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Setting the palette keeps an internal reference to the palette, which can
|
||
/// be safely destroyed afterwards.
|
||
/// </para>
|
||
/// <para>
|
||
/// A single palette can be shared with many textures.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreatePalette"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTexturePalette"/>
|
||
public bool SetPalette(SdlPalette* palette) => Sdl.Render.SetTexturePalette(this, palette);
|
||
|
||
/// <summary>
|
||
/// Set the scale mode used for texture scale operations.
|
||
/// </summary>
|
||
/// <param name="scaleMode">the SDL_ScaleMode to use for texture scaling.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The default texture scale mode is SDL_SCALEMODE_LINEAR.
|
||
/// </para>
|
||
/// <para>
|
||
/// If the scale mode is not supported, the closest supported mode is chosen.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextureScaleMode"/>
|
||
public bool SetScaleMode(SdlScaleMode scaleMode) => Sdl.Render.SetTextureScaleMode(this, scaleMode);
|
||
|
||
/// <summary>
|
||
/// Unlock a texture, uploading the changes to video memory, if needed.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// <b>Warning</b>: 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Which is to say: locking and immediately unlocking a texture can result in
|
||
/// corrupted textures, depending on the renderer in use.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.LockTexture"/>
|
||
public void Unlock() => Sdl.Render.UnlockTexture(this);
|
||
|
||
/// <summary>
|
||
/// Update a rectangle within a planar NV12 or NV21 texture with new pixels.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer to the rectangle of pixels to update, or NULL to
|
||
/// update the entire texture.
|
||
/// </param>
|
||
/// <param name="Yplane">the raw pixel data for the Y plane.</param>
|
||
/// <param name="Ypitch">
|
||
/// the number of bytes between rows of pixel data for the Y
|
||
/// plane.
|
||
/// </param>
|
||
/// <param name="UVplane">the raw pixel data for the UV plane.</param>
|
||
/// <param name="UVpitch">
|
||
/// the number of bytes between rows of pixel data for the UV
|
||
/// plane.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateYUVTexture"/>
|
||
public bool UpdateNV(SdlRect* rect, byte* Yplane, int Ypitch, byte* UVplane, int UVpitch) =>
|
||
Sdl.Render.UpdateNVTexture(this, rect, Yplane, Ypitch, UVplane, UVpitch);
|
||
|
||
/// <summary>
|
||
/// Update the given texture rectangle with new pixel data.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// an SDL_Rect structure representing the area to update, or NULL
|
||
/// to update the entire texture.
|
||
/// </param>
|
||
/// <param name="pixels">the raw pixel data in the format of the texture.</param>
|
||
/// <param name="pitch">
|
||
/// the number of bytes in a row of pixel data, including padding
|
||
/// between lines.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The pixel data must be in the pixel format of the texture, which can be
|
||
/// queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
|
||
/// </para>
|
||
/// <para>
|
||
/// This is a fairly slow function, intended for use with static textures that
|
||
/// do not change often.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.LockTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UnlockTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateNVTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateYUVTexture"/>
|
||
public bool Update(SdlRect* rect, void* pixels, int pitch) =>
|
||
Sdl.Render.UpdateTexture(this, rect, pixels, pitch);
|
||
|
||
/// <summary>
|
||
/// Update a rectangle within a planar YV12 or IYUV texture with new pixel
|
||
/// data.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer to the rectangle of pixels to update, or NULL to
|
||
/// update the entire texture.
|
||
/// </param>
|
||
/// <param name="Yplane">the raw pixel data for the Y plane.</param>
|
||
/// <param name="Ypitch">
|
||
/// the number of bytes between rows of pixel data for the Y
|
||
/// plane.
|
||
/// </param>
|
||
/// <param name="Uplane">the raw pixel data for the U plane.</param>
|
||
/// <param name="Upitch">
|
||
/// the number of bytes between rows of pixel data for the U
|
||
/// plane.
|
||
/// </param>
|
||
/// <param name="Vplane">the raw pixel data for the V plane.</param>
|
||
/// <param name="Vpitch">
|
||
/// the number of bytes between rows of pixel data for the V
|
||
/// plane.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateNVTexture"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateTexture"/>
|
||
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
|
||
{
|
||
/// <summary>
|
||
/// Dismiss the composition window/IME without disabling the subsystem.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StartTextInput"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StopTextInput"/>
|
||
public bool ClearComposition() => Sdl.Keyboard.ClearComposition(this);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_CreatePopupWindow</c>. Throws instead of returning a null handle on failure.
|
||
/// </summary>
|
||
/// <param name="offset_x">
|
||
/// the x position of the popup window relative to the origin
|
||
/// of the parent.
|
||
/// </param>
|
||
/// <param name="offset_y">
|
||
/// the y position of the popup window relative to the origin
|
||
/// of the parent window.
|
||
/// </param>
|
||
/// <param name="w">the width of the window.</param>
|
||
/// <param name="h">the height of the window.</param>
|
||
/// <param name="flags">
|
||
/// SDL_WINDOW_TOOLTIP or SDL_WINDOW_POPUP_MENU, and zero or more
|
||
/// additional SDL_WindowFlags OR'd together.
|
||
/// </param>
|
||
/// <returns>The created handle (never a null handle).</returns>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_CreateRenderer</c>. Throws instead of returning a null handle on failure.
|
||
/// </summary>
|
||
/// <param name="name">
|
||
/// the name of the rendering driver to initialize, or NULL to let
|
||
/// SDL choose one.
|
||
/// </param>
|
||
/// <returns>The created handle (never a null handle).</returns>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
public SdlRenderer CreateRenderer(string name) => Sdl.Render.CreateRenderer(this, name);
|
||
|
||
/// <summary>
|
||
/// Destroy a window.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Any child windows owned by the window will be recursively destroyed as
|
||
/// well.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreatePopupWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateWindowWithProperties"/>
|
||
public void Destroy()
|
||
{
|
||
if (IsNull())
|
||
{
|
||
return;
|
||
}
|
||
Sdl.Video.DestroyWindow(this);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Destroy the surface associated with the window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSurface"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WindowHasSurface"/>
|
||
public bool DestroySurface() => Sdl.Video.DestroyWindowSurface(this);
|
||
|
||
/// <summary>
|
||
/// Request a window to demand attention from the user.
|
||
/// </summary>
|
||
/// <param name="operation">the operation to perform.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool Flash(SdlFlashOperation operation) => Sdl.Video.FlashWindow(this, operation);
|
||
|
||
/// <summary>
|
||
/// Create an OpenGL context for an OpenGL window, and make it current.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the OpenGL context associated with <c>window</c> or NULL on failure;
|
||
/// call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The OpenGL context will be created with the current states set through
|
||
/// SDL_GL_SetAttribute().
|
||
/// </para>
|
||
/// <para>
|
||
/// The SDL_Window specified must have been created with the SDL_WINDOW_OPENGL
|
||
/// flag, or context creation will fail.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// SDL_GLContext is opaque to the application.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GLDestroyContext"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GLMakeCurrent"/>
|
||
public nint GLCreateContext() => Sdl.Video.GLCreateContext(this);
|
||
|
||
/// <summary>
|
||
/// Set up an OpenGL context for rendering into an OpenGL window.
|
||
/// </summary>
|
||
/// <param name="context">the OpenGL context to associate with the window.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The context must have been created with a compatible window.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GLCreateContext"/>
|
||
public bool GLMakeCurrent(nint context) => Sdl.Video.GLMakeCurrent(this, context);
|
||
|
||
/// <summary>
|
||
/// Update a window with OpenGL rendering.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This is used with double-buffered OpenGL contexts, which are the default.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool GLSwap() => Sdl.Video.GLSwapWindow(this);
|
||
|
||
/// <summary>
|
||
/// Get the display associated with a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the instance ID of the display containing the center of the window
|
||
/// on success or 0 on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetDisplayBounds"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetDisplays"/>
|
||
public uint GetDisplayForWindow() => Sdl.Video.GetDisplayForWindow(this);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetRenderer</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlRenderer GetRenderer() => Sdl.Render.GetRenderer(this);
|
||
|
||
/// <summary>
|
||
/// Get the area used to type Unicode text input.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer to an SDL_Rect filled in with the text input area,
|
||
/// may be NULL.
|
||
/// </param>
|
||
/// <param name="cursor">
|
||
/// a pointer to the offset of the current cursor location
|
||
/// relative to <c>rect->x</c>, may be NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This returns the values previously set by SDL_SetTextInputArea().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextInputArea"/>
|
||
public bool GetTextInputArea(SdlRect* rect, out int cursor) =>
|
||
Sdl.Keyboard.GetTextInputArea(this, rect, out cursor);
|
||
|
||
/// <summary>
|
||
/// Get the aspect ratio of a window's client area.
|
||
/// </summary>
|
||
/// <param name="min_aspect">
|
||
/// a pointer filled in with the minimum aspect ratio of the
|
||
/// window, may be NULL.
|
||
/// </param>
|
||
/// <param name="max_aspect">
|
||
/// a pointer filled in with the maximum aspect ratio of the
|
||
/// window, may be NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowAspectRatio"/>
|
||
public bool GetAspectRatio(out float min_aspect, out float max_aspect) =>
|
||
Sdl.Video.GetWindowAspectRatio(this, out min_aspect, out max_aspect);
|
||
|
||
/// <summary>
|
||
/// Get the size of a window's borders (decorations) around the client area.
|
||
/// </summary>
|
||
/// <param name="top">
|
||
/// pointer to variable for storing the size of the top border; NULL
|
||
/// is permitted.
|
||
/// </param>
|
||
/// <param name="left">
|
||
/// pointer to variable for storing the size of the left border;
|
||
/// NULL is permitted.
|
||
/// </param>
|
||
/// <param name="bottom">
|
||
/// pointer to variable for storing the size of the bottom
|
||
/// border; NULL is permitted.
|
||
/// </param>
|
||
/// <param name="right">
|
||
/// pointer to variable for storing the size of the right border;
|
||
/// NULL is permitted.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function also returns false if getting the information is not
|
||
/// supported.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSize"/>
|
||
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);
|
||
|
||
/// <summary>
|
||
/// Get the content display scale relative to a window's pixel size.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the display scale, or 0.0f on failure; call SDL_GetError() for
|
||
/// more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public float GetDisplayScale() => Sdl.Video.GetWindowDisplayScale(this);
|
||
|
||
/// <summary>
|
||
/// Get the window flags.
|
||
/// </summary>
|
||
/// <returns>a mask of the SDL_WindowFlags associated with <c>window</c>.</returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.HideWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MaximizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MinimizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowFullscreen"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMouseGrab"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowFillDocument"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.ShowWindow"/>
|
||
public SdlWindowFlags GetFlags() => Sdl.Video.GetWindowFlags(this);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetWindowICCProfile</c>.
|
||
/// </summary>
|
||
/// <exception cref="SdlException">The SDL call failed; the message carries the <c>SDL_GetError</c>
|
||
/// text.</exception>
|
||
/// <remarks>
|
||
/// SDL returns a freshly <c>SDL_malloc</c>'d buffer for this call; the returned array is a managed copy, and
|
||
/// the native buffer is freed with <c>SDL_free</c> before this method returns.
|
||
/// </remarks>
|
||
public byte[] GetICCProfile() => Sdl.Video.GetWindowICCProfile(this);
|
||
|
||
/// <summary>
|
||
/// Get the numeric ID of a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the ID of the window on success or 0 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The numeric ID is what SDL_WindowEvent references, and is necessary to map
|
||
/// these events to specific SDL_Window objects.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFromID"/>
|
||
public uint GetID() => Sdl.Video.GetWindowID(this);
|
||
|
||
/// <summary>
|
||
/// Get a window's keyboard grab mode.
|
||
/// </summary>
|
||
/// <returns>true if keyboard is grabbed, and false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowKeyboardGrab"/>
|
||
public bool GetKeyboardGrab() => Sdl.Video.GetWindowKeyboardGrab(this);
|
||
|
||
/// <summary>
|
||
/// Get the maximum size of a window's client area.
|
||
/// </summary>
|
||
/// <param name="w">
|
||
/// a pointer filled in with the maximum width of the window, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <param name="h">
|
||
/// a pointer filled in with the maximum height of the window, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMinimumSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMaximumSize"/>
|
||
public bool GetMaximumSize(out int w, out int h) => Sdl.Video.GetWindowMaximumSize(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Get the minimum size of a window's client area.
|
||
/// </summary>
|
||
/// <param name="w">
|
||
/// a pointer filled in with the minimum width of the window, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <param name="h">
|
||
/// a pointer filled in with the minimum height of the window, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMaximumSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMinimumSize"/>
|
||
public bool GetMinimumSize(out int w, out int h) => Sdl.Video.GetWindowMinimumSize(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Get a window's mouse grab mode.
|
||
/// </summary>
|
||
/// <returns>true if mouse is grabbed, and false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMouseRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMouseRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMouseGrab"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowKeyboardGrab"/>
|
||
public bool GetMouseGrab() => Sdl.Video.GetWindowMouseGrab(this);
|
||
|
||
/// <summary>
|
||
/// Get the opacity of a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on
|
||
/// failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If transparency isn't supported on this platform, opacity will be returned
|
||
/// as 1.0f without error.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowOpacity"/>
|
||
public float GetOpacity() => Sdl.Video.GetWindowOpacity(this);
|
||
|
||
/// <summary>
|
||
/// Ergonomic wrapper over <c>SDL_GetWindowParent</c>.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// <b>Borrowed handle:</b> the returned handle is owned by SDL (or by another object) and must not be
|
||
/// disposed. Do not call <see cref="System.IDisposable.Dispose"/> on it; doing so would free a resource this
|
||
/// call does not own. A null handle is returned on failure.
|
||
/// </remarks>
|
||
public SdlWindow GetParent() => Sdl.Video.GetWindowParent(this);
|
||
|
||
/// <summary>
|
||
/// Get the pixel density of a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the pixel density or 0.0f on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowDisplayScale"/>
|
||
public float GetPixelDensity() => Sdl.Video.GetWindowPixelDensity(this);
|
||
|
||
/// <summary>
|
||
/// Get the pixel format associated with the window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the pixel format of the window on success or
|
||
/// SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public SdlPixelFormat GetPixelFormat() => Sdl.Video.GetWindowPixelFormat(this);
|
||
|
||
/// <summary>
|
||
/// Get the position of a window.
|
||
/// </summary>
|
||
/// <param name="x">
|
||
/// a pointer filled in with the x position of the window, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <param name="y">
|
||
/// a pointer filled in with the y position of the window, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This is the current position of the window as last reported by the
|
||
/// windowing system.
|
||
/// </para>
|
||
/// <para>
|
||
/// If you do not need the value for one of the positions a NULL may be passed
|
||
/// in the <c>x</c> or <c>y</c> parameter.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowPosition"/>
|
||
public bool GetPosition(out int x, out int y) => Sdl.Video.GetWindowPosition(this, out x, out y);
|
||
|
||
/// <summary>
|
||
/// Get the state of the progress bar for the given window’s taskbar icon.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the progress state, or <c>SDL_PROGRESS_STATE_INVALID</c> on failure;
|
||
/// call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
public SdlProgressState GetProgressState() => Sdl.Video.GetWindowProgressState(this);
|
||
|
||
/// <summary>
|
||
/// Get the value of the progress bar for the given window’s taskbar icon.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the progress value in the range of [0.0f - 1.0f], or -1.0f on
|
||
/// failure; call SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
public float GetProgressValue() => Sdl.Video.GetWindowProgressValue(this);
|
||
|
||
/// <summary>
|
||
/// Get the properties associated with a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// a valid property ID on success or 0 on failure; call
|
||
/// SDL_GetError() for more information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The following read-only properties are provided by SDL:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_SHAPE_POINTER</c>: the surface associated with a shaped
|
||
/// window
|
||
/// - <c>SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN</c>: 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.
|
||
/// - <c>SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT</c>: 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.
|
||
/// - <c>SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT</c>: 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// On Android:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER</c>: the ANativeWindow associated
|
||
/// with the window
|
||
/// - <c>SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER</c>: the EGLSurface associated with
|
||
/// the window
|
||
/// </para>
|
||
/// <para>
|
||
/// On iOS:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER</c>: the <c>(__unsafe_unretained)</c>
|
||
/// UIWindow associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER</c>: the NSInteger tag
|
||
/// associated with metal views on the window
|
||
/// - <c>SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER</c>: the OpenGL view's
|
||
/// framebuffer object. It must be bound when rendering to the screen using
|
||
/// OpenGL.
|
||
/// - <c>SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER</c>: the OpenGL view's
|
||
/// renderbuffer object. It must be bound when SDL_GL_SwapWindow is called.
|
||
/// - <c>SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER</c>: the OpenGL
|
||
/// view's resolve framebuffer, when MSAA is used.
|
||
/// </para>
|
||
/// <para>
|
||
/// On KMS/DRM:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER</c>: the device index associated
|
||
/// with the window (e.g. the X in /dev/dri/cardX)
|
||
/// - <c>SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER</c>: the DRM FD associated with the
|
||
/// window
|
||
/// - <c>SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER</c>: the GBM device associated
|
||
/// with the window
|
||
/// </para>
|
||
/// <para>
|
||
/// On macOS:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_COCOA_WINDOW_POINTER</c>: the <c>(__unsafe_unretained)</c>
|
||
/// NSWindow associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER</c>: the NSInteger tag
|
||
/// associated with metal views on the window
|
||
/// </para>
|
||
/// <para>
|
||
/// On OpenVR:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER</c>: the OpenVR Overlay Handle ID
|
||
/// for the associated overlay window.
|
||
/// </para>
|
||
/// <para>
|
||
/// On Vivante:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER</c>: the EGLNativeDisplayType
|
||
/// associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER</c>: the EGLNativeWindowType
|
||
/// associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER</c>: the EGLSurface associated with
|
||
/// the window
|
||
/// </para>
|
||
/// <para>
|
||
/// On Windows:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_WIN32_HWND_POINTER</c>: the HWND associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_WIN32_HDC_POINTER</c>: the HDC associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER</c>: the HINSTANCE associated with
|
||
/// the window
|
||
/// </para>
|
||
/// <para>
|
||
/// On Wayland:
|
||
/// </para>
|
||
/// <para>
|
||
/// Note: The <c>xdg_*</c> 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER</c>: the wl_display associated with
|
||
/// the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER</c>: the wl_surface associated with
|
||
/// the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER</c>: the wp_viewport associated
|
||
/// with the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER</c>: the wl_egl_window
|
||
/// associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER</c>: the xdg_surface associated
|
||
/// with the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER</c>: the xdg_toplevel role
|
||
/// associated with the window
|
||
/// - 'SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING': the export
|
||
/// handle associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER</c>: the xdg_popup role
|
||
/// associated with the window
|
||
/// - <c>SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER</c>: the xdg_positioner
|
||
/// associated with the window, in popup mode
|
||
/// </para>
|
||
/// <para>
|
||
/// On X11:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_X11_DISPLAY_POINTER</c>: the X11 Display associated with
|
||
/// the window
|
||
/// - <c>SDL_PROP_WINDOW_X11_SCREEN_NUMBER</c>: the screen number associated with
|
||
/// the window
|
||
/// - <c>SDL_PROP_WINDOW_X11_WINDOW_NUMBER</c>: the X11 Window associated with the
|
||
/// window
|
||
/// </para>
|
||
/// <para>
|
||
/// On Emscripten:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING</c>: the id the canvas element
|
||
/// will have
|
||
/// - <c>SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING</c>: the keyboard
|
||
/// element that associates keyboard events to this window
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public uint GetProperties() => Sdl.Video.GetWindowProperties(this);
|
||
|
||
/// <summary>
|
||
/// Query whether relative mouse mode is enabled for a window.
|
||
/// </summary>
|
||
/// <returns>true if relative mode is enabled for a window or false otherwise.</returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowRelativeMouseMode"/>
|
||
public bool GetRelativeMouseMode() => Sdl.Mouse.GetWindowRelativeMouseMode(this);
|
||
|
||
/// <summary>
|
||
/// Get the safe area for this window.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a pointer filled in with the client area that is safe for
|
||
/// interactive content.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool GetSafeArea(SdlRect* rect) => Sdl.Video.GetWindowSafeArea(this, rect);
|
||
|
||
/// <summary>
|
||
/// Get the size of a window's client area.
|
||
/// </summary>
|
||
/// <param name="w">a pointer filled in with the width of the window, may be NULL.</param>
|
||
/// <param name="h">a pointer filled in with the height of the window, may be NULL.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRenderOutputSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSizeInPixels"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowSize"/>
|
||
public bool GetSize(out int w, out int h) => Sdl.Video.GetWindowSize(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Get the size of a window's client area, in pixels.
|
||
/// </summary>
|
||
/// <param name="w">
|
||
/// a pointer to variable for storing the width in pixels, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <param name="h">
|
||
/// a pointer to variable for storing the height in pixels, may be
|
||
/// NULL.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.CreateWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSize"/>
|
||
public bool GetSizeInPixels(out int w, out int h) => Sdl.Video.GetWindowSizeInPixels(this, out w, out h);
|
||
|
||
/// <summary>
|
||
/// Get VSync for the window surface.
|
||
/// </summary>
|
||
/// <param name="vsync">
|
||
/// an int filled with the current vertical refresh sync interval.
|
||
/// See SDL_SetWindowSurfaceVSync() for the meaning of the value.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowSurfaceVSync"/>
|
||
public bool GetSurfaceVSync(out int vsync) => Sdl.Video.GetWindowSurfaceVSync(this, out vsync);
|
||
|
||
/// <summary>
|
||
/// Get the title of a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// the title of the window in UTF-8 format or "" if there is no
|
||
/// title.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowTitle"/>
|
||
public string? GetTitle() => Sdl.Video.GetWindowTitle(this);
|
||
|
||
/// <summary>
|
||
/// Hide a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.ShowWindow"/>
|
||
public bool Hide() => Sdl.Video.HideWindow(this);
|
||
|
||
/// <summary>
|
||
/// Request that the window be made as large as possible.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Non-resizable windows can't be maximized. The window must have the
|
||
/// SDL_WINDOW_RESIZABLE flag set, or this will have no effect.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MinimizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RestoreWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool Maximize() => Sdl.Video.MaximizeWindow(this);
|
||
|
||
/// <summary>
|
||
/// Request that the window be minimized to an iconic representation.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MaximizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RestoreWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool Minimize() => Sdl.Video.MinimizeWindow(this);
|
||
|
||
/// <summary>
|
||
/// Request that a window be raised above other windows and gain the input
|
||
/// focus.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool Raise() => Sdl.Video.RaiseWindow(this);
|
||
|
||
/// <summary>
|
||
/// Request that the size and position of a minimized or maximized window be
|
||
/// restored.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MaximizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MinimizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool Restore() => Sdl.Video.RestoreWindow(this);
|
||
|
||
/// <summary>
|
||
/// Check whether the screen keyboard is shown for given window.
|
||
/// </summary>
|
||
/// <returns>true if screen keyboard is shown or false if not.</returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.HasScreenKeyboardSupport"/>
|
||
public bool ScreenKeyboardShown() => Sdl.Keyboard.ScreenKeyboardShown(this);
|
||
|
||
/// <summary>
|
||
/// Set the area used to type Unicode text input.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// the SDL_Rect representing the text input area, in window
|
||
/// coordinates, or NULL to clear it.
|
||
/// </param>
|
||
/// <param name="cursor">
|
||
/// the offset of the current cursor location relative to
|
||
/// <c>rect->x</c>, in window coordinates.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Native input methods may place a window with word suggestions near the
|
||
/// cursor, without covering the text being entered.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetTextInputArea"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StartTextInput"/>
|
||
public bool SetTextInputArea(SdlRect* rect, int cursor) => Sdl.Keyboard.SetTextInputArea(this, rect, cursor);
|
||
|
||
/// <summary>
|
||
/// Set the window to always be above the others.
|
||
/// </summary>
|
||
/// <param name="on_top">true to set the window always on top, false to disable.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This will add or remove the window's <c>SDL_WINDOW_ALWAYS_ON_TOP</c> flag. This
|
||
/// will bring the window to the front and keep the window above the rest.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFlags"/>
|
||
public bool SetAlwaysOnTop(bool on_top) => Sdl.Video.SetWindowAlwaysOnTop(this, on_top);
|
||
|
||
/// <summary>
|
||
/// Request that the aspect ratio of a window's client area be set.
|
||
/// </summary>
|
||
/// <param name="min_aspect">
|
||
/// the minimum aspect ratio of the window, or 0.0f for no
|
||
/// limit.
|
||
/// </param>
|
||
/// <param name="max_aspect">
|
||
/// the maximum aspect ratio of the window, or 0.0f for no
|
||
/// limit.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowAspectRatio"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool SetAspectRatio(float min_aspect, float max_aspect) =>
|
||
Sdl.Video.SetWindowAspectRatio(this, min_aspect, max_aspect);
|
||
|
||
/// <summary>
|
||
/// Set the border state of a window.
|
||
/// </summary>
|
||
/// <param name="bordered">false to remove border, true to add border.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This will add or remove the window's <c>SDL_WINDOW_BORDERLESS</c> 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// You can't change the border state of a fullscreen window.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFlags"/>
|
||
public bool SetBordered(bool bordered) => Sdl.Video.SetWindowBordered(this, bordered);
|
||
|
||
/// <summary>
|
||
/// Set the window to fill the current document space (Emscripten only).
|
||
/// </summary>
|
||
/// <param name="fill">true to set the window to fill the document, false to disable.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This will add or remove the window's <c>SDL_WINDOW_FILL_DOCUMENT</c> flag.
|
||
/// </para>
|
||
/// <para>
|
||
/// Currently this flag only applies to the Emscripten target.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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 <c>div</c> element).
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFlags"/>
|
||
public bool SetFillDocument(bool fill) => Sdl.Video.SetWindowFillDocument(this, fill);
|
||
|
||
/// <summary>
|
||
/// Set whether the window may have input focus.
|
||
/// </summary>
|
||
/// <param name="focusable">true to allow input focus, false to not allow input focus.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool SetFocusable(bool focusable) => Sdl.Video.SetWindowFocusable(this, focusable);
|
||
|
||
/// <summary>
|
||
/// Request that the window's fullscreen state be changed.
|
||
/// </summary>
|
||
/// <param name="fullscreen">true for fullscreen mode, false for windowed mode.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// By default a window in fullscreen state uses borderless fullscreen desktop
|
||
/// mode, but a specific exclusive display mode can be set using
|
||
/// SDL_SetWindowFullscreenMode().
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFullscreenMode"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowFullscreenMode"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool SetFullscreen(bool fullscreen) => Sdl.Video.SetWindowFullscreen(this, fullscreen);
|
||
|
||
/// <summary>
|
||
/// Set the display mode to use when a window is visible and fullscreen.
|
||
/// </summary>
|
||
/// <param name="mode">
|
||
/// a pointer to the display mode to use, which can be NULL for
|
||
/// borderless fullscreen desktop mode, or one of the fullscreen
|
||
/// modes returned by SDL_GetFullscreenDisplayModes() to set an
|
||
/// exclusive fullscreen mode.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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().
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFullscreenMode"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowFullscreen"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool SetFullscreenMode(SdlDisplayMode* mode) => Sdl.Video.SetWindowFullscreenMode(this, mode);
|
||
|
||
/// <summary>
|
||
/// Set the icon for a window.
|
||
/// </summary>
|
||
/// <param name="icon">an SDL_Surface structure containing the icon for the window.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.AddSurfaceAlternateImage"/>
|
||
public bool SetIcon(SdlSurface* icon) => Sdl.Video.SetWindowIcon(this, icon);
|
||
|
||
/// <summary>
|
||
/// Set a window's keyboard grab mode.
|
||
/// </summary>
|
||
/// <param name="grabbed">this is true to grab keyboard, and false to release.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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).
|
||
/// </para>
|
||
/// <para>
|
||
/// This is primarily intended for specialized applications such as VNC clients
|
||
/// or VM frontends. Normal games should not use keyboard grab.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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
|
||
/// <c>SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED</c>.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowKeyboardGrab"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMouseGrab"/>
|
||
public bool SetKeyboardGrab(bool grabbed) => Sdl.Video.SetWindowKeyboardGrab(this, grabbed);
|
||
|
||
/// <summary>
|
||
/// Set the maximum size of a window's client area.
|
||
/// </summary>
|
||
/// <param name="max_w">the maximum width of the window, or 0 for no limit.</param>
|
||
/// <param name="max_h">the maximum height of the window, or 0 for no limit.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMaximumSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMinimumSize"/>
|
||
public bool SetMaximumSize(int max_w, int max_h) => Sdl.Video.SetWindowMaximumSize(this, max_w, max_h);
|
||
|
||
/// <summary>
|
||
/// Set the minimum size of a window's client area.
|
||
/// </summary>
|
||
/// <param name="min_w">the minimum width of the window, or 0 for no limit.</param>
|
||
/// <param name="min_h">the minimum height of the window, or 0 for no limit.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMinimumSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMaximumSize"/>
|
||
public bool SetMinimumSize(int min_w, int min_h) => Sdl.Video.SetWindowMinimumSize(this, min_w, min_h);
|
||
|
||
/// <summary>
|
||
/// Toggle the state of the window as modal.
|
||
/// </summary>
|
||
/// <param name="modal">true to toggle modal status on, false to toggle it off.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowParent"/>
|
||
public bool SetModal(bool modal) => Sdl.Video.SetWindowModal(this, modal);
|
||
|
||
/// <summary>
|
||
/// Set a window's mouse grab mode.
|
||
/// </summary>
|
||
/// <param name="grabbed">this is true to grab mouse, and false to release.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Mouse grab confines the mouse cursor to the window.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMouseRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMouseRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowKeyboardGrab"/>
|
||
public bool SetMouseGrab(bool grabbed) => Sdl.Video.SetWindowMouseGrab(this, grabbed);
|
||
|
||
/// <summary>
|
||
/// Confines the cursor to the specified area of a window.
|
||
/// </summary>
|
||
/// <param name="rect">
|
||
/// a rectangle area in window-relative coordinates. If NULL the
|
||
/// barrier for the specified window will be destroyed.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// Note that this does NOT grab the cursor, it only defines the area a cursor
|
||
/// is restricted to when the window has mouse focus.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMouseRect"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowMouseGrab"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowMouseGrab"/>
|
||
public bool SetMouseRect(SdlRect* rect) => Sdl.Video.SetWindowMouseRect(this, rect);
|
||
|
||
/// <summary>
|
||
/// Set the opacity for a window.
|
||
/// </summary>
|
||
/// <param name="opacity">the opacity value (0.0f - transparent, 1.0f - opaque).</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// The parameter <c>opacity</c> will be clamped internally between 0.0f
|
||
/// (transparent) and 1.0f (opaque).
|
||
/// </para>
|
||
/// <para>
|
||
/// This function also returns false if setting the opacity isn't supported.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowOpacity"/>
|
||
public bool SetOpacity(float opacity) => Sdl.Video.SetWindowOpacity(this, opacity);
|
||
|
||
/// <summary>
|
||
/// Set the window as a child of a parent window.
|
||
/// </summary>
|
||
/// <param name="parent">the new parent window for the child window.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Popup windows cannot change parents and attempts to do so will fail.
|
||
/// </para>
|
||
/// <para>
|
||
/// Setting a parent window that is currently the sibling or descendent of the
|
||
/// child window results in undefined behavior.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowModal"/>
|
||
public bool SetParent(SdlWindow parent) => Sdl.Video.SetWindowParent(this, parent);
|
||
|
||
/// <summary>
|
||
/// Request that the window's position be set.
|
||
/// </summary>
|
||
/// <param name="x">
|
||
/// the x coordinate of the window, or <c>SDL_WINDOWPOS_CENTERED</c> or
|
||
/// <c>SDL_WINDOWPOS_UNDEFINED</c>.
|
||
/// </param>
|
||
/// <param name="y">
|
||
/// the y coordinate of the window, or <c>SDL_WINDOWPOS_CENTERED</c> or
|
||
/// <c>SDL_WINDOWPOS_UNDEFINED</c>.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the window is in an exclusive fullscreen or maximized state, this
|
||
/// request has no effect.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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().
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowPosition"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool SetPosition(int x, int y) => Sdl.Video.SetWindowPosition(this, x, y);
|
||
|
||
/// <summary>
|
||
/// Sets the state of the progress bar for the given window’s taskbar icon.
|
||
/// </summary>
|
||
/// <param name="state">
|
||
/// the progress state. <c>SDL_PROGRESS_STATE_NONE</c> stops displaying
|
||
/// the progress bar.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
public bool SetProgressState(SdlProgressState state) => Sdl.Video.SetWindowProgressState(this, state);
|
||
|
||
/// <summary>
|
||
/// Sets the value of the progress bar for the given window’s taskbar icon.
|
||
/// </summary>
|
||
/// <param name="value">
|
||
/// the progress value in the range of [0.0f - 1.0f]. If the value
|
||
/// is outside the valid range, it gets clamped.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.4.0.
|
||
/// </since>
|
||
public bool SetProgressValue(float value) => Sdl.Video.SetWindowProgressValue(this, value);
|
||
|
||
/// <summary>
|
||
/// Set relative mouse mode for a window.
|
||
/// </summary>
|
||
/// <param name="enabled">true to enable relative mode, false to disable.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function will flush any pending mouse motion for this window.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowRelativeMouseMode"/>
|
||
public bool SetRelativeMouseMode(bool enabled) => Sdl.Mouse.SetWindowRelativeMouseMode(this, enabled);
|
||
|
||
/// <summary>
|
||
/// Set the user-resizable state of a window.
|
||
/// </summary>
|
||
/// <param name="resizable">true to allow resizing, false to disallow.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This will add or remove the window's <c>SDL_WINDOW_RESIZABLE</c> 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// You can't change the resizable state of a fullscreen window.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowFlags"/>
|
||
public bool SetResizable(bool resizable) => Sdl.Video.SetWindowResizable(this, resizable);
|
||
|
||
/// <summary>
|
||
/// Set the shape of a transparent window.
|
||
/// </summary>
|
||
/// <param name="shape">
|
||
/// the surface representing the shape of the window, or NULL to
|
||
/// remove any current shape.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// The window must have been created with the SDL_WINDOW_TRANSPARENT flag.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool SetShape(SdlSurface* shape) => Sdl.Video.SetWindowShape(this, shape);
|
||
|
||
/// <summary>
|
||
/// Request that the size of a window's client area be set.
|
||
/// </summary>
|
||
/// <param name="w">the width of the window, must be > 0.</param>
|
||
/// <param name="h">the height of the window, must be > 0.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If the window is in a fullscreen or maximized state, this request has no
|
||
/// effect.
|
||
/// </para>
|
||
/// <para>
|
||
/// To change the exclusive fullscreen mode of a window, use
|
||
/// SDL_SetWindowFullscreenMode().
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowFullscreenMode"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SyncWindow"/>
|
||
public bool SetSize(int w, int h) => Sdl.Video.SetWindowSize(this, w, h);
|
||
|
||
/// <summary>
|
||
/// Toggle VSync for the window surface.
|
||
/// </summary>
|
||
/// <param name="vsync">the vertical refresh sync interval.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// When a window surface is created, vsync defaults to
|
||
/// SDL_WINDOW_SURFACE_VSYNC_DISABLED.
|
||
/// </para>
|
||
/// <para>
|
||
/// The <c>vsync</c> 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSurfaceVSync"/>
|
||
public bool SetSurfaceVSync(int vsync) => Sdl.Video.SetWindowSurfaceVSync(this, vsync);
|
||
|
||
/// <summary>
|
||
/// Set the title of a window.
|
||
/// </summary>
|
||
/// <param name="title">the desired window title in UTF-8 format.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This string is expected to be in UTF-8 encoding.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowTitle"/>
|
||
public bool SetTitle(string title) => Sdl.Video.SetWindowTitle(this, title);
|
||
|
||
/// <summary>
|
||
/// Show a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.HideWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RaiseWindow"/>
|
||
public bool Show() => Sdl.Video.ShowWindow(this);
|
||
|
||
/// <summary>
|
||
/// Display the system-level window menu.
|
||
/// </summary>
|
||
/// <param name="x">
|
||
/// the x coordinate of the menu, relative to the origin (top-left) of
|
||
/// the client area.
|
||
/// </param>
|
||
/// <param name="y">
|
||
/// the y coordinate of the menu, relative to the origin (top-left) of
|
||
/// the client area.
|
||
/// </param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// On platforms or desktops where this is unsupported, this function does
|
||
/// nothing.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
public bool ShowSystemMenu(int x, int y) => Sdl.Video.ShowWindowSystemMenu(this, x, y);
|
||
|
||
/// <summary>
|
||
/// Start accepting Unicode text input events in a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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().
|
||
/// </para>
|
||
/// <para>
|
||
/// Text input events are not received by default.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextInputArea"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StartTextInputWithProperties"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StopTextInput"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.TextInputActive"/>
|
||
public bool StartTextInput() => Sdl.Keyboard.StartTextInput(this);
|
||
|
||
/// <summary>
|
||
/// Start accepting Unicode text input events in a window, with properties
|
||
/// describing the input.
|
||
/// </summary>
|
||
/// <param name="props">the properties to use.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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().
|
||
/// </para>
|
||
/// <para>
|
||
/// Text input events are not received by default.
|
||
/// </para>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// These are the supported properties:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTINPUT_TYPE_NUMBER</c> - an SDL_TextInputType value that
|
||
/// describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT.
|
||
/// - <c>SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER</c> - 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.
|
||
/// - <c>SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN</c> - true to enable auto completion
|
||
/// and auto correction, defaults to true.
|
||
/// - <c>SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN</c> - 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".
|
||
/// </para>
|
||
/// <para>
|
||
/// On Android you can directly specify the input type:
|
||
/// </para>
|
||
/// <para>
|
||
/// - <c>SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER</c> - the text input type to
|
||
/// use, overriding other properties. This is documented at
|
||
/// https://developer.android.com/reference/android/text/InputType
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetTextInputArea"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StartTextInput"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StopTextInput"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.TextInputActive"/>
|
||
public bool StartTextInputWithProperties(uint props) => Sdl.Keyboard.StartTextInputWithProperties(this, props);
|
||
|
||
/// <summary>
|
||
/// Stop receiving any text input events in a window.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// If SDL_StartTextInput() showed the screen keyboard, this function will hide
|
||
/// it.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StartTextInput"/>
|
||
public bool StopTextInput() => Sdl.Keyboard.StopTextInput(this);
|
||
|
||
/// <summary>
|
||
/// Block until any pending window state is finalized.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false if the operation timed out before the
|
||
/// window was in the requested state.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// On windowing systems where changes are immediate, this does nothing.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowSize"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowPosition"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetWindowFullscreen"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MinimizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.MaximizeWindow"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RestoreWindow"/>
|
||
public bool Sync() => Sdl.Video.SyncWindow(this);
|
||
|
||
/// <summary>
|
||
/// Check whether or not Unicode text input events are enabled for a window.
|
||
/// </summary>
|
||
/// <returns>true if text input events are enabled else false.</returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StartTextInput"/>
|
||
public bool TextInputActive() => Sdl.Keyboard.TextInputActive(this);
|
||
|
||
/// <summary>
|
||
/// Copy the window surface to the screen.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This is the function you use to reflect any changes to the surface on the
|
||
/// screen.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function is equivalent to the SDL 1.2 API SDL_Flip().
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSurface"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateWindowSurfaceRects"/>
|
||
public bool UpdateSurface() => Sdl.Video.UpdateWindowSurface(this);
|
||
|
||
/// <summary>
|
||
/// Copy areas of the window surface to the screen.
|
||
/// </summary>
|
||
/// <param name="rects">
|
||
/// an array of SDL_Rect structures representing areas of the
|
||
/// surface to copy, in pixels.
|
||
/// </param>
|
||
/// <param name="numrects">the number of rectangles.</param>
|
||
/// <returns>
|
||
/// true on success or false on failure; call SDL_GetError() for more
|
||
/// information.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// This is the function you use to reflect changes to portions of the surface
|
||
/// on the screen.
|
||
/// </para>
|
||
/// <para>
|
||
/// This function is equivalent to the SDL 1.2 API SDL_UpdateRects().
|
||
/// </para>
|
||
/// <para>
|
||
/// Note that this function will update <em>at least</em> 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.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSurface"/>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.UpdateWindowSurface"/>
|
||
public bool UpdateSurfaceRects(SdlRect* rects, int numrects) =>
|
||
Sdl.Video.UpdateWindowSurfaceRects(this, rects, numrects);
|
||
|
||
/// <summary>
|
||
/// Move the mouse cursor to the given position within the window.
|
||
/// </summary>
|
||
/// <param name="x">the x coordinate within the window.</param>
|
||
/// <param name="y">the y coordinate within the window.</param>
|
||
/// <remarks>
|
||
/// <para>
|
||
/// 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.
|
||
/// </para>
|
||
/// <para>
|
||
/// Note that this function will appear to succeed, but not actually move the
|
||
/// mouse when used over Microsoft Remote Desktop.
|
||
/// </para>
|
||
/// </remarks>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WarpMouseGlobal"/>
|
||
public void WarpMouseInWindow(float x, float y) => Sdl.Mouse.WarpMouseInWindow(this, x, y);
|
||
|
||
/// <summary>
|
||
/// Return whether the window has a surface associated with it.
|
||
/// </summary>
|
||
/// <returns>
|
||
/// true if there is a surface associated with the window, or false
|
||
/// otherwise.
|
||
/// </returns>
|
||
/// <threadsafety>
|
||
/// This function should only be called on the main thread.
|
||
/// </threadsafety>
|
||
/// <since>
|
||
/// This function is available since SDL 3.2.0.
|
||
/// </since>
|
||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetWindowSurface"/>
|
||
public bool HasSurface() => Sdl.Video.WindowHasSurface(this);
|
||
}
|
||
}
|