void ribi::bnkn::QtControlsDialog::onAccelerate2() noexcept { QtPressKeyDialog d; this->ShowChild(&d); const int key = d.GetKey(); m_keys_accel[1] = key; showKeys(); }
void ribi::bnkn::QtControlsDialog::onTurn1() noexcept { QtPressKeyDialog d; this->ShowChild(&d); const int key = d.GetKey(); m_keys_turn[0] = key; showKeys(); }
ribi::bnkn::QtControlsDialog::QtControlsDialog(QWidget *parent) : QtHideAndShowDialog(parent), ui(new Ui::QtBoenkenControlsDialog), m_keys_accel{}, m_keys_turn{} { ui->setupUi(this); QObject::connect(ui->button_done,SIGNAL(clicked(bool)),this,SLOT(close())); m_keys_accel.push_back(Qt::Key_W); m_keys_accel.push_back(Qt::Key_Up); m_keys_turn.push_back(Qt::Key_D); m_keys_turn.push_back(Qt::Key_Right); QObject::connect( ui->button_accelerate_1, SIGNAL(clicked(bool)), this, SLOT(onAccelerate1()) ); QObject::connect( ui->button_accelerate_2, SIGNAL(clicked(bool)), this, SLOT(onAccelerate2()) ); QObject::connect( ui->button_turn_1, SIGNAL(clicked(bool)), this, SLOT(onTurn1()) ); QObject::connect(ui->button_turn_2, SIGNAL(clicked(bool)), this, SLOT(onTurn2()) ); showKeys(); }
void Gdc2005Demo::handleTweakingInput() { const bool usingGamepad = m_env->m_window->hasGamePads() && !m_env->m_options->m_forceKeyboardGamepad; const hkgKeyboard& keys = m_env->m_window->getKeyboard(); if ( m_env->m_gamePad->wasButtonPressed(HKG_PAD_SELECT) || keys.wasKeyPressed('T') ) { m_tweaking = !m_tweaking; } if (m_tweaking) { // Show help on the keys showKeys(); if (m_selected[0]!='/') m_selected = "/"; extern const hkClass Gdc2005DemoOptionsClass; const hkClass& klass = Gdc2005DemoOptionsClass; hkgPad* pad = m_env->m_gamePad; if (pad->wasButtonPressed(HKG_PAD_DPAD_DOWN)) { m_selected = TweakerUtils::getNextSiblingPath(m_selected, &m_options, klass); } if (pad->wasButtonPressed(HKG_PAD_DPAD_UP)) { m_selected = TweakerUtils::getPrevSiblingPath(m_selected, &m_options, klass); } if (pad->wasButtonPressed(HKG_PAD_DPAD_LEFT)) { m_selected = TweakerUtils::getParentPath(m_selected, &m_options, klass); } if (pad->wasButtonPressed(HKG_PAD_DPAD_RIGHT)) { m_selected = TweakerUtils::getChildPath(m_selected, &m_options, klass); } if (usingGamepad) { if (pad->wasButtonPressed(HKG_PAD_BUTTON_0 )) { TweakerUtils::tweakData(m_selected, &m_options, klass, -0.1f); } if (pad->wasButtonPressed(HKG_PAD_BUTTON_3)) { TweakerUtils::tweakData(m_selected, &m_options, klass, 0.1f); } if (pad->wasButtonPressed(HKG_PAD_BUTTON_2)) { TweakerUtils::clearData(m_selected, &m_options, klass); } } else { if ( keys.wasKeyPressed(HKG_VKEY_SUBTRACT) || keys.wasKeyPressed(HKG_VKEY_SPACE) || keys.wasKeyPressed(HKG_VKEY_OEM_MINUS) || keys.wasKeyPressed(HKG_VKEY_OEM_COMMA) ) { TweakerUtils::tweakData(m_selected, &m_options, klass, -0.1f); } if ( keys.wasKeyPressed(HKG_VKEY_ADD) || keys.wasKeyPressed(HKG_VKEY_OEM_PLUS) || keys.wasKeyPressed(HKG_VKEY_OEM_PERIOD) ) { TweakerUtils::tweakData(m_selected, &m_options, klass, 0.1f); } if ( keys.wasKeyPressed('0') || keys.wasKeyPressed(HKG_VKEY_DELETE) || keys.wasKeyPressed(HKG_VKEY_NUMPAD0) ) { TweakerUtils::clearData(m_selected, &m_options, klass); } } TweakerUtils::displayData(m_selected, &m_options, klass, *m_env->m_textDisplay, 40, 40); m_env->m_textDisplay->outputText( hkString("Tweaking: ") + m_selected, 40, 15, 0xffffffff); // Clean out the pad so the keypresses don't propagate below. hkString::memSet( pad, 0, sizeof(hkgPad)); } }
void Gdc2005Demo::handleUserInput(struct GdcStateInput& stateInput) { const hkgKeyboard& keys = m_env->m_window->getKeyboard(); // Show help on the keys if the user asks for it if ( keys.getKeyState('H') || keys.getKeyState(HKG_VKEY_F1) || ( m_env->m_gamePad->isButtonPressed(HKG_PAD_BUTTON_L1) && m_env->m_gamePad->isButtonPressed(HKG_PAD_BUTTON_R1) && m_env->m_gamePad->isButtonPressed(HKG_PAD_BUTTON_0) ) ) { showKeys(); } // For reference, on PC keyboard: // HKG_VKEY_DELETE == HKG_PAD_BUTTON_L1 // HKG_VKEY_END == HKG_PAD_BUTTON_R1 // HKG_VKEY_INSERT == HKG_PAD_BUTTON_L2 // HKG_VKEY_HOME == HKG_PAD_BUTTON_R2 // See if we want to chuck anything into the scene if ( m_env->m_gamePad->wasButtonPressed(HKG_PAD_BUTTON_2) ) { hkVector4 startPos; m_env->m_window->getCurrentViewport()->getCamera()->getFrom( (float*)&startPos ); hkVector4 velocity; m_env->m_window->getCurrentViewport()->getCamera()->getDir( (float*)&velocity ); velocity.mul4( m_options.m_Physics.m_launchVelocity ); chuckSomething( startPos, velocity ); } // See if we want to shot the guy (right click or L2) if ( m_env->m_gamePad->isButtonPressed(HKG_PAD_BUTTON_L2) || (m_env->m_window->getMouse().getButtonState() & HKG_MOUSE_RIGHT_BUTTON) ) { hkVector4 rayStart; hkVector4 rayEnd; // unproject current 'mouse' pos. hkgCamera* cam = m_env->m_window->getViewport(0)->getCamera(); int xPos = m_env->m_window->getMouse().getPosX(); int yPos = m_env->m_window->getMouse().getPosY(); cam->unProject( xPos, yPos, 0, m_env->m_window->getWidth(), m_env->m_window->getHeight(), (float*)&rayStart); cam->unProject( xPos, yPos, 1, m_env->m_window->getWidth(), m_env->m_window->getHeight(), (float*)&rayEnd); fireShot( rayStart, rayEnd, m_options.m_Physics.m_shotStrength ); // num == strength } // See if we want to drag objects around if( !m_mouseActive && ( m_env->m_gamePad->wasButtonPressed(HKG_PAD_BUTTON_R1) || keys.getKeyState(HKG_VKEY_SPACE)) ) // Space == Button0 on PC == jump { mouseDown(); // pick object under cursor } else if ( m_mouseActive ) { if( !m_env->m_gamePad->isButtonPressed(HKG_PAD_BUTTON_R1) && !m_env->m_window->getKeyboard().getKeyState(HKG_VKEY_SPACE) ) { mouseUp(); // default physics game impl : delete mouse spring } else { mouseDrag(); // default physics game impl : unproject mouse and move spring. } } // Desired direction // If we are on a console we are using a stick and want that to dictate // the desired direction. Otherwise we will use the dpad ( keyboard dir keys ) updateUserControl(); // Die ? Get up? Jump? { const hkUint32 currentAnimationState = m_animationStateMachine->getCurrentState(); const bool usingGamepad = m_env->m_window->hasGamePads() && !m_env->m_options->m_forceKeyboardGamepad; // DIE? if (m_env->m_gamePad->wasButtonPressed(HKG_PAD_BUTTON_1) && currentAnimationState != GDC_DYING_STATE && currentAnimationState != GDC_DEAD_STATE && currentAnimationState != GDC_GETTING_UP_STATE) { stateInput.m_shouldDie = true; } else { stateInput.m_shouldDie = false; } // DIVE? if (m_env->m_gamePad->wasButtonPressed(HKG_PAD_BUTTON_3) && currentAnimationState != GDC_DYING_STATE && currentAnimationState != GDC_DEAD_STATE && currentAnimationState != GDC_GETTING_UP_STATE) { stateInput.m_shouldDive = true; } else { stateInput.m_shouldDive = false; } // GET UP? if (m_env->m_gamePad->wasButtonPressed(HKG_PAD_BUTTON_1) && currentAnimationState == GDC_DEAD_STATE) { stateInput.m_shouldGetUp = true; } else { stateInput.m_shouldGetUp = false; } // JUMP? bool jumpPressed; if (usingGamepad) { jumpPressed = m_env->m_gamePad->wasButtonPressed(HKG_PAD_BUTTON_0); } else { jumpPressed = keys.wasKeyPressed('4'); } if (jumpPressed && currentAnimationState!=GDC_DYING_STATE && currentAnimationState!=GDC_IN_AIR_STATE && currentAnimationState!=GDC_DEAD_STATE && currentAnimationState!=GDC_JUMP_STATE) { stateInput.m_shouldJump = true; } else { stateInput.m_shouldJump = false; } } }
int GnuPGConnector::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDeclarativeItem::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: ready(); break; case 1: errorOccured(); break; case 2: gpgFinished((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: gpgError((*reinterpret_cast< QProcess::ProcessError(*)>(_a[1]))); break; case 4: { QString _r = encrypt((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 5: { QString _r = decrypt((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 6: { QString _r = showKeys(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 7: { QString _r = showSecretKeys(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 8: { QString _r = getData((*reinterpret_cast< bool(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 9: { QString _r = getFromClipboard(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 10: setToClipboard((*reinterpret_cast< QString(*)>(_a[1]))); break; case 11: { QString _r = getKey((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 12: { QString _r = getKey((*reinterpret_cast< int(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 13: { QString _r = getKeyByID((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 14: { QString _r = getPrivateKeyIDs((*reinterpret_cast< bool(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 15: { QString _r = getPrivateKeyIDs(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 16: { int _r = getNumOfPubKeys((*reinterpret_cast< int(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 17: { int _r = getNumOfPubKeys(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 18: { bool _r = generateKeyPair((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 19: { bool _r = setOwnerTrust((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 20: { bool _r = checkGPGVersion((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 21: { QString _r = getGPGVersionString(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 22: { bool _r = importKeysFromFile((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 23: { bool _r = importKeysFromClipboard(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 24: { bool _r = searchKeysOnKeyserver((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 25: { bool _r = importKeysFromKeyserver((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 26: { bool _r = deleteKey((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 27: { bool _r = signKey((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 28: { bool _r = exportKeys((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 29: { QString _r = getHistory(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 30: { bool _r = saveHistory((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 31: settingsSetValue((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 32: { QString _r = settingsGetValue((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 33: settingsReset(); break; default: ; } _id -= 34; } return _id; }