void GameStateConfigDesktop::update() { GameStateConfigBase::update(); updateVideo(); updateInput(); updateKeybinds(); }
void ToltecsEngine::updateScreen() { _sound->updateSpeech(); _screen->updateShakeScreen(); // TODO: Set quit flag if (shouldQuit()) return; if (!_movieSceneFlag) updateInput(); else _mouseButton = 0; // TODO? Check keyb _counter01--; if (_counter01 <= 0) { _counter01 = MIN(_counter02, 30); _counter02 = 0; drawScreen(); _flag01 = 1; _counter02 = 1; } else { _screen->clearSprites(); _flag01 = 0; } static uint32 prevUpdateTime = 0; uint32 currUpdateTime; do { currUpdateTime = _system->getMillis(); _counter02 = (currUpdateTime - prevUpdateTime) / 13; } while (_counter02 == 0); prevUpdateTime = currUpdateTime; }
void wavesScene::update(){ updateModeChange(); updateParticles(); updateInput(); gradientWaves.update(); stencilWaves.update(); updateFade(); }
void update() { float time = 0.001f * SDL_GetTicks(); skipFrames(time); updateInput(); updateGame(time); updateCamera(); }
void Player::control() { updateInput(); parseInput(); //Clamp velocity float magnitude = sqrt(getVelocity().x * getVelocity().x + getVelocity().y * getVelocity().y); sf::Vector2f unit = getVelocity()/magnitude; setVelocity(unit * terminalVelocity); }
void menuLoop(Input *pIn,GameState *pGameState, Screen *pScreen, Menu* pMenu,GameOptions* pGameOptions){ updateScreenMenu(pMenu,pScreen,pGameState,pGameOptions); int flagE = 1; int flagUP = 1; int flagDOWN = 1; while(pGameState->menu && !pIn->quit){ updateScreenMenu(pMenu,pScreen,pGameState,pGameOptions); updateInput(pIn); //on teste quelle touche est appuyée if (pIn->keys[SDL_SCANCODE_E]){ if(!flagE){ pGameOptions->mode = (pGameOptions->mode+1)%2; flagE = 1; } }else{ flagE = 0; } if (pIn->keys[SDL_SCANCODE_DOWN]){ if (!flagDOWN){ if (pGameState->choice < 2){ pGameState->choice ++; flagDOWN = 1; } } }else{ flagDOWN = 0; } if (pIn->keys[SDL_SCANCODE_UP]){ if (!flagUP){ if (pGameState->choice > 0 ){ pGameState->choice --; flagUP = 1; } } }else{ flagUP = 0; } if (pIn->keys[SDL_SCANCODE_RETURN]){ if (pGameState->choice == 0){ pGameState->menu = 0; } if (pGameState->choice == 1){ pGameState->menu = 2; menuOptionLoop (pIn,pGameState,pScreen,pMenu,pGameOptions); pGameState->choice = 1; pGameState->menu = 1; } if (pGameState->choice == 2){ pIn->quit = 1; } } SDL_Delay(15); } }
void KyraEngine_MR::update() { updateInput(); refreshAnimObjectsIfNeed(); updateMouse(); updateSpecialSceneScripts(); updateCommandLine(); updateItemAnimations(); _screen->updateScreen(); }
task main() { nxtState currentState; initialize(currentState); while(true){ updateInput(currentState); updateRobot(currentState); showDiagnostics(currentState); } }
void KyraEngine_HoF::update() { updateInput(); refreshAnimObjectsIfNeed(); updateMouse(); updateSpecialSceneScripts(); _timer->update(); updateItemAnimations(); updateInvWsa(); fadeMessagePalette(); _screen->updateScreen(); }
bool Game::update(float _fElapsedTime) { // Check if the game is ready to exit if (true == Hardware::getJoypad()->getExit()) { // Indicate that the game should exit return false; } updateInput(_fElapsedTime); return true; }
void GLBackend::do_draw(Batch& batch, uint32 paramOffset) { updateInput(); updateTransform(); updatePipeline(); Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint; GLenum mode = _primitiveToGLmode[primitiveType]; uint32 numVertices = batch._params[paramOffset + 1]._uint; uint32 startVertex = batch._params[paramOffset + 0]._uint; glDrawArrays(mode, startVertex, numVertices); (void) CHECK_GL_ERROR(); }
// Update focus input // Return false to remove focus. bool UIButton::updateInputFocus(KeyHandler* mKeyH, MouseHandler* mMouseH){ UIObject::updateInputFocus(mKeyH, mMouseH); updateInput(mKeyH, mMouseH); if (hovered){ toolTipX = mMouseH->getX() + 20.0f; toolTipY = mMouseH->getY(); return true; } return false; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); int i, j; la_f[0][0] = new QLabel(ui->scrollArea); la_f[0][0]->setText("max f(x) ="); la_f[0][0]->setMinimumWidth(60); ui->horizontalLayout_2->addWidget(la_f[0][0]); for(i=0;i<MAX;i++) { le_f[i] = new QLineEdit(ui->scrollArea); le_f[i]->setMinimumWidth(60); ui->horizontalLayout_2->addWidget(le_f[i]); la_f[0][i+1] = new QLabel(ui->scrollArea); la_f[0][i+1]->setText("x"+QString::number(i+1)+" +"); ui->horizontalLayout_2->addWidget(la_f[0][i+1]); } le_f[i] = new QLineEdit(ui->scrollArea); le_f[i]->setMinimumWidth(60); ui->horizontalLayout_2->addWidget(le_f[i]); for(i=0;i<MAX;i++) { hl[i] = new QHBoxLayout(); ui->verticalLayout_4->addLayout(hl[i]); la_f[i+1][0] = new QLabel(ui->scrollArea); la_f[i+1][0]->setText("y"+QString::number(i+1) + " = -("); la_f[i+1][0]->setMinimumWidth(60); hl[i]->addWidget(la_f[i+1][0]); for(j=0;j<MAX;j++) { le_o[i][j] = new QLineEdit(ui->scrollArea); le_o[i][j]->setMinimumWidth(60); hl[i]->addWidget(le_o[i][j]); la_f[i+1][j+1] = new QLabel(ui->scrollArea); la_f[i+1][j+1]->setText("x"+QString::number(j+1)+" +"); hl[i]->addWidget(la_f[i+1][j+1]); } le_o[i][j] = new QLineEdit(ui->scrollArea); le_o[i][j]->setMinimumWidth(60); hl[i]->addWidget(le_o[i][j]); } verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); ui->verticalLayout_4->addItem(verticalSpacer); updateInput(); }
void pauseLoop(GameState* pGameState,Input* pIn,Screen *pScreen){ while(pGameState->pause && !pIn->quit){ updateInput(pIn); SDL_RenderPresent(pScreen->renderer); if(pIn->keys[SDL_SCANCODE_P]){ pGameState->pause=0; pIn->keys[SDL_SCANCODE_P]=0; } if(pIn->keys[SDL_SCANCODE_Q]){ pGameState->pause=0; pGameState->menu=1; } SDL_Delay(15); } }
void endGameLoop(Input *pIn,GameState *pGameState,Screen *pScreen){ while(pGameState->waiting && !pIn->quit){ SDL_RenderPresent(pScreen->renderer); updateInput(pIn); if(pIn->keys[SDL_SCANCODE_N]){ pGameState->menu=1; pGameState->waiting=0; } if(pIn->keys[SDL_SCANCODE_Y]){ pGameState->waiting=0; } SDL_Delay(15); } }
void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) { updateInput(); updateTransform(); updatePipeline(); Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint; GLenum mode = _primitiveToGLmode[primitiveType]; uint32 numIndices = batch._params[paramOffset + 1]._uint; uint32 startIndex = batch._params[paramOffset + 0]._uint; GLenum glType = _elementTypeToGLType[_input._indexBufferType]; glDrawElements(mode, numIndices, glType, reinterpret_cast<GLvoid*>(startIndex + _input._indexBufferOffset)); (void) CHECK_GL_ERROR(); }
void AppWindow::start(){ setRunning(true); init(); while(Running){ if(!pause){ calcDelta(); }else{ delta = 0; } while(SDL_PollEvent(&e)){ updateInput(e); } updateAuto(); render(); } }
void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) { uint32 start = _system->getMillis(); do { if (updateGame) { if (_chatText) updateWithText(); else update(); } else { updateInput(); } if (amount > 0) _system->delayMillis(amount > 10 ? 10 : amount); } while (!skipFlag() && _system->getMillis() < start + amount && !shouldQuit()); }
u32 cForm::doModal() { windowManager().addWindow( this ); show(); do { // manually update system loop timer().updateFps(); INPUT & inputs = updateInput(); processInput( inputs ); windowManager().update(); gdi().present( GE_MAIN ); //dbg_printf( "modal window looping\n" ); } while( modalRet() == (u32 )-1 ); windowManager().removeWindow( this ); return modalRet(); }
ErrorCode updateStarter(Module* parent, OriginWord port) { OriginByte i; ErrorCode error; (void) port; ValHistory *vHist; vHist = ((Starter*)parent->fun)->hist; // debug("S"); for(i=0; i<parent->nbInputs; i++) { // On sauvegarde les entrées précédentes vHist[i].val2 = vHist[i].val1; vHist[i].val1 = vHist[i].val0; // MAJ de ses entrées error = updateInput(parent, i); if(error != NO_ERR) { return error; } // On récupère l'entrée vHist[i].val0 = getInput(parent, i); // Si suffisament de tours ont eu lieu if(vHist[i].val1 != 0x7FFFFFFF && vHist[i].val2 != 0x7FFFFFFF) { // Si les valeurs n'ont pas évoluées if(vHist[i].val0 - vHist[i].val1 < ACCURACY && vHist[i].val0 - vHist[i].val1 > -ACCURACY && vHist[i].val1 - vHist[i].val2 < ACCURACY && vHist[i].val1 - vHist[i].val2 > -ACCURACY) { if (parent->isVerbose) { debug("MVTF\r\n"); } // On indique que le mouvement est fini semaphoreGive(parent->ctl->semReached); } } } return NO_ERR; }
void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll) { updateInput(mx, my, mbut, scroll); s_state.hot = s_state.hotToBe; s_state.hotToBe = 0; s_state.wentActive = false; s_state.isActive = false; s_state.isHot = false; s_state.widgetX = 0; s_state.widgetY = 0; s_state.widgetW = 0; s_state.areaId = 1; s_state.widgetId = 1; }
PublishDialog::PublishDialog( QWidget *parent ) : KDialog( parent ) { setCaption( i18n( "Select Addresses" ) ); setButtons( Ok|Cancel|Help ); setHelp( "group-scheduling", "korganizer" ); QWidget *widget = new QWidget( this ); widget->setObjectName( "PublishFreeBusy" ); mUI.setupUi( widget ); setMainWidget( widget ); mUI.mListWidget->setSelectionMode( QAbstractItemView::SingleSelection ); mUI.mNameLineEdit->setEnabled( false ); mUI.mEmailLineEdit->setEnabled( false ); setButtonToolTip( Ok, i18n( "Send email to these recipients" ) ); setButtonWhatsThis( Ok, i18n( "Clicking the <b>Ok</b> button will cause " "an email to be sent to the recipients you " "have entered." ) ); setButtonToolTip( Cancel, i18n( "Cancel recipient selection and the email" ) ); setButtonWhatsThis( Cancel, i18n( "Clicking the <b>Cancel</b> button will " "cause the email operation to be terminated." ) ); setButtonWhatsThis( Help, i18n( "Click the <b>Help</b> button to read " "more information about Group Scheduling." ) ); mUI.mNew->setIcon( KIcon( "list-add" ) ); mUI.mRemove->setIcon( KIcon( "list-remove" ) ); mUI.mRemove->setEnabled( false ); mUI.mSelectAddressee->setIcon( KIcon( "view-pim-contacts" ) ); connect( mUI.mListWidget, SIGNAL(itemSelectionChanged()), SLOT(updateInput()) ); connect( mUI.mNew, SIGNAL(clicked()), SLOT(addItem()) ); connect( mUI.mRemove, SIGNAL(clicked()), SLOT(removeItem()) ); connect( mUI.mSelectAddressee, SIGNAL(clicked()), SLOT(openAddressbook()) ); connect( mUI.mNameLineEdit, SIGNAL(textChanged(const QString &)), SLOT(updateItem()) ); connect( mUI.mEmailLineEdit, SIGNAL(textChanged(const QString &)), SLOT(updateItem()) ); }
void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll) { updateInput(mx,my,mbut,scroll); g_state.hot = g_state.hotToBe; g_state.hotToBe = 0; g_state.wentActive = false; g_state.isActive = false; g_state.isHot = false; g_state.widgetX = 0; g_state.widgetY = 0; g_state.widgetW = 0; g_state.areaId = 1; g_state.widgetId = 1; resetGfxCmdQueue(); }
void KyraEngine_MR::updateWithText() { updateInput(); updateMouse(); updateItemAnimations(); updateSpecialSceneScripts(); updateCommandLine(); restorePage3(); drawAnimObjects(); if (_chatTextEnabled && _chatText) { int curPage = _screen->_curPage; _screen->_curPage = 2; objectChatPrintText(_chatText, _chatObject); _screen->_curPage = curPage; } refreshAnimObjects(0); _screen->updateScreen(); }
KstObject::UpdateType KstBasicPlugin::update(int updateCounter) { Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED); if (recursed()) { return setLastUpdateResult(NO_CHANGE); } bool force = dirty(); setDirty(false); if (KstObject::checkUpdateCounter(updateCounter) && !force) { return lastUpdateResult(); } //Make sure we have all the necessary inputs if (!inputsExist()) { return setLastUpdateResult(NO_CHANGE); } writeLockInputsAndOutputs(); //Update the dependent inputs bool depUpdated = updateInput(updateCounter, force); //Call the plugins algorithm to operate on the inputs //and produce the outputs if ( !algorithm() ) { KstDebug::self()->log(i18n("There is an error in the %1 algorithm.").arg(propertyString()), KstDebug::Error); unlockInputsAndOutputs(); return lastUpdateResult(); } //Perform update on the outputs updateOutput(updateCounter); createFitScalars(); unlockInputsAndOutputs(); return setLastUpdateResult(depUpdated ? UPDATE : NO_CHANGE); }
void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { uint32 start = _system->getMillis(); do { if (update) { _sprites->updateSceneAnims(); _animator->updateAllObjectShapes(); updateTextFade(); updateMousePointer(); } else { // We need to do Screen::updateScreen here, since client code // relies on this method to copy screen changes to the actual // screen since at least 0af418e7ea3a41f93fcc551a45ee5bae822d812a. _screen->updateScreen(); } _isSaveAllowed = isMainLoop; updateInput(); _isSaveAllowed = false; if (_currentCharacter && _currentCharacter->sceneId == 210 && update) updateKyragemFading(); if (amount > 0 && !skipFlag() && !shouldQuit()) _system->delayMillis(10); // FIXME: Major hackery to allow skipping the intro if (_seqPlayerFlag) { for (Common::List<Event>::iterator i = _eventList.begin(); i != _eventList.end(); ++i) { if (i->causedSkip) { if (i->event.type == Common::EVENT_KEYDOWN && i->event.kbd.keycode == Common::KEYCODE_ESCAPE) _abortIntroFlag = true; else i->causedSkip = false; } } } if (skipFlag()) snd_stopVoice(); } while (!skipFlag() && _system->getMillis() < start + amount && !shouldQuit()); }
int main(int argc, char** argv) { if (initialize()) { while (running) { beginFrame(); updateInput(); updateGame(); updateRender(); endFrame(); } end(); } else Logger::log("CRITICAL ERROR: Could not initialize."); return 0; }
void KyraEngine_HoF::updateWithText() { updateInput(); updateMouse(); fadeMessagePalette(); updateSpecialSceneScripts(); _timer->update(); updateItemAnimations(); updateInvWsa(); restorePage3(); drawAnimObjects(); if (_chatTextEnabled && _chatText) { int pageBackUp = _screen->_curPage; _screen->_curPage = 2; objectChatPrintText(_chatText, _chatObject); _screen->_curPage = pageBackUp; } refreshAnimObjects(0); _screen->updateScreen(); }
int main(int argc, char** argv) { GLFWwindow* window = initGLWindow(); movement = new CameraMovement(window); initGL(); int width, height; glfwGetFramebufferSize(window, &width, &height); renderer.init(width, height); camera.init(width/(float)height, 60.f, .1f, 100.f); camera.setCameraProjection(PROJECTION_PERSPECTIVE); // Floor std::shared_ptr<Mesh> floorMesh = std::make_shared<Mesh>(UnitQuad::CreateUnitQuad()); floorMesh->material.diffuse = glm::vec4(0.3f, 0.6f, 0.7f, 1.0f); floorMesh->material.ambient = glm::vec4(0.01f, 0.01f, 0.01f, 1.0f); floorMesh->material.specular = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f); floorMesh->material.shininess = 100.0f; std::shared_ptr<SceneNode> floor(new SceneNode); floor->init(floorMesh); floor->position = glm::vec3(0.0,-1.0, 0.0); floor->rotation = glm::rotate(glm::mat4(1.0f),-90.0f, glm::vec3(1.0, 0.0, 0.0)); floor->scale = glm::scale(glm::mat4(1.0), glm::vec3(100.0f)); LightProperties lightProperties = LightFactory::Bright(glm::vec3(1.0, 1.0, 1.0)); lightProperties.position = glm::vec4(-2.0f, 2.0f, -1.0f, 1.0); lightProperties.direction = glm::vec4(0.0, -0.1, -1.0, 0.0); std::shared_ptr<Light> light(new Light); light->properties = lightProperties; renderer.lights.push_back(light); LightProperties lightProperties1 = LightFactory::Bright(glm::vec3(1.0, 1.0, 1.0)); lightProperties1.position = glm::vec4(4.0f, 2.0f, -3.0f, 1.0); lightProperties1.direction = glm::vec4(-1.0, -0.1, 0.0, 0.0); std::shared_ptr<Light> light1(new Light); light1->properties = lightProperties1; renderer.lights.push_back(light1); std::string path(MODEL_PATH); path.append("cooldragon.off"); auto node = createSceneNode(path); node->position = glm::vec3(0.0f, 0.0f, -3.0f); renderer.nodes.push_back(node); renderer.nodes.push_back(floor); std::thread first (startGui, argc, argv); glfwSwapInterval(1); //0 to disable vsync, 1 to enable it while (!glfwWindowShouldClose(window)) { if(shouldFlipNormals) { renderer.nodes[0]->mesh->flipNormals(); shouldFlipNormals = false; } if(shouldLoadFile) { std::string path(MODEL_PATH); path.append(filename); renderer.nodes[0] = createSceneNode(path); renderer.nodes[0]->position = glm::vec3(-2.0f, -0.5f, -3.0f); gui->material = &renderer.nodes[0]->mesh->material; shouldLoadFile = false; } updateInput(window); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClearColor(0.0, 0.0, 0.0, 0.0); light->properties.position = glm::translate(glm::mat4(1.0f), glm::vec3(-2.5f + cosf(glfwGetTime()), 0.5f, -0.0f)) * glm::vec4(1.0f); camera.position = movement->position; camera.target = camera.position + movement->lookatDirection; camera.update(); renderer.proj = camera.getCameraProjectionTransform(); renderer.view = camera.getCameraViewTransform(); renderer.renderScene(); glfwSwapBuffers(window); glfwPollEvents(); } delete movement; glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); }
void Game::updateGameInput() { for (int i = 0; i < _inputsCount; ++i) { _inputDirKeyReleased[_inputsTable[i].inputKey0] = 0; _inputDirKeyReleased[_inputsTable[i].inputKey1] = 0; } if (_res._demoInputDataSize != 0 && _demoInput < _res._demoInputDataSize) { while (_ticks == _res._demoInputData[_demoInput].ticks) { const ResDemoInput *input = &_res._demoInputData[_demoInput]; switch (input->key) { case 0: break; case 5: inp.shiftKey = input->pressed; break; case 7: // escape break; case 51: inp.enterKey = input->pressed; break; case 64: inp.numKeys[2] = input->pressed; break; case 70: inp.numKeys[6] = input->pressed; break; case 73: if (input->pressed) { inp.dirMask |= kInputDirLeft; } else { inp.dirMask &= ~kInputDirLeft; } break; case 74: if (input->pressed) { inp.dirMask |= kInputDirDown; } else { inp.dirMask &= ~kInputDirDown; } break; case 80: if (input->pressed) { inp.dirMask |= kInputDirRight; } else { inp.dirMask &= ~kInputDirRight; } break; case 81: if (input->pressed) { inp.dirMask |= kInputDirUp; } else { inp.dirMask &= ~kInputDirUp; } break; case 83: inp.spaceKey = input->pressed; break; case 144: inp.altKey = input->pressed; break; case 145: inp.ctrlKey = input->pressed; break; default: warning("Game::updateGameInput() unhandled demo input key %d", input->key); break; } ++_demoInput; if (_demoInput >= _res._demoInputDataSize) { break; } } } updateInput(); if (_inf) { _objectsPtrTable[kObjPtrConrad]->specialData[1][18] = _varsTable[kVarConradLife]; } }