Table of Contents

Struct Event

Namespace
Sdl3Sharp.Events
Assembly
Sdl3Sharp.dll

Represents a general event in SDL

public struct Event : ICommonEvent<Event>, ICommonEvent, ISpanFormattable, IFormattable
Implements
Inherited Members

Remarks

Even though SDL's *Event structures do not use inheritance (as they are all structs or ValueTypes), you may think of Event as a common base representation of all the other *Event structures.

More specifically: all of the other *Event structures can be represented as an Event (this is usually achieved through implicit operator Event(in TSelf)), while an Event structure could potentially be represented as one of the *Event structures, depending on it's Type (this can be achieved through explicit operator TSelf(in Event), or copyless through TryAs<TEvent>(ref Event, out NullableRef<TEvent>) or TryAsReadOnly<TEvent>(ref readonly Event, out NullableRefReadOnly<TEvent>))

Associated EventTypes:

Constructors

Event(in AudioDeviceEvent)

Creates a new Event from an AudioDeviceEvent

public Event(in AudioDeviceEvent @event)

Parameters

event AudioDeviceEvent

The AudioDeviceEvent to store into the newly created Event

Event(in CameraDeviceEvent)

Creates a new Event from a CameraDeviceEvent

public Event(in CameraDeviceEvent @event)

Parameters

event CameraDeviceEvent

The CameraDeviceEvent to store into the newly created Event

Event(in ClipboardEvent)

Creates a new Event from a ClipboardEvent

public Event(in ClipboardEvent @event)

Parameters

event ClipboardEvent

The ClipboardEvent to store into the newly created Event

Event(in DisplayEvent)

Creates a new Event from a DisplayEvent

public Event(in DisplayEvent @event)

Parameters

event DisplayEvent

The DisplayEvent to store into the newly created Event

Event(in DropEvent)

Creates a new Event from a DropEvent

public Event(in DropEvent @event)

Parameters

event DropEvent

The DropEvent to store into the newly created Event

Event(in GamepadAxisEvent)

Creates a new Event from a GamepadAxisEvent

public Event(in GamepadAxisEvent @event)

Parameters

event GamepadAxisEvent

The GamepadAxisEvent to store into the newly created Event

Event(in GamepadButtonEvent)

Creates a new Event from a GamepadButtonEvent

public Event(in GamepadButtonEvent @event)

Parameters

event GamepadButtonEvent

The GamepadButtonEvent to store into the newly created Event

Event(in GamepadDeviceEvent)

Creates a new Event from a GamepadDeviceEvent

public Event(in GamepadDeviceEvent @event)

Parameters

event GamepadDeviceEvent

The GamepadDeviceEvent to store into the newly created Event

Event(in GamepadSensorEvent)

Creates a new Event from a GamepadSensorEvent

public Event(in GamepadSensorEvent @event)

Parameters

event GamepadSensorEvent

The GamepadSensorEvent to store into the newly created Event

Event(in GamepadTouchpadEvent)

Creates a new Event from a GamepadTouchpadEvent

public Event(in GamepadTouchpadEvent @event)

Parameters

event GamepadTouchpadEvent

The GamepadTouchpadEvent to store into the newly created Event

Event(in JoyAxisEvent)

Creates a new Event from a JoyAxisEvent

public Event(in JoyAxisEvent @event)

Parameters

event JoyAxisEvent

The JoyAxisEvent to store into the newly created Event

Event(in JoyBallEvent)

Creates a new Event from a JoyBallEvent

public Event(in JoyBallEvent @event)

Parameters

event JoyBallEvent

The JoyBallEvent to store into the newly created Event

Event(in JoyBatteryEvent)

Creates a new Event from a JoyBatteryEvent

public Event(in JoyBatteryEvent @event)

Parameters

event JoyBatteryEvent

The JoyBatteryEvent to store into the newly created Event

Event(in JoyButtonEvent)

Creates a new Event from a JoyButtonEvent

public Event(in JoyButtonEvent @event)

Parameters

event JoyButtonEvent

The JoyButtonEvent to store into the newly created Event

Event(in JoyDeviceEvent)

Creates a new Event from a JoyDeviceEvent

public Event(in JoyDeviceEvent @event)

Parameters

event JoyDeviceEvent

The JoyDeviceEvent to store into the newly created Event

Event(in JoyHatEvent)

Creates a new Event from a JoyHatEvent

public Event(in JoyHatEvent @event)

Parameters

event JoyHatEvent

The JoyHatEvent to store into the newly created Event

Event(in KeyboardDeviceEvent)

Creates a new Event from a KeyboardDeviceEvent

public Event(in KeyboardDeviceEvent @event)

Parameters

event KeyboardDeviceEvent

The KeyboardDeviceEvent to store into the newly created Event

Event(in KeyboardEvent)

Creates a new Event from a KeyboardEvent

public Event(in KeyboardEvent @event)

Parameters

event KeyboardEvent

The KeyboardEvent to store into the newly created Event

Event(in MouseButtonEvent)

Creates a new Event from a MouseButtonEvent

public Event(in MouseButtonEvent @event)

Parameters

event MouseButtonEvent

The MouseButtonEvent to store into the newly created Event

Event(in MouseDeviceEvent)

Creates a new Event from a MouseDeviceEvent

public Event(in MouseDeviceEvent @event)

Parameters

event MouseDeviceEvent

The MouseDeviceEvent to store into the newly created Event

Event(in MouseMotionEvent)

Creates a new Event from a MouseMotionEvent

public Event(in MouseMotionEvent @event)

Parameters

event MouseMotionEvent

The MouseMotionEvent to store into the newly created Event

Event(in MouseWheelEvent)

Creates a new Event from a MouseWheelEvent

public Event(in MouseWheelEvent @event)

Parameters

event MouseWheelEvent

The MouseWheelEvent to store into the newly created Event

Event(in PenAxisEvent)

Creates a new Event from a PenAxisEvent

public Event(in PenAxisEvent @event)

Parameters

event PenAxisEvent

The PenAxisEvent to store into the newly created Event

Event(in PenButtonEvent)

Creates a new Event from a PenButtonEvent

public Event(in PenButtonEvent @event)

Parameters

event PenButtonEvent

The PenButtonEvent to store into the newly created Event

Event(in PenMotionEvent)

Creates a new Event from a PenMotionEvent

public Event(in PenMotionEvent @event)

Parameters

event PenMotionEvent

The PenMotionEvent to store into the newly created Event

Event(in PenProximityEvent)

Creates a new Event from a PenProximityEvent

public Event(in PenProximityEvent @event)

Parameters

event PenProximityEvent

The PenProximityEvent to store into the newly created Event

Event(in PenTouchEvent)

Creates a new Event from a PenTouchEvent

public Event(in PenTouchEvent @event)

Parameters

event PenTouchEvent

The PenTouchEvent to store into the newly created Event

Event(in PinchFingerEvent)

Creates a new Event from a PinchFingerEvent

public Event(in PinchFingerEvent @event)

Parameters

event PinchFingerEvent

The PinchFingerEvent to store into the newly created Event

Event(in QuitEvent)

Creates a new Event from a QuitEvent

public Event(in QuitEvent @event)

Parameters

event QuitEvent

The QuitEvent to store into the newly created Event

Event(in RenderEvent)

Creates a new Event from a RenderEvent

public Event(in RenderEvent @event)

Parameters

event RenderEvent

The RenderEvent to store into the newly created Event

Event(in SensorEvent)

Creates a new Event from a SensorEvent

public Event(in SensorEvent @event)

Parameters

event SensorEvent

The SensorEvent to store into the newly created Event

Event(in TextEditingCandidatesEvent)

Creates a new Event from a TextEditingCandidatesEvent

public Event(in TextEditingCandidatesEvent @event)

Parameters

event TextEditingCandidatesEvent

The TextEditingCandidatesEvent to store into the newly created Event

Event(in TextEditingEvent)

Creates a new Event from a TextEditingEvent

public Event(in TextEditingEvent @event)

Parameters

event TextEditingEvent

The TextEditingEvent to store into the newly created Event

Event(in TextInputEvent)

Creates a new Event from a TextInputEvent

public Event(in TextInputEvent @event)

Parameters

event TextInputEvent

The TextInputEvent to store into the newly created Event

Event(in TouchFingerEvent)

Creates a new Event from a TouchFingerEvent

public Event(in TouchFingerEvent @event)

Parameters

event TouchFingerEvent

The TouchFingerEvent to store into the newly created Event

Event(in UserEvent)

Creates a new Event from an UserEvent

public Event(in UserEvent @event)

Parameters

event UserEvent

The UserEvent to store into the newly created Event

Event(in WindowEvent)

Creates a new Event from an WindowEvent

public Event(in WindowEvent @event)

Parameters

event WindowEvent

The WindowEvent to store into the newly created Event

Properties

Timestamp

Gets or sets the timestamp of the current event

public ulong Timestamp { readonly get; set; }

Property Value

ulong

The timestamp of the current event, in nanoseconds in nanoseconds since the initialization of SDL

Remarks

The value of this property usually describes the time passed, in nanoseconds since the initialization of SDL. It can be properly populated by using NanosecondTicks.

Type

Gets or sets the type of the current event

public EventType Type { readonly get; set; }

Property Value

EventType

The type of the current event

Remarks

Do not attempt to set this property on a base Event, instead set the Type property on an instance of a more specialized *Event structure. Setting this property on a base Event is not supported and will lead the property to throw a NotSupportedException.

Exceptions

NotSupportedException

When setting this property

Methods

ToString()

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string

The fully qualified type name.

ToString(IFormatProvider?)

Formats the value of the current instance using the specified format.

public readonly string ToString(IFormatProvider? formatProvider)

Parameters

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

ToString(string?)

Formats the value of the current instance using the specified format.

public readonly string ToString(string? format)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

Returns

string

The value of the current instance in the specified format.

ToString(string?, IFormatProvider?)

Formats the value of the current instance using the specified format.

public readonly string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Tries to format the value of the current instance into the provided span of characters.

public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)

Parameters

destination Span<char>

The span in which to write this instance's value formatted as a span of characters.

charsWritten int

When this method returns, contains the number of characters that were written in destination.

format ReadOnlySpan<char>

A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.

provider IFormatProvider

An optional object that supplies culture-specific formatting information for destination.

Returns

bool

true if the formatting was successful; otherwise, false.