mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-27 21:48:25 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
8 changed files with 784842 additions and 0 deletions
557
Brutal.Sdl/Generated/Libraries/Sdl.Events.gen.cs
Normal file
557
Brutal.Sdl/Generated/Libraries/Sdl.Events.gen.cs
Normal file
|
|
@ -0,0 +1,557 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Sdl.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.SdlApi
|
||||
{
|
||||
public static unsafe partial class Sdl
|
||||
{
|
||||
public static unsafe partial class Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Pump the event loop, gathering events from the input devices.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function updates the event queue and internal input device state.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// SDL_PumpEvents() gathers all the pending input information from devices and
|
||||
/// places it in the event queue. Without calls to SDL_PumpEvents() no events
|
||||
/// would ever be placed on the queue. Often the need for calls to
|
||||
/// SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and
|
||||
/// SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not
|
||||
/// polling or waiting for events (e.g. you are filtering them), then you must
|
||||
/// call SDL_PumpEvents() to force an event queue update.
|
||||
/// </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.PollEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WaitEvent"/>
|
||||
public static void PumpEvents()
|
||||
{
|
||||
PInvoke.PumpEvents();
|
||||
Sdl.ExceptionAggregator.CheckExceptions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check the event queue for messages and optionally return them.
|
||||
/// </summary>
|
||||
/// <param name="events">
|
||||
/// destination buffer for the retrieved events, may be NULL to
|
||||
/// leave the events in the queue and return the number of events
|
||||
/// that would have been stored.
|
||||
/// </param>
|
||||
/// <param name="numevents">
|
||||
/// if action is SDL_ADDEVENT, the number of events to add
|
||||
/// back to the event queue; if action is SDL_PEEKEVENT or
|
||||
/// SDL_GETEVENT, the maximum number of events to retrieve.
|
||||
/// </param>
|
||||
/// <param name="action">action to take; see [Remarks](#remarks) for details.</param>
|
||||
/// <param name="minType">
|
||||
/// minimum value of the event type to be considered;
|
||||
/// SDL_EVENT_FIRST is a safe choice.
|
||||
/// </param>
|
||||
/// <param name="maxType">
|
||||
/// maximum value of the event type to be considered;
|
||||
/// SDL_EVENT_LAST is a safe choice.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// the number of events actually stored or -1 on failure; call
|
||||
/// SDL_GetError() for more information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <c>action</c> may be any of the following:
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// - <c>SDL_ADDEVENT</c>: up to <c>numevents</c> events will be added to the back of the
|
||||
/// event queue.
|
||||
/// - <c>SDL_PEEKEVENT</c>: <c>numevents</c> events at the front of the event queue,
|
||||
/// within the specified minimum and maximum type, will be returned to the
|
||||
/// caller and will <em>not</em> be removed from the queue. If you pass NULL for
|
||||
/// <c>events</c>, then <c>numevents</c> is ignored and the total number of matching
|
||||
/// events will be returned.
|
||||
/// - <c>SDL_GETEVENT</c>: up to <c>numevents</c> events at the front of the event queue,
|
||||
/// within the specified minimum and maximum type, will be returned to the
|
||||
/// caller and will be removed from the queue.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// You may have to call SDL_PumpEvents() before calling this function.
|
||||
/// Otherwise, the events may not be ready to be filtered when you call
|
||||
/// SDL_PeepEvents().
|
||||
/// </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.PollEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.PumpEvents"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.PushEvent"/>
|
||||
public static int PeepEvents(
|
||||
SdlEvent* events,
|
||||
int numevents,
|
||||
SdlEventAction action,
|
||||
uint minType,
|
||||
uint maxType
|
||||
) => PInvoke.PeepEvents(events, numevents, action, minType, maxType);
|
||||
|
||||
/// <summary>
|
||||
/// Check for the existence of a certain event type in the event queue.
|
||||
/// </summary>
|
||||
/// <param name="type">the type of event to be queried; see SDL_EventType for details.</param>
|
||||
/// <returns>
|
||||
/// true if events matching <c>type</c> are present, or false if events
|
||||
/// matching <c>type</c> are not present.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If you need to check for a range of event types, use SDL_HasEvents()
|
||||
/// instead.
|
||||
/// </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.HasEvents"/>
|
||||
public static bool HasEvent(uint type) => PInvoke.HasEvent(type) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check for the existence of certain event types in the event queue.
|
||||
/// </summary>
|
||||
/// <param name="minType">
|
||||
/// the low end of event type to be queried, inclusive; see
|
||||
/// SDL_EventType for details.
|
||||
/// </param>
|
||||
/// <param name="maxType">
|
||||
/// the high end of event type to be queried, inclusive; see
|
||||
/// SDL_EventType for details.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true if events with type >= <c>minType</c> and <= <c>maxType</c> are
|
||||
/// present, or false if not.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If you need to check for a single event type, use SDL_HasEvent() instead.
|
||||
/// </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.HasEvents"/>
|
||||
public static bool HasEvents(uint minType, uint maxType) => PInvoke.HasEvents(minType, maxType) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Clear events of a specific type from the event queue.
|
||||
/// </summary>
|
||||
/// <param name="type">the type of event to be cleared; see SDL_EventType for details.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This will unconditionally remove any events from the queue that match
|
||||
/// <c>type</c>. If you need to remove a range of event types, use SDL_FlushEvents()
|
||||
/// instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// It's also normal to just ignore events you don't care about in your event
|
||||
/// loop without calling this function.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function only affects currently queued events. If you want to make
|
||||
/// sure that all pending OS events are flushed, you can call SDL_PumpEvents()
|
||||
/// on the main thread immediately before the flush call.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If you have user events with custom data that needs to be freed, you should
|
||||
/// use SDL_PeepEvents() to remove and clean up those events before calling
|
||||
/// this function.
|
||||
/// </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.FlushEvents"/>
|
||||
public static void FlushEvent(uint type) => PInvoke.FlushEvent(type);
|
||||
|
||||
/// <summary>
|
||||
/// Clear events of a range of types from the event queue.
|
||||
/// </summary>
|
||||
/// <param name="minType">
|
||||
/// the low end of event type to be cleared, inclusive; see
|
||||
/// SDL_EventType for details.
|
||||
/// </param>
|
||||
/// <param name="maxType">
|
||||
/// the high end of event type to be cleared, inclusive; see
|
||||
/// SDL_EventType for details.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This will unconditionally remove any events from the queue that are in the
|
||||
/// range of <c>minType</c> to <c>maxType</c>, inclusive. If you need to remove a single
|
||||
/// event type, use SDL_FlushEvent() instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// It's also normal to just ignore events you don't care about in your event
|
||||
/// loop without calling this function.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function only affects currently queued events. If you want to make
|
||||
/// sure that all pending OS events are flushed, you can call SDL_PumpEvents()
|
||||
/// on the main thread immediately before the flush call.
|
||||
/// </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.FlushEvent"/>
|
||||
public static void FlushEvents(uint minType, uint maxType) => PInvoke.FlushEvents(minType, maxType);
|
||||
|
||||
/// <summary>
|
||||
/// Poll for currently pending events.
|
||||
/// </summary>
|
||||
/// <param name="event">
|
||||
/// the SDL_Event structure to be filled with the next event from
|
||||
/// the queue, or NULL.
|
||||
/// </param>
|
||||
/// <returns>true if this got an event or false if there are none available.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If <c>event</c> is not NULL, the next event is removed from the queue and stored
|
||||
/// in the SDL_Event structure pointed to by <c>event</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If <c>event</c> is NULL, it simply returns true if there is an event in the
|
||||
/// queue, but will not remove it from the queue.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// As this function may implicitly call SDL_PumpEvents(), you can only call
|
||||
/// this function in the thread that initialized the video subsystem.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// SDL_PollEvent() is the favored way of receiving system events since it can
|
||||
/// be done from the main loop and does not suspend the main loop while waiting
|
||||
/// on an event to be posted.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The common practice is to fully process the event queue once every frame,
|
||||
/// usually as a first step before updating the game's state:
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// ```c
|
||||
/// while (game_is_still_running) {
|
||||
/// SDL_Event event;
|
||||
/// while (SDL_PollEvent(&event)) { // poll until all events are handled!
|
||||
/// // decide what to do with this event.
|
||||
/// }
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// // update game state, draw the current frame
|
||||
/// }
|
||||
/// ```
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that Windows (and possibly other platforms) has a quirk about how it
|
||||
/// handles events while dragging/resizing a window, which can cause this
|
||||
/// function to block for significant amounts of time. Technical explanations
|
||||
/// and solutions are discussed on the wiki:
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// https://wiki.libsdl.org/SDL3/AppFreezeDuringDrag
|
||||
/// </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.PushEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WaitEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WaitEventTimeout"/>
|
||||
public static bool PollEvent(SdlEvent* @event)
|
||||
{
|
||||
bool result = PInvoke.PollEvent(@event) != 0;
|
||||
Sdl.ExceptionAggregator.CheckExceptions();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wait indefinitely for the next available event.
|
||||
/// </summary>
|
||||
/// <param name="event">
|
||||
/// the SDL_Event structure to be filled in with the next event
|
||||
/// from the queue, or NULL.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true on success or false if there was an error while waiting for
|
||||
/// events; call SDL_GetError() for more information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If <c>event</c> is not NULL, the next event is removed from the queue and stored
|
||||
/// in the SDL_Event structure pointed to by <c>event</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// As this function may implicitly call SDL_PumpEvents(), you can only call
|
||||
/// this function in the thread that initialized the video subsystem.
|
||||
/// </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.PollEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.PushEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WaitEventTimeout"/>
|
||||
public static bool WaitEvent(SdlEvent* @event)
|
||||
{
|
||||
bool result = PInvoke.WaitEvent(@event) != 0;
|
||||
Sdl.ExceptionAggregator.CheckExceptions();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wait until the specified timeout (in milliseconds) for the next available
|
||||
/// event.
|
||||
/// </summary>
|
||||
/// <param name="event">
|
||||
/// the SDL_Event structure to be filled in with the next event
|
||||
/// from the queue, or NULL.
|
||||
/// </param>
|
||||
/// <param name="timeoutMS">
|
||||
/// the maximum number of milliseconds to wait for the next
|
||||
/// available event.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true if this got an event or false if the timeout elapsed without
|
||||
/// any events available.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If <c>event</c> is not NULL, the next event is removed from the queue and stored
|
||||
/// in the SDL_Event structure pointed to by <c>event</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// As this function may implicitly call SDL_PumpEvents(), you can only call
|
||||
/// this function in the thread that initialized the video subsystem.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The timeout is not guaranteed, the actual wait time could be longer due to
|
||||
/// system scheduling.
|
||||
/// </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.PollEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.PushEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.WaitEvent"/>
|
||||
public static bool WaitEventTimeout(SdlEvent* @event, int timeoutMS)
|
||||
{
|
||||
bool result = PInvoke.WaitEventTimeout(@event, timeoutMS) != 0;
|
||||
Sdl.ExceptionAggregator.CheckExceptions();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an event to the event queue.
|
||||
/// </summary>
|
||||
/// <param name="event">the SDL_Event to be added to the queue.</param>
|
||||
/// <returns>
|
||||
/// true on success, false if the event was filtered or on failure;
|
||||
/// call SDL_GetError() for more information. A common reason for
|
||||
/// error is the event queue being full.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The event queue can actually be used as a two way communication channel.
|
||||
/// Not only can events be read from the queue, but the user can also push
|
||||
/// their own events onto it. <c>event</c> is a pointer to the event structure you
|
||||
/// wish to push onto the queue. The event is copied into the queue, and the
|
||||
/// caller may dispose of the memory pointed to after SDL_PushEvent() returns.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note: Pushing device input events onto the queue doesn't modify the state
|
||||
/// of the device within SDL.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note: Events pushed onto the queue with SDL_PushEvent() get passed through
|
||||
/// the event filter but events added with SDL_PeepEvents() do not.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// For pushing application-specific events, please use SDL_RegisterEvents() to
|
||||
/// get an event type that does not conflict with other code that also wants
|
||||
/// its own custom event types.
|
||||
/// </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.PeepEvents"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.PollEvent"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.RegisterEvents"/>
|
||||
public static bool PushEvent(SdlEvent* @event)
|
||||
{
|
||||
bool result = PInvoke.PushEvent(@event) != 0;
|
||||
Sdl.ExceptionAggregator.CheckExceptions();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the current event filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">the current callback function will be stored here.</param>
|
||||
/// <param name="userdata">
|
||||
/// the pointer that is passed to the current event filter will
|
||||
/// be stored here.
|
||||
/// </param>
|
||||
/// <returns>true on success or false if there is no event filter set.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function can be used to "chain" filters, by saving the existing filter
|
||||
/// before replacing it with a function that will call that saved filter.
|
||||
/// </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.SetEventFilter"/>
|
||||
public static bool GetEventFilter(
|
||||
delegate* unmanaged[Cdecl]<void*, SdlEvent*, byte>* filter,
|
||||
void** userdata
|
||||
) => PInvoke.GetEventFilter(filter, userdata) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Set the state of processing events by type.
|
||||
/// </summary>
|
||||
/// <param name="type">the type of event; see SDL_EventType for details.</param>
|
||||
/// <param name="enabled">whether to process the event or not.</param>
|
||||
/// <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.EventEnabled"/>
|
||||
public static void SetEventEnabled(uint type, bool enabled) =>
|
||||
PInvoke.SetEventEnabled(type, enabled ? (byte)1 : (byte)0);
|
||||
|
||||
/// <summary>
|
||||
/// Query the state of processing events by type.
|
||||
/// </summary>
|
||||
/// <param name="type">the type of event; see SDL_EventType for details.</param>
|
||||
/// <returns>true if the event is being processed, 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.SetEventEnabled"/>
|
||||
public static bool EventEnabled(uint type) => PInvoke.EventEnabled(type) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Allocate a set of user-defined events, and return the beginning event
|
||||
/// number for that set of events.
|
||||
/// </summary>
|
||||
/// <param name="numevents">the number of events to be allocated.</param>
|
||||
/// <returns>
|
||||
/// the beginning event number, or 0 if numevents is invalid or if
|
||||
/// there are not enough user-defined events left.
|
||||
/// </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.PushEvent"/>
|
||||
public static uint RegisterEvents(int numevents) => PInvoke.RegisterEvents(numevents);
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetWindowFromEvent</c>.
|
||||
/// </summary>
|
||||
/// <param name="event">an event containing a <c>windowID</c>.</param>
|
||||
/// <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 static SdlWindow GetWindowFromEvent(SdlEvent* @event) => PInvoke.GetWindowFromEvent(@event);
|
||||
|
||||
/// <summary>
|
||||
/// Generate an English description of an event.
|
||||
/// </summary>
|
||||
/// <param name="event">an event to describe. May be NULL.</param>
|
||||
/// <param name="buf">the buffer to fill with the description string. May be NULL.</param>
|
||||
/// <param name="buflen">the maximum bytes that can be written to <c>buf</c>.</param>
|
||||
/// <returns>
|
||||
/// number of bytes needed for the full string, not counting the
|
||||
/// null-terminator byte.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This will fill <c>buf</c> with a null-terminated string that might look
|
||||
/// something like this:
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// ```
|
||||
/// SDL_EVENT_MOUSE_MOTION (timestamp=1140256324 windowid=2 which=0 state=0 x=492.99 y=139.09 xrel=52
|
||||
/// yrel=6)
|
||||
/// ```
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The exact format of the string is not guaranteed; it is intended for
|
||||
/// logging purposes, to be read by a human, and not parsed by a computer.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The returned value follows the same rules as SDL_snprintf(): <c>buf</c> will
|
||||
/// always be NULL-terminated (unless <c>buflen</c> is zero), and will be truncated
|
||||
/// if <c>buflen</c> is too small. The return code is the number of bytes needed for
|
||||
/// the complete string, not counting the NULL-terminator, whether the string
|
||||
/// was truncated or not. Unlike SDL_snprintf(), though, this function never
|
||||
/// returns -1.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// It is safe to call this function from any thread.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.4.0.
|
||||
/// </since>
|
||||
public static int GetEventDescription(SdlEvent* @event, byte* buf, int buflen) =>
|
||||
PInvoke.GetEventDescription(@event, buf, buflen);
|
||||
}
|
||||
}
|
||||
}
|
||||
1571
Brutal.Sdl/Generated/Libraries/Sdl.Gamepad.gen.cs
Normal file
1571
Brutal.Sdl/Generated/Libraries/Sdl.Gamepad.gen.cs
Normal file
File diff suppressed because it is too large
Load diff
253
Brutal.Sdl/Generated/Libraries/Sdl.Init.gen.cs
Normal file
253
Brutal.Sdl/Generated/Libraries/Sdl.Init.gen.cs
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Sdl.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.SdlApi
|
||||
{
|
||||
public static unsafe partial class Sdl
|
||||
{
|
||||
public static unsafe partial class Init
|
||||
{
|
||||
/// <summary>
|
||||
/// Compatibility function to initialize the SDL library.
|
||||
/// </summary>
|
||||
/// <param name="flags">any of the flags used by SDL_Init(); see SDL_Init for details.</param>
|
||||
/// <returns>
|
||||
/// true on success or false on failure; call SDL_GetError() for more
|
||||
/// information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function and SDL_Init() are interchangeable.
|
||||
/// </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.Init"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.Quit"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.QuitSubSystem"/>
|
||||
public static bool InitSubSystem(SdlInitFlags flags) => PInvoke.InitSubSystem(flags) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Shut down specific SDL subsystems.
|
||||
/// </summary>
|
||||
/// <param name="flags">any of the flags used by SDL_Init(); see SDL_Init for details.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// You still need to call SDL_Quit() even if you close all open subsystems
|
||||
/// with SDL_QuitSubSystem().
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.InitSubSystem"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.Quit"/>
|
||||
public static void QuitSubSystem(SdlInitFlags flags) => PInvoke.QuitSubSystem(flags);
|
||||
|
||||
/// <summary>
|
||||
/// Get a mask of the specified subsystems which are currently initialized.
|
||||
/// </summary>
|
||||
/// <param name="flags">any of the flags used by SDL_Init(); see SDL_Init for details.</param>
|
||||
/// <returns>
|
||||
/// a mask of all initialized subsystems if <c>flags</c> is 0, otherwise it
|
||||
/// returns the initialization status of the specified subsystems.
|
||||
/// </returns>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.Init"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.InitSubSystem"/>
|
||||
public static SdlInitFlags WasInit(SdlInitFlags flags) => PInvoke.WasInit(flags);
|
||||
|
||||
/// <summary>
|
||||
/// Return whether this is the main thread.
|
||||
/// </summary>
|
||||
/// <returns>true if this thread is the main thread, or false otherwise.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// On Apple platforms, the main thread is the thread that runs your program's
|
||||
/// main() entry point. On other platforms, the main thread is the one that
|
||||
/// calls SDL_Init(SDL_INIT_VIDEO), which should usually be the one that runs
|
||||
/// your program's main() entry point. If you are using the main callbacks,
|
||||
/// SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the
|
||||
/// main thread.
|
||||
/// </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.RunOnMainThread"/>
|
||||
public static bool IsMainThread() => PInvoke.IsMainThread() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Specify basic metadata about your app.
|
||||
/// </summary>
|
||||
/// <param name="appname">
|
||||
/// The name of the application ("My Game 2: Bad Guy's
|
||||
/// Revenge!").
|
||||
/// </param>
|
||||
/// <param name="appversion">
|
||||
/// The version of the application ("1.0.0beta5" or a git
|
||||
/// hash, or whatever makes sense).
|
||||
/// </param>
|
||||
/// <param name="appidentifier">
|
||||
/// A unique string in reverse-domain format that
|
||||
/// identifies this app ("com.example.mygame2").
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// true on success or false on failure; call SDL_GetError() for more
|
||||
/// information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// You can optionally provide metadata about your app to SDL. This is not
|
||||
/// required, but strongly encouraged.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// There are several locations where SDL can make use of metadata (an "About"
|
||||
/// box in the macOS menu bar, the name of the app can be shown on some audio
|
||||
/// mixers, etc). Any piece of metadata can be left as NULL, if a specific
|
||||
/// detail doesn't make sense for the app.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function should be called as early as possible, before SDL_Init.
|
||||
/// Multiple calls to this function are allowed, but various state might not
|
||||
/// change once it has been set up with a previous call to this function.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Passing a NULL removes any previous metadata.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This is a simplified interface for the most important information. You can
|
||||
/// supply significantly more detailed metadata with
|
||||
/// SDL_SetAppMetadataProperty().
|
||||
/// </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.SetAppMetadataProperty"/>
|
||||
public static bool SetAppMetadata(string appname, string appversion, string appidentifier) =>
|
||||
PInvoke.SetAppMetadata(appname, appversion, appidentifier) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Specify metadata about your app through a set of properties.
|
||||
/// </summary>
|
||||
/// <param name="name">the name of the metadata property to set.</param>
|
||||
/// <param name="value">the value of the property, or NULL to remove that property.</param>
|
||||
/// <returns>
|
||||
/// true on success or false on failure; call SDL_GetError() for more
|
||||
/// information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// You can optionally provide metadata about your app to SDL. This is not
|
||||
/// required, but strongly encouraged.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// There are several locations where SDL can make use of metadata (an "About"
|
||||
/// box in the macOS menu bar, the name of the app can be shown on some audio
|
||||
/// mixers, etc). Any piece of metadata can be left out, if a specific detail
|
||||
/// doesn't make sense for the app.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function should be called as early as possible, before SDL_Init.
|
||||
/// Multiple calls to this function are allowed, but various state might not
|
||||
/// change once it has been set up with a previous call to this function.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Once set, this metadata can be read using SDL_GetAppMetadataProperty().
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// These are the supported properties:
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// - <c>SDL_PROP_APP_METADATA_NAME_STRING</c>: The human-readable name of the
|
||||
/// application, like "My Game 2: Bad Guy's Revenge!". This will show up
|
||||
/// anywhere the OS shows the name of the application separately from window
|
||||
/// titles, such as volume control applets, etc. This defaults to "SDL
|
||||
/// Application".
|
||||
/// - <c>SDL_PROP_APP_METADATA_VERSION_STRING</c>: The version of the app that is
|
||||
/// running; there are no rules on format, so "1.0.3beta2" and "April 22nd,
|
||||
/// 2024" and a git hash are all valid options. This has no default.
|
||||
/// - <c>SDL_PROP_APP_METADATA_IDENTIFIER_STRING</c>: A unique string that
|
||||
/// identifies this app. This must be in reverse-domain format, like
|
||||
/// "com.example.mygame2". This string is used by desktop compositors to
|
||||
/// identify and group windows together, as well as match applications with
|
||||
/// associated desktop settings and icons. If you plan to package your
|
||||
/// application in a container such as Flatpak, the app ID should match the
|
||||
/// name of your Flatpak container as well. This has no default.
|
||||
/// - <c>SDL_PROP_APP_METADATA_CREATOR_STRING</c>: The human-readable name of the
|
||||
/// creator/developer/maker of this app, like "MojoWorkshop, LLC"
|
||||
/// - <c>SDL_PROP_APP_METADATA_COPYRIGHT_STRING</c>: The human-readable copyright
|
||||
/// notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this
|
||||
/// to one line, don't paste a copy of a whole software license in here. This
|
||||
/// has no default.
|
||||
/// - <c>SDL_PROP_APP_METADATA_URL_STRING</c>: A URL to the app on the web. Maybe a
|
||||
/// product page, or a storefront, or even a GitHub repository, for user's
|
||||
/// further information This has no default.
|
||||
/// - <c>SDL_PROP_APP_METADATA_TYPE_STRING</c>: The type of application this is.
|
||||
/// Currently this string can be "game" for a video game, "mediaplayer" for a
|
||||
/// media player, or generically "application" if nothing else applies.
|
||||
/// Future versions of SDL might add new types. This defaults to
|
||||
/// "application".
|
||||
/// </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.GetAppMetadataProperty"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetAppMetadata"/>
|
||||
public static bool SetAppMetadataProperty(string name, string value) =>
|
||||
PInvoke.SetAppMetadataProperty(name, value) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get metadata about your app.
|
||||
/// </summary>
|
||||
/// <param name="name">the name of the metadata property to get.</param>
|
||||
/// <returns>
|
||||
/// the current value of the metadata property, or the default if it
|
||||
/// is not set, NULL for properties with no default.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This returns metadata previously set using SDL_SetAppMetadata() or
|
||||
/// SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list
|
||||
/// of available properties and their meanings.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// It is safe to call this function from any thread, although
|
||||
/// the string returned is not protected and could potentially be
|
||||
/// freed if you call SDL_SetAppMetadataProperty() to set that
|
||||
/// property from another thread.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetAppMetadata"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetAppMetadataProperty"/>
|
||||
public static string? GetAppMetadataProperty(string name) => PInvoke.GetAppMetadataProperty(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
1448
Brutal.Sdl/Generated/Libraries/Sdl.Joystick.gen.cs
Normal file
1448
Brutal.Sdl/Generated/Libraries/Sdl.Joystick.gen.cs
Normal file
File diff suppressed because it is too large
Load diff
561
Brutal.Sdl/Generated/Libraries/Sdl.Keyboard.gen.cs
Normal file
561
Brutal.Sdl/Generated/Libraries/Sdl.Keyboard.gen.cs
Normal file
|
|
@ -0,0 +1,561 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Sdl.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.SdlApi
|
||||
{
|
||||
public static unsafe partial class Sdl
|
||||
{
|
||||
public static unsafe partial class Keyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Return whether a keyboard is currently connected.
|
||||
/// </summary>
|
||||
/// <returns>true if a keyboard is connected, 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.GetKeyboards"/>
|
||||
public static bool HasKeyboard() => PInvoke.HasKeyboard() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetKeyboards</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 static uint[] GetKeyboards()
|
||||
{
|
||||
int count;
|
||||
var ptr = PInvoke.GetKeyboards(&count);
|
||||
if (ptr is null)
|
||||
throw SdlException.FromError("SDL_GetKeyboards failed");
|
||||
try
|
||||
{
|
||||
return new ReadOnlySpan<uint>(ptr, count).ToArray();
|
||||
}
|
||||
finally
|
||||
{
|
||||
PInvoke.Free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of a keyboard.
|
||||
/// </summary>
|
||||
/// <param name="instance_id">the keyboard instance ID.</param>
|
||||
/// <returns>
|
||||
/// the name of the selected keyboard or NULL on failure; call
|
||||
/// SDL_GetError() for more information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function returns "" if the keyboard doesn't have a name.
|
||||
/// </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.GetKeyboards"/>
|
||||
public static string? GetKeyboardNameForID(uint instance_id) => PInvoke.GetKeyboardNameForID(instance_id);
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetKeyboardFocus</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 static SdlWindow GetKeyboardFocus() => PInvoke.GetKeyboardFocus();
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetKeyboardState</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The returned array is a managed copy of SDL's own internal buffer, which SDL owns for the lifetime of
|
||||
/// the process; nothing here is freed.
|
||||
/// </remarks>
|
||||
public static bool[] GetKeyboardState()
|
||||
{
|
||||
int numkeys;
|
||||
var ptr = PInvoke.GetKeyboardState(&numkeys);
|
||||
if (ptr is null)
|
||||
return [];
|
||||
var result = new bool[numkeys];
|
||||
for (var i = 0; i < numkeys; i++)
|
||||
result[i] = ptr[i] != 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the state of the keyboard.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function will generate key up events for all pressed keys.
|
||||
/// </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.GetKeyboardState"/>
|
||||
public static void ResetKeyboard() => PInvoke.ResetKeyboard();
|
||||
|
||||
/// <summary>
|
||||
/// Get the current key modifier state for the keyboard.
|
||||
/// </summary>
|
||||
/// <returns>an OR'd combination of the modifier keys for the keyboard.</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.GetKeyboardState"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.SetModState"/>
|
||||
public static ushort GetModState() => PInvoke.GetModState();
|
||||
|
||||
/// <summary>
|
||||
/// Set the current key modifier state for the keyboard.
|
||||
/// </summary>
|
||||
/// <param name="modstate">the desired SDL_Keymod for the keyboard.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose
|
||||
/// modifier key states on your application. Simply pass your desired modifier
|
||||
/// states into <c>modstate</c>. This value may be a bitwise, OR'd combination of
|
||||
/// SDL_Keymod values.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This does not change the keyboard state, only the key modifier flags that
|
||||
/// SDL reports.
|
||||
/// </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.GetModState"/>
|
||||
public static void SetModState(ushort modstate) => PInvoke.SetModState(modstate);
|
||||
|
||||
/// <summary>
|
||||
/// Get the key code corresponding to the given scancode according to the
|
||||
/// current keyboard layout.
|
||||
/// </summary>
|
||||
/// <param name="scancode">the desired SDL_Scancode to query.</param>
|
||||
/// <param name="modstate">
|
||||
/// the modifier state to use when translating the scancode to
|
||||
/// a keycode.
|
||||
/// </param>
|
||||
/// <param name="key_event">true if the keycode will be used in key events.</param>
|
||||
/// <returns>the SDL_Keycode that corresponds to the given SDL_Scancode.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If you want to get the keycode as it would be delivered in key events,
|
||||
/// including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should
|
||||
/// pass <c>key_event</c> as true. Otherwise this function simply translates the
|
||||
/// scancode based on the given modifier state.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyName"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeFromKey"/>
|
||||
public static SdlKeycode GetKeyFromScancode(SdlScancode scancode, ushort modstate, bool key_event) =>
|
||||
PInvoke.GetKeyFromScancode(scancode, modstate, key_event ? (byte)1 : (byte)0);
|
||||
|
||||
/// <summary>
|
||||
/// Get the scancode corresponding to the given key code according to the
|
||||
/// current keyboard layout.
|
||||
/// </summary>
|
||||
/// <param name="key">the desired SDL_Keycode to query.</param>
|
||||
/// <param name="modstate">
|
||||
/// a pointer to the modifier state that would be used when the
|
||||
/// scancode generates this key, may be NULL.
|
||||
/// </param>
|
||||
/// <returns>the SDL_Scancode that corresponds to the given SDL_Keycode.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Note that there may be multiple scancode+modifier states that can generate
|
||||
/// this keycode, this will just return the first one found.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyFromScancode"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeName"/>
|
||||
public static SdlScancode GetScancodeFromKey(SdlKeycode key, ushort* modstate) =>
|
||||
PInvoke.GetScancodeFromKey(key, modstate);
|
||||
|
||||
/// <summary>
|
||||
/// Get a human-readable name for a scancode.
|
||||
/// </summary>
|
||||
/// <param name="scancode">the desired SDL_Scancode to query.</param>
|
||||
/// <returns>
|
||||
/// a pointer to the name for the scancode. If the scancode doesn't
|
||||
/// have a name this function returns an empty string ("").
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Warning</b>: The returned name is by design not stable across platforms,
|
||||
/// e.g. the name for <c>SDL_SCANCODE_LGUI</c> is "Left GUI" under Linux but "Left
|
||||
/// Windows" under Microsoft Windows, and some scancodes like
|
||||
/// <c>SDL_SCANCODE_NONUSBACKSLASH</c> don't have any name at all. There are even
|
||||
/// scancodes that share names, e.g. <c>SDL_SCANCODE_RETURN</c> and
|
||||
/// <c>SDL_SCANCODE_RETURN2</c> (both called "Return"). This function is therefore
|
||||
/// unsuitable for creating a stable cross-platform two-way mapping between
|
||||
/// strings and scancodes.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeFromKey"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeFromName"/>
|
||||
public static string? GetScancodeName(SdlScancode scancode) => PInvoke.GetScancodeName(scancode);
|
||||
|
||||
/// <summary>
|
||||
/// Get a scancode from a human-readable name.
|
||||
/// </summary>
|
||||
/// <param name="name">the human-readable scancode name.</param>
|
||||
/// <returns>
|
||||
/// the SDL_Scancode, or <c>SDL_SCANCODE_UNKNOWN</c> if the name wasn't
|
||||
/// recognized; call SDL_GetError() for more information.
|
||||
/// </returns>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyFromName"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeFromKey"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeName"/>
|
||||
public static SdlScancode GetScancodeFromName(string name) => PInvoke.GetScancodeFromName(name);
|
||||
|
||||
/// <summary>
|
||||
/// Get a human-readable name for a key.
|
||||
/// </summary>
|
||||
/// <param name="key">the desired SDL_Keycode to query.</param>
|
||||
/// <returns>a UTF-8 encoded string of the key name.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If the key doesn't have a name, this function returns an empty string ("").
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Letters will be presented in their uppercase form, if applicable.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyFromName"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyFromScancode"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeFromKey"/>
|
||||
public static string? GetKeyName(SdlKeycode key) => PInvoke.GetKeyName(key);
|
||||
|
||||
/// <summary>
|
||||
/// Get a key code from a human-readable name.
|
||||
/// </summary>
|
||||
/// <param name="name">the human-readable key name.</param>
|
||||
/// <returns>
|
||||
/// key code, or <c>SDLK_UNKNOWN</c> if the name wasn't recognized; call
|
||||
/// SDL_GetError() for more information.
|
||||
/// </returns>
|
||||
/// <threadsafety>
|
||||
/// This function is not thread safe.
|
||||
/// </threadsafety>
|
||||
/// <since>
|
||||
/// This function is available since SDL 3.2.0.
|
||||
/// </since>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyFromScancode"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetKeyName"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetScancodeFromName"/>
|
||||
public static SdlKeycode GetKeyFromName(string name) => PInvoke.GetKeyFromName(name);
|
||||
|
||||
/// <summary>
|
||||
/// Start accepting Unicode text input events in a window.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to enable text input.</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>
|
||||
/// </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 static bool StartTextInput(SdlWindow window) => PInvoke.StartTextInput(window) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Start accepting Unicode text input events in a window, with properties
|
||||
/// describing the input.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to enable text input.</param>
|
||||
/// <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 static bool StartTextInputWithProperties(SdlWindow window, uint props) =>
|
||||
PInvoke.StartTextInputWithProperties(window, props) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check whether or not Unicode text input events are enabled for a window.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to check.</param>
|
||||
/// <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 static bool TextInputActive(SdlWindow window) => PInvoke.TextInputActive(window) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Stop receiving any text input events in a window.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to disable text input.</param>
|
||||
/// <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 static bool StopTextInput(SdlWindow window) => PInvoke.StopTextInput(window) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Dismiss the composition window/IME without disabling the subsystem.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to affect.</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.StartTextInput"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.StopTextInput"/>
|
||||
public static bool ClearComposition(SdlWindow window) => PInvoke.ClearComposition(window) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Set the area used to type Unicode text input.
|
||||
/// </summary>
|
||||
/// <param name="window">the window for which to set the text input area.</param>
|
||||
/// <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 static bool SetTextInputArea(SdlWindow window, SdlRect* rect, int cursor) =>
|
||||
PInvoke.SetTextInputArea(window, rect, cursor) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get the area used to type Unicode text input.
|
||||
/// </summary>
|
||||
/// <param name="window">the window for which to query the text input area.</param>
|
||||
/// <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 static bool GetTextInputArea(SdlWindow window, SdlRect* rect, out int cursor)
|
||||
{
|
||||
cursor = default;
|
||||
fixed (int* cursorPtr = &cursor)
|
||||
{
|
||||
return PInvoke.GetTextInputArea(window, rect, cursorPtr) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the platform has screen keyboard support.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// true if the platform has some screen keyboard support 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.StartTextInput"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.ScreenKeyboardShown"/>
|
||||
public static bool HasScreenKeyboardSupport() => PInvoke.HasScreenKeyboardSupport() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the screen keyboard is shown for given window.
|
||||
/// </summary>
|
||||
/// <param name="window">the window for which screen keyboard should be queried.</param>
|
||||
/// <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 static bool ScreenKeyboardShown(SdlWindow window) => PInvoke.ScreenKeyboardShown(window) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
635
Brutal.Sdl/Generated/Libraries/Sdl.Mouse.gen.cs
Normal file
635
Brutal.Sdl/Generated/Libraries/Sdl.Mouse.gen.cs
Normal file
|
|
@ -0,0 +1,635 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Sdl.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.SdlApi
|
||||
{
|
||||
public static unsafe partial class Sdl
|
||||
{
|
||||
public static unsafe partial class Mouse
|
||||
{
|
||||
/// <summary>
|
||||
/// Return whether a mouse is currently connected.
|
||||
/// </summary>
|
||||
/// <returns>true if a mouse is connected, 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.GetMice"/>
|
||||
public static bool HasMouse() => PInvoke.HasMouse() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetMice</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 static uint[] GetMice()
|
||||
{
|
||||
int count;
|
||||
var ptr = PInvoke.GetMice(&count);
|
||||
if (ptr is null)
|
||||
throw SdlException.FromError("SDL_GetMice failed");
|
||||
try
|
||||
{
|
||||
return new ReadOnlySpan<uint>(ptr, count).ToArray();
|
||||
}
|
||||
finally
|
||||
{
|
||||
PInvoke.Free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of a mouse.
|
||||
/// </summary>
|
||||
/// <param name="instance_id">the mouse instance ID.</param>
|
||||
/// <returns>
|
||||
/// the name of the selected mouse, or NULL on failure; call
|
||||
/// SDL_GetError() for more information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function returns "" if the mouse doesn't have a name.
|
||||
/// </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.GetMice"/>
|
||||
public static string? GetMouseNameForID(uint instance_id) => PInvoke.GetMouseNameForID(instance_id);
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetMouseFocus</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 static SdlWindow GetMouseFocus() => PInvoke.GetMouseFocus();
|
||||
|
||||
/// <summary>
|
||||
/// Query SDL's cache for the synchronous mouse button state and the
|
||||
/// window-relative SDL-cursor position.
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// a pointer to receive the SDL-cursor's x-position from the focused
|
||||
/// window's top left corner, can be NULL if unused.
|
||||
/// </param>
|
||||
/// <param name="y">
|
||||
/// a pointer to receive the SDL-cursor's y-position from the focused
|
||||
/// window's top left corner, can be NULL if unused.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// a 32-bit bitmask of the button state that can be bitwise-compared
|
||||
/// against the SDL_BUTTON_MASK(X) macro.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function returns the cached synchronous state as SDL understands it
|
||||
/// from the last pump of the event queue.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// To query the platform for immediate asynchronous state, use
|
||||
/// SDL_GetGlobalMouseState.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Passing non-NULL pointers to <c>x</c> or <c>y</c> will write the destination with
|
||||
/// respective x or y coordinates relative to the focused window.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// In Relative Mode, the SDL-cursor's position usually contradicts the
|
||||
/// platform-cursor's position as manually calculated from
|
||||
/// SDL_GetGlobalMouseState() and SDL_GetWindowPosition.
|
||||
/// </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.GetGlobalMouseState"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetRelativeMouseState"/>
|
||||
public static SdlMouseButtonFlags GetMouseState(out float x, out float y)
|
||||
{
|
||||
x = default;
|
||||
y = default;
|
||||
fixed (float* xPtr = &x)
|
||||
{
|
||||
fixed (float* yPtr = &y)
|
||||
{
|
||||
return PInvoke.GetMouseState(xPtr, yPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query the platform for the asynchronous mouse button state and the
|
||||
/// desktop-relative platform-cursor position.
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// a pointer to receive the platform-cursor's x-position from the
|
||||
/// desktop's top left corner, can be NULL if unused.
|
||||
/// </param>
|
||||
/// <param name="y">
|
||||
/// a pointer to receive the platform-cursor's y-position from the
|
||||
/// desktop's top left corner, can be NULL if unused.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// a 32-bit bitmask of the button state that can be bitwise-compared
|
||||
/// against the SDL_BUTTON_MASK(X) macro.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function immediately queries the platform for the most recent
|
||||
/// asynchronous state, more costly than retrieving SDL's cached state in
|
||||
/// SDL_GetMouseState().
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Passing non-NULL pointers to <c>x</c> or <c>y</c> will write the destination with
|
||||
/// respective x or y coordinates relative to the desktop.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// In Relative Mode, the platform-cursor's position usually contradicts the
|
||||
/// SDL-cursor's position as manually calculated from SDL_GetMouseState() and
|
||||
/// SDL_GetWindowPosition.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function can be useful if you need to track the mouse outside of a
|
||||
/// specific window and SDL_CaptureMouse() doesn't fit your needs. For example,
|
||||
/// it could be useful if you need to track the mouse while dragging a window,
|
||||
/// where coordinates relative to a window might not be in sync at all times.
|
||||
/// </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.CaptureMouse"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetMouseState"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGlobalMouseState"/>
|
||||
public static SdlMouseButtonFlags GetGlobalMouseState(out float x, out float y)
|
||||
{
|
||||
x = default;
|
||||
y = default;
|
||||
fixed (float* xPtr = &x)
|
||||
{
|
||||
fixed (float* yPtr = &y)
|
||||
{
|
||||
return PInvoke.GetGlobalMouseState(xPtr, yPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query SDL's cache for the synchronous mouse button state and accumulated
|
||||
/// mouse delta since last call.
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// a pointer to receive the x mouse delta accumulated since last
|
||||
/// call, can be NULL if unused.
|
||||
/// </param>
|
||||
/// <param name="y">
|
||||
/// a pointer to receive the y mouse delta accumulated since last
|
||||
/// call, can be NULL if unused.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// a 32-bit bitmask of the button state that can be bitwise-compared
|
||||
/// against the SDL_BUTTON_MASK(X) macro.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function returns the cached synchronous state as SDL understands it
|
||||
/// from the last pump of the event queue.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// To query the platform for immediate asynchronous state, use
|
||||
/// SDL_GetGlobalMouseState.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Passing non-NULL pointers to <c>x</c> or <c>y</c> will write the destination with
|
||||
/// respective x or y deltas accumulated since the last call to this function
|
||||
/// (or since event initialization).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function is useful for reducing overhead by processing relative mouse
|
||||
/// inputs in one go per-frame instead of individually per-event, at the
|
||||
/// expense of losing the order between events within the frame (e.g. quickly
|
||||
/// pressing and releasing a button within the same frame).
|
||||
/// </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.GetMouseState"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.GetGlobalMouseState"/>
|
||||
public static SdlMouseButtonFlags GetRelativeMouseState(out float x, out float y)
|
||||
{
|
||||
x = default;
|
||||
y = default;
|
||||
fixed (float* xPtr = &x)
|
||||
{
|
||||
fixed (float* yPtr = &y)
|
||||
{
|
||||
return PInvoke.GetRelativeMouseState(xPtr, yPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move the mouse cursor to the given position within the window.
|
||||
/// </summary>
|
||||
/// <param name="window">
|
||||
/// the window to move the mouse into, or NULL for the current
|
||||
/// mouse focus.
|
||||
/// </param>
|
||||
/// <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 static void WarpMouseInWindow(SdlWindow window, float x, float y) =>
|
||||
PInvoke.WarpMouseInWindow(window, x, y);
|
||||
|
||||
/// <summary>
|
||||
/// Move the mouse to the given position in global screen space.
|
||||
/// </summary>
|
||||
/// <param name="x">the x coordinate.</param>
|
||||
/// <param name="y">the y coordinate.</param>
|
||||
/// <returns>
|
||||
/// true on success or false on failure; call SDL_GetError() for more
|
||||
/// information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function generates a mouse motion event.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// A failure of this function usually means that it is unsupported by a
|
||||
/// platform.
|
||||
/// </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.WarpMouseInWindow"/>
|
||||
public static bool WarpMouseGlobal(float x, float y) => PInvoke.WarpMouseGlobal(x, y) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Set relative mouse mode for a window.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to change.</param>
|
||||
/// <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 static bool SetWindowRelativeMouseMode(SdlWindow window, bool enabled) =>
|
||||
PInvoke.SetWindowRelativeMouseMode(window, enabled ? (byte)1 : (byte)0) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Query whether relative mouse mode is enabled for a window.
|
||||
/// </summary>
|
||||
/// <param name="window">the window to query.</param>
|
||||
/// <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 static bool GetWindowRelativeMouseMode(SdlWindow window) =>
|
||||
PInvoke.GetWindowRelativeMouseMode(window) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Capture the mouse and to track input outside an SDL window.
|
||||
/// </summary>
|
||||
/// <param name="enabled">true to enable capturing, false to disable.</param>
|
||||
/// <returns>
|
||||
/// true on success or false on failure; call SDL_GetError() for more
|
||||
/// information.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Capturing enables your app to obtain mouse events globally, instead of just
|
||||
/// within your window. Not all video targets support this function. When
|
||||
/// capturing is enabled, the current window will get all mouse events, but
|
||||
/// unlike relative mode, no change is made to the cursor and it is not
|
||||
/// restrained to your window.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function may also deny mouse input to other windows--both those in
|
||||
/// your application and others on the system--so you should use this function
|
||||
/// sparingly, and in small bursts. For example, you might want to track the
|
||||
/// mouse while the user is dragging something, until the user releases a mouse
|
||||
/// button. It is not recommended that you capture the mouse for long periods
|
||||
/// of time, such as the entire time your app is running. For that, you should
|
||||
/// probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(),
|
||||
/// depending on your goals.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// While captured, mouse events still report coordinates relative to the
|
||||
/// current (foreground) window, but those coordinates may be outside the
|
||||
/// bounds of the window (including negative values). Capturing is only allowed
|
||||
/// for the foreground window. If the window loses focus while capturing, the
|
||||
/// capture will be disabled automatically.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// While capturing is enabled, the current window will have the
|
||||
/// <c>SDL_WINDOW_MOUSE_CAPTURE</c> flag set.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Please note that SDL will attempt to "auto capture" the mouse while the
|
||||
/// user is pressing a button; this is to try and make mouse behavior more
|
||||
/// consistent between platforms, and deal with the common case of a user
|
||||
/// dragging the mouse outside of the window. This means that if you are
|
||||
/// calling SDL_CaptureMouse() only to deal with this situation, you do not
|
||||
/// have to (although it is safe to do so). If this causes problems for your
|
||||
/// app, you can disable auto capture by setting the
|
||||
/// <c>SDL_HINT_MOUSE_AUTO_CAPTURE</c> hint to zero.
|
||||
/// </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.GetGlobalMouseState"/>
|
||||
public static bool CaptureMouse(bool enabled) => PInvoke.CaptureMouse(enabled ? (byte)1 : (byte)0) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_CreateCursor</c>. Throws instead of returning a null handle on failure.
|
||||
/// </summary>
|
||||
/// <param name="data">the color value for each pixel of the cursor.</param>
|
||||
/// <param name="mask">the mask value for each pixel of the cursor.</param>
|
||||
/// <param name="w">the width of the cursor.</param>
|
||||
/// <param name="h">the height of the cursor.</param>
|
||||
/// <param name="hot_x">
|
||||
/// the x-axis offset from the left of the cursor image to the
|
||||
/// mouse x position, in the range of 0 to <c>w</c> - 1.
|
||||
/// </param>
|
||||
/// <param name="hot_y">
|
||||
/// the y-axis offset from the top of the cursor image to the
|
||||
/// mouse y position, in the range of 0 to <c>h</c> - 1.
|
||||
/// </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 static SdlCursor CreateCursor(byte* data, byte* mask, int w, int h, int hot_x, int hot_y)
|
||||
{
|
||||
SdlCursor result = PInvoke.CreateCursor(data, mask, w, h, hot_x, hot_y);
|
||||
if (result.IsNull())
|
||||
{
|
||||
throw SdlException.FromError("SDL_CreateCursor failed");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_CreateColorCursor</c>. Throws instead of returning a null handle on
|
||||
/// failure.
|
||||
/// </summary>
|
||||
/// <param name="surface">an SDL_Surface structure representing the cursor image.</param>
|
||||
/// <param name="hot_x">the x position of the cursor hot spot.</param>
|
||||
/// <param name="hot_y">the y position of the cursor hot spot.</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 static SdlCursor CreateColorCursor(SdlSurface* surface, int hot_x, int hot_y)
|
||||
{
|
||||
SdlCursor result = PInvoke.CreateColorCursor(surface, hot_x, hot_y);
|
||||
if (result.IsNull())
|
||||
{
|
||||
throw SdlException.FromError("SDL_CreateColorCursor failed");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_CreateAnimatedCursor</c>. Throws instead of returning a null handle on
|
||||
/// failure.
|
||||
/// </summary>
|
||||
/// <param name="frames">an array of cursor images composing the animation.</param>
|
||||
/// <param name="frame_count">the number of frames in the sequence.</param>
|
||||
/// <param name="hot_x">the x position of the cursor hot spot.</param>
|
||||
/// <param name="hot_y">the y position of the cursor hot spot.</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 static SdlCursor CreateAnimatedCursor(
|
||||
SdlCursorFrameInfo* frames,
|
||||
int frame_count,
|
||||
int hot_x,
|
||||
int hot_y
|
||||
)
|
||||
{
|
||||
SdlCursor result = PInvoke.CreateAnimatedCursor(frames, frame_count, hot_x, hot_y);
|
||||
if (result.IsNull())
|
||||
{
|
||||
throw SdlException.FromError("SDL_CreateAnimatedCursor failed");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_CreateSystemCursor</c>. Throws instead of returning a null handle on
|
||||
/// failure.
|
||||
/// </summary>
|
||||
/// <param name="id">an SDL_SystemCursor enum value.</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 static SdlCursor CreateSystemCursor(SdlSystemCursor id)
|
||||
{
|
||||
SdlCursor result = PInvoke.CreateSystemCursor(id);
|
||||
if (result.IsNull())
|
||||
{
|
||||
throw SdlException.FromError("SDL_CreateSystemCursor failed");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the active cursor.
|
||||
/// </summary>
|
||||
/// <param name="cursor">a cursor to make active.</param>
|
||||
/// <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 static bool SetCursor(SdlCursor cursor) => PInvoke.SetCursor(cursor) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetCursor</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 static SdlCursor GetCursor() => PInvoke.GetCursor();
|
||||
|
||||
/// <summary>
|
||||
/// Ergonomic wrapper over <c>SDL_GetDefaultCursor</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 static SdlCursor GetDefaultCursor() => PInvoke.GetDefaultCursor();
|
||||
|
||||
/// <summary>
|
||||
/// Free a previously-created cursor.
|
||||
/// </summary>
|
||||
/// <param name="cursor">the cursor to free.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Use this function to free cursor resources created with SDL_CreateCursor(),
|
||||
/// SDL_CreateColorCursor() or SDL_CreateSystemCursor().
|
||||
/// </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 static void DestroyCursor(SdlCursor cursor) => PInvoke.DestroyCursor(cursor);
|
||||
|
||||
/// <summary>
|
||||
/// Show the cursor.
|
||||
/// </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.CursorVisible"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.HideCursor"/>
|
||||
public static bool ShowCursor() => PInvoke.ShowCursor() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Hide the cursor.
|
||||
/// </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.CursorVisible"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.ShowCursor"/>
|
||||
public static bool HideCursor() => PInvoke.HideCursor() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Return whether the cursor is currently being shown.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the cursor is being shown, or <c>false</c> if the cursor is
|
||||
/// hidden.
|
||||
/// </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.HideCursor"/>
|
||||
/// <seealso cref="Brutal.SdlApi.Sdl.PInvoke.ShowCursor"/>
|
||||
public static bool CursorVisible() => PInvoke.CursorVisible() != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
3349
Brutal.Sdl/Generated/Libraries/Sdl.Render.gen.cs
Normal file
3349
Brutal.Sdl/Generated/Libraries/Sdl.Render.gen.cs
Normal file
File diff suppressed because it is too large
Load diff
2975
Brutal.Sdl/Generated/Libraries/Sdl.Video.gen.cs
Normal file
2975
Brutal.Sdl/Generated/Libraries/Sdl.Video.gen.cs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue