FlorianRhiem / pyGLFW

Python bindings for GLFW
MIT License
233 stars 36 forks source link

Fix TypeError(s) when initialising GamePad state #50

Closed brpollock closed 4 years ago

brpollock commented 4 years ago

The initialisers for buttons (and axes) require integer (or float) arguments, but got arrays instead.

Fixed by unpacking the arrays.

The error happened in a call to get_gamepad_state, but it can be reproduced in the REPL (as can the fix).

>>> import ctypes
>>> # Init with zeros creates an instance of c_ubyte_Array_15
... (ctypes.c_ubyte * 15)(0,0,0)
<__main__.c_ubyte_Array_15 object at 0x101f5d7a0>
>>> # Init with an array is a TypeError
... (ctypes.c_ubyte * 15)([0,0,0])
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: an integer is required
FlorianRhiem commented 4 years ago

Thank you for the fix! I've merged it and released it as version 1.11.1.

brpollock commented 4 years ago

Wow, that was fast :-)

Thank you for pyGLFW!

I discovered it a few days ago, and it's really nice to work with.

Thanks (again),

Brian

On Fri, May 15, 2020 at 4:38 PM Florian Rhiem notifications@github.com wrote:

Thank you for the fix! I've merged it and released it as version 1.11.1.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FlorianRhiem/pyGLFW/pull/50#issuecomment-629319189, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFMQLMY5MX44RT6AHWL4X3RRVOWTANCNFSM4NBA34QA .