Skip to content

Commit 9ab6f5b

Browse files
committed
Update SDL bindings
1 parent aa13c48 commit 9ab6f5b

33 files changed

Lines changed: 7283 additions & 2369 deletions

.silktouch/sdl-clangsharp.stout

9.18 KB
Binary file not shown.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// Ported from SDL.h and corresponding dependencies of SDL3.
4+
// Original source is Copyright (C) 1997-2024 Sam Lantinga. Licensed under the zlib license.
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
namespace Silk.NET.SDL;
10+
11+
[NativeName("SDL_GPURenderState")]
12+
public readonly unsafe partial struct GpuRenderStateHandle
13+
{
14+
public readonly void* Handle;
15+
16+
public GpuRenderStateHandle(void* handle)
17+
{
18+
Handle = handle;
19+
}
20+
21+
public bool Equals(GpuRenderStateHandle other) => Handle == other.Handle;
22+
23+
public override bool Equals(object? obj) => obj is GpuRenderStateHandle other && Equals(other);
24+
25+
public override int GetHashCode() => HashCode.Combine((nuint)Handle);
26+
27+
public static bool operator ==(GpuRenderStateHandle left, GpuRenderStateHandle right) =>
28+
left.Equals(right);
29+
30+
public static bool operator !=(GpuRenderStateHandle left, GpuRenderStateHandle right) =>
31+
!left.Equals(right);
32+
33+
public bool Equals(NullPtr _) => Handle is null;
34+
35+
public static bool operator ==(GpuRenderStateHandle left, NullPtr right) => left.Equals(right);
36+
37+
public static bool operator !=(GpuRenderStateHandle left, NullPtr right) => !left.Equals(right);
38+
39+
public static implicit operator GpuRenderStateHandle(NullPtr _) => default;
40+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// Ported from SDL.h and corresponding dependencies of SDL3.
4+
// Original source is Copyright (C) 1997-2024 Sam Lantinga. Licensed under the zlib license.
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
namespace Silk.NET.SDL;
10+
11+
[NativeName("SDL_AudioStreamDataCompleteCallback")]
12+
public readonly unsafe struct AudioStreamDataCompleteCallback : IDisposable
13+
{
14+
private readonly void* Pointer;
15+
public delegate* unmanaged<void*, void*, int, void> Handle =>
16+
(delegate* unmanaged<void*, void*, int, void>)Pointer;
17+
18+
public AudioStreamDataCompleteCallback(delegate* unmanaged<void*, void*, int, void> ptr) =>
19+
Pointer = ptr;
20+
21+
public AudioStreamDataCompleteCallback(AudioStreamDataCompleteCallbackDelegate proc) =>
22+
Pointer = SilkMarshal.DelegateToPtr(proc);
23+
24+
public void Dispose() => SilkMarshal.Free(Pointer);
25+
26+
public static implicit operator AudioStreamDataCompleteCallback(
27+
delegate* unmanaged<void*, void*, int, void> pfn
28+
) => new(pfn);
29+
30+
public static implicit operator delegate* unmanaged<void*, void*, int, void>(
31+
AudioStreamDataCompleteCallback pfn
32+
) => (delegate* unmanaged<void*, void*, int, void>)pfn.Pointer;
33+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// Ported from SDL.h and corresponding dependencies of SDL3.
4+
// Original source is Copyright (C) 1997-2024 Sam Lantinga. Licensed under the zlib license.
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
namespace Silk.NET.SDL;
10+
11+
[NativeName("SDL_AudioStreamDataCompleteCallback")]
12+
public unsafe delegate void AudioStreamDataCompleteCallbackDelegate(
13+
void* arg0,
14+
void* arg1,
15+
int arg2
16+
);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// Ported from SDL.h and corresponding dependencies of SDL3.
4+
// Original source is Copyright (C) 1997-2024 Sam Lantinga. Licensed under the zlib license.
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
namespace Silk.NET.SDL;
10+
11+
[NativeName("SDL_CameraPermissionState")]
12+
public enum CameraPermissionState
13+
{
14+
[NativeName("SDL_CAMERA_PERMISSION_STATE_DENIED")]
15+
Denied = -1,
16+
17+
[NativeName("SDL_CAMERA_PERMISSION_STATE_PENDING")]
18+
Pending = 0,
19+
20+
[NativeName("SDL_CAMERA_PERMISSION_STATE_APPROVED")]
21+
Approved = 1,
22+
}

sources/SDL/SDL/SDL3/Colorspace.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ public enum Colorspace
4848
RgbDefault = Srgb,
4949

5050
[NativeName("SDL_COLORSPACE_YUV_DEFAULT")]
51-
YuvDefault = Jpeg,
51+
YuvDefault = Bt601Limited,
5252
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// Ported from SDL.h and corresponding dependencies of SDL3.
4+
// Original source is Copyright (C) 1997-2024 Sam Lantinga. Licensed under the zlib license.
5+
using System.Runtime.CompilerServices;
6+
using System.Runtime.InteropServices;
7+
8+
namespace Silk.NET.SDL;
9+
10+
[NativeName("SDL_CursorFrameInfo")]
11+
public unsafe partial struct CursorFrameInfo
12+
{
13+
[NativeName("surface")]
14+
public Surface* Surface;
15+
16+
[NativeName("duration")]
17+
public uint Duration;
18+
}

sources/SDL/SDL/SDL3/Event.gen.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ public partial struct Event
131131
[FieldOffset(0)]
132132
public TouchFingerEvent Tfinger;
133133

134+
[NativeName("pinch")]
135+
[FieldOffset(0)]
136+
public PinchFingerEvent Pinch;
137+
134138
[NativeName("pproximity")]
135139
[FieldOffset(0)]
136140
public PenProximityEvent Pproximity;

sources/SDL/SDL/SDL3/EventType.gen.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ public enum EventType
6161
[NativeName("SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED")]
6262
DisplayContentScaleChanged = 343,
6363

64+
[NativeName("SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED")]
65+
DisplayUsableBoundsChanged = 344,
66+
6467
[NativeName("SDL_EVENT_DISPLAY_FIRST")]
6568
DisplayFirst = DisplayOrientation,
6669

6770
[NativeName("SDL_EVENT_DISPLAY_LAST")]
68-
DisplayLast = DisplayContentScaleChanged,
71+
DisplayLast = DisplayUsableBoundsChanged,
6972

7073
[NativeName("SDL_EVENT_WINDOW_SHOWN")]
7174
WindowShown = 514,
@@ -172,6 +175,12 @@ public enum EventType
172175
[NativeName("SDL_EVENT_TEXT_EDITING_CANDIDATES")]
173176
TextEditingCandidates = 775,
174177

178+
[NativeName("SDL_EVENT_SCREEN_KEYBOARD_SHOWN")]
179+
ScreenKeyboardShown = 776,
180+
181+
[NativeName("SDL_EVENT_SCREEN_KEYBOARD_HIDDEN")]
182+
ScreenKeyboardHidden = 777,
183+
175184
[NativeName("SDL_EVENT_MOUSE_MOTION")]
176185
MouseMotion = 1024,
177186

@@ -265,6 +274,15 @@ public enum EventType
265274
[NativeName("SDL_EVENT_FINGER_CANCELED")]
266275
FingerCanceled = 1795,
267276

277+
[NativeName("SDL_EVENT_PINCH_BEGIN")]
278+
PinchBegin = 1808,
279+
280+
[NativeName("SDL_EVENT_PINCH_UPDATE")]
281+
PinchUpdate = 1809,
282+
283+
[NativeName("SDL_EVENT_PINCH_END")]
284+
PinchEnd = 1810,
285+
268286
[NativeName("SDL_EVENT_CLIPBOARD_UPDATE")]
269287
ClipboardUpdate = 2304,
270288

sources/SDL/SDL/SDL3/FlipMode.gen.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ public enum FlipMode
1818

1919
[NativeName("SDL_FLIP_VERTICAL")]
2020
Vertical = 2,
21+
22+
[NativeName("SDL_FLIP_HORIZONTAL_AND_VERTICAL")]
23+
HorizontalAndVertical = (Horizontal | Vertical),
2124
}

0 commit comments

Comments
 (0)