View Single Post
  #4  
Old 02-03-2004, 11:16 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The upcoming version of Vizard will allow you to create callbacks for joystick buttons, but for now you'll have to manually check when a button is first pressed. Here's a simple example:
Code:
import viz
import sid

viz.go()

laststate = sid.buttons()

def mytimer(num):
	global laststate
	state = sid.buttons()
	if state & 1 and not laststate & 1:
		print 'button pressed down'
	laststate = state

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.001,viz.FOREVER)
Reply With Quote