Re: Opening Devices & Joystick Input

new topic     » goto parent     » topic index » view thread      » older message » newer message
DanM said...

Turns out the aforementioned lib (or earlier version?) IS what I used, you can get buttons off the joystick too. May have to play with values and methods, tho. One thing I did mention in my app is that the query for available joysticks on system didn't work right on XP system, as follows (with fix):

-- JOYSTICK INPUT STUFF: 
 
include joy.ew 
 
  object void 
 
if joy_init()=0 then 
	puts(1,"No joystick(s) attached!") 
	abort(0) 
end if 
 
-- NOTE: BOTH ABOVE AND THIS DO *NOT* WORK ON XP, SHOWS 1 CONNECTED WHEN NONE IS! 
puts(1, "number of joysticks attached: " & sprint(joy_init()) & "\n") 
 
-- these DO work: 
sequence joy_info,s 
integer button_mask 
 
joy_info = {} 
 
	s = joy_get_state(1) 
 
--DM  THIS MAKES QUIT IF NO JOYSTICK FOUND ON XP SYSTEM. 
      if equal(s, {}) then 
         puts(1, "no joystick connected.\n") 
         puts(1, "press any key to exit; then attach a joystick to a USB port") 
         void= wait_key() 
         abort(0) 
      end if 

I'm pretty sure that the demo with the lib does show more about how to use it.

Dan

Well the joystick library helps. But I was wondering how I'd go about getting input and info from an Xbox360 controller.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu