void Sprite::drawTexture() { GLfloat x = getBoxX(); if( x < 0 ) { x = 0; } //GameRender::drawFullTexture(textureBox, Vector2f(x, getBoxY()), getBoxWidth(), getBoxHeight()); int currentState = getCurrentState(); if ( currentState == GameCoreStates::DOUBLE_JUMP ) { currentState = GameCoreStates::JUMPING; } if ( getCurrentState() == GameCoreStates::FAST_ATTACK ) { int attackState = getPreviousState(); /*GameRender::drawFullTexture(textureBox, Vector2f(weaponCollisionBoxes.at(attackState).getX(), weaponCollisionBoxes.at(attackState).getY()), weaponCollisionBoxes.at(attackState).getWidth(), weaponCollisionBoxes.at(attackState).getHeight());*/ currentState = ( GameCoreStates::FAST_ATTACK - 1 ) + getPreviousState(); } if ( getCurrentState() == GameCoreStates::FALLING ) { currentState = 8; } GameRender::drawSpriteTexture(texture, position, handlerAnimation->getCurrentFrame(), width, height, handlerAnimation->getAnimationDirection(), currentState ); }
/*! * Helper method to handle Symbian event that specificly is of type QSymbianEvent::WindowServerEvent. * @param event Symbian event to be handled. (Ownership not taken.) */ void CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event) { // We receive tons of these events, so function start and end traces // are intentionally left out. const TWsEvent *wsEvent = event->windowServerEvent(); if (wsEvent) { switch (wsEvent->Type()) { case EEventFocusGroupChanged: { CX_DEBUG(("CxuiApplicationFrameworkMonitor - EEventFocusGroupChanged event")); setState(getCurrentState()); break; } case EEventFocusGained: { CX_DEBUG(("CxuiApplicationFrameworkMonitor - EEventFocusGained event")); setState(getCurrentState()); break; } case EEventFocusLost: { CX_DEBUG(("CxuiApplicationFrameworkMonitor - EEventFocusLost event")); setState(getCurrentState()); break; } default: break; } } }
void StateTextureControl::notifyChangePosition() { mPointValue = mAreaSelectorControl->getPosition(); // снапим к гриду if (!MyGUI::InputManager::getInstance().isShiftPressed()) { MyGUI::IntPoint point = mPointValue; MyGUI::IntCoord actionScale = mAreaSelectorControl->getActionScale(); if (actionScale.left != 0) { point.left = toGrid(point.left + (mGridStep / 2)); } if (actionScale.top != 0) { point.top = toGrid(point.top + (mGridStep / 2)); } if (point != mPointValue) { mPointValue = point; mAreaSelectorControl->setPosition(mPointValue); } } if (getCurrentState() != nullptr) getCurrentState()->getPropertySet()->setPropertyValue("Position", mPointValue.print(), mTypeName); }
void StateTextureControl::updateFromPointValue() { mAreaSelectorControl->setPosition(mPointValue); if (getCurrentState() != nullptr) getCurrentState()->getPropertySet()->setPropertyValue("Position", mPointValue.print(), mTypeName); }
void RegionTextureControl::updateTextureVisible() { mTextureVisible = false; if (getCurrentState() != nullptr) mTextureVisible = getCurrentState()->getPropertySet()->getPropertyValue("Visible") == "True"; updateTextureControl(); }
void StateInterpreter::interpret(Player *player, String command) { if(getCurrentState()->isCompleted(player, command)) { if(nextState()) { getCurrentState()->introduction(player); } } else { getCurrentState(); } }
void StateTextureControl::updateVisible() { MyGUI::UString visible; if (getCurrentState() != nullptr) visible = getCurrentState()->getPropertySet()->getPropertyValue("Visible"); mAreaSelectorControl->setVisible(visible == "True"); }
bool Sprite::isPlayerOnTheAir() { if ( getCurrentState() != GameCoreStates::JUMPING && getCurrentState() != GameCoreStates::DOUBLE_JUMP && getCurrentState() != GameCoreStates::FALLING && !(getPreviousState() == GameCoreStates::JUMPING && getCurrentState() == GameCoreStates::FAST_ATTACK) ) { return false; } return true; }
void SwingingBlade::updateImpl(const std::chrono::microseconds& deltaTime) { if( updateTriggerTimeout( deltaTime ) ) { if( getCurrentState() == 0 ) setTargetState( 2 ); } else if( getCurrentState() == 2 ) { setTargetState( 0 ); } }
ConfiguredComponent(Component underlaying_component) : underlaying_name(underlaying_component->getName()) { component = underlaying_component; auto spec = std::dynamic_pointer_cast<SpecializedComponentObjBase>(underlaying_component); if (spec.get()) { component = spec->getOrginal(); for(auto c : spec->configuration){ switch(underlaying_component->getProperty(c.first)){ case ConfigurationModel::INT: { int_config.push_back(Config<int>{atoi(c.second.first.c_str()),atoi(c.second.second.c_str()), c.first}); break; } default: throw std::runtime_error("Cannot create configuredComponent from a specialized component yet - Not implemented"); } } } auto sm = std::dynamic_pointer_cast<StateMachineObj>(underlaying_component); if (sm.get()) { int_config.push_back(Config<int>{(int)sm->getCurrentState(), (int)sm->getCurrentState(), "current_state"}); } /* // std::cout << "Debug for " << underlaying_component->getName() << std::endl; // string_name << component->toString() << std::endl; for (auto j : i) { // std::cout << "\t-" << j.first << j.second << std::endl; int_config.push_back(Config<int>{j.second.min(), j.second.max(), j.first}); } for (auto j : f) { double_config.push_back(Config<double>{j.second.min(), j.second.max(), j.first}); } for (auto j : b) { bool_config.push_back(Config<bool>{(bool)j.second.min(), (bool)j.second.max(), j.first}); } for (auto e : s) { std::string config_value = "ERR: N/A"; // TODO check unassigned values if (e.second.assigned()) { auto id = e.second.val(); for (auto v : *sh) { if (v.second == id) { config_value = v.first; break; } } } string_config.push_back({e.first, config_value}); } */ }
void StateTextureControl::updatePosition() { MyGUI::UString value; if (getCurrentState() != nullptr) value = getCurrentState()->getPropertySet()->getPropertyValue("Position"); MyGUI::IntPoint position; if (MyGUI::utility::parseComplex(value, position.left, position.top)) { mPointValue = position; mAreaSelectorControl->setPosition(mPointValue); } }
void RegionTextureControl::updateRegionPosition() { mTextureRegion.left = 0; mTextureRegion.top = 0; if (getCurrentState() != nullptr) { MyGUI::IntPoint position = MyGUI::IntPoint::parse(getCurrentState()->getPropertySet()->getPropertyValue("Position")); mTextureRegion.left = position.left; mTextureRegion.top = position.top; } updateTextureControl(); }
void Sprite::movePosYWithSpeed() { characterMovement.playerMoveInY = false || characterMovement.playerMoveInY; characterMovement.playerMoveInYInCurrentFrame = false; countY++; if ( countY > delayMovementSprite.at(getCurrentState()).y ) { countY = 0; if( getBoxY() + getBoxHeight() <= 880.0f ) { handlerAnimation->changeDirectionY( getSpeedY() ); if ( !getPlayerDirectionYBasedInDirection() ) { return; } rigidBody->applyNaturalPhysicForces(GamePhysics::Y, &speed.x, &speed.y, getCurrentState(), handlerAnimation->getAnimationDirection(), getPreviousState()); characterMovement.playerMoveInY = true; characterMovement.playerMoveInYInCurrentFrame = true; collisionHandler->checkTileCollisionY(*getCollisionBox(), &speed.y, handlerAnimation->getDirectionY(), directionsMove); spriteCollisionBox->setBoxYBasedOnSpeed(spriteCollisionBox->getY() + getSpeedY()); position.y = spriteCollisionBox->getY() - spriteCollisionBox->getOffset().y; isOnGround = collisionHandler->onTheGround(*getCollisionBox()); collisionHandler->checkStateCollisionPlayer(*this); for(std::string::size_type i = 0; i < weaponCollisionBoxes.size(); i++) { weaponCollisionBoxes.at(i).setY( position.y ); } return; } speed.y = 0.0f; characterMovement.playerMoveInX = false; characterMovement.playerMoveInY = false; } }
static void LcdTask( void ) { while(1) { vTaskDelay(250000); //wait 10ms state = getCurrentState(prevState); switch (state) { case RUNNING: updateTime(&tenMs,&seconds,&minutes,&hours); break; case RESET: tenMs = 0; seconds = 0; minutes = 0; hours = 0; break; case STOPPED: break; } } }
void RoboState::messageCallback(const nav_simple::mymsg::ConstPtr& msg) { // only accept message if movement is not in progress if(getCurrentState()==NEUTRAL) { if(msg->x==0 && msg->y==0) ROS_INFO("No reason to move a distance of 0. Message not sent."); else{ ROS_INFO("X and Y coordinates sent were: x:%f y:%f", msg->x, msg->y); setX(msg->x); setY(msg->y); ROS_INFO("xCoord is: %f. yCoord is: %f", getX(), getY()); // we don't need to face backward since initial movement is forward if(getX() >= 0){ setCurrentState(TURN_LEFT_90); } // need to face backward since initial movement is backward // (want bumper sensors to be useful) else{ //setCurrentState(TURN_NEG_X); setCurrentState(TURN_LEFT_90); } //setErr(sqrt(pow(getX(),2)+pow(getY(),2))*.1); setErr(.1); } // need to determine what direction we will ultimately face setYawGoal(90); // determineYawGoal(); } else ROS_INFO("Cannot accept message. Movement still in progress."); }
int steering::getAngle(int*array, int size) { int state; state = getCurrentState(array, size); return angleFromState(state); }
void BoardUtils::saveState() { m_sett.setValue("lastLevelID", m_level.m_levelId); m_sett.setValue("lastLevelMoves", m_level.m_currentMoves); m_sett.setValue("lastLevelState", getCurrentState()); m_sett.sync(); }
void StatePropertyControl::updateStateProperties() { StateItem* state = getCurrentState(); mPropertyVisibleControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("Visible") : nullptr); mPropertyPositionControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("Position") : nullptr); mPropertyColourControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("TextColour") : nullptr); mPropertyOffsetControl->setProperty(state != nullptr ? state->getPropertySet()->getChild("TextShift") : nullptr); }
static void buttonStateTask( void ) { while(1) { vTaskDelay(250000); //wait 10ms state = getCurrentState(prevState); } }
void Service::executeEvent(Event& ev) { OutputDebugString(L"イベント実行\n"); // 現在のステータスを取得 State& state = getCurrentState(); // イベントを実行 state.executeEvent(*this, ev); }
void DriveTrainController::run() { switch (getCurrentState()) { case CONTINUOUSDRIVE: break; //Goal state with the drivers are driving the robot case TELEOP: manualDrive(); break; //Goal state of when the robot is not doing anything case IDLE: m_rightMotorPower = 0.0f; m_leftMotorPower = 0.0f; break; //Goal state of when the robot is moving by its self case ENCODERDRIVE: if (m_rightEncoderComplete){ m_goalState = IDLE; } if (m_leftEncoderComplete){ m_goalState = IDLE; } break; case GYROTURN: if (clockwise){ if(m_gyroTargetDegree <= m_gyro->GetAngle()) m_goalState = IDLE; } else{ if(m_gyroTargetDegree >= m_gyro->GetAngle()) m_goalState = IDLE; } break; case LIDARDRIVE: if(lidarInches >= (m_lidar->getDistance() *2.54 + RobotConstants::lidarErrorRange)) { if(m_leftMotorPower<0){ m_leftMotorPower *= -1; m_rightMotorPower *= -1; } } else if (lidarInches <= (m_lidar->getDistance() *2.54 - RobotConstants::lidarErrorRange)) { if(m_leftMotorPower>0){ m_leftMotorPower *= -1; m_rightMotorPower *= -1; } } else{ m_goalState = IDLE; } break; }; m_driveTrain->TankDrive(m_leftMotorPower, m_rightMotorPower); }
int PlayBack::Fastforwardandrewind(bool flag,int keystate) { if(true == flag){ seek(5000); //right true 2000 = step 2S updateProgressBar(); }else if(false == flag){ seek(-5000); //left false updateProgressBar(); } if(MSG_KEYUP == keystate){ if(getCurrentState() == STATE_STARTED){ PlayBackPlayStatus(PlayStart); }else if(getCurrentState() == STATE_PAUSED) { PlayBackPlayStatus(PlayStop); } } return 0; }
void Sprite::setSpeedY(GLfloat speedY) { if ( getCurrentState() == GameCoreStates::FAST_ATTACK ) { if ( getPreviousState() == GameCoreStates::JUMPING ) { speedY = -4.0f; rigidBody->getMaxSpeed().at(getCurrentState()).y = speedY; } else { speedY = 0.0f; rigidBody->getMaxSpeed().at(getCurrentState()).y = speedY; } } speed.y = speedY; }
void DialingSipConnectionState::handleStateEntry(StateEnum previousState, const StateTransitionMemory* pTransitionMemory) { StateTransitionEventDispatcher eventDispatcher(m_rSipConnectionEventSink, pTransitionMemory); eventDispatcher.dispatchEvent(getCurrentState()); notifyConnectionStateObservers(); OsSysLog::add(FAC_CP, PRI_DEBUG, "Entry dialing connection state from state: %d, sip call-id: %s\r\n", (int)previousState, getCallId().data()); }
Scheduler* ExecutionStack::getCurrentScheduler() const { const std::shared_ptr<GameState>& currentState = getCurrentState(); if(currentState != nullptr) { return currentState->getScheduler(); } return nullptr; }
void StateCmds::setCurrentState(int stateCmd, bool state) { int mask = (1 << stateCmd); if (getCurrentState(stateCmd) != state) { // swap the stateCmd bit states = states ^ mask; } }
void Flywheel::run(){ switch(getCurrentState()){ case OFF: setRate(0.0); break; case NOTREADY: case READY: setRate(calculateSpeed()); break; } }
void ParticleManager::accumulateState(Eigen::Matrix< double, Eigen::Dynamic, 1 >& currentState, int particleNum) { if (particleNum != -1) { accumulateStateForParticle( particleNum, currentState, true, true, true ); } else { getCurrentState( currentState, true, true ); } }
Math::RigidTransform3d Fem2DLocalization::getElementPose() { auto femRepresentation = std::static_pointer_cast<Fem2DRepresentation>(getRepresentation()); auto position = getLocalPosition(); auto femElement = femRepresentation->getFemElement(getLocalPosition().index); const auto& nodeIds = femElement->getNodeIds(); std::array<Math::Vector3d, 3> nodePositions = {femRepresentation->getCurrentState()->getPosition(nodeIds[0]), femRepresentation->getCurrentState()->getPosition(nodeIds[1]), femRepresentation->getCurrentState()->getPosition(nodeIds[2])}; Math::Vector3d edge, normal, binormal; edge = (nodePositions[1] - nodePositions[0]).normalized(); normal = (nodePositions[2] - nodePositions[0]).cross(edge).normalized(); binormal = edge.cross(normal); Math::Matrix33d rotation; rotation << edge, normal, binormal; return Math::makeRigidTransform(rotation, (nodePositions[0] + nodePositions[1] + nodePositions[2]) / 3.0); }
void RegionTextureControl::updateTextureControl() { if (mTextureVisible && !mTextureName.empty() && getCurrentSkin() != nullptr && getCurrentState() != nullptr) { setTextureName(mTextureName); setTextureRegion(mTextureRegion); } else { setTextureRegion(MyGUI::IntCoord()); } }