2.0.4 GUI backend additions

This commit is contained in:
Ethan Lee 2014-10-18 12:50:39 -04:00
parent e395a5114d
commit 9a1f823bca

View file

@ -1003,7 +1003,26 @@ namespace SDL2
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN_DESKTOP =
(SDL_WINDOW_FULLSCREEN | 0x00001000), (SDL_WINDOW_FULLSCREEN | 0x00001000),
SDL_WINDOW_FOREIGN = 0x00000800, SDL_WINDOW_FOREIGN = 0x00000800,
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /* Only available in 2.0.1 */ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /* Only available in 2.0.1 */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /* Only available in 2.0.4 */
}
/// <summary>
/// Possible return values from the SDL_HitTest callback.
/// This is only available in 2.0.4.
/// </summary>
public enum SDL_HitTestResult
{
SDL_HITTEST_NORMAL, /* Region is normal. No special properties. */
SDL_HITTEST_DRAGGABLE, /* Region can drag entire window. */
SDL_HITTEST_RESIZE_TOPLEFT,
SDL_HITTEST_RESIZE_TOP,
SDL_HITTEST_RESIZE_TOPRIGHT,
SDL_HITTEST_RESIZE_RIGHT,
SDL_HITTEST_RESIZE_BOTTOMRIGHT,
SDL_HITTEST_RESIZE_BOTTOM,
SDL_HITTEST_RESIZE_BOTTOMLEFT,
SDL_HITTEST_RESIZE_LEFT
} }
public const int SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000; public const int SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000;
@ -1044,6 +1063,10 @@ namespace SDL2
public IntPtr driverdata; // void* public IntPtr driverdata; // void*
} }
/* win refers to an SDL_Window*, area to a cosnt SDL_Point*, data to a void* */
/* Only available in 2.0.4 */
public delegate SDL_HitTestResult SDL_HitTest(IntPtr win, IntPtr area, IntPtr data);
/// <summary> /// <summary>
/// Use this function to create a window with the specified position, dimensions, and flags. /// Use this function to create a window with the specified position, dimensions, and flags.
/// </summary> /// </summary>
@ -1620,6 +1643,15 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_VideoQuit(); public static extern void SDL_VideoQuit();
/* window refers to an SDL_Window*, callback_data to a void* */
/* Only available in 2.0.4 */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_SetWindowHitTest(
IntPtr window,
SDL_HitTest callback,
IntPtr callback_data
);
#endregion #endregion
#region SDL_render.h #region SDL_render.h
@ -2651,6 +2683,10 @@ namespace SDL2
public int h; public int h;
} }
/* Only available in 2.0.4 */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_PointInRect(ref SDL_Point p, ref SDL_Rect r);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_EnclosePoints( public static extern SDL_bool SDL_EnclosePoints(
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct, SizeParamIndex = 1)] [In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct, SizeParamIndex = 1)]
@ -4394,20 +4430,24 @@ namespace SDL2
public static extern UInt32 SDL_GetMouseState(IntPtr x, IntPtr y); public static extern UInt32 SDL_GetMouseState(IntPtr x, IntPtr y);
/* Get the current state of the mouse, in relation to the desktop */ /* Get the current state of the mouse, in relation to the desktop */
/* Only available in 2.0.4 */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 SDL_GetGlobalMouseState(out int x, out int y); public static extern UInt32 SDL_GetGlobalMouseState(out int x, out int y);
/* Get the current state of the mouse, in relation to the desktop */ /* Get the current state of the mouse, in relation to the desktop */
/* Only available in 2.0.4 */
/* This overload allows for passing NULL to x */ /* This overload allows for passing NULL to x */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 SDL_GetGlobalMouseState(IntPtr x, out int y); public static extern UInt32 SDL_GetGlobalMouseState(IntPtr x, out int y);
/* Get the current state of the mouse, in relation to the desktop */ /* Get the current state of the mouse, in relation to the desktop */
/* Only available in 2.0.4 */
/* This overload allows for passing NULL to y */ /* This overload allows for passing NULL to y */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 SDL_GetGlobalMouseState(out int x, IntPtr y); public static extern UInt32 SDL_GetGlobalMouseState(out int x, IntPtr y);
/* Get the current state of the mouse, in relation to the desktop */ /* Get the current state of the mouse, in relation to the desktop */
/* Only available in 2.0.4 */
/* This overload allows for passing NULL to both x and y */ /* This overload allows for passing NULL to both x and y */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 SDL_GetGlobalMouseState(IntPtr x, IntPtr y); public static extern UInt32 SDL_GetGlobalMouseState(IntPtr x, IntPtr y);
@ -4422,6 +4462,7 @@ namespace SDL2
public static extern void SDL_WarpMouseInWindow(IntPtr window, int x, int y); public static extern void SDL_WarpMouseInWindow(IntPtr window, int x, int y);
/* Set the mouse cursor's position in global screen space */ /* Set the mouse cursor's position in global screen space */
/* Only available in 2.0.4 */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_WarpMouseGlobal(int x, int y); public static extern void SDL_WarpMouseGlobal(int x, int y);
@ -4429,6 +4470,11 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_SetRelativeMouseMode(SDL_bool enabled); public static extern int SDL_SetRelativeMouseMode(SDL_bool enabled);
/* Capture the mouse, to track input outside an SDL window */
/* Only available in 2.0.4 */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_CaptureMouse(SDL_bool enabled);
/* Query if the relative mouse mode is enabled */ /* Query if the relative mouse mode is enabled */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_GetRelativeMouseMode(); public static extern SDL_bool SDL_GetRelativeMouseMode();