Commits

Marcus von Appen committed 0aa582b

- fixed issue #56: sdl2.ext.Renderer.draw_line() and
sdl2.ext.Renderer.draw_point() handle multiple lines (or points) as
arguments properly now

Comments (0)

Files changed (1)

sdl2/ext/sprite.py

         sy = c_float(0.0)
         render.SDL_RenderGetScale(self.renderer, byref(sx), byref(sy))
         return sx.value, sy.value
-        
+
     @scale.setter
     def scale(self, value):
         """The horizontal and vertical drawing scale."""
         else:
             x = 0
             off = 0
+            count = pcount // 2
             SDL_Point = rect.SDL_Point
-            ptlist = (SDL_Point * pcount / 2)()
+            ptlist = (SDL_Point * count)()
             while x < pcount:
                 ptlist[off] = SDL_Point(points[x], points[x + 1])
                 x += 2
                 tmp = self.color
                 self.color = color
             ptr = cast(ptlist, POINTER(SDL_Point))
-            ret = render.SDL_RenderDrawLines(self.renderer, ptr, pcount / 2)
+            ret = render.SDL_RenderDrawLines(self.renderer, ptr, count)
             if color is not None:
                 self.color = tmp
             if ret == -1:
         else:
             x = 0
             off = 0
+            count = pcount // 2
             SDL_Point = rect.SDL_Point
-            ptlist = (SDL_Point * pcount / 2)()
+            ptlist = (SDL_Point * count)()
             while x < pcount:
                 ptlist[off] = SDL_Point(points[x], points[x + 1])
                 x += 2
                 tmp = self.color
                 self.color = color
             ptr = cast(ptlist, POINTER(SDL_Point))
-            ret = render.SDL_RenderDrawPoints(self.renderer, ptr, pcount / 2)
+            ret = render.SDL_RenderDrawPoints(self.renderer, ptr, count)
             if color is not None:
                 self.color = tmp
             if ret == -1: