sdl2-compat: make sure the SDL2 SDL_bool (an enum) and the SDL3 one (an int) are compatible.

From fab4f808b141199ac900445f5dadb5c9aef39792 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 28 Mar 2024 23:20:40 +0300
Subject: [PATCH] make sure the SDL2 SDL_bool (an enum) and the SDL3 one (an
 int) are compatible.

Reference issue: https://github.com/libsdl-org/SDL/issues/9392 .
---
 src/sdl2_compat.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/sdl2_compat.h b/src/sdl2_compat.h
index 7432074..c35a5db 100644
--- a/src/sdl2_compat.h
+++ b/src/sdl2_compat.h
@@ -22,6 +22,14 @@
 #ifndef sdl2_compat_h
 #define sdl2_compat_h
 
+/* This is to make sure the SDL2 SDL_bool (an enum) and the SDL3 one (an int) are compatible. */
+typedef enum
+{
+    DUMMY_ENUM_VALUE0,
+    DUMMY_ENUM_VALUE1
+} SDL2_DUMMY_ENUM;
+SDL_COMPILE_TIME_ASSERT(SDL23bool, sizeof(SDL2_DUMMY_ENUM) == sizeof(SDL_bool));
+
 /* these types were removed from / renamed in SDL3. We need them for SDL2 APIs exported here. */
 
 typedef SDL_AtomicInt SDL_atomic_t;