Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Joystic Lag - false reading

This thread is locked; no one can reply to it. rss feed Print
Joystic Lag - false reading
devo_au
Member #15,282
August 2013

Hey there,

Sometimes al_get_joystick_state gives me
false axis readings. Eg sometimes when I release the analog
the player will continue to travel in the last direction it was heading.
I checked the rest of the loop,

#SelectExpand
1 al_get_joystick_state(joy, &joyState); 2 axvalX = joyState.stick[0].axis[0]; 3 axvalY = joyState.stick[0].axis[1]; 4 5 //TEST X AXIS 6 if(axvalX < 0)//left 7 { 8 keys[LEFT] = true; 9 keys[RIGHT] = false; 10 } 11 else if(axvalX > 0)//right 12 { 13 keys[LEFT] = false; 14 keys[RIGHT] = true; 15 } 16 else //center 17 { 18 keys[LEFT] = false; 19 keys[RIGHT] = false; 20 }

the issue seems to be coming straight
after al_get_joystick_state.

I'm running v5.0.7 mono
VC 2010 express on win7 32
& Logitech F310 switched to directinput
Cheers

it wasn't me, it was other kids

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

devo_au
Member #15,282
August 2013

Thanks for reply. Normally the stick is 0.00000 center. When bugging the stick is reading 0.435652 when it has physically returned to the center. It works ok most the time, so I haven't worked out what is triggering it, only that I can debug the false read back to al_get_joystick_state(joy, &joyState).

it wasn't me, it was other kids

l j
Member #10,584
January 2009
avatar

No joystick is perfect and the issue is likely hardware related but 0.435652 seems a tad high though.

devo_au
Member #15,282
August 2013

Could be right about hardware, it might be a dodgy controller. Can't find another explanation. It works well 99.9% of the time.

it wasn't me, it was other kids

Go to: