Hi All!
I’m a newbie on SDL and reading the tutorials I found that the joystick hat function should be called with
if( event.jhat.hat | SDL_HAT_UP )
but it didn’t work, and fooling around I came up with
if( event.jhat.value == SDL_HAT_UP )
and it worked. Is my way the correct one? Are there any other joystick corrections in the tutorial? A list of them somewhere?
Thanks,
Barry
If .hat returns values that are a power of 2, then you’ll need to AND
it with the corresponding constant, otherwise anything ORed with a
constant will always return values not equal to zero (that is, if the
constant is non-zero).
try:
if( event.jhat.hat & SDL_HAT_UP )–
Olivier A. Dagenais - Software Architect and Developer
“Barry Sperling” wrote in message
news:000e01c100a0$ee0d7030$2b0d0180 at foley…
Hi All!
I’m a newbie on SDL and reading the tutorials I found that the
joystick hat function should be called with
if( event.jhat.hat | SDL_HAT_UP )
but it didn’t work, and fooling around I came up with
if( event.jhat.value == SDL_HAT_UP )
and it worked. Is my way the correct one? Are there any other
joystick corrections in the tutorial? A list of them somewhere?
Thanks,
Barry