void InputController::update() { m_isWindowFocused = m_mainWindow->hasFocus(); m_isActionLocked = false; m_lastPressedKey = sf::Keyboard::Unknown; // update keys for (auto& it : m_keyActiveMap) { m_keyJustPressedMap[it.first] = !m_keyActiveMap[it.first] && (isKeyPressed(m_mainKeyMap->at(it.first)) || isKeyPressed(m_alternativeKeyMap->at(it.first))); m_keyActiveMap[it.first] = isKeyPressed(m_mainKeyMap->at(it.first)) || isKeyPressed(m_alternativeKeyMap->at(it.first)); } // update mouse clicks m_isMouseClickedLeft = (m_isMousePressedLeft && !sf::Mouse::isButtonPressed(sf::Mouse::Left)); m_isMouseClickedRight = (m_isMousePressedRight && !sf::Mouse::isButtonPressed(sf::Mouse::Right)); m_isMouseJustPressedLeft = (!m_isMousePressedLeft && sf::Mouse::isButtonPressed(sf::Mouse::Left)); m_isMouseJustPressedRight = (!m_isMousePressedRight && sf::Mouse::isButtonPressed(sf::Mouse::Right)); m_isMousePressedLeft = sf::Mouse::isButtonPressed(sf::Mouse::Left); m_isMousePressedRight = sf::Mouse::isButtonPressed(sf::Mouse::Right); // update mouse positions sf::Vector2f pos(sf::Mouse::getPosition((*m_mainWindow))); pos.x = pos.x * (static_cast<float>(WINDOW_WIDTH) / m_windowSize.x); pos.y = pos.y * (static_cast<float>(WINDOW_HEIGHT) / m_windowSize.y); sf::Vector2f view = sf::Vector2f( m_renderTexture->getView().getCenter().x - m_renderTexture->getView().getSize().x / 2, m_renderTexture->getView().getCenter().y - m_renderTexture->getView().getSize().y / 2); sf::Vector2f defaultview = sf::Vector2f( m_renderTexture->getDefaultView().getCenter().x - m_renderTexture->getView().getSize().x / 2, m_renderTexture->getDefaultView().getCenter().y - m_renderTexture->getView().getSize().y / 2); m_mousePosition = pos + view; m_defaultViewMousePosition = pos + defaultview; }
void processPlayer2Control()//Done by Sham,Set player 2 control scheme { if((isKeyPressed('1'))||(isKeyPressed(VK_NUMPAD1))){ keyStates[K_UP2].key = 'W'; keyStates[K_UPLEFT2].key = 'Q'; keyStates[K_UPRIGHT2].key = 'E'; keyStates[K_DOWN2].key = 'X'; keyStates[K_DOWNLEFT2].key = 'Z'; keyStates[K_DOWNRIGHT2].key = 'C'; keyStates[K_LEFT2].key = 'A'; keyStates[K_RIGHT2].key = 'D'; } else if((isKeyPressed('2'))||(isKeyPressed(VK_NUMPAD2))){ keyStates[K_UP2].key = VK_NUMPAD8; keyStates[K_UPLEFT2].key = VK_NUMPAD7; keyStates[K_UPRIGHT2].key = VK_NUMPAD9; keyStates[K_DOWN2].key = VK_NUMPAD2; keyStates[K_DOWNLEFT2].key = VK_NUMPAD1; keyStates[K_DOWNRIGHT2].key = VK_NUMPAD3; keyStates[K_LEFT2].key = VK_NUMPAD4; keyStates[K_RIGHT2].key = VK_NUMPAD6; } else if (isKeyPressed(VK_ESCAPE)) { g_eGameState=S_OPTION; } }
void processOptionsMenu()//Done by Sham, process options input { if ( (isKeyPressed('1')) || (isKeyPressed(VK_NUMPAD1)) ) { PlaySound(L"sound\\button.wav",NULL,SND_ASYNC); g_eGameState = S_P1CTRL; } if ( (isKeyPressed('2')) || (isKeyPressed(VK_NUMPAD2)) ) { PlaySound(L"sound\\button.wav",NULL,SND_ASYNC); g_eGameState = S_P2CTRL; } if (isKeyPressed(VK_ESCAPE)) { PlaySound(L"sound\\button.wav",NULL,SND_ASYNC); g_eGameState=S_MAINMENU; } }
void jfBoxesAndBallsEventHandler_cuda::handleKeyEvents() { jfKey keyNum = isKeyPressed(); while (keyNum != JFK_NULL) { switch (keyNum) { case JFK_w: cam->strafeForward(); break; case JFK_s: cam->strafeBackward(); break; case JFK_a: cam->strafeLeft(); break; case JFK_d: cam->strafeRight(); break; case JFK_NULL: break; default: break; } keyNum = isKeyPressed(keyNum + 1); } }
// Wait for a key to be pressed and return the hexadecimal key value as 4 bits int8_t Keypad4x4::readKeyHex() { // Key number int8_t key; // Wait for previous key to be released while (isKeyPressed()) {} // Wait for noise to disappear (noise period when key released is shorter than when pressed) delay (debounceDelay_ms / 2); // Wait indefinitely for a valid key while (true) { // Wait for new key to be pressed while (!isKeyPressed()) {} // Get key key = pollKeyHex(); // Return key number if valid if (key >= 0) return key; // This was only noise, keep waiting in loop } // We will never get here return 0; }
void ghosts::onKeyStateChange(int Key, key_action old_state, key_action new_state) { // debug CTRL+D if (isKeyPressed(GLFW_KEY_LEFT_CONTROL) && Key == GLFW_KEY_D && new_state == test::KEY_PRESS) { for (auto model : m_Models) { model->toggleRenderMode(framework::model::render_mode::DEBUG); } } // wireframe CTRL+W if (isKeyPressed(GLFW_KEY_LEFT_CONTROL) && Key == GLFW_KEY_W && new_state == test::KEY_PRESS) { for (auto model : m_Models) { model->toggleRenderMode(framework::model::render_mode::WIREFRAME); } } // shaded CTRL+S if (isKeyPressed(GLFW_KEY_LEFT_CONTROL) && Key == GLFW_KEY_S && new_state == test::KEY_PRESS) { for (auto model : m_Models) { model->toggleRenderMode(framework::model::render_mode::SHADED); } } }
bool OpenGLGame::update() { if ( !isActive() ) // 程序激活的么? { return true; } if ( isKeyPressed( VK_ESCAPE ) ) // ESC 按下了么? { return false; // ESC 发出退出信号 } // 不是退出的时候,刷新屏幕 drawGLScene(); // 绘制场景 ::SwapBuffers( m_hDC ); // 交换缓存 (双缓存) processKeyEvent(); if ( isKeyPressed( VK_F1 ) ) // F1键按下了么? { onKeyReleased( VK_F1 ); // 若是,使对应的Key数组中的值为 FALSE killGLWindow(); // 销毁当前的窗口 m_bFullScreen = !m_bFullScreen; // 切换 全屏 / 窗口 模式 // 重建 OpenGL 窗口 if ( !createGLWindow() ) { return false; // 如果窗口未能创建,程序退出 } } return true; }
void getInput() { keyPressed[K_UP] = isKeyPressed(VK_UP); keyPressed[K_DOWN] = isKeyPressed(VK_DOWN); keyPressed[K_LEFT] = isKeyPressed(VK_LEFT); keyPressed[K_RIGHT] = isKeyPressed(VK_RIGHT); keyPressed[K_ESCAPE] = isKeyPressed(VK_ESCAPE); }
//-------------------------------------------------------------- // Purpose : Getting all the key press states // Input : Void // Output : void //-------------------------------------------------------------- void getInput( void ) { g_abKeyPressed[K_UP] = isKeyPressed(VK_UP); g_abKeyPressed[K_DOWN] = isKeyPressed(VK_DOWN); g_abKeyPressed[K_LEFT] = isKeyPressed(VK_LEFT); g_abKeyPressed[K_RIGHT] = isKeyPressed(VK_RIGHT); g_abKeyPressed[K_ESCAPE] = isKeyPressed(VK_ESCAPE); }
void Drumrolls::playDRstate() { if(isKeyPressed(VK_LEFT)) { ++higherscore; } if(isKeyPressed(VK_RIGHT)) { ++higherscore; } }
uint8_t readarrow() { if (isKeyPressed(KEY_NSPIRE_UP)) return ARROW_UP_NUM; if (isKeyPressed(KEY_NSPIRE_RIGHT)) return ARROW_RIGHT_NUM; if (isKeyPressed(KEY_NSPIRE_DOWN)) return ARROW_DOWN_NUM; if (isKeyPressed(KEY_NSPIRE_LEFT)) return ARROW_LEFT_NUM; return 0; }
void Player::update(float delta) { CCLOG(to_string(this->getPosition().y).c_str()); distanceTravelled++; framePassed--; if (this->getPhysicsBody()->getVelocity().y > 1000) { this->getPhysicsBody()->setVelocity(Vec2(this->getPhysicsBody()->getVelocity().x, 0)); } if (this->getPosition().y < Director::getInstance()->getWinSize().height / GROUND_PERCENTAGE_FOR_BOX) { this->getPhysicsBody()->setVelocity(Vec2(this->getPhysicsBody()->getVelocity().x, 0)); this->setPosition(Vec2(this->getPosition().x, Director::getInstance()->getWinSize().height / GROUND_PERCENTAGE_FOR_BOX)); } if (this->currentAction != Action::RUNNING && this->getPhysicsBody()->getVelocity().y > -1.0f && this->getPhysicsBody()->getVelocity().y < 1.0f) { // Get resource loader instance ResourceLoader resLoader = ResourceLoader::getInstance(); // Get running animation Vector<SpriteFrame*> runningAnimation = resLoader.getAnimation(PLAYER_ANIMATION_RUNNING); auto animation = Animation::createWithSpriteFrames(runningAnimation); animation->setDelayPerUnit(PLAYER_SPRITE_DELAY_RUNNING); auto runningAction = RepeatForever::create(Animate::create(animation)); runningAction->setTag(PLAYER_ANIMATION_RUNNING); this->runAction(runningAction); this->currentAction = Action::RUNNING; } if ((isKeyPressed(EventKeyboard::KeyCode::KEY_LEFT_ARROW) || isKeyPressed(EventKeyboard::KeyCode::KEY_A)) &&(bossMode)) { this->getPhysicsBody()->applyImpulse(Vect(-((Director::getInstance()->getWinSize().height - 600)/32 + 25), 0)); } if ((isKeyPressed(EventKeyboard::KeyCode::KEY_RIGHT_ARROW) || isKeyPressed(EventKeyboard::KeyCode::KEY_D)) &&(bossMode)) { this->getPhysicsBody()->applyImpulse(Vect(((Director::getInstance()->getWinSize().height - 600) / 32 + 25), 0)); } if (invurnerableTime != 0) invurnerableTime--; if (invurnerable && invurnerableTime == 0) invurnerable = false; }
//------------------------------------------------------------------------------------------------------------------------------------ // called when we need to update the app. 'dt' is the time delta (the number of seconds since the last frame) //------------------------------------------------------------------------------------------------------------------------------------ void update(float dt) { g_timer += dt; if(g_timer > 0.5f && isKeyPressed('n')) { g_timer = 0; g_displayNormals = !g_displayNormals; } if(g_timer > 0.5f && isKeyPressed('l')) { g_timer = 0; g_manualLighting = !g_manualLighting; } }
// Called every frame to snatch the input buffer from the device thread void InputManager::capture() { flushBufferedEvents(); _mKeyboard->capture(); _mMouse->capture(); if (isKeyPressed(OIS::KC_ESCAPE)) { GraphicsManager::instance()->stopRendering(); } if (isKeyPressed(OIS::KC_GRAVE)) { // the tilde key GuiManager::instance()->ToggleConsole(); } }
/*This function checks if any key had been pressed since the last time we checked If a key is pressed, the value for that particular key will be true Add more keys to the enum in game.h if you need to detect more keys To get other VK key defines, right click on the VK define (e.g. VK_UP) and choose "Go To Definition" For Alphanumeric keys, the values are their ascii values (uppercase).*/ void getInput() { keyPressed[K_UP] = isKeyPressed(VK_UP); keyPressed[K_DOWN] = isKeyPressed(VK_DOWN); keyPressed[K_LEFT] = isKeyPressed(VK_LEFT); keyPressed[K_RIGHT] = isKeyPressed(VK_RIGHT); keyPressed[K_PAUSE] = isKeyPressed(0x50); keyPressed[K_ESCAPE] = isKeyPressed(VK_ESCAPE); keyPressed[K_ENTER] = isKeyPressed(VK_RETURN); keyPressed[K_GRAB] = isKeyPressed(0x43); keyPressed[K_RESTART] = isKeyPressed(0x52); }
// Check for key press and update attacks that are attacking bool Vampire::checkInputForAttack(AOEAttack& attack) { bool result = false; // Process input if (isKeyPressed(attack.getKey()) || joystick.isPressed(attack.getJoyButton())) { assert(!attack.isPlaying()); result = true; // Start attack playing attack.play(loc_); // Set cooldown timer on ourself cooldownTimer_ = attack.getCooldownTime(); // Reset animation state for small attack // because vampire animates whild doing the attack if (!attack.isBatAttack() && (state != ATTACKING)) { debug("resetting combat animation"); frame = 0; state = ATTACKING; frameTime = 42; } } return result; }
void PS2KeyboardManager::collectKeysDown(Report* report) { int pos = 0; for (PS2Keyboard::KeyCode kc = PS2Keyboard::KC_FIRST_NON_MODIFIER_KEYCODE; kc < PS2Keyboard::KC_COUNT_NON_MODIFIER_KEYCODE; kc = static_cast<PS2Keyboard::KeyCode>(kc + 1)) { if (isKeyPressed(kc)) { if (pos == numberof(report->keycodes)) break; report->keycodes[pos++] = kc; // Workaround for missing break code for the Pause key. if (kc == PS2Keyboard::KC_PAUSE) { int index = kc / 8; int bit = kc % 8; pressed_[index] &= ~(1 << bit); } } } // If more keys are pressed than can fit into the report, return a phantom // state by setting all keycoes to ERROR_ROLL_OVER. if (pos == numberof(report->keycodes)) { memset(report->keycodes, PS2Keyboard::KC_ERROR_ROLL_OVER, numberof(report->keycodes)); } }
void CPlay::eval () { game->draw (); if (game->isLevelComplete()) { doExitLevel(); return; } // // eval game when EVAL_INTERVAL has elapsed. // this ensures the game plays at the same speed // on all machines. // bool evaled = false; while (adjustedEvalTime >= CGame::EVAL_INTERVAL) { adjustedEvalTime -= CGame::EVAL_INTERVAL; evaled = true; game->eval (lmbExists); if (CGameDevice::MOUSE_RMB) rmbExists = true; else if (rmbExists) { doPause (); return; } if (isKeyPressed (CGameDevice::ESC, esc)) { doAbort (); return; } } if (evaled) adjustedEvalTime = 0; // discard remaining time for smooth motion }
void Control::mouseMoveEvent(int x, int y, int pointer) { if(!_multiPointer) pointer = MOUSE_LEFT; setMouseX(x, pointer); setMouseY(y, pointer); if(isKeyPressed(static_cast<Control::Keys>(pointer))) { for(std::vector<Hud*>::const_iterator it = _huds.begin(); it != _huds.end(); it++) reinterpret_cast<Hud*>(*it)->update(getMouseX(pointer), getMouseY(pointer), pointer); } for(std::vector<Event>::iterator it = _events.begin(); it != _events.end(); it++) { Event e = *it; if(e.state == STATE_MOUSE_MOVE && isKeyPressed(e.key)) callCallBack(e.instance, e.callback, STATE_MOUSE_MOVE, e.key, x, y); } }
void MCScreenDC::getkeysdown(MCExecPoint &ep) { char kstring[U4L]; char km[32]; ep.clear(); MCmodifierstate = querymods(); XQueryKeymap(dpy, km); bool first = true; uint2 i; KeySym ksym; for (i = 0; i < 256; i++) { if (isKeyPressed(km, i)) { ksym = i; if (MCmodifierstate & MS_SHIFT || MCmodifierstate & MS_CAPS_LOCK) ksym = XKeycodeToKeysym(dpy, i, 1); else ksym = XKeycodeToKeysym(dpy, i, 0); if (ksym > 0) { ep.concatuint(ksym, EC_COMMA, first); first = false; } } } }
gamestate Candy::update() { if(isKeyPressed(VK_ESCAPE)) { return MAIN_MENU; } draw(); play(); if(CurrentFrame > twosec && isKeyPressed(VK_RETURN)) { return MAIN_MENU; } else{ return CANDY; } }
int main(void) { entry* entries = main_create_entries(); list* menu = create_list(0,24,25,entries,MAINMENU_SIZE); nio_scrbuf_init(); do { int selection = update_list(menu); if(selection != -1) { wait_no_key_pressed(); switch(selection) { case 0: display_tasks_screen(); break; case 1: display_pools_screen(); break; case 2: display_events_screen(); break; case 3: display_queues_screen(); break; case 4: display_semaphores_screen(); break; case 5: display_mailboxes_screen(); break; default: display_settings_screen(); break; } } nio_scrbuf_clear(); nio_grid_printf(0,0,0,0,NIO_COLOR_WHITE,NIO_COLOR_BLACK,"TI-Nspire Task Manager (built %s %s)",__DATE__,__TIME__); int i; for(i = 0; i < 53; i++) { nio_grid_putc(0,0,i,2,'-',NIO_COLOR_WHITE,NIO_COLOR_BLACK); nio_grid_putc(0,0,i,28,'-',NIO_COLOR_WHITE,NIO_COLOR_BLACK); } draw_list(menu); nio_grid_puts(0,0,0,29,"Use UP/DOWN keys to navigate, ENTER to select",NIO_COLOR_WHITE,NIO_COLOR_BLACK); nio_scrbuf_flip(); wait_key_pressed(); } while(!isKeyPressed(KEY_NSPIRE_ESC)); nio_scrbuf_free(); free(entries); free(menu); return 0; }
TEST_F(COSXKeyStateTests, fakeAndPoll_charKeyAndModifier) { CKeyMap keyMap; CMockEventQueue eventQueue; COSXKeyState keyState(&eventQueue, keyMap); keyState.updateKeyMap(); keyState.fakeKeyDown(A_CHAR_ID, KeyModifierShift, 1); EXPECT_TRUE(isKeyPressed(keyState, A_CHAR_BUTTON)); keyState.fakeKeyUp(1); EXPECT_TRUE(!isKeyPressed(keyState, A_CHAR_BUTTON)); // HACK: delete the key in case it was typed into a text editor. // we should really set focus to an invisible window. keyState.fakeKeyDown(kKeyBackSpace, 0, 2); keyState.fakeKeyUp(2); }
void MenuStateGraphicInfo::keyDown(SDL_KeyboardEvent key) { Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys)); //if(key == configKeys.getCharKey("SaveGUILayout")) { if(isKeyPressed(configKeys.getSDLKey("SaveGUILayout"),key) == true) { GraphicComponent::saveAllCustomProperties(containerName); //Lang &lang= Lang::getInstance(); //console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]"); } }
TEST_F(COSXKeyStateTests, fakeAndPoll_shift) { CKeyMap keyMap; CMockEventQueue eventQueue; COSXKeyState keyState(&eventQueue, keyMap); keyState.updateKeyMap(); keyState.fakeKeyDown(SHIFT_ID_L, 0, 1); EXPECT_TRUE(isKeyPressed(keyState, SHIFT_BUTTON)); keyState.fakeKeyUp(1); EXPECT_TRUE(!isKeyPressed(keyState, SHIFT_BUTTON)); keyState.fakeKeyDown(SHIFT_ID_R, 0, 2); EXPECT_TRUE(isKeyPressed(keyState, SHIFT_BUTTON)); keyState.fakeKeyUp(2); EXPECT_TRUE(!isKeyPressed(keyState, SHIFT_BUTTON)); }
void CPause::eval () { game->draw (); menu.draw (); menu.input (); if (CGameDevice::MOUSE_RMB) rmbExists = true; else if (rmbExists) { doPlay (true); return; } if (isKeyPressed (CGameDevice::ESC, esc)) doAbort (); }
/// Update the continuous input detection void InputSystem::update(const Time& time) { for (auto it = bindings.axisMappings.begin(); it != bindings.axisMappings.end(); ++it) { if (isKeyPressed(it->second.key)) { emitAxisAction(it->first, 1.f); } } }
void MyGLWidget::paintGL() { checkInput(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(scene->camera.fov*180/M_PI, aspect, 0.1, 1000); if(isKeyPressed(Qt::Key_T)) { glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); } else { glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(scene->camera.position.x(), scene->camera.position.y(), scene->camera.position.z(), scene->camera.looksAt().x(), scene->camera.looksAt().y(), scene->camera.looksAt().z(), scene->camera.up.x(), scene->camera.up.y(), scene->camera.up.z()); float lightDiffuse[4] = {light_diffuse.x(), light_diffuse.y(), light_diffuse.z(), light_diffuse.w()}; /* diffuse light. */ float lightAmbient[4] = {light_ambient.x(), light_ambient.y(), light_ambient.z(), light_ambient.w()}; /* ambient light. */ float lightSpecular[4] = {light_specular.x(), light_specular.y(), light_specular.z(), light_specular.w()}; /* ambient light. */ float lightPosition1[4] = {light_position1.x(), light_position1.y(), light_position1.z(), light_position1.w()}; /* Infinite light location. */ float lightPosition2[4] = {light_position2.x(), light_position2.y(), light_position2.z(), light_position2.w()}; /* Infinite light location. */ float lightPosition3[4] = {light_position3.x(), light_position3.y(), light_position3.z(), light_position3.w()}; /* Infinite light location. */ glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse); glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient); glLightfv(GL_LIGHT0, GL_SPECULAR, lightSpecular); glLightfv(GL_LIGHT0, GL_POSITION, lightPosition1); glLightfv(GL_LIGHT1, GL_DIFFUSE, lightDiffuse); glLightfv(GL_LIGHT1, GL_AMBIENT, lightAmbient); glLightfv(GL_LIGHT1, GL_SPECULAR, lightSpecular); glLightfv(GL_LIGHT1, GL_POSITION, lightPosition2); glLightfv(GL_LIGHT2, GL_DIFFUSE, lightDiffuse); glLightfv(GL_LIGHT2, GL_AMBIENT, lightAmbient); glLightfv(GL_LIGHT2, GL_SPECULAR, lightSpecular); glLightfv(GL_LIGHT2, GL_POSITION, lightPosition3); glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, 1.0f); scene->getRootNode()->draw(); scene->cursor->draw(); }
void renderPlayerControl()//Done by Sham ,Render Player Control scheme { std::ifstream qweFile; string controlSet1; std::ifstream numFile; string controlSet2; COORD textPrintCoord; textPrintCoord.X = 5; textPrintCoord.Y = 3; qweFile.open("display\\qwekeys.txt"); while(qweFile.good()) { std::getline(qweFile,controlSet1); g_Console.writeToBuffer(textPrintCoord,controlSet1,0x04); textPrintCoord.Y++; } qweFile.close(); textPrintCoord.Y = 3; textPrintCoord.X += 35; numFile.open("display\\numkeys.txt"); while(numFile.good()) { std::getline(numFile,controlSet2); g_Console.writeToBuffer(textPrintCoord,controlSet2,0x04); textPrintCoord.Y++; } numFile.close(); if((isKeyPressed('1'))||(isKeyPressed(VK_NUMPAD1))){ choicePrint="Option 1 was selected"; } else if((isKeyPressed('2'))||(isKeyPressed(VK_NUMPAD2))){ choicePrint="Option 2 was selected"; } g_Console.writeToBuffer(1,1,choicePrint,0x04); }
void SSAODemo::update(float timeSinceLastUpdate) { auto input = engine->getInput(); if(input.isKeyPressed(KEY_R)) { ssaoOn = !ssaoOn; updateShaderParameters(); } else if(input.isKeyPressed(KEY_T)) { showSSAOTex = !showSSAOTex; updateShaderParameters(); } float moveDistance = timeSinceLastUpdate * 20.0f; float moveRotation = timeSinceLastUpdate * 60.0f; if(input.isKeyDown(KEY_LEFT)) camera->rotate(Quaternion(moveRotation, Vector3::UNIT_Y), FrameOfReference::World); if(input.isKeyDown(KEY_RIGHT)) camera->rotate(Quaternion(-moveRotation, Vector3::UNIT_Y), FrameOfReference::World); if(input.isKeyDown(KEY_UP)) camera->rotate(Quaternion(moveRotation, Vector3::UNIT_X), FrameOfReference::Local); if(input.isKeyDown(KEY_DOWN)) camera->rotate(Quaternion(-moveRotation, Vector3::UNIT_X), FrameOfReference::Local); if(input.isKeyDown(KEY_W)) camera->translate((Vector3(0.0f, 0.0f, -moveDistance)), FrameOfReference::Local); if(input.isKeyDown(KEY_S)) camera->translate(Vector3(0.0f, 0.0f, moveDistance), FrameOfReference::Local); if(input.isKeyDown(KEY_A)) camera->translate(Vector3(-moveDistance, 0.0f, 0.0f), FrameOfReference::Local); if(input.isKeyDown(KEY_D)) camera->translate(Vector3(moveDistance, 0.0f, 0.0f), FrameOfReference::Local); }