sdl2.ext.Renderer "draw_lines" method is unclear, or operating incorrectly.

Issue #65 resolved
Owatch created an issue

Documentation for http://pysdl2.readthedocs.org/en/latest/modules/sdl2ext_sprite.html#sdl2.ext.Renderer.draw_line currently states:

Draws one or multiple lines on the rendering context. The line argument contains the start and end coordinates of the individual lines in the form (line1_x1, line1_y1, line1_x2, line1_y2, line2_x1, line2_y1, ...).

I would highly suggest changing this, because I am unable to draw lines correctly using this description. Attempting to draw several lines will result in additional lines being drawn where none were specified when using the following code:

Renderer = sdl2.ext.Renderer(sdl2.ext.Window)
Renderer.draw_line((4,4,15,15, 15,4,4,15), color = Red)

Error.png

A different result is achieved if the lines are Rendered independently:

Renderer = sdl2.ext.Renderer(sdl2.ext.Window)
Renderer.draw_line((4,4,15,15), color = Red)
Renderer.draw_line((15,4,4,15), color = Red)

Norm.png

I apologize if I'm missing something here, but it is confusing to me. I was previously using sdl2.ext.line to draw my lines, which did appear "correctly" when the lines were passed together in an iterable tuple.

I've attached the .py file if you think it will come of use in this issue.

Comments (2)

  1. Marcus von Appen repo owner

    Thanks for spotting this. The documentation is misleading here and I updated it accordingly.

  2. Log in to comment