mirror of https://github.com/ppy/SDL3-CS.git
Merge pull request #217 from Susko3/rework-sdl-interface
Rework SDL_INIT_INTERFACE and add missing interfaces
This commit is contained in:
commit
dddb17d34d
|
|
@ -51,7 +51,10 @@ namespace SDL
|
||||||
SDL_GPU_COLORCOMPONENT_A = (byte)SDL3.SDL_GPU_COLORCOMPONENT_A,
|
SDL_GPU_COLORCOMPONENT_A = (byte)SDL3.SDL_GPU_COLORCOMPONENT_A,
|
||||||
}
|
}
|
||||||
|
|
||||||
public static partial class SDL3
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
public partial struct SDL_GPURenderStateDesc : SDL3.ISDLInterface
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
{
|
{
|
||||||
|
uint SDL3.ISDLInterface.version { set => version = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
namespace SDL
|
||||||
|
{
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
public partial struct SDL_IOStreamInterface : SDL3.ISDLInterface
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
{
|
||||||
|
uint SDL3.ISDLInterface.version { set => version = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,4 +19,11 @@ namespace SDL
|
||||||
return SDLArray.Create(array, count);
|
return SDLArray.Create(array, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
public partial struct SDL_VirtualJoystickDesc : SDL3.ISDLInterface
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
{
|
||||||
|
uint SDL3.ISDLInterface.version { set => version = value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,18 +46,20 @@ namespace SDL
|
||||||
[Macro]
|
[Macro]
|
||||||
public static uint SDL_FOURCC(byte A, byte B, byte C, byte D) => (uint)((A << 0) | (B << 8) | (C << 16) | (D << 24));
|
public static uint SDL_FOURCC(byte A, byte B, byte C, byte D) => (uint)((A << 0) | (B << 8) | (C << 16) | (D << 24));
|
||||||
|
|
||||||
[Macro]
|
[Obsolete("Do not use.")] // used internally
|
||||||
public static unsafe void SDL_INIT_INTERFACE(out SDL_IOStreamInterface iface)
|
public interface ISDLInterface
|
||||||
{
|
{
|
||||||
iface = default;
|
internal uint version { set; }
|
||||||
iface.version = (uint)sizeof(SDL_IOStreamInterface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Macro]
|
[Macro]
|
||||||
public static unsafe void SDL_INIT_INTERFACE(out SDL_StorageInterface iface)
|
public static unsafe void SDL_INIT_INTERFACE<T>(out T iface)
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
where T : unmanaged, ISDLInterface
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
{
|
{
|
||||||
iface = default;
|
iface = default;
|
||||||
iface.version = (uint)sizeof(SDL_StorageInterface);
|
iface.version = (uint)sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void SDL_free(void* mem) => SDL_free((IntPtr)mem);
|
public static unsafe void SDL_free(void* mem) => SDL_free((IntPtr)mem);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@ using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace SDL
|
namespace SDL
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
public partial struct SDL_StorageInterface : SDL3.ISDLInterface
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
{
|
||||||
|
uint SDL3.ISDLInterface.version { set => version = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public static partial class SDL3
|
public static partial class SDL3
|
||||||
{
|
{
|
||||||
/// <returns>
|
/// <returns>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
namespace SDL
|
||||||
|
{
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
public partial struct TTF_TextEngine : SDL3.ISDLInterface
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
{
|
||||||
|
uint SDL3.ISDLInterface.version { set => version = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue