mirror of https://github.com/ppy/SDL3-CS.git
Add custom definition for win32 MSG struct
The win32 types are kinda cursed, but it makes it easy to copy&paste and check.
This commit is contained in:
parent
a123a3c904
commit
5cf5bb69d7
|
|
@ -28,10 +28,6 @@ using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace SDL
|
namespace SDL
|
||||||
{
|
{
|
||||||
public partial struct tagMSG
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial struct XTaskQueueObject
|
public partial struct XTaskQueueObject
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +40,7 @@ namespace SDL
|
||||||
{
|
{
|
||||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
[SupportedOSPlatform("Windows")]
|
[SupportedOSPlatform("Windows")]
|
||||||
public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl]<void*, tagMSG*, int> callback, void* userdata);
|
public static extern void SDL_SetWindowsMessageHook([NativeTypeName("SDL_WindowsMessageHook")] delegate* unmanaged[Cdecl]<void*, MSG*, int> callback, void* userdata);
|
||||||
|
|
||||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
[SupportedOSPlatform("Windows")]
|
[SupportedOSPlatform("Windows")]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SDL
|
||||||
|
{
|
||||||
|
// https://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#common-windows-data-types
|
||||||
|
using LONG = int;
|
||||||
|
using DWORD = uint;
|
||||||
|
using UINT = uint;
|
||||||
|
using HWND = IntPtr;
|
||||||
|
using WPARAM = UIntPtr;
|
||||||
|
using LPARAM = IntPtr;
|
||||||
|
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
|
||||||
|
public struct POINT
|
||||||
|
{
|
||||||
|
public LONG x;
|
||||||
|
public LONG y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-msg
|
||||||
|
public struct MSG
|
||||||
|
{
|
||||||
|
public HWND hwnd;
|
||||||
|
public UINT message;
|
||||||
|
public WPARAM wParam;
|
||||||
|
public LPARAM lParam;
|
||||||
|
public DWORD time;
|
||||||
|
public POINT pt;
|
||||||
|
public DWORD lPrivate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Exclude struct forward declaration
|
||||||
|
--exclude
|
||||||
|
tagMSG
|
||||||
|
|
||||||
|
# ClangSharp recommended remapping
|
||||||
|
--remap
|
||||||
|
tagMSG=MSG
|
||||||
Loading…
Reference in New Issue