Merge branch 'flibitijibibo/master'

This commit is contained in:
Dean Herbert 2021-08-11 11:59:58 +09:00
commit c94f27fa40

View file

@ -647,7 +647,7 @@ namespace SDL2
/* Only available in 2.0.14 or higher. */
public const string SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT =
"SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT";
"SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT"; /* NOTE: This was removed in 2.0.16. */
public const string SDL_HINT_JOYSTICK_RAWINPUT =
"SDL_JOYSTICK_RAWINPUT";
public const string SDL_HINT_AUDIO_DEVICE_APP_NAME =
@ -679,6 +679,38 @@ namespace SDL2
public const string SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE =
"SDL_JOYSTICK_HIDAPI_PS5_RUMBLE";
/* Only available in 2.0.16 or higher. */
public const string SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS =
"SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS";
public const string SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL =
"SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL";
public const string SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED =
"SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED";
public const string SDL_HINT_WINDOWS_USE_D3D9EX =
"SDL_WINDOWS_USE_D3D9EX";
public const string SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS =
"SDL_JOYSTICK_HIDAPI_JOY_CONS";
public const string SDL_HINT_JOYSTICK_HIDAPI_STADIA =
"SDL_JOYSTICK_HIDAPI_STADIA";
public const string SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED =
"SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED";
public const string SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED =
"SDL_ALLOW_ALT_TAB_WHILE_GRABBED";
public const string SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER =
"SDL_KMSDRM_REQUIRE_DRM_MASTER";
public const string SDL_HINT_AUDIO_DEVICE_STREAM_ROLE =
"SDL_AUDIO_DEVICE_STREAM_ROLE";
public const string SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT =
"SDL_X11_FORCE_OVERRIDE_REDIRECT";
public const string SDL_HINT_JOYSTICK_HIDAPI_LUNA =
"SDL_JOYSTICK_HIDAPI_LUNA";
public const string SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT =
"SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT";
public const string SDL_HINT_AUDIO_INCLUDE_MONITORS =
"SDL_AUDIO_INCLUDE_MONITORS";
public const string SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR =
"SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR";
public enum SDL_HintPriority
{
SDL_HINT_DEFAULT,
@ -1252,7 +1284,7 @@ namespace SDL2
*/
public const int SDL_MAJOR_VERSION = 2;
public const int SDL_MINOR_VERSION = 0;
public const int SDL_PATCHLEVEL = 14;
public const int SDL_PATCHLEVEL = 16;
public static readonly int SDL_COMPILEDVERSION = SDL_VERSIONNUM(
SDL_MAJOR_VERSION,
@ -1389,6 +1421,14 @@ namespace SDL2
SDL_ORIENTATION_PORTRAIT_FLIPPED
}
/* Only available in 2.0.16 or higher. */
public enum SDL_FlashOperation
{
SDL_FLASH_CANCEL,
SDL_FLASH_BRIEFLY,
SDL_FLASH_UNTIL_FOCUSED
}
[Flags]
public enum SDL_WindowFlags : uint
{
@ -1400,7 +1440,7 @@ namespace SDL2
SDL_WINDOW_RESIZABLE = 0x00000020,
SDL_WINDOW_MINIMIZED = 0x00000040,
SDL_WINDOW_MAXIMIZED = 0x00000080,
SDL_WINDOW_INPUT_GRABBED = 0x00000100,
SDL_WINDOW_MOUSE_GRABBED = 0x00000100,
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP =
@ -1413,8 +1453,12 @@ namespace SDL2
SDL_WINDOW_UTILITY = 0x00020000, /* Requires >= 2.0.5 */
SDL_WINDOW_TOOLTIP = 0x00040000, /* Requires >= 2.0.5 */
SDL_WINDOW_POPUP_MENU = 0x00080000, /* Requires >= 2.0.5 */
SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /* Requires >= 2.0.16 */
SDL_WINDOW_VULKAN = 0x10000000, /* Requires >= 2.0.6 */
SDL_WINDOW_METAL = 0x2000000, /* Requires >= 2.0.14 */
SDL_WINDOW_INPUT_GRABBED =
SDL_WINDOW_MOUSE_GRABBED,
}
/* Only available in 2.0.4 or higher. */
@ -1707,6 +1751,18 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_GetWindowGrab(IntPtr window);
/* window refers to an SDL_Window*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_GetWindowKeyboardGrab(IntPtr window);
/* window refers to an SDL_Window*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_GetWindowMouseGrab(IntPtr window);
/* window refers to an SDL_Window* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint SDL_GetWindowID(IntPtr window);
@ -1943,6 +1999,14 @@ namespace SDL2
ref SDL_DisplayMode mode
);
/* window refers to an SDL_Window* */
/* NULL overload - use the window's dimensions and the desktop's format and refresh rate */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_SetWindowDisplayMode(
IntPtr window,
IntPtr mode
);
/* window refers to an SDL_Window* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_SetWindowFullscreen(
@ -1969,6 +2033,25 @@ namespace SDL2
SDL_bool grabbed
);
/* window refers to an SDL_Window*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_SetWindowKeyboardGrab(
IntPtr window,
SDL_bool grabbed
);
/* window refers to an SDL_Window*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_SetWindowMouseGrab(
IntPtr window,
SDL_bool grabbed
);
/* window refers to an SDL_Window*, icon to an SDL_Surface* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_SetWindowIcon(
@ -2034,6 +2117,15 @@ namespace SDL2
SDL_bool resizable
);
/* window refers to an SDL_Window*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_SetWindowAlwaysOnTop(
IntPtr window,
SDL_bool on_top
);
/* window refers to an SDL_Window* */
[DllImport(nativeLibName, EntryPoint = "SDL_SetWindowTitle", CallingConvention = CallingConvention.Cdecl)]
private static extern unsafe void INTERNAL_SDL_SetWindowTitle(
@ -2100,6 +2192,15 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr SDL_GetGrabbedWindow();
/* window refers to an SDL_Window*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_FlashWindow(
IntPtr window,
SDL_FlashOperation operation
);
#endregion
#region SDL_blendmode.h
@ -3179,6 +3280,20 @@ namespace SDL2
int vPitch
);
/* texture refers to an SDL_Texture*.
* yPlane and uvPlane refer to const Uint*.
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_UpdateNVTexture(
IntPtr texture,
ref SDL_Rect rect,
IntPtr yPlane,
int yPitch,
IntPtr uvPlane,
int uvPitch
);
/* renderer refers to an SDL_Renderer* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_RenderTargetSupported(
@ -4339,6 +4454,17 @@ namespace SDL2
ref SDL_Rect dstrect
);
/* src and dst refer to an SDL_Surface*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_SoftStretchLinear(
IntPtr src,
ref SDL_Rect srcrect,
IntPtr dst,
ref SDL_Rect dstrect
);
/* surface refers to an SDL_Surface* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_UnlockSurface(IntPtr surface);
@ -6408,6 +6534,17 @@ namespace SDL2
byte blue
);
/* joystick refers to an SDL_Joystick*.
* data refers to a const void*.
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_JoystickSendEffect(
IntPtr joystick,
IntPtr data,
int size
);
#endregion
#region SDL_gamecontroller.h
@ -6467,8 +6604,10 @@ namespace SDL2
SDL_CONTROLLER_TYPE_PS3,
SDL_CONTROLLER_TYPE_PS4,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
SDL_CONTROLLER_TYPE_VIRTUAL, /* Requires >= 2.0.14 */
SDL_CONTROLLER_TYPE_PS5, /* Requires >= 2.0.14 */
SDL_CONTROLLER_TYPE_VIRTUAL, /* Requires >= 2.0.14 */
SDL_CONTROLLER_TYPE_PS5, /* Requires >= 2.0.14 */
SDL_CONTROLLER_TYPE_AMAZON_LUNA, /* Requires >= 2.0.16 */
SDL_CONTROLLER_TYPE_GOOGLE_STADIA /* Requires >= 2.0.16 */
}
// FIXME: I'd rather this somehow be private...
@ -6535,7 +6674,8 @@ namespace SDL2
return UTF8_ToManaged(
INTERNAL_SDL_GameControllerMappingForIndex(
mapping_index
)
),
true
);
}
@ -6558,7 +6698,8 @@ namespace SDL2
public static string SDL_GameControllerMappingForGUID(Guid guid)
{
return UTF8_ToManaged(
INTERNAL_SDL_GameControllerMappingForGUID(guid)
INTERNAL_SDL_GameControllerMappingForGUID(guid),
true
);
}
@ -6573,7 +6714,8 @@ namespace SDL2
return UTF8_ToManaged(
INTERNAL_SDL_GameControllerMapping(
gamecontroller
)
),
true
);
}
@ -6601,7 +6743,8 @@ namespace SDL2
int joystick_index
) {
return UTF8_ToManaged(
INTERNAL_SDL_GameControllerMappingForDeviceIndex(joystick_index)
INTERNAL_SDL_GameControllerMappingForDeviceIndex(joystick_index),
true
);
}
@ -6966,6 +7109,26 @@ namespace SDL2
int num_values
);
/* gamecontroller refers to an SDL_GameController*.
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float SDL_GameControllerGetSensorDataRate(
IntPtr gamecontroller,
SDL_SensorType type
);
/* gamecontroller refers to an SDL_GameController*.
* data refers to a const void*.
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_GameControllerSendEffect(
IntPtr gamecontroller,
IntPtr data,
int size
);
#endregion
#region SDL_haptic.h
@ -7766,6 +7929,14 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_FreeAudioStream(IntPtr stream);
/* Only available in 2.0.16 or higher. */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_GetAudioDeviceSpec(
int index,
int iscapture,
out SDL_AudioSpec spec
);
#endregion
#region SDL_timer.h
@ -7835,6 +8006,20 @@ namespace SDL2
IntPtr userdata
);
/* renderer refers to an SDL_Renderer*
* IntPtr refers to an IDirect3DDevice9*
* Only available in 2.0.1 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr SDL_RenderGetD3D9Device(IntPtr renderer);
/* renderer refers to an SDL_Renderer*
* IntPtr refers to an ID3D11Device*
* Only available in 2.0.18 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr SDL_RenderGetD3D11Device(IntPtr renderer);
/* iOS */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@ -7904,7 +8089,7 @@ namespace SDL2
/* Only available in 2.0.14 or higher. */
[DllImport(nativeLibName, EntryPoint = "SDL_AndroidRequestPermission", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern SDL_bool INTERNAL_SDL_AndroidRequestPermission(
private static unsafe extern SDL_bool INTERNAL_SDL_AndroidRequestPermission(
byte* permission
);
public static unsafe SDL_bool SDL_AndroidRequestPermission(
@ -7918,6 +8103,34 @@ namespace SDL2
return result;
}
/* Only available in 2.0.16 or higher. */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
private static unsafe extern int INTERNAL_SDL_AndroidShowToast(
byte* message,
int duration,
int gravity,
int xOffset,
int yOffset
);
public static unsafe int SDL_AndroidShowToast(
string message,
int duration,
int gravity,
int xOffset,
int yOffset
) {
byte* messagePtr = Utf8EncodeHeap(message);
int result = INTERNAL_SDL_AndroidShowToast(
messagePtr,
duration,
gravity,
xOffset,
yOffset
);
Marshal.FreeHGlobal((IntPtr) messagePtr);
return result;
}
/* WinRT */
public enum SDL_WinRT_DeviceFamily
@ -7952,7 +8165,8 @@ namespace SDL2
SDL_SYSWM_ANDROID,
SDL_SYSWM_VIVANTE,
SDL_SYSWM_OS2,
SDL_SYSWM_HAIKU
SDL_SYSWM_HAIKU,
SDL_SYSWM_KMSDRM /* requires >= 2.0.16 */
}
// FIXME: I wish these weren't public...
@ -8006,6 +8220,8 @@ namespace SDL2
public IntPtr display; // Refers to a wl_display*
public IntPtr surface; // Refers to a wl_surface*
public IntPtr shell_surface; // Refers to a wl_shell_surface*
public IntPtr egl_window; // Refers to an egl_window*, requires >= 2.0.16
public IntPtr xdg_surface; // Refers to an xdg_surface*, requires >= 2.0.16
}
[StructLayout(LayoutKind.Sequential)]
@ -8033,8 +8249,17 @@ namespace SDL2
[StructLayout(LayoutKind.Sequential)]
public struct INTERNAL_os2_wminfo
{
public IntPtr hwnd; /* Refers to an HWND */
public IntPtr hwndFrame; /* Refers to an HWND */
public IntPtr hwnd; // Refers to an HWND
public IntPtr hwndFrame; // Refers to an HWND
}
/* Only available in 2.0.16 or higher. */
[StructLayout(LayoutKind.Sequential)]
public struct INTERNAL_kmsdrm_wminfo
{
int dev_index;
int drm_fd;
IntPtr gbm_dev; // Refers to a gbm_device*
}
[StructLayout(LayoutKind.Explicit)]
@ -8059,9 +8284,11 @@ namespace SDL2
[FieldOffset(0)]
public INTERNAL_android_wminfo android;
[FieldOffset(0)]
public INTERNAL_os2_wminfo os2;
[FieldOffset(0)]
public INTERNAL_vivante_wminfo vivante;
[FieldOffset(0)]
public INTERNAL_os2_wminfo os2;
public INTERNAL_kmsdrm_wminfo ksmdrm;
// private int dummy;
}