本文整理汇总了C++中enterState函数的典型用法代码示例。如果您正苦于以下问题:C++ enterState函数的具体用法?C++ enterState怎么用?C++ enterState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enterState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enterState
void Rover::move(float distance) {
//Convert from metres into millimetres.
distance *= 1000;
//Work out how many pulses are required to go that many millimetres.
distance *= PULSES_PER_MM;
//Make sure we scale the number of pulses according to our encoding method.
distance /= ENCODING;
positionSetPoint_ = distance;
//Moving forward.
if (distance > 0) {
enterState(STATE_MOVING_FORWARD);
}
//Moving backward.
else if (distance < 0) {
enterState(STATE_MOVING_BACKWARD);
}
//If distance == 0, then do nothing, i.e. stay stationary.
}
示例2: GGDBGM
void FalseColorDock::processApplyClicked()
{
if(coloringState[selectedColoring()] == FalseColoringState::CALCULATING) {
GGDBGM("enterState():"<<endl);
enterState(selectedColoring(), FalseColoringState::ABORTING);
if (lastShown == selectedColoring()) {
// Cancel after re-calc
enterState(selectedColoring(), FalseColoringState::UNKNOWN);
emit unsubscribeFalseColoring(this, selectedColoring());
updateProgressBar();
updateTheButton();
} else {
emit unsubscribeFalseColoring(this, selectedColoring());
// go back to last shown coloring
if(coloringUpToDate[lastShown]) {
uisel->sourceBox->setCurrentIndex(int(lastShown));
requestColoring(lastShown);
} else { // or fall back to CMF, e.g. after ROI change
uisel->sourceBox->setCurrentIndex(FalseColoring::CMF);
requestColoring(FalseColoring::CMF);
}
}
} else if( coloringState[selectedColoring()] == FalseColoringState::FINISHED ||
coloringState[selectedColoring()] == FalseColoringState::UNKNOWN )
{
requestColoring(selectedColoring(), /* recalc */ true);
}
}
示例3: abs
void Rover::turn(int degrees) {
//Correct the amount to turn based on deviation during last segment.
headingSetPoint_ = abs(degrees) + (endHeading_ - startHeading_);
//In case the rover tries to [pointlessly] turn >360 degrees.
if (headingSetPoint_ > 359.8){
headingSetPoint_ -= 359.8;
}
//Rotating clockwise.
if (degrees > 0) {
enterState(STATE_ROTATING_CLOCKWISE);
}
//Rotating counter-clockwise.
else if (degrees < 0) {
enterState(STATE_ROTATING_COUNTER_CLOCKWISE);
}
//If degrees == 0, then do nothing, i.e. stay stationary.
}
示例4: enterState
void XtgScanner::defAtRate()
{
enterState(nameMode);
sfcName = getToken();
if (sfcName == "@$:")
{
if (doc->paragraphStyles().contains(m_item->itemName() + "_Normal"))
{
ParagraphStyle newStyle;
newStyle.setParent(m_item->itemName() + "_Normal");
currentParagraphStyle = newStyle;
currentCharStyle = newStyle.charStyle();
}
else if (doc->paragraphStyles().contains("Normal"))
{
ParagraphStyle newStyle;
newStyle.setParent("Normal");
currentParagraphStyle = newStyle;
currentCharStyle = newStyle.charStyle();
}
enterState(previousState());
}
else if (sfcName == "@:")
{
QString pStyle = CommonStrings::DefaultParagraphStyle;
ParagraphStyle newStyle;
newStyle.setParent(pStyle);
newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
currentParagraphStyle = newStyle;
currentCharStyle = newStyle.charStyle();
currentCharStyle.setFontSize(120.0);
styleEffects = ScStyle_None;
currentCharStyle.setFeatures(styleEffects.featureList());
enterState(textMode);
}
else if (doc->paragraphStyles().contains(m_item->itemName() + "_" + sfcName))
{
ParagraphStyle newStyle;
newStyle.setParent(m_item->itemName() + "_" + sfcName);
currentParagraphStyle = newStyle;
currentCharStyle = newStyle.charStyle();
if (lookAhead() == ':')
top++;
enterState(textMode);
}
else if (doc->paragraphStyles().contains(sfcName))
{
ParagraphStyle newStyle;
newStyle.setParent(sfcName);
currentParagraphStyle = newStyle;
currentCharStyle = newStyle.charStyle();
if (lookAhead() == ':')
top++;
enterState(textMode);
}
}
示例5: analogRead
/*----------------------------------- CompressorSystem::heartbeat-----------------------------------
* This is called from the heartbeat() in the main page
* 1. Reads the reservoir pressure
* 2. Fills tank when it is too low, enters starting state
* 3. Waits for one loop through, then enters the on state
* 4. Once tank is filled to correct pressure, enter stopping state
* 5. Waits for on loop through, then enters the off state
*/
void CompressorSystem::heartbeat(void){
//Serial.print("Compressor System Heartbeat Started, State: "); Serial.println(comp.state);
int reservoirPressure = analogRead(aiReservoirPin);
if(reservoirPressure < pvTankPressMin-100)
reservoirPressure = pvTankPressMin;
switch(state){
case CSS_OFF:
if (reservoirPressure <= pvTankPressMin) { //if the compressor is off, and the tank is to low, turn it on
inverter.neededByCompressor(true);
// Serial.print(" reservoirPressure: "); Serial.println(reservoirPressure);
digitalWrite(oUnloaderPin, HIGH); //dump pressure for 2 heart beats before compressor is truned on
pvUnloaderTimeout = 2; // number of heartbeat intervals to wait for unloader
enterState(CSS_STARTING); //compressor system is now starting
} else
digitalWrite(oCompressorPin, LOW); //turn off compressor
break;
case CSS_STARTING:
if (pvUnloaderTimeout > 1) {
pvUnloaderTimeout--; // keep waiting This works allongs as
} else if (digitalRead(iInverterOnPin)) {
digitalWrite(oUnloaderPin, LOW); // unloader has timed out so close it
digitalWrite(oCompressorPin, HIGH); //start compressor
//Serial.print("oCompressorPin: "); Serial.print(oCompressorPin);
enterState(CSS_ON); //the compressor is now on
} // end else if
break;
case CSS_ON:
if (reservoirPressure > pvTankPressMax) {
digitalWrite(oCompressorPin, LOW); //turn off if tank is pressurized
inverter.neededByCompressor(false); //compressor is no longer needed by inverter
pvUnloaderTimeout = 2; // number of heartbeat intervals to wait for unloader
enterState(CSS_STOPPING); //enter the stopping state
} else
digitalWrite(oCompressorPin, HIGH); //if tank pressure is not achieved, keep compressor on
break;
case CSS_STOPPING:
if (pvUnloaderTimeout > 1) {
pvUnloaderTimeout--; // keep waiting
} else {
// unloader has timed out so close it
digitalWrite(oUnloaderPin, LOW);
enterState(CSS_OFF); //compressor is now off
}
break;
} //end switch (state)
} //end CompressorSystem::heartbeat
示例6: switch
void ComponentGate::handleMessageClientUsesObject(Message &message)
{
switch(state)
{
case STATE_A:
enterState(STATE_TRANSITION_AB);
break;
case STATE_B:
enterState(STATE_TRANSITION_BA);
break;
case STATE_TRANSITION_AB: /* do nothing */
break;
case STATE_TRANSITION_BA: /* do nothing */
break;
}
}
示例7: enterState
void FenwarBoss::dealDamage(float damage, bool makesFlash)
{
//Fenwar is invincible until you kill his orbs!!!
if (orbManager->numOrbsAlive() > 0)
{
smh->soundManager->playSound("snd_HitInvulnerable");
return;
}
if (!flashing) {
health -= damage;
if (makesFlash) {
flashing = true;
timeStartedFlashing = smh->getGameTime();
}
}
if (health <= 0.0)
{
if (state != FenwarStates::NEAR_DEATH && state != FenwarStates::RETURN_TO_ARENA)
{
//Initial "death"
health = 0.0;
fadeWhiteAlpha = 0;
flashing = false;
smh->screenEffectsManager->stopEffect();
orbManager->killOrbs();
bulletManager->killBullets();
enterState(FenwarStates::RETURN_TO_ARENA);
smh->windowManager->openDialogueTextBox(-1, FENWAR_NEAR_DEFEAT_TEXT);
hasBegunFadeToWhite=false;
}
}
}
示例8: hgeRect
FenwarBoss::FenwarBoss(int _gridX, int _gridY, int _groupID)
{
x = _gridX * 64 + 32;
y = _gridY * 64 + 32;
startGridX = _gridX;
startGridY = _gridY;
groupID = _groupID;
health = maxHealth = FenwarAttributes::HEALTH;
startedIntroDialogue = false;
terraformedYet = false;
startedShakingYet = false;
flashing = false;
floatingYOffset = 0.0;
collisionBox = new hgeRect();
collisionBox->SetRadius(x, y, 1);
timeRelocated = 999999999.0;
relocatedYet = false;
hasBegunFadeToWhite=false;
orbManager = new FenwarOrbs(this);
bulletManager = new FenwarBullets(this);
bombManager = new FenwarBombs(this);
smh->resources->GetAnimation("fenwar")->Play();
smh->resources->GetAnimation("fenwar")->SetColor(ARGB(255,255,255,255));
initPlatformPoints();
tauntedAboutOrbs = false;
enterState(FenwarStates::INACTIVE);
}
示例9: mainWindow
void gui_mode::documentChanged(){
// qDebug("gui_mode::documentChanged()");
if(!mainWindow()->hasModePlugin()) return;
ModePlugin* iMode = mainWindow()->getModePlugin();
switch(state){
/// But there was no active plugin
case DEFAULT:
return;
/// And there was an active plugin
case MODE:
/// Give the plugin a chance to react to the selection change
/// If plugin didn't specify how to perform the update, simply
/// destroy it and re-create it from scratch.
if(!iMode->documentChanged()){
iMode->__internal_destroy();
iMode->__internal_create();
}
return;
/// There was a suspended plugin
case SUSPENDED:
/// On the other hand, when plugin is suspended, change in document just
/// results in the plugin termination
if(!iMode->documentChanged())
iMode->__internal_destroy();
mainWindow()->removeModePlugin();
lastActiveModeAction = NULL;
enterState(DEFAULT);
return;
}
}
示例10: enterState
void Label::resetState() {
m_occludedLastFrame = false;
m_occlusionSolved = false;
m_updateMeshVisibility = true;
m_dirty = true;
enterState(State::wait_occ, 0.0);
}
示例11: calcMoveCenterVector
void StateIdle::MouseLeftDrag(int dx, int dy) {
if (Controller::bMoveCenterMode) {
mCamera->setCamCenter(mCamera->getCamCenter() +
calcMoveCenterVector(dx, dy, Plane()));
return;
}
if (INTERNAL_STATE_MOUSE_DOWN == internalState) {
std::vector<Vector3> selectedPoints;
Vector3 planeVec = Vector3(0, 1, 0);
selectedPoints.push_back(selectedPoint);
Plane::buildPlane(selectedPoints, Controller::currPlane, planeVec);
if (Controller::currPlane.N.dot(mCamera->getDirection()) > 0) {
Controller::currPlane = -Controller::currPlane;
}
dynamic_cast<StateDraw*>(State::statePool[STATE_DRAW])->selectedPoints =
selectedPoints;
dynamic_cast<StateDraw*>(State::statePool[STATE_DRAW])->startPoint =
selectedPoint;
dynamic_cast<StateDraw*>(State::statePool[STATE_DRAW])->endPoint =
selectedPoint;
dynamic_cast<StateDraw*>(State::statePool[STATE_DRAW])->internalState =
StateDraw::STATE_DRAW_START_POINT_SELECTED;
enterState(State::statePool[STATE_DRAW]);
internalState = INTERNAL_STATE_IDLE;
}
}
示例12: rtgChainBegin
INLINE_CHAINS void ElevatorDoor_Actor::chain1_Initial( void )
{
// transition ':TOP:Initial:Initial'
rtgChainBegin( 1, "Initial" );
rtgTransitionBegin();
rtgTransitionEnd();
enterState( 2 );
}
示例13: enterState
void StateBasedGame::enterState(unsigned int id) {
for (unsigned int i = 0; i < m_states.size(); i++) {
if (m_states.at(i)->id() == id) {
enterState(m_states.at(i));
break;
}
}
}
示例14: rtgChainBegin
INLINE_CHAINS void serialTranslateCapsule_Actor::chain1_Initial( void )
{
// transition ':TOP:Initial:Initial'
rtgChainBegin( 1, "Initial" );
rtgTransitionBegin();
rtgTransitionEnd();
enterState( 2 );
}
示例15: enterState
void FalseColorDock::setCalculationInProgress(FalseColoring::Type coloringType)
{
if (selectedColoring() == coloringType) {
enterState(selectedColoring(), FalseColoringState::CALCULATING);
updateTheButton();
updateProgressBar();
}
}