Quote:
|
Originally Posted by deltacoder1020
example:
Code:
if( (p1_wheel & 0xC0) == 0xC0 )
{
//hat control is pushed right
}
else if( (p1_wheel & 0xA4) == 0xA4 )
{
//hat control is pushed down-left
}
...
et cetera
...
just use the bitwise AND function (&) to determine if the correct bits are set.
|
Haven't been on for a while, but here goes (Sorry delta!)
If you push the hat up by your code then it will default to the first conditional statement you put in.
A more correct way might be to do it this way (using constants provided courtesy of Astronouth7303)
Code:
switch (px_wheel & 0xFC) {
case Hat_Up_Left: {
// ... Code here
break;
}
case Hat_Up_Right: {
// ... Code here
break;
}
// etc...
default: {
break;
}
}