mirror of https://github.com/ppy/SDL3-CS.git
Remove SDL_bool define patche
This doesn't compile as true/false can't be converted to `enum SDL_bool`
This commit is contained in:
parent
5fbda17ae9
commit
fb08ccb2ce
|
|
@ -1,48 +0,0 @@
|
|||
diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h
|
||||
index 4e18f6382..d737c7a9a 100644
|
||||
--- a/include/SDL3/SDL.h
|
||||
+++ b/include/SDL3/SDL.h
|
||||
@@ -28,6 +28,8 @@
|
||||
#ifndef SDL_h_
|
||||
#define SDL_h_
|
||||
|
||||
+#error Don't build with enum type changes
|
||||
+
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_assert.h>
|
||||
#include <SDL3/SDL_atomic.h>
|
||||
diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h
|
||||
index 3c0e80f38..44f58add3 100644
|
||||
--- a/include/SDL3/SDL_log.h
|
||||
+++ b/include/SDL3/SDL_log.h
|
||||
@@ -407,7 +407,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogMessageV(int category,
|
||||
*
|
||||
* \since This datatype is available since SDL 3.0.0.
|
||||
*/
|
||||
-typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
|
||||
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, SDL_LogCategory category, SDL_LogPriority priority, const char *message);
|
||||
|
||||
/**
|
||||
* Get the current log output function.
|
||||
diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h
|
||||
index 5539f2a81..3155f3f31 100644
|
||||
--- a/include/SDL3/SDL_stdinc.h
|
||||
+++ b/include/SDL3/SDL_stdinc.h
|
||||
@@ -194,7 +194,7 @@ void *alloca(size_t);
|
||||
*
|
||||
* \sa SDL_bool
|
||||
*/
|
||||
-#define SDL_FALSE false
|
||||
+#define SDL_FALSE (SDL_bool)0
|
||||
|
||||
/**
|
||||
* A boolean true.
|
||||
@@ -203,7 +203,7 @@ void *alloca(size_t);
|
||||
*
|
||||
* \sa SDL_bool
|
||||
*/
|
||||
-#define SDL_TRUE true
|
||||
+#define SDL_TRUE (SDL_bool)1
|
||||
|
||||
/**
|
||||
* A boolean type: true or false.
|
||||
|
|
@ -108,9 +108,9 @@ namespace SDL
|
|||
public static extern void SDL_LogMessageV(int category, SDL_LogPriority priority, [NativeTypeName("const char *")] byte* fmt, [NativeTypeName("va_list")] byte* ap);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]<IntPtr, SDL_LogCategory, SDL_LogPriority, byte*, void>* callback, [NativeTypeName("void **")] IntPtr* userdata);
|
||||
public static extern void SDL_GetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction *")] delegate* unmanaged[Cdecl]<IntPtr, int, SDL_LogPriority, byte*, void>* callback, [NativeTypeName("void **")] IntPtr* userdata);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl]<IntPtr, SDL_LogCategory, SDL_LogPriority, byte*, void> callback, [NativeTypeName("void*")] IntPtr userdata);
|
||||
public static extern void SDL_SetLogOutputFunction([NativeTypeName("SDL_LogOutputFunction")] delegate* unmanaged[Cdecl]<IntPtr, int, SDL_LogPriority, byte*, void> callback, [NativeTypeName("void*")] IntPtr userdata);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,17 +75,17 @@ namespace SDL
|
|||
|
||||
public static SDL_bool SDL_PointInRect([NativeTypeName("const SDL_Point *")] SDL_Point* p, [NativeTypeName("const SDL_Rect *")] SDL_Rect* r)
|
||||
{
|
||||
return ((p) != null && (r) != null && (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0);
|
||||
return ((p) != null && (r) != null && (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h))) ? true : false;
|
||||
}
|
||||
|
||||
public static SDL_bool SDL_RectEmpty([NativeTypeName("const SDL_Rect *")] SDL_Rect* r)
|
||||
{
|
||||
return ((r == null) || (r->w <= 0) || (r->h <= 0)) ? (SDL_bool)(1) : (SDL_bool)(0);
|
||||
return ((r == null) || (r->w <= 0) || (r->h <= 0)) ? true : false;
|
||||
}
|
||||
|
||||
public static SDL_bool SDL_RectsEqual([NativeTypeName("const SDL_Rect *")] SDL_Rect* a, [NativeTypeName("const SDL_Rect *")] SDL_Rect* b)
|
||||
{
|
||||
return ((a) != null && (b) != null && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? (SDL_bool)(1) : (SDL_bool)(0);
|
||||
return ((a) != null && (b) != null && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? true : false;
|
||||
}
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
|
|
@ -105,17 +105,17 @@ namespace SDL
|
|||
|
||||
public static SDL_bool SDL_PointInRectFloat([NativeTypeName("const SDL_FPoint *")] SDL_FPoint* p, [NativeTypeName("const SDL_FRect *")] SDL_FRect* r)
|
||||
{
|
||||
return ((p) != null && (r) != null && (p->x >= r->x) && (p->x <= (r->x + r->w)) && (p->y >= r->y) && (p->y <= (r->y + r->h))) ? (SDL_bool)(1) : (SDL_bool)(0);
|
||||
return ((p) != null && (r) != null && (p->x >= r->x) && (p->x <= (r->x + r->w)) && (p->y >= r->y) && (p->y <= (r->y + r->h))) ? true : false;
|
||||
}
|
||||
|
||||
public static SDL_bool SDL_RectEmptyFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* r)
|
||||
{
|
||||
return ((r == null) || (r->w < 0.0f) || (r->h < 0.0f)) ? (SDL_bool)(1) : (SDL_bool)(0);
|
||||
return ((r == null) || (r->w < 0.0f) || (r->h < 0.0f)) ? true : false;
|
||||
}
|
||||
|
||||
public static SDL_bool SDL_RectsEqualEpsilon([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b, [NativeTypeName("const float")] float epsilon)
|
||||
{
|
||||
return ((a) != null && (b) != null && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) ? (SDL_bool)(1) : (SDL_bool)(0);
|
||||
return ((a) != null && (b) != null && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) ? true : false;
|
||||
}
|
||||
|
||||
public static SDL_bool SDL_RectsEqualFloat([NativeTypeName("const SDL_FRect *")] SDL_FRect* a, [NativeTypeName("const SDL_FRect *")] SDL_FRect* b)
|
||||
|
|
|
|||
|
|
@ -611,32 +611,32 @@ namespace SDL
|
|||
{
|
||||
if (a != 0 && b > 0xffffffffffffffffUL / a)
|
||||
{
|
||||
return (SDL_bool)(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
*ret = a * b;
|
||||
return (SDL_bool)(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static SDL_bool SDL_size_add_check_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
|
||||
{
|
||||
if (b > 0xffffffffffffffffUL - a)
|
||||
{
|
||||
return (SDL_bool)(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
*ret = a + b;
|
||||
return (SDL_bool)(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
[NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")]
|
||||
public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL;
|
||||
|
||||
[NativeTypeName("#define SDL_FALSE (SDL_bool)0")]
|
||||
public const SDL_bool SDL_FALSE = (SDL_bool)(0);
|
||||
[NativeTypeName("#define SDL_FALSE false")]
|
||||
public const bool SDL_FALSE = false;
|
||||
|
||||
[NativeTypeName("#define SDL_TRUE (SDL_bool)1")]
|
||||
public const SDL_bool SDL_TRUE = (SDL_bool)(1);
|
||||
[NativeTypeName("#define SDL_TRUE true")]
|
||||
public const bool SDL_TRUE = true;
|
||||
|
||||
[NativeTypeName("#define SDL_MAX_SINT8 ((Sint8)0x7F)")]
|
||||
public const sbyte SDL_MAX_SINT8 = ((sbyte)(0x7F));
|
||||
|
|
|
|||
|
|
@ -140,13 +140,6 @@ def prepare_sdl_source():
|
|||
"HEAD"
|
||||
], cwd=SDL_root)
|
||||
|
||||
subprocess.run([
|
||||
"git",
|
||||
"apply",
|
||||
"--3way",
|
||||
repository_root / "External" / "SDL-use-proper-types.patch"
|
||||
], cwd=SDL_root)
|
||||
|
||||
|
||||
def get_sdl_api_dump():
|
||||
subprocess.run([
|
||||
|
|
|
|||
Loading…
Reference in New Issue