Fixes found by BRUTE

master
Ethan Lee 2018-04-25 11:51:21 -04:00
parent 8e75771fca
commit 99846d578c
2 changed files with 30 additions and 24 deletions

View File

@ -2966,8 +2966,15 @@ namespace SDL2
}
/* 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);
public static SDL_bool SDL_PointInRect(ref SDL_Point p, ref SDL_Rect r)
{
return ( (p.x >= r.x) &&
(p.x < (r.x + r.w)) &&
(p.y >= r.y) &&
(p.y < (r.y + r.h)) ) ?
SDL_bool.SDL_TRUE :
SDL_bool.SDL_FALSE;
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_EnclosePoints(
@ -3000,14 +3007,24 @@ namespace SDL2
ref int Y2
);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_RectEmpty(ref SDL_Rect rect);
public static SDL_bool SDL_RectEmpty(ref SDL_Rect r)
{
return ((r.w <= 0) || (r.h <= 0)) ?
SDL_bool.SDL_TRUE :
SDL_bool.SDL_FALSE;
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern SDL_bool SDL_RectEquals(
ref SDL_Rect A,
ref SDL_Rect B
);
public static SDL_bool SDL_RectEquals(
ref SDL_Rect a,
ref SDL_Rect b
) {
return ( (a.x == b.x) &&
(a.y == b.y) &&
(a.w == b.w) &&
(a.h == b.h) ) ?
SDL_bool.SDL_TRUE :
SDL_bool.SDL_FALSE;
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_UnionRect(
@ -5112,10 +5129,6 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr SDL_JoystickOpen(int device_index);
/* joystick refers to an SDL_Joystick* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_JoystickOpened(int device_index);
/* joystick refers to an SDL_Joystick* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SDL_JoystickUpdate();
@ -6015,10 +6028,6 @@ namespace SDL2
int len
);
/* dev refers to an SDL_AudioDeviceID */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_AudioDeviceConnected(uint dev);
[DllImport(nativeLibName, EntryPoint = "SDL_AudioInit", CallingConvention = CallingConvention.Cdecl)]
private static extern int INTERNAL_SDL_AudioInit(
byte[] driver_name

View File

@ -68,12 +68,12 @@ namespace SDL2
X.patch = SDL_IMAGE_PATCHLEVEL;
}
[DllImport(nativeLibName, EntryPoint = "IMG_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_IMG_LinkedVersion();
public static SDL.SDL_version IMG_LinkedVersion()
[DllImport(nativeLibName, EntryPoint = "IMG_Linked_Version", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_IMG_Linked_Version();
public static SDL.SDL_version IMG_Linked_Version()
{
SDL.SDL_version result;
IntPtr result_ptr = INTERNAL_IMG_LinkedVersion();
IntPtr result_ptr = INTERNAL_IMG_Linked_Version();
result = (SDL.SDL_version) Marshal.PtrToStructure(
result_ptr,
typeof(SDL.SDL_version)
@ -179,9 +179,6 @@ namespace SDL2
);
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int IMG_InvertAlpha(int on);
/* IntPtr refers to an SDL_Surface* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_ReadXPMFromArray(