-
CODE
if( myGamePad.wButtons & XINPUT_GAMEPAD_DPAD_UP )
This code works to check if up and back was pressed:CODE
if(( myGamePad.wButtons & XINPUT_GAMEPAD_DPAD_UP )&& (myGamePad.wButtons & XINPUT_GAMEPAD_BACK ))
So in theory if I change it to check just for the back button being pressed, it should work. Wrong, it automatically executes like the button is being pressed. Here is the code for that:CODE
if( myGamePad.wButtons & XINPUT_GAMEPAD_BACK )
How would I get it to wait until the back button was pressed?
-
I tried that but it still automatically executes the code.
-
Are you sure you update the XINPUT_STATE struct correct?
-
CODE
#include
void ReBoot()
{
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
}
bool GamePad()
{
XINPUT_GAMEPAD myGamePad;
DWORD dwInsertions, dwRemovals;
XGetDeviceChanges( XDEVICE_TYPE_GAMEPAD, &dwInsertions, &dwRemovals );
static HANDLE pGamePd;
if( dwInsertions & 1 )
{
pGamePd = XInputOpen( XDEVICE_TYPE_GAMEPAD, 0,
XDEVICE_NO_SLOT, NULL );
}
if( pGamePd )
{
XINPUT_STATE myInputStates;
XInputGetState( pGamePd, &myInputStates );
memcpy( &myGamePad, &myInputStates.Gamepad, sizeof(XINPUT_GAMEPAD) );
}
// if(( myGamePad.wButtons & XINPUT_GAMEPAD_DPAD_UP )&& (myGamePad.wButtons & XINPUT_GAMEPAD_BACK ))
//if( myGamePad.wButtons & XINPUT_GAMEPAD_BACK )
while( !(myGamePad.wButtons & XINPUT_GAMEPAD_BACK ) )
{
return true;
}
return false;
}
void __cdecl main()
{
XInitDevices(0, 0);
while( true )
{
bool bb = GamePad();
if( bb )
{
break;
}
}
ReBoot();
}
-
-
CODE
if( myGamePad.wButtons == XINPUT_GAMEPAD_BACK )
-
CODE
while( !( myGamePad.wButtons & XINPUT_GAMEPAD_BACK ) )
{
return false;
}
return true;
It that correct cause if so, I can't get that to work either.
-
CODE
// While BACK is not pressed don't go any further
while( !( myGamePad.wButtons & XINPUT_GAMEPAD_BACK ) )
{
// Reget button state here
XInputGetState( blah blah again! to reget what buttons are down & up! )
// Now the code goes back to the "while()" to see if its down this time
// if BACK is pressed it will continue!
}
// BACK FINALLY PRESSED!
Thats as simple as i can put it.
If you can't understand that then im sorry but i give up!