add sdl3 shim generator

This commit is contained in:
Alex Zenla 2024-08-04 18:29:49 -07:00
parent bae6950525
commit 86803db3ac
Signed by: alex
GPG Key ID: C0780728420EBFE5
2 changed files with 68 additions and 0 deletions

15
Scripts/generate-sdl3-shim.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
cd "$(dirname "${0}")/.."
echo "#pragma once"
echo ""
echo "#include <SDL3/SDL.h>"
echo ""
grep -r 'UINT64_C' Frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework/Versions/A/Headers | awk -F ':' '{print $2}' | grep -F '#define' | grep "UINT64_C(0x" | while read -r LINE
do
MACRO_NAME="$(echo "${LINE}" | awk '{print $2}')"
ACTUAL_STUFF="$(echo "${LINE}" | awk -F 'SDL_UINT64_C\\(' '{print $2}' | sed 's/)/UL/')"
echo "#undef ${MACRO_NAME}"
echo "#define ${MACRO_NAME} ${ACTUAL_STUFF}"
done

View File

@ -1,3 +1,56 @@
#pragma once #pragma once
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#undef SDL_MAX_UINT64
#define SDL_MAX_UINT64 0xFFFFFFFFFFFFFFFFUL /* 18446744073709551615 */
#undef SDL_MIN_UINT64
#define SDL_MIN_UINT64 0x0000000000000000UL /* 0 */
#undef SDL_WINDOW_FULLSCREEN
#define SDL_WINDOW_FULLSCREEN 0x0000000000000001UL /**< window is in fullscreen mode */
#undef SDL_WINDOW_OPENGL
#define SDL_WINDOW_OPENGL 0x0000000000000002UL /**< window usable with OpenGL context */
#undef SDL_WINDOW_OCCLUDED
#define SDL_WINDOW_OCCLUDED 0x0000000000000004UL /**< window is occluded */
#undef SDL_WINDOW_HIDDEN
#define SDL_WINDOW_HIDDEN 0x0000000000000008UL /**< window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible */
#undef SDL_WINDOW_BORDERLESS
#define SDL_WINDOW_BORDERLESS 0x0000000000000010UL /**< no window decoration */
#undef SDL_WINDOW_RESIZABLE
#define SDL_WINDOW_RESIZABLE 0x0000000000000020UL /**< window can be resized */
#undef SDL_WINDOW_MINIMIZED
#define SDL_WINDOW_MINIMIZED 0x0000000000000040UL /**< window is minimized */
#undef SDL_WINDOW_MAXIMIZED
#define SDL_WINDOW_MAXIMIZED 0x0000000000000080UL /**< window is maximized */
#undef SDL_WINDOW_MOUSE_GRABBED
#define SDL_WINDOW_MOUSE_GRABBED 0x0000000000000100UL /**< window has grabbed mouse input */
#undef SDL_WINDOW_INPUT_FOCUS
#define SDL_WINDOW_INPUT_FOCUS 0x0000000000000200UL /**< window has input focus */
#undef SDL_WINDOW_MOUSE_FOCUS
#define SDL_WINDOW_MOUSE_FOCUS 0x0000000000000400UL /**< window has mouse focus */
#undef SDL_WINDOW_EXTERNAL
#define SDL_WINDOW_EXTERNAL 0x0000000000000800UL /**< window not created by SDL */
#undef SDL_WINDOW_MODAL
#define SDL_WINDOW_MODAL 0x0000000000001000UL /**< window is modal */
#undef SDL_WINDOW_HIGH_PIXEL_DENSITY
#define SDL_WINDOW_HIGH_PIXEL_DENSITY 0x0000000000002000UL /**< window uses high pixel density back buffer if possible */
#undef SDL_WINDOW_MOUSE_CAPTURE
#define SDL_WINDOW_MOUSE_CAPTURE 0x0000000000004000UL /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
#undef SDL_WINDOW_ALWAYS_ON_TOP
#define SDL_WINDOW_ALWAYS_ON_TOP 0x0000000000008000UL /**< window should always be above others */
#undef SDL_WINDOW_UTILITY
#define SDL_WINDOW_UTILITY 0x0000000000020000UL /**< window should be treated as a utility window, not showing in the task bar and window list */
#undef SDL_WINDOW_TOOLTIP
#define SDL_WINDOW_TOOLTIP 0x0000000000040000UL /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */
#undef SDL_WINDOW_POPUP_MENU
#define SDL_WINDOW_POPUP_MENU 0x0000000000080000UL /**< window should be treated as a popup menu, requires a parent window */
#undef SDL_WINDOW_KEYBOARD_GRABBED
#define SDL_WINDOW_KEYBOARD_GRABBED 0x0000000000100000UL /**< window has grabbed keyboard input */
#undef SDL_WINDOW_VULKAN
#define SDL_WINDOW_VULKAN 0x0000000010000000UL /**< window usable for Vulkan surface */
#undef SDL_WINDOW_METAL
#define SDL_WINDOW_METAL 0x0000000020000000UL /**< window usable for Metal view */
#undef SDL_WINDOW_TRANSPARENT
#define SDL_WINDOW_TRANSPARENT 0x0000000040000000UL /**< window with transparent buffer */
#undef SDL_WINDOW_NOT_FOCUSABLE
#define SDL_WINDOW_NOT_FOCUSABLE 0x0000000080000000UL /**< window should not be focusable */