[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] euclid.Vector2 to pygame coordinate tuple shortcut?



Lenard Lindstrom wrote:

Jake b wrote:
I wanted to use this to call pygame functions, ( I am not writing new
functions in this way )

(It would save code and make it clearer then typing out the two
members every time.)

'tuple()' seems to work this way :)
Since a euclid Vector supports the slice operator you can probably just pass a Vector, as is, to a pygame function with tuple of two integer values is expected.

Let me try this again. Pygame functions don't expect tuples as such, but rather a sequence of numbers. A euclid Vector is a sequence, so doesn't need to be converted to a tuple first. Where the problem may be is that Pygame functions want a sequence of integers for a position, color or rectangle. The pygame.draw.circle gives me a DeprecationWarning if I pass it the center coordinates as floats. So unless a euclid Vector's can have integer elements it is suggested to convert it to an integer sequences first. By the way aaline accepts float positions without complaint, to I assume this will also apply to an anti-aliased circle function should that also be added to Pygame.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>