本文整理汇总了C++中PAD_ButtonsHeld函数的典型用法代码示例。如果您正苦于以下问题:C++ PAD_ButtonsHeld函数的具体用法?C++ PAD_ButtonsHeld怎么用?C++ PAD_ButtonsHeld使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PAD_ButtonsHeld函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FPAD_Update
void FPAD_Update( void )
{
if (WPAD_ScanPads() > WPAD_ERR_NONE) {
WPAD_Pressed = WPAD_ButtonsDown(0) | WPAD_ButtonsDown(1) | WPAD_ButtonsDown(2) | WPAD_ButtonsDown(3);
WPAD_Pressed |= WPAD_ButtonsHeld(0) | WPAD_ButtonsHeld(1) | WPAD_ButtonsHeld(2) | WPAD_ButtonsHeld(3);
} else {
// No Wii remotes are connected
WPAD_Pressed = 0;
}
if (PAD_ScanPads() > PAD_ERR_NONE) {
PAD_Pressed = PAD_ButtonsDown(0) | PAD_ButtonsDown(1) | PAD_ButtonsDown(2) | PAD_ButtonsDown(3);
PAD_Pressed |= PAD_ButtonsHeld(0) | PAD_ButtonsHeld(1) | PAD_ButtonsHeld(2) | PAD_ButtonsHeld(3);
PAD_Stick_Y = PAD_StickY(0) | PAD_StickY(1) | PAD_StickY(2) | PAD_StickY(3);
PAD_Stick_X = PAD_StickX(0) | PAD_StickX(1) | PAD_StickX(2) | PAD_StickX(3);
} else {
// No GC controllers are connected
PAD_Pressed = 0;
PAD_Stick_Y = 0;
PAD_Stick_X = 0;
}
if( WPAD_Pressed == 0 && PAD_Pressed == 0 && ( PAD_Stick_Y < 25 && PAD_Stick_Y > -25 ) && ( PAD_Stick_X < 25 && PAD_Stick_X > -25 ) )
{
SLock = false;
SpeedX= DELAY_START;
}
}
示例2: DrawArgsSelector
void DrawArgsSelector(char *fileName) {
Parameters* params = getParameters();
int param_selection = 0;
int params_per_page = 6;
while ((PAD_ButtonsHeld(0) & PAD_BUTTON_A)){ VIDEO_WaitVSync (); }
while(1) {
doBackdrop();
DrawEmptyBox(20,60, vmode->fbWidth-20, 460, COLOR_BLACK);
sprintf(txtbuffer, "%s Parameters:", fileName);
WriteFontStyled(25, 62, txtbuffer, GetTextScaleToFitInWidth(txtbuffer, vmode->fbWidth-50), false, defaultColor);
int j = 0;
int current_view_start = MIN(MAX(0,param_selection-params_per_page/2),MAX(0,params->num_params-params_per_page));
int current_view_end = MIN(params->num_params, MAX(param_selection+params_per_page/2,params_per_page));
int scrollBarHeight = 90+(params_per_page*20);
int scrollBarTabHeight = (int)((float)scrollBarHeight/(float)params->num_params);
DrawVertScrollBar(vmode->fbWidth-45, 120, 25, scrollBarHeight, (float)((float)param_selection/(float)(params->num_params-1)),scrollBarTabHeight);
for(j = 0; current_view_start<current_view_end; ++current_view_start,++j) {
drawParameterForArgsSelector(¶ms->parameters[current_view_start], 25, 120+j*35, current_view_start==param_selection);
}
// Write about the default if there is any
DrawTransparentBox( 35, 350, vmode->fbWidth-35, 400);
WriteFontStyled(33, 345, "Default values will be used by the DOL being loaded if a", 0.8f, false, defaultColor);
WriteFontStyled(33, 365, "parameter is not enabled. Please check the documentation", 0.8f, false, defaultColor);
WriteFontStyled(33, 385, "for this DOL if you are unsure of the default values.", 0.8f, false, defaultColor);
WriteFontStyled(640/2, 440, "(A) Toggle Param - (Start) Load the DOL", 1.0f, true, defaultColor);
DrawFrameFinish();
while (!(PAD_ButtonsHeld(0) & (PAD_BUTTON_RIGHT|PAD_BUTTON_LEFT|PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_START|PAD_BUTTON_A)))
{ VIDEO_WaitVSync (); }
u16 btns = PAD_ButtonsHeld(0);
if((btns & (PAD_BUTTON_RIGHT|PAD_BUTTON_LEFT)) && params->parameters[param_selection].enable) {
int curValIdx = params->parameters[param_selection].currentValueIdx;
int maxValIdx = params->parameters[param_selection].num_values;
curValIdx = btns & PAD_BUTTON_LEFT ?
((--curValIdx < 0) ? maxValIdx-1 : curValIdx):((curValIdx + 1) % maxValIdx);
params->parameters[param_selection].currentValueIdx = curValIdx;
}
if(btns & (PAD_BUTTON_UP|PAD_BUTTON_DOWN)) {
param_selection = btns & PAD_BUTTON_UP ?
((--param_selection < 0) ? params->num_params-1 : param_selection)
:((param_selection + 1) % params->num_params);
}
if(btns & PAD_BUTTON_A) {
params->parameters[param_selection].enable ^= 1;
}
if(btns & PAD_BUTTON_START) {
break;
}
while (PAD_ButtonsHeld(0) & (PAD_BUTTON_RIGHT|PAD_BUTTON_LEFT|PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_START|PAD_BUTTON_A))
{ VIDEO_WaitVSync (); }
}
}
示例3: UpdatePads
void
UpdatePads()
{
#ifdef HW_RVL
WiiDRC_ScanPads();
WPAD_ScanPads();
#endif
PAD_ScanPads();
for(int i=3; i >= 0; i--)
{
userInput[i].pad.btns_d = PAD_ButtonsDown(i);
userInput[i].pad.btns_u = PAD_ButtonsUp(i);
userInput[i].pad.btns_h = PAD_ButtonsHeld(i);
userInput[i].pad.stickX = PAD_StickX(i);
userInput[i].pad.stickY = PAD_StickY(i);
userInput[i].pad.substickX = PAD_SubStickX(i);
userInput[i].pad.substickY = PAD_SubStickY(i);
userInput[i].pad.triggerL = PAD_TriggerL(i);
userInput[i].pad.triggerR = PAD_TriggerR(i);
}
#ifdef HW_RVL
if(WiiDRC_Inited() && WiiDRC_Connected())
{
userInput[0].wiidrcdata.btns_d = WiiDRC_ButtonsDown();
userInput[0].wiidrcdata.btns_u = WiiDRC_ButtonsUp();
userInput[0].wiidrcdata.btns_h = WiiDRC_ButtonsHeld();
userInput[0].wiidrcdata.stickX = WiiDRC_lStickX();
userInput[0].wiidrcdata.stickY = WiiDRC_lStickY();
userInput[0].wiidrcdata.substickX = WiiDRC_rStickX();
userInput[0].wiidrcdata.substickY = WiiDRC_rStickY();
}
#endif
}
示例4: UpdatePadsCB
/****************************************************************************
* UpdatePadsCB
*
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
***************************************************************************/
static void
UpdatePadsCB ()
{
#ifdef HW_RVL
WPAD_ScanPads();
#endif
PAD_ScanPads();
for(int i=3; i >= 0; i--)
{
#ifdef HW_RVL
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
#endif
userInput[i].chan = i;
userInput[i].pad.btns_d = PAD_ButtonsDown(i);
userInput[i].pad.btns_u = PAD_ButtonsUp(i);
userInput[i].pad.btns_h = PAD_ButtonsHeld(i);
userInput[i].pad.stickX = PAD_StickX(i);
userInput[i].pad.stickY = PAD_StickY(i);
userInput[i].pad.substickX = PAD_SubStickX(i);
userInput[i].pad.substickY = PAD_SubStickY(i);
userInput[i].pad.triggerL = PAD_TriggerL(i);
userInput[i].pad.triggerR = PAD_TriggerR(i);
}
}
示例5: StandardGamecube
u32 StandardGamecube(unsigned short pad)
{
u32 J = 0;
u32 jp = PAD_ButtonsHeld(pad);
if (jp & PAD_BUTTON_UP)
J |= VBA_UP;
if (jp & PAD_BUTTON_DOWN)
J |= VBA_DOWN;
if (jp & PAD_BUTTON_LEFT)
J |= VBA_LEFT;
if (jp & PAD_BUTTON_RIGHT)
J |= VBA_RIGHT;
if (jp & PAD_BUTTON_A)
J |= VBA_BUTTON_A;
if (jp & PAD_BUTTON_B)
J |= VBA_BUTTON_B;
if (jp & PAD_BUTTON_START)
J |= VBA_BUTTON_START;
if (jp & PAD_BUTTON_X)
J |= VBA_BUTTON_SELECT;
if (jp & PAD_TRIGGER_L)
J |= VBA_BUTTON_L;
if (jp & PAD_TRIGGER_R)
J |= VBA_BUTTON_R;
if (jp & PAD_TRIGGER_Z || jp & PAD_BUTTON_Y)
J |= VBA_SPEED;
return J;
}
示例6: GetInput
/****************************************************************************
* Controller Configuration
*
* Snes9x 1.51 uses a cmd system to work out which button has been pressed.
* Here, I simply move the designated value to the gcpadmaps array, which
* saves on updating the cmd sequences.
***************************************************************************/
u32
GetInput (u16 ctrlr_type)
{
//u32 exp_type;
u32 pressed;
pressed=0;
s8 gc_px = 0;
while( PAD_ButtonsHeld(0)
#ifdef HW_RVL
| WPAD_ButtonsHeld(0)
#endif
) VIDEO_WaitVSync(); // button 'debounce'
while (pressed == 0)
{
VIDEO_WaitVSync();
// get input based on controller type
if (ctrlr_type == CTRLR_GCPAD)
{
pressed = PAD_ButtonsHeld (0);
gc_px = PAD_SubStickX (0);
}
#ifdef HW_RVL
else
{
// if ( WPAD_Probe( 0, &exp_type) == 0) // check wiimote and expansion status (first if wiimote is connected & no errors)
// {
pressed = WPAD_ButtonsHeld (0);
// if (ctrlr_type != CTRLR_WIIMOTE && exp_type != ctrlr_type+1) // if we need input from an expansion, and its not connected...
// pressed = 0;
// }
}
#endif
/*** check for exit sequence (c-stick left OR home button) ***/
if ( (gc_px < -70) || (pressed & WPAD_BUTTON_HOME) || (pressed & WPAD_CLASSIC_BUTTON_HOME) )
return 0;
} // end while
while( pressed == (PAD_ButtonsHeld(0)
#ifdef HW_RVL
| WPAD_ButtonsHeld(0)
#endif
) ) VIDEO_WaitVSync();
return pressed;
} // end GetInput()
示例7: WPAD_ButtonsHeld
u32 InputDevices::GetPadButtonStatus(int channel)
{
u32 extensions;
WPADData data;
u32 buttons, gcbuttons;
PAD2WPAD *p2w;
joystick_t padjoy;
// Check standard buttons
buttons = WPAD_ButtonsHeld(channel);
// Add GameCube buttons
gcbuttons = PAD_ButtonsHeld(channel);
p2w = pad2wpad;
while( p2w->pad ) {
if( gcbuttons & p2w->pad ) {
buttons |= p2w->wpad;
}
p2w++;
}
// Key translations for default WiiMote buttons
ProcessWPadButtons(channel, wpad_default);
// Check extensions
WPAD_Probe(channel, &extensions);
if( extensions == WPAD_EXP_NUNCHUK ) {
// Nunchuk stick
WPAD_Expansion(channel, &data.exp);
buttons |= GetJoystickDirection(&data.exp.nunchuk.js);
// Nunchuck key translations
ProcessWPadButtons(channel, wpad_nunchuk);
} else if( extensions == WPAD_EXP_CLASSIC ) {
// Both classic controller sticks
WPAD_Expansion(channel, &data.exp);
buttons |= GetJoystickDirection(&data.exp.classic.ljs);
buttons |= GetJoystickDirection(&data.exp.classic.rjs);
// Classic controller key translations
ProcessWPadButtons(channel, wpad_classic);
}
// Scan GameCube sticks
padjoy.min.x = 0;
padjoy.min.y = 0;
padjoy.max.x = 255;
padjoy.max.y = 255;
padjoy.center.x = 128;
padjoy.center.y = 128;
padjoy.pos.x = (int)PAD_StickX(channel) + 128;
padjoy.pos.y = (int)PAD_StickY(channel) + 128;
buttons |= GetJoystickDirection(&padjoy);
padjoy.pos.x = (int)PAD_SubStickX(channel) + 128;
padjoy.pos.y = (int)PAD_SubStickY(channel) + 128;
buttons |= GetJoystickDirection(&padjoy);
return buttons;
}
示例8: NGCReportButtons
/****************************************************************************
* NGCReportButtons
*
* Called on each rendered frame
* Our way of putting controller input into Snes9x
***************************************************************************/
void NGCReportButtons ()
{
s8 gc_px = PAD_SubStickX (0);
s8 gc_py = PAD_SubStickY (0);
u16 gc_pb = PAD_ButtonsHeld (0);
#ifdef HW_RVL
s8 wm_sx = WPAD_StickX (0,1);
s8 wm_sy = WPAD_StickY (0,1);
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
#endif
/*** Check for video zoom ***/
if (GCSettings.NGCZoom)
{
if (gc_py < -36 || gc_py > 36)
zoom ((float) gc_py / -36);
#ifdef HW_RVL
if (wm_sy < -36 || wm_sy > 36)
zoom ((float) wm_sy / -36);
#endif
}
Settings.TurboMode = ( (gc_px > 70)
#ifdef HW_RVL
|| (wm_sx > 70)
#endif
); // RIGHT on c-stick and on classic ctrlr right joystick
/*** Check for menu:
CStick left
OR "L+R+X+Y" (eg. Hombrew/Adapted SNES controllers)
OR "Home" on the wiimote or classic controller
OR LEFT on classic right analog stick***/
if ((gc_px < -70) ||
((gc_pb & PAD_TRIGGER_L) &&
(gc_pb & PAD_TRIGGER_R ) &&
(gc_pb & PAD_BUTTON_X) &&
(gc_pb & PAD_BUTTON_Y ))
#ifdef HW_RVL
|| (wm_pb & WPAD_BUTTON_HOME)
|| (wm_pb & WPAD_CLASSIC_BUTTON_HOME)
|| (wm_sx < -70)
#endif
)
{
ConfigRequested = 1; // go to the menu
}
else
{
int j = (Settings.MultiPlayer5Master == true ? 4 : 2);
for (int i = 0; i < j; i++)
decodepad (i);
}
}
示例9: WPAD_ButtonsHeld
void CMenu::ButtonsHeld()
{
gc_btnsHeld = 0;
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
wii_btnsHeld[chan] = WPAD_ButtonsHeld(chan);
gc_btnsHeld |= PAD_ButtonsHeld(chan);
wupc_btnsHeld[chan] = WUPC_ButtonsHeld(chan);
}
}
示例10: populateDeviceAvailability
// Checks if devices are available, prints name of device being detected for slow init devices
void populateDeviceAvailability() {
if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) {
deviceHandler_setAllDevicesAvailable();
return;
}
uiDrawObj_t *msgBox = DrawPublish(DrawProgressBar(true, 0, "Detecting devices ...\nThis can be skipped by holding B next time"));
int i;
for(i = 0; i < MAX_DEVICES; i++) {
if(allDevices[i] != NULL && !deviceHandler_getDeviceAvailable(allDevices[i])) {
print_gecko("Checking device availability for device %s\r\n", allDevices[i]->deviceName);
deviceHandler_setDeviceAvailable(allDevices[i], allDevices[i]->test());
}
if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) {
deviceHandler_setAllDevicesAvailable();
break;
}
}
DrawDispose(msgBox);
}
示例11: DecodeGamecube
u32 DecodeGamecube(unsigned short pad)
{
u32 J = 0;
u32 jp = PAD_ButtonsHeld(pad);
for (int i = 0; i < MAXJP; i++)
{
if (jp & btnmap[CTRLR_GCPAD][i])
J |= vbapadmap[i];
}
return J;
}
示例12: GetInput
/****************************************************************************
* Controller Configuration
*
* Snes9x 1.50 uses a cmd system to work out which button has been pressed.
* Here, I simply move the designated value to the gcpadmaps array, which saves
* on updating the cmd sequences.
****************************************************************************/
u32
GetInput (u16 ctrlr_type)
{
u32 exp_type, pressed;
pressed=0;
while( PAD_ButtonsHeld(0)
#ifdef HW_RVL
| WPAD_ButtonsHeld(0)
#endif
) VIDEO_WaitVSync(); // button 'debounce'
while (pressed == 0)
{
VIDEO_WaitVSync();
// get input based on controller type
//if (ctrlr_type == CTRLR_GCPAD)
//{
pressed = PAD_ButtonsHeld (0);
//}
#ifdef HW_RVL
//else
//{
// if ( WPAD_Probe( 0, &exp_type) == 0) // check wiimote and expansion status (first if wiimote is connected & no errors)
// {
pressed = WPAD_ButtonsHeld (0);
// if (ctrlr_type != CTRLR_WIIMOTE && exp_type != ctrlr_type+1) // if we need input from an expansion, and its not connected...
// pressed = 0;
// }
//}
#endif
} // end while
while( pressed == (PAD_ButtonsHeld(0)
#ifdef HW_RVL
| WPAD_ButtonsHeld(0)
#endif
) ) VIDEO_WaitVSync();
return pressed;
} // end GetInput()
示例13: GetInput
/****************************************************************************
* Controller Configuration
***************************************************************************/
u32
GetInput (u16 ctrlr_type)
{
//u32 exp_type;
u32 pressed;
pressed=0;
s8 gc_px = 0;
while( PAD_ButtonsHeld(0)
#ifdef HW_RVL
| WPAD_ButtonsHeld(0)
#endif
) VIDEO_WaitVSync(); // button 'debounce'
while (pressed == 0)
{
VIDEO_WaitVSync();
// get input based on controller type
if (ctrlr_type == CTRLR_GCPAD)
{
pressed = PAD_ButtonsHeld (0);
gc_px = PAD_SubStickX (0);
}
#ifdef HW_RVL
else
{
pressed = WPAD_ButtonsHeld (0);
}
#endif
/*** check for exit sequence (c-stick left OR home button) ***/
if ( (gc_px < -70) || (pressed & WPAD_BUTTON_HOME) || (pressed & WPAD_CLASSIC_BUTTON_HOME) )
return 0;
} // end while
while( pressed == (PAD_ButtonsHeld(0)
#ifdef HW_RVL
| WPAD_ButtonsHeld(0)
#endif
) ) VIDEO_WaitVSync();
return pressed;
} // end GetInput()
示例14: OnePieceInput
u32 OnePieceInput(unsigned short pad) {
// Only Nunchuk and Gamecube controls available
// Wiimote and Classic controls depend on user configuration
u32 J = StandardMovement(pad)
| DecodeWiimote(pad) | DecodeClassic(pad);
static u32 LastDir = VBA_RIGHT;
bool JumpButton=0, AttackButton=0, ViewButton=0, CharacterButton=0, PauseButton=0,
DashButton=0, GrabButton=0, SpeedButton=0, AttackUpButton = 0;
#ifdef HW_RVL
WPADData * wp = WPAD_Data(pad);
// Nunchuk controls are based on One Piece: Unlimited Adventure for the Wii
if (wp->exp.type == WPAD_EXP_NUNCHUK) {
J |= StandardDPad(pad);
JumpButton = wp->btns_h & WPAD_BUTTON_B;
AttackButton = wp->btns_h & WPAD_BUTTON_A;
CharacterButton = wp->btns_h & WPAD_BUTTON_MINUS;
PauseButton = wp->btns_h & WPAD_BUTTON_PLUS;
DashButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_C;
GrabButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_Z;
ViewButton = wp->btns_h & WPAD_BUTTON_1; // doesn't do anything?
SpeedButton = wp->btns_h & WPAD_BUTTON_2;
}
#endif
// Gamecube controls are based on One Piece Grand Adventure
{
u32 gc = PAD_ButtonsHeld(pad);
signed char gc_px = PAD_SubStickX(pad);
if (gc_px > 70) J |= VBA_SPEED;
JumpButton = JumpButton || gc & PAD_BUTTON_Y;
AttackButton = AttackButton || gc & PAD_BUTTON_A;
GrabButton = GrabButton || gc & PAD_BUTTON_B;
AttackUpButton = AttackUpButton || gc & PAD_BUTTON_X;
DashButton = DashButton || gc & PAD_TRIGGER_L;
PauseButton = PauseButton || gc & PAD_BUTTON_START;
CharacterButton = CharacterButton || gc & PAD_TRIGGER_R; // supposed to be block
}
if (JumpButton) J |= VBA_BUTTON_A;
if (AttackButton) J |= VBA_BUTTON_B;
if (AttackUpButton) J |= VBA_UP | VBA_BUTTON_B;
if (CharacterButton) J |= VBA_BUTTON_L;
if (DashButton) J |= LastDir;
if (PauseButton) J |= VBA_BUTTON_START;
if (GrabButton) J |= VBA_BUTTON_R;
if (SpeedButton) J |= VBA_SPEED;
if (ViewButton) J |= VBA_BUTTON_SELECT; // doesn't do anything?
if (J & VBA_RIGHT) LastDir = VBA_RIGHT;
else if (J & VBA_LEFT) LastDir = VBA_LEFT;
return J;
}
示例15: wii_is_any_button_held
/*
* Checks to see if any buttons are held
*
* joys The number of joysticks to check
* return Whether any of the buttons are held
*/
BOOL wii_is_any_button_held( int joys )
{
int i;
for( i = 0; i < joys; i++ )
{
if( WPAD_ButtonsHeld( i ) || PAD_ButtonsHeld( i ) )
{
return TRUE;
}
}
return FALSE;
}