23
23
import logging
24
24
import math
25
25
import sys
26
- from ctypes import c_bool , c_int , c_size_t , pointer
26
+ from ctypes import c_bool , c_float , byref , c_size_t , pointer
27
27
from typing import TYPE_CHECKING
28
28
29
29
import sdl3
@@ -111,11 +111,11 @@ def prime(self) -> None:
111
111
texture = sdl3 .SDL_CreateTextureFromSurface (self .renderer , self .surface )
112
112
sdl3 .SDL_DestroySurface (self .surface )
113
113
self .surface = None
114
- tex_w = pointer ( c_int ( 0 ) )
115
- tex_h = pointer ( c_int ( 0 ) )
116
- sdl3 .SDL_QueryTexture (texture , None , None , tex_w , tex_h )
117
- self .rect .w = int (tex_w .contents . value )
118
- self .rect .h = int (tex_h .contents . value )
114
+ tex_w = c_float ( 0.0 )
115
+ tex_h = c_float ( 0.0 )
116
+ sdl3 .SDL_GetTextureSize (texture , byref ( tex_w ), byref ( tex_h ) )
117
+ self .rect .w = int (tex_w .value )
118
+ self .rect .h = int (tex_h .value )
119
119
self .texture = texture
120
120
121
121
def draw (self , x : int , y : int ) -> bool | None :
@@ -131,7 +131,7 @@ def draw(self, x: int, y: int) -> bool | None:
131
131
self .prime ()
132
132
self .rect .x = round (x )
133
133
self .rect .y = round (y )
134
- sdl3 .SDL_RenderCopy (self .renderer , self .texture , None , self .rect )
134
+ sdl3 .SDL_RenderTexture (self .renderer , self .texture , None , self .rect )
135
135
136
136
return True
137
137
@@ -842,12 +842,12 @@ def __draw_text_windows(
842
842
ke = sdl3 .SDL_MapRGB (s_image .contents .format , bg .r , bg .g , bg .b )
843
843
sdl3 .SDL_SetColorKey (s_image , True , ke )
844
844
c = sdl3 .SDL_CreateTextureFromSurface (self .renderer , s_image )
845
- tex_w = pointer ( c_int ( 0 ) )
846
- tex_h = pointer ( c_int ( 0 ) )
847
- sdl3 .SDL_QueryTexture (c , None , None , tex_w , tex_h )
845
+ tex_w = c_float ( 0.0 )
846
+ tex_h = c_float ( 0.0 )
847
+ sdl3 .SDL_GetTextureSize (c , byref ( tex_w ), byref ( tex_h ) )
848
848
dst = sdl3 .SDL_FRect (round (x ), round (y ))
849
- dst .w = int (tex_w .contents . value )
850
- dst .h = int (tex_h .contents . value )
849
+ dst .w = int (tex_w .value )
850
+ dst .h = int (tex_h .value )
851
851
852
852
sdl3 .SDL_DestroySurface (s_image )
853
853
#im.close()
0 commit comments