当前位置: 首页>>代码示例>>C++>>正文


C++ pushState函数代码示例

本文整理汇总了C++中pushState函数的典型用法代码示例。如果您正苦于以下问题:C++ pushState函数的具体用法?C++ pushState怎么用?C++ pushState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pushState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createSelected

/**
 * Start level under pressed button.
 * Start pedometer when level is solved already.
 */
    void
WorldMap::runSelected()
{
    Level *level = createSelected();
    if (level) {
        m_levelStatus->prepareRun(m_selected->getCodename(),
                m_selected->getPoster(),
                m_selected->getBestMoves(),
                m_selected->getBestAuthor());
        level->fillStatus(m_levelStatus);

        if (m_selected->getState() == LevelNode::STATE_SOLVED) {
            Pedometer *pedometer = new Pedometer(m_levelStatus, level);
            pushState(pedometer);
        }
        else {
            pushState(level);
        }
    }
    else {
        if (m_activeMask == m_maskIntro) {
            runIntro();
        }
        else if (m_activeMask == m_maskExit) {
            quitState();
        }
        else if (m_activeMask == m_maskCredits) {
            runCredits();
        }
        else if (m_activeMask == m_maskOptions) {
            runOptions();
        }
    }
}
开发者ID:FishFilletsNG,项目名称:Fish-Fillets-NG,代码行数:38,代码来源:WorldMap.cpp

示例2: m_content

Lexer::Lexer(TokenStream* tokenStream, const QString& content, int initialState):
        m_content(content), m_tokenStream(tokenStream),
        m_curpos(0), m_contentSize(m_content.size()),
        m_tokenBegin(0), m_tokenEnd(0), m_haltCompiler(0)
{
    pushState(ErrorState);
    pushState(initialState);
}
开发者ID:scooterman,项目名称:kdevelop-erlang,代码行数:8,代码来源:erlanglexer.cpp

示例3: TEST

TEST(Wikipedia, AddAndMultiply)
{
    input = "1+0+1*1+1+1+1+1+1*1";

    nextToken();
    pushState(0);
    while((top() != STATE_ERROR) && (top() != STATE_ACCEPT))
        pushState(parseFunction(token));

    EXPECT_EQ(STATE_ACCEPT, top()) << "An error has occured while parsing expression";
    EXPECT_EQ(7, valueStack[nbValues - 1].value);
}
开发者ID:jaydee-io,项目名称:bnf2c,代码行数:12,代码来源:wikipedia_main.cpp

示例4: QTextCursor

void RTF::Reader::read(QIODevice* device, QTextDocument* text)
{
	try {
		// Open file
		m_text = 0;
		if (!m_cursor.isNull()) {
			m_cursor = QTextCursor();
		}
		m_text = text;
		m_cursor = QTextCursor(m_text);
		m_cursor.movePosition(QTextCursor::End);
		m_token.setDevice(device);
		setBlockDirection(Qt::LeftToRight);

		// Check file type
		m_token.readNext();
		if (m_token.type() == StartGroupToken) {
			pushState();
		} else {
			throw tr("Not a supported RTF file.");
		}
		m_token.readNext();
		if (m_token.type() != ControlWordToken || m_token.text() != "rtf" || m_token.value() != 1) {
			throw tr("Not a supported RTF file.");
		}

		// Parse file contents
		while (!m_states.isEmpty() && m_token.hasNext()) {
			m_token.readNext();

			if ((m_token.type() != EndGroupToken) && !m_in_block) {
				m_cursor.insertBlock();
				m_in_block = true;
			}

			if (m_token.type() == StartGroupToken) {
				pushState();
			} else if (m_token.type() == EndGroupToken) {
				popState();
			} else if (m_token.type() == ControlWordToken) {
				if (!m_state.ignore_control_word && functions.contains(m_token.text())) {
					functions[m_token.text()].call(this, m_token);
				}
			} else if (m_token.type() == TextToken) {
				if (!m_state.ignore_text) {
					m_cursor.insertText(m_codec->toUnicode(m_token.text()));
				}
			}
		}
	} catch (const QString& error) {
		m_error = error;
	}
}
开发者ID:YAPLLE,项目名称:manual-indexing,代码行数:53,代码来源:rtf_reader.cpp

示例5: pushState

void
PlayState::keyPressed
(const OIS::KeyEvent &e)
{
  // Tecla p --> PauseState.
  if (e.key == OIS::KC_P) {
    pushState(PauseState::getSingletonPtr());
  }
  if (e.key == OIS::KC_M) {
    pushState(FinalState::getSingletonPtr());
  }
  if ((e.key == OIS::KC_B) && (_timeLastObject <= 0)) 
    //AddDynamicObject(box);
  if (e.key == OIS::KC_E){
    //_shootKeyDown = true;
  } 
  else{
    _keyDownTime = 0.0;
  }
  if (e.key == OIS::KC_H){
    OBEntity *obAux = new OBEntity("none");
    std::cout << "OBEntities" << std::endl;
    for(std::vector<OBEntity *>::iterator it = _obEntities.begin(); it != _obEntities.end(); ++it) {
      obAux = *it;
      std::cout << obAux->getType() <<std::endl;
    }
  } 
  if (e.key == OIS::KC_A){ //AerialCamera
    _root->getAutoCreatedWindow()->removeAllViewports();
    _viewport = _root->getAutoCreatedWindow()->addViewport(_aerialCamera);
    double width = _viewport->getActualWidth();
    double height = _viewport->getActualHeight();
    _aerialCamera->setAspectRatio(width / height);
  }
  if (e.key == OIS::KC_D){ //DefaultCamera
    _root->getAutoCreatedWindow()->removeAllViewports();
    _viewport = _root->getAutoCreatedWindow()->addViewport(_camera);
    double width = _viewport->getActualWidth();
    double height = _viewport->getActualHeight();
    _camera->setAspectRatio(width / height);
  }

  if (e.key == OIS::KC_S && _trackedBody){
     _root->getAutoCreatedWindow()->removeAllViewports();
     _viewport = _root->getAutoCreatedWindow()->addViewport(_projectileCamera);
     double width = _viewport->getActualWidth();
     double height = _viewport->getActualHeight();
     _projectileCamera->setAspectRatio(width / height);
  } 
   
}
开发者ID:enriqueforner,项目名称:Hunter,代码行数:51,代码来源:PlayState.cpp

示例6: if

void RTF::Reader::insertUnicodeSymbol(qint32 value)
{
	m_cursor.insertText(QChar(value));

	for (int i = m_state.skip; i > 0;) {
		m_token.readNext();

		if (m_token.type() == TextToken) {
			int len = m_token.text().count();
			if (len > i) {
				m_cursor.insertText(m_codec->toUnicode(m_token.text().mid(i)));
				break;
			} else {
				i -= len;
			}
		} else if (m_token.type() == ControlWordToken) {
			--i;
		} else if (m_token.type() == StartGroupToken) {
			pushState();
			break;
		} else if (m_token.type() == EndGroupToken) {
			popState();
			break;
		}
	}
}
开发者ID:YAPLLE,项目名称:manual-indexing,代码行数:26,代码来源:rtf_reader.cpp

示例7: while

void CursorDropdown::onStateDeactivate(StateEvent* event)
{
    if (!_deactivated)
    {
        auto game = Game::getInstance();
        auto mouse = game->mouse();
        // workaround to get rid of cursor disappearing issues
        std::vector<unsigned int> icons;
        while (mouse->states()->size() > _initialMouseStack)
        {
            icons.push_back(mouse->state());
            mouse->popState();
        }
        if (icons.size() > 0)
        {
            icons.pop_back(); // remove empty icon from CursorDropdown state
            // place only new icons back in stack
            for (auto it = icons.rbegin(); it != icons.rend(); it++)
            {
                mouse->pushState(*it);
            }
        }
        mouse->setX(_initialX);
        mouse->setY(_initialY);
        _deactivated = true;
    }
}
开发者ID:McGr3g0r,项目名称:falltergeist,代码行数:27,代码来源:CursorDropdown.cpp

示例8: LOG_INFO

	void GamePlayState::exit() {
		LOG_INFO("GamePlayState: Exiting");

		// mConsole->setActive(false);

		// Debugging pos/dir writes. For performance profiling
		// std::cerr << mCamera->getPosition() << std::endl;
		// std::cerr << mCamera->getDirection() << std::endl;

		if (mPortalOverlay)
			mPortalOverlay->hide();

		if (mDebugOverlay)
			mDebugOverlay->hide();
		/*mConsole->setActive(false);
		mConsole->update(1); // to hide the console while exiting
		*/

		if (mToLoadScreen) {
			pushState(GameLoadState::getSingletonPtr());
			mToLoadScreen = false;
		}

		LOG_INFO("GamePlayState: Exited");
	}
开发者ID:Painpillow,项目名称:openDarkEngine,代码行数:25,代码来源:GamePlayState.cpp

示例9: pushState

void QGstreamerPlayerControl::updateMediaStatus()
{
    pushState();
    QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;

    switch (m_session->state()) {
    case QMediaPlayer::StoppedState:
        if (m_currentResource.isNull())
            m_mediaStatus = QMediaPlayer::NoMedia;
        else if (oldStatus != QMediaPlayer::InvalidMedia)
            m_mediaStatus = QMediaPlayer::LoadingMedia;
        break;

    case QMediaPlayer::PlayingState:
    case QMediaPlayer::PausedState:
        if (m_currentState == QMediaPlayer::StoppedState) {
            m_mediaStatus = QMediaPlayer::LoadedMedia;
        } else {
            if (m_bufferProgress == -1 || m_bufferProgress == 100)
                m_mediaStatus = QMediaPlayer::BufferedMedia;
            else
                m_mediaStatus = QMediaPlayer::StalledMedia;
        }
        break;
    }

    if (m_currentState == QMediaPlayer::PlayingState && !m_resources->isGranted())
        m_mediaStatus = QMediaPlayer::StalledMedia;

    //EndOfMedia status should be kept, until reset by pause, play or setMedia
    if (oldStatus == QMediaPlayer::EndOfMedia)
        m_mediaStatus = QMediaPlayer::EndOfMedia;

    popAndNotifyState();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:35,代码来源:qgstreamerplayercontrol.cpp

示例10: popStateFromStack

void stateMachine::tick(sf::Time deltaTime)
    {
        // check if someone wants to close the window
        // do this at the start of the loop so it doesnt happen inbetween rendering and updating    
        if (_closeWindow)
            {
                _window->close();
            }

        // check if a state is popped
        // We need this flag so a state isnt popped/cleaned up mid render/update. If it does happen, program crashes
        if (_popState)
            {
                // if so, pop it off the stack
                popStateFromStack();
            }

        // this makes sure that a state isnt changed mid render / update
        if (!_queuedState.empty())
            {
                for (int i = (_queuedState.size() - 1); i >= 0; i--)
                    {
                        pushState(_queuedState.front());
                        _queuedState.pop();
                    }
            }
        
        handleInput();
        update(deltaTime);
    }
开发者ID:TheCandianVendingMachine,项目名称:Breakout_TCVM,代码行数:30,代码来源:stateMachine.cpp

示例11: SDL_GetError

void Game::init(int width, int height, bool fullscreen) {
	Game::print("Initialisation du jeu...");
	end = false;

	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) == -1) {
		Game::assert(std::string("Impossible d'initialiser la SDL") + SDL_GetError());
	}

	atexit(SDL_Quit);

	if (TTF_Init() == -1) {
		Game::assert(std::string("Impossible d'initialiser SDL_ttf : ") + TTF_GetError());
	}

	atexit(TTF_Quit);

	Uint32 flags = SDL_HWSURFACE | SDL_DOUBLEBUF;
	if (fullscreen) flags |= SDL_FULLSCREEN;
	if ((window = SDL_SetVideoMode(width, height, 0, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)
		Game::assert(std::string("La fenêtre n'a pas pu être créé : ") + SDL_GetError());
	SDL_WM_SetCaption("My Game Square", NULL);

	std::srand(std::time(0));

	std::string fontName = "/usr/share/fonts/TTF/DejaVuSans.ttf";
	if ((font = TTF_OpenFont(fontName.c_str(), 28)) == NULL)
		Game::assert(std::string("Impossible de charger la police " + fontName + " : " + TTF_GetError()));

	Game::print("Création du menu...");
	GameState *menu = new Menu();
	if (!menu)
		Game::assert("Création du menu impossible");
	Game::print("Menu comme premier état du jeu.");
	pushState(menu);
}
开发者ID:cactusmutant,项目名称:Square,代码行数:35,代码来源:game.cpp

示例12: pause

void CGameEngine::winGame()
{
	CLog::debug("Partie gagne");
	pause();
	boost::shared_ptr<CGameWonState> winState(new CGameWonState());
	pushState(winState);
}
开发者ID:isra17,项目名称:toursatan,代码行数:7,代码来源:CGameEngine.cpp

示例13: popState

void StateManager::changeState(State *state) {
	// pop the current state
	popState();

	// push the new state
	pushState(state);
}
开发者ID:kidaa,项目名称:final-fantasy-1-clone,代码行数:7,代码来源:statemanager.cpp

示例14: pushState

//-----------------------------------------------------------------
    void
WorldMap::runIntro()
{
#ifdef HAVE_SMPEG
    Path movieFile = Path::dataReadPath("images/menu/intro.mpg");
    if (movieFile.exists()) {
        pushState(new MovieState(movieFile));
        return;
    }

    LOG_WARNING(ExInfo("cannot find intro")
            .addInfo("file", movieFile.getNative()));
#endif

    pushState(new DemoMode(Path::dataReadPath("script/share/demo_intro.lua")));
}
开发者ID:FishFilletsNG,项目名称:Fish-Fillets-NG,代码行数:17,代码来源:WorldMap.cpp

示例15: popState

void Game::changeState(GameState* state) {
    if(!this->states.empty())
        popState();
    pushState(state);

    return;
}
开发者ID:CFelipe,项目名称:Xadribol,代码行数:7,代码来源:Game.cpp


注:本文中的pushState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。