Skip to content

Commit b13c9ec

Browse files
committed
Use internal definitions for 'SDL_Surface' and 'SDL_Texture' structures.
https://github.com/search?q=repo%3Alibsdl-org%2FSDL+SDL_INTERNAL+path%3Ainclude%2F&type=code
1 parent d297172 commit b13c9ec

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

sdl3/SDL_render.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ class SDL_Vertex(ctypes.Structure):
3737
class SDL_Renderer(ctypes.c_void_p):
3838
...
3939

40-
class SDL_Texture(ctypes.c_void_p):
41-
...
40+
class SDL_Texture(ctypes.Structure):
41+
_fields_ = [
42+
("format", SDL_PixelFormat),
43+
("w", ctypes.c_int),
44+
("h", ctypes.c_int),
45+
("refcount", ctypes.c_int)
46+
]
4247

4348
SDL_FUNC("SDL_GetNumRenderDrivers", ctypes.c_int)
4449
SDL_FUNC("SDL_GetRenderDriver", ctypes.c_char_p, ctypes.c_int)

sdl3/SDL_surface.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,17 @@
2929
SDL_FLIP_HORIZONTAL = 1
3030
SDL_FLIP_VERTICAL = 2
3131

32-
class SDL_Surface(ctypes.c_void_p):
33-
...
32+
class SDL_Surface(ctypes.Structure):
33+
_fields_ = [
34+
("flags", SDL_SurfaceFlags),
35+
("format", SDL_PixelFormat),
36+
("w", ctypes.c_int),
37+
("h", ctypes.c_int),
38+
("pitch", ctypes.c_int),
39+
("pixels", ctypes.c_void_p),
40+
("refcount", ctypes.c_int),
41+
("reserved", ctypes.c_void_p)
42+
]
3443

3544
SDL_FUNC("SDL_CreateSurface", ctypes.POINTER(SDL_Surface), ctypes.c_int, ctypes.c_int, SDL_PixelFormat)
3645
SDL_FUNC("SDL_CreateSurfaceFrom", ctypes.POINTER(SDL_Surface), ctypes.c_int, ctypes.c_int, SDL_PixelFormat, ctypes.c_void_p, ctypes.c_int)

0 commit comments

Comments
 (0)