mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 18:15:38 +00:00
[SDL2] Added PeepEvents/PollEvent functions
This commit is contained in:
parent
14d53010b0
commit
0c262cd5b2
|
@ -350,11 +350,47 @@ namespace OpenTK.Platform.SDL2
|
|||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_NumJoysticks", ExactSpelling = true)]
|
||||
public static extern int NumJoysticks();
|
||||
|
||||
public static int PeepEvents(ref Event e, EventAction action, EventType min, EventType max)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (Event* pe = &e)
|
||||
{
|
||||
return PeepEvents(pe, 1, action, min, max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int PeepEvents(Event[] e, int count, EventAction action, EventType min, EventType max)
|
||||
{
|
||||
if (e == null)
|
||||
throw new ArgumentNullException();
|
||||
if (count <= 0 || count > e.Length)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
||||
unsafe
|
||||
{
|
||||
fixed (Event *pe = e)
|
||||
{
|
||||
return PeepEvents(pe, count, action, min, max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_PeepEvents", ExactSpelling = true)]
|
||||
unsafe static extern int PeepEvents(Event* e, int count, EventAction action, EventType min, EventType max);
|
||||
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_PixelFormatEnumToMasks", ExactSpelling = true)]
|
||||
public static extern bool PixelFormatEnumToMasks(uint format, out int bpp,
|
||||
out uint rmask, out uint gmask, out uint bmask, out uint amask);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_PollEvent", ExactSpelling = true)]
|
||||
public static extern int PollEvent(out Event e);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_PumpEvents", ExactSpelling = true)]
|
||||
public static extern void PumpEvents();
|
||||
|
@ -589,6 +625,13 @@ namespace OpenTK.Platform.SDL2
|
|||
ES = 0x0004
|
||||
}
|
||||
|
||||
enum EventAction
|
||||
{
|
||||
Add,
|
||||
Peek,
|
||||
Get
|
||||
}
|
||||
|
||||
enum EventState
|
||||
{
|
||||
Query = -1,
|
||||
|
|
Loading…
Reference in a new issue