New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OverflowError: integer 32769 does not fit 'int16_t' #68
Comments
ok did some research and found that in sdl 2.0 SDL_Rect fields are int type. |
pygame is clearly using a int32_t under the hood >>> pygame.ver
'1.9.1release'
>>> pygame.draw.circle(screen, (0xff, 0xff, 0xff), (((2**31))-1, 0), 1)
<rect(2147483646, 0, 2, 1)>
>>> pygame.draw.circle(screen, (0xff, 0xff, 0xff), (((2**31)), 0), 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: signed integer is greater than maximum We should do likewise . |
seems i can make really big x y cordinates now. i have tested with |
i noticed a curious thing though: this:
and this:
and also this:
both draw the circle at x=10. |
Because the underlying C data type for the position is int16, everything gets truncated and you get these wrap-around effects. ygame has the same behaviour (try with 2**16 there),. Because pygame uses an int32, while we use a python integer, pygame will oververflow on 2**32, while pygame-cffi won't. |
alright, i guess it's not a to big issue, since who whould draw like that far out of the screen, when it's not necesarry. |
i encountered this error/bug when running my pygame code.
i think it happens where a to big value for x is entered and can not be stored in a int16_t.
in my case it was a entity in my code going far offscreen.
this is the full traceback:
http://pastebin.com/hf1g75Fn
to reproduce:
The text was updated successfully, but these errors were encountered: