Commits

Anonymous committed 8d1114e Merge

Merged in shjohnson_pi/py-sdl2/shjohnson_pi/fix-draw_rect-call-to-use-sdl_rect-1374226056513 (pull request #7)

Fix draw_rect call to use SDL_Rect

Comments (0)

Files changed (1)

sdl2/ext/sprite.py

 
     def draw_rect(self, rects, color=None):
         """Draws one or multiple rectangles on the rendering context."""
+        SDL_Rect = rect.SDL_Rect
         # ((x, y, w, h), ...)
         if type(rects[0]) == int:
             # single rect
                 tmp = self.color
                 self.color = color
             x, y, w, h = rects
-            ret = render.SDL_RenderDrawRect(self.renderer, x, y, w, h)
+            ret = render.SDL_RenderDrawRect(self.renderer, SDL_Rect(x, y, w, h))
             if color is not None:
                 self.color = tmp
             if ret == -1:
                 raise SDLError()
         else:
             x = 0
-            SDL_Rect = rect.SDL_Rect
             rlist = (SDL_Rect * len(rects))()
             for idx, r in enumerate(rects):
                 rlist[idx] = SDL_Rect(r[0], r[1], r[2], r[3])