Skip to content

Commit ae97c23

Browse files
committed
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Upgrade to use SDL3 version of libtcod
1 parent e4010d6 commit ae97c23

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tcod/cffi.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@
1515

1616
__sdl_version__ = ""
1717

18+
REQUIRED_SDL_VERSION = (3, 2, 0)
19+
1820
ffi_check = cffi.FFI()
1921
ffi_check.cdef(
2022
"""
21-
typedef struct SDL_version
22-
{
23-
uint8_t major;
24-
uint8_t minor;
25-
uint8_t patch;
26-
} SDL_version;
27-
28-
void SDL_GetVersion(SDL_version * ver);
23+
int SDL_GetVersion(void);
2924
"""
3025
)
3126

@@ -34,10 +29,12 @@ def verify_dependencies() -> None:
3429
"""Try to make sure dependencies exist on this system."""
3530
if sys.platform == "win32":
3631
lib_test: Any = ffi_check.dlopen("SDL3.dll") # Make sure SDL3.dll is here.
37-
version: Any = ffi_check.new("struct SDL_version*")
38-
lib_test.SDL_GetVersion(version) # Need to check this version.
39-
version_tuple = version.major, version.minor, version.patch
40-
if version_tuple < (2, 0, 5):
32+
int_version = lib_test.SDL_GetVersion() # Need to check this version.
33+
major = int_version // 1000000
34+
minor = (int_version // 1000) % 1000
35+
patch = int_version % 1000
36+
version_tuple = major, minor, patch
37+
if version_tuple < REQUIRED_SDL_VERSION:
4138
msg = f"Tried to load an old version of SDL {version_tuple!r}"
4239
raise RuntimeError(msg)
4340

0 commit comments

Comments
 (0)