bastienleonard / pysfml-cython

A Python 2/3 binding for SFML 2, written with Cython
http://pysfml2-cython.readthedocs.org/
Other
68 stars 8 forks source link

I made i so that all sequence types work with draw. This fixes #24 #25

Closed AphonicChaos closed 12 years ago

AphonicChaos commented 12 years ago

I tested this by changing the custom drawables example to use a tuple instead of a list, compiling, and running the code (of course having to add those declarations you mentioned to sfml.cpp).

Mind you, this patch still allows lists to be sent. There is also no worry of strings being processed as a "list".

bastienleonard commented 12 years ago

If I'm not mistaken, this will clash with user-made drawables that have an __iter__() method. Instead I simply added tuple in the type-check with instanceof(). I also removed the <list> casts that I added in the past and are actually useless. I'm also not sure whether testing for __iter__ is enough, since I need to use len() as well for allocating the C++ vertex array. For example, generators support iteration for not len().