Hi,
The latest version of Vizard uses python 2.3, however python does not support the
switch statement. The equivalent of this in python is to do
if ... elif ... elif ...
On a side note, to check if a joystick button is down you would do the following:
Code:
buttonstate = sid.buttons()
if buttonstate & sid.BUTTON1:
print 'button 1 is down'
if buttonstate & sid.BUTTON2:
print 'button 2 is down'
if buttonstate & sid.BUTTON3:
print 'button 3 is down'
if buttonstate & sid.BUTTON4:
print 'button 4 is down'
The button state is a bitmask, where each bit represents the state of a corresponding button. Therefore you have to perform a bitwise
AND to check if a button is down.
Alternatively, you could setup a callback to notify you when a joystick button is pressed. There is an example script that shows how to use the sid library under
C:\Program Files\Vizard20\examples\input\joystick.py
Please let me know if you need any more help.