Skip to content

Commit

Permalink
Use internal definitions for 'SDL_Surface' and 'SDL_Texture' structures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aermoss committed Jan 30, 2025
1 parent d297172 commit b13c9ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 7 additions & 2 deletions sdl3/SDL_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ class SDL_Vertex(ctypes.Structure):
class SDL_Renderer(ctypes.c_void_p):
...

class SDL_Texture(ctypes.c_void_p):
...
class SDL_Texture(ctypes.Structure):
_fields_ = [
("format", SDL_PixelFormat),
("w", ctypes.c_int),
("h", ctypes.c_int),
("refcount", ctypes.c_int)
]

SDL_FUNC("SDL_GetNumRenderDrivers", ctypes.c_int)
SDL_FUNC("SDL_GetRenderDriver", ctypes.c_char_p, ctypes.c_int)
Expand Down
13 changes: 11 additions & 2 deletions sdl3/SDL_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@
SDL_FLIP_HORIZONTAL = 1
SDL_FLIP_VERTICAL = 2

class SDL_Surface(ctypes.c_void_p):
...
class SDL_Surface(ctypes.Structure):
_fields_ = [
("flags", SDL_SurfaceFlags),
("format", SDL_PixelFormat),
("w", ctypes.c_int),
("h", ctypes.c_int),
("pitch", ctypes.c_int),
("pixels", ctypes.c_void_p),
("refcount", ctypes.c_int),
("reserved", ctypes.c_void_p)
]

SDL_FUNC("SDL_CreateSurface", ctypes.POINTER(SDL_Surface), ctypes.c_int, ctypes.c_int, SDL_PixelFormat)
SDL_FUNC("SDL_CreateSurfaceFrom", ctypes.POINTER(SDL_Surface), ctypes.c_int, ctypes.c_int, SDL_PixelFormat, ctypes.c_void_p, ctypes.c_int)
Expand Down

0 comments on commit b13c9ec

Please sign in to comment.