AnalogChess icon indicating copy to clipboard operation
AnalogChess copied to clipboard

No float coordinates issues in pygame 1.9.6

Open aleloi opened this issue 3 years ago • 0 comments

Getting a bunch of errors like these in python 3.8.10+pygame 1.9.6:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
analogchessV4.py:47: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  pygame.draw.polygon(surf, c, pts)
Traceback (most recent call last):
  File "analogchessV4.py", line 1214, in <module>
    piece.draw_paths(pieces)
  File "analogchessV4.py", line 535, in draw_paths
    draw_line_round_corners_polygon(see_through, to_screen_coords((self.start_x,self.start_y)), to_screen_coords(end_pos), RED_HIGHLIGHT, self.radius*2*640/8)
  File "analogchessV4.py", line 48, in draw_line_round_corners_polygon
    pygame.draw.circle(surf, c, p1, round(w / 2))
TypeError: integer argument expected, got float

It's easy to fix by converting all float lengths and coords to int

aleloi avatar Jan 13 '23 23:01 aleloi