Commits

Marcus von Appen  committed c9584f2

- fixed issue #19: the sdl2.ext.TextureSpriteRenderer and
sdl2.ext.SoftwareSpriteRenderer misinterpret the x and y arguments,
when set to 0.
- fixed sdl2.SDL_GL_GetDrawableSize() function for non-hg SDL2 versions

  • Participants
  • Parent commits d5267c0

Comments (0)

Files changed (2)

File sdl2/ext/sprite.py

                 r.y = y + sp.y
                 blit_surface(sp.surface, None, imgsurface, r)
         else:
-            r.x = x or sprites.x
-            r.y = y or sprites.y
+            r.x = sprites.x
+            r.y = sprites.y
+            if x is not None and y is not None:
+                r.x = x
+                r.y = y
             surface.SDL_BlitSurface(sprites.surface, None, self.surface, r)
         video.SDL_UpdateWindowSurface(self.window)
 
                 if rcopy(renderer, sp.texture, None, r) == -1:
                     raise SDLError()
         else:
-            if x is None or y is None:
-                r.x = sprites.x
-                r.y = sprites.y
-                r.w, r.h = sprites.size
+            r.x = sprites.x
+            r.y = sprites.y
+            r.w, r.h = sprites.size
+            if x is not None and y is not None:
+                r.x = x
+                r.y = y
             render.SDL_RenderCopy(self.sdlrenderer, sprites.texture, None, r)
         render.SDL_RenderPresent(self.sdlrenderer)

File sdl2/video.py

 from ctypes import Structure, POINTER, c_int, c_void_p, c_char_p, c_float, \
     py_object
-from .dll import _bind
+from .dll import _bind, nullfunc
 from .stdinc import Uint16, Uint32, SDL_bool
 from .rect import SDL_Rect
 from .surface import SDL_Surface
 SDL_GL_GetSwapInterval = _bind("SDL_GL_GetSwapInterval", None, c_int)
 SDL_GL_SwapWindow = _bind("SDL_GL_SwapWindow", [POINTER(SDL_Window)])
 SDL_GL_DeleteContext = _bind("SDL_GL_DeleteContext", [SDL_GLContext])
-SDL_GL_GetDrawableSize = _bind("SDL_GL_GetDrawableSize", [POINTER(SDL_Window), POINTER(c_int), POINTER(c_int)])
+SDL_GL_GetDrawableSize = _bind("SDL_GL_GetDrawableSize", [POINTER(SDL_Window), POINTER(c_int), POINTER(c_int)], optfunc=nullfunc)