arcade
arcade copied to clipboard
arcade.draw_lines() draws random data when passed an empty list when a camera is activated
Pretty much what it says on the tin. If you have a camera active, draw some points, and then call draw_lines() with an empty list, you'll get lines between the points, as if Arcade is re-using some kind of memory buffer or something.
Minimal example:
import arcade
# Set up the constants
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
WINDOW_TITLE = "draw_lines bug"
class GameView(arcade.View):
def __init__(self):
super().__init__()
self.background_color = arcade.color.BLACK
self.camera = arcade.camera.Camera2D(position=(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2))
def on_draw(self):
self.clear()
with self.camera.activate():
# Draw some points
arcade.draw_points([(100, 100), (200, 200), (300, 300), (400, 400)], arcade.color.RED, 5)
# Draw an empty list of lines
arcade.draw_lines([], arcade.color.RED, 3)
def main():
window = arcade.Window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
game = GameView()
window.show_view(game)
arcade.run()
if __name__ == "__main__":
main()
Here's what Arcade shows for this code:
Correct output would obviously just be to show the 4 points.
Thanks. That shouldn't be too difficult to fix.
https://github.com/pythonarcade/arcade/pull/2737