File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change 15
15
16
16
__sdl_version__ = ""
17
17
18
+ REQUIRED_SDL_VERSION = (3 , 2 , 0 )
19
+
18
20
ffi_check = cffi .FFI ()
19
21
ffi_check .cdef (
20
22
"""
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);
29
24
"""
30
25
)
31
26
@@ -34,10 +29,12 @@ def verify_dependencies() -> None:
34
29
"""Try to make sure dependencies exist on this system."""
35
30
if sys .platform == "win32" :
36
31
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 :
41
38
msg = f"Tried to load an old version of SDL { version_tuple !r} "
42
39
raise RuntimeError (msg )
43
40
You can’t perform that action at this time.
0 commit comments