本文整理汇总了C++中shouldQuit函数的典型用法代码示例。如果您正苦于以下问题:C++ shouldQuit函数的具体用法?C++ shouldQuit怎么用?C++ shouldQuit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shouldQuit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clearKeyQueue
int AgiEngine::waitAnyKey() {
int key = 0;
clearKeyQueue();
debugC(3, kDebugLevelInput, "waiting... (any key)");
while (!(shouldQuit() || _restartGame)) {
pollTimer();
key = doPollKeyboard();
if (key)
break;
_gfx->doUpdate();
}
// Have to clear it as original did not set this variable, and we do it in doPollKeyboard()
_game.keypress = 0;
return key;
}
示例2: onStart
void App::run()
{
window_->show();
onStart();
double last_update_time = getTime();
while (!shouldQuit())
{
processEvents();
double update_time = getTime();
double dt = update_time - last_update_time;
last_update_time = update_time;
onUpdate(dt);
onRender();
window_->swapBuffers();
}
onStop();
}
示例3: seq_demo
Common::Error KyraEngine_LoK::go() {
if (_res->getFileSize("6.FNT"))
_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
_screen->setScreenDim(0);
_abortIntroFlag = false;
if (_flags.isDemo && !_flags.isTalkie) {
_seqPlayerFlag = true;
seq_demo();
_seqPlayerFlag = false;
} else {
setGameFlag(0xF3);
setGameFlag(0xFD);
if (_gameToLoad == -1) {
setGameFlag(0xEF);
_seqPlayerFlag = true;
seq_intro();
_seqPlayerFlag = false;
if (_flags.isDemo) {
_screen->fadeToBlack();
return Common::kNoError;
}
if (shouldQuit())
return Common::kNoError;
if (_skipIntroFlag && _abortIntroFlag && saveFileLoadable(0))
resetGameFlag(0xEF);
}
_eventList.clear();
startup();
resetGameFlag(0xEF);
mainLoop();
}
return Common::kNoError;
}
示例4: init
void App::run()
{
init();
onSetup();
window_->show();
while (!shouldQuit())
{
input_.update();
timer_.update();
processEvents();
if (screen_)
{
screen_->onUpdate();
screen_->onRender();
}
window_->swapBuffers();
}
destroy();
}
示例5: invokeTestsuites
void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) {
Common::Array<Testsuite *>::const_iterator iter;
uint count = 1;
Common::Point pt = Testsuite::getDisplayRegionCoordinates();
int numSuitesEnabled = cfMan.getNumSuitesEnabled();
if (!numSuitesEnabled)
return;
for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) {
if (shouldQuit()) {
return;
}
(*iter)->reset();
if ((*iter)->isEnabled()) {
Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, numSuitesEnabled, pt);
(*iter)->execute();
}
}
}
示例6: checkAllMotions
void AgiEngine::interpretCycle() {
int oldSound, oldScore;
if (_game.playerControl)
_game.vars[vEgoDir] = _game.viewTable[0].direction;
else
_game.viewTable[0].direction = _game.vars[vEgoDir];
checkAllMotions();
oldScore = _game.vars[vScore];
oldSound = getflag(fSoundOn);
_game.exitAllLogics = false;
while (runLogic(0) == 0 && !(shouldQuit() || _restartGame)) {
_game.vars[vWordNotFound] = 0;
_game.vars[vBorderTouchObj] = 0;
_game.vars[vBorderCode] = 0;
oldScore = _game.vars[vScore];
setflag(fEnteredCli, false);
_game.exitAllLogics = false;
resetControllers();
}
resetControllers();
_game.viewTable[0].direction = _game.vars[vEgoDir];
if (_game.vars[vScore] != oldScore || getflag(fSoundOn) != oldSound)
writeStatus();
_game.vars[vBorderTouchObj] = 0;
_game.vars[vBorderCode] = 0;
setflag(fNewRoomExec, false);
setflag(fRestartGame, false);
setflag(fRestoreJustRan, false);
if (_game.gfxMode) {
updateViewtable();
_gfx->doUpdate();
}
}
示例7: snd_processEnvironmentalSoundEffect
bool KyraRpgEngine::snd_processEnvironmentalSoundEffect(int soundId, int block) {
if (!_sound->sfxEnabled() || shouldQuit())
return false;
if (_environmentSfx)
snd_playSoundEffect(_environmentSfx, _environmentSfxVol);
int dist = 0;
if (block) {
dist = getBlockDistance(_currentBlock, block);
if (dist > _envSfxDistThreshold) {
_environmentSfx = 0;
return false;
}
}
_environmentSfx = soundId;
_environmentSfxVol = (15 - ((block || (_flags.gameID == GI_LOL && dist < 2)) ? dist : 0)) << 4;
return true;
}
示例8: initGraphics
void CineEngine::showSplashScreen() {
Common::File file;
if (!file.open("sony.lbm"))
return;
Image::IFFDecoder decoder;
if (!decoder.loadStream(file))
return;
const Graphics::Surface *surface = decoder.getSurface();
if (surface->getWidth() == 640 && surface->getHeight() == 480) {
initGraphics(640, 480, true);
const byte *palette = decoder.getPalette();
int paletteColorCount = decoder.getPaletteColorCount();
g_system->getPaletteManager()->setPalette(palette, 0, paletteColorCount);
g_system->copyRectToScreen(surface->getPixels(), 640, 0, 0, 640, 480);
g_system->updateScreen();
Common::EventManager *eventMan = g_system->getEventManager();
bool done = false;
uint32 now = g_system->getMillis();
while (!done && g_system->getMillis() - now < 2000) {
Common::Event event;
while (eventMan->pollEvent(event)) {
if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
done = true;
break;
}
if (shouldQuit())
done = true;
}
}
}
decoder.destroy();
}
示例9: loadCFIEC
/**
* Main game loop. Handles potentially playing the game multiple times, such as if the player
* loses, and chooses to start playing the game again.
*/
void MortevielleEngine::mainGame() {
if (_reloadCFIEC)
loadCFIEC();
for (_crep = 1; _crep <= _x26KeyCount; ++_crep)
decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
_menu->initMenu();
charToHour();
initGame();
clearScreen();
drawRightFrame();
_mouse->showMouse();
// Loop to play the game
do {
playGame();
if (shouldQuit())
return;
} while (!_quitGame);
}
示例10: while
void SherlockEngine::sceneLoop() {
while (!shouldQuit() && _scene->_goToScene == -1) {
// See if a script needs to be completed from either a goto room code,
// or a script that was interrupted by another script
if (_talk->_scriptMoreFlag == 1 || _talk->_scriptMoreFlag == 3)
_talk->talkTo(_talk->_scriptName);
else
_talk->_scriptMoreFlag = 0;
// Handle any input from the keyboard or mouse
handleInput();
if (_people->_savedPos.x == -1) {
_canLoadSave = true;
_scene->doBgAnim();
_canLoadSave = false;
}
}
_scene->freeScene();
_people->freeWalk();
}
示例11: while
void DrasculaEngine::placeVonBraun(int pointX) {
trackVonBraun = (pointX < vonBraunX) ? 0 : 1;
vonBraunHasMoved = 1;
while (!shouldQuit()) {
updateEvents();
updateRoom();
updateScreen();
if (trackVonBraun == 0) {
vonBraunX = vonBraunX - 5;
if (vonBraunX <= pointX)
break;
} else {
vonBraunX = vonBraunX + 5;
if (vonBraunX >= pointX)
break;
}
pause(5);
}
vonBraunHasMoved = 0;
}
示例12: getTime
bool AGOSEngine::kickoffTimeEvents() {
uint32 cur_time;
TimeEvent *te;
bool result = false;
if (getGameType() == GType_FF && _clockStopped)
return result;
cur_time = getTime() - _gameStoppedClock;
while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !shouldQuit()) {
result = true;
_pendingDeleteTimeEvent = te;
invokeTimeEvent(te);
if (_pendingDeleteTimeEvent) {
_pendingDeleteTimeEvent = NULL;
delTimeEvent(te);
}
}
return result;
}
示例13: CSTimeConsole
Common::Error MohawkEngine_CSTime::run() {
MohawkEngine::run();
_console = new CSTimeConsole(this);
_gfx = new CSTimeGraphics(this);
_cursor = new DefaultCursorManager(this, ID_CURS);
_interface = new CSTimeInterface(this);
_view = new CSTimeView(this);
_view->setupView();
_view->setModule(new CSTimeModule(this));
while (!shouldQuit()) {
switch (_state) {
case kCSTStateStartup:
// We just jump straight to the case for now.
_state = kCSTStateNewCase;
break;
case kCSTStateNewCase:
initCase();
_state = kCSTStateNewScene;
break;
case kCSTStateNewScene:
nextScene();
_state = kCSTStateNormal;
break;
case kCSTStateNormal:
update();
break;
}
}
return Common::kNoError;
}
示例14: GUI_V2_BUTTON
void KyraEngine_HoF::bookLoop() {
Button bookButtons[5];
GUI_V2_BUTTON(bookButtons[0], 0x24, 0, 0, 1, 1, 1, 0x4487, 0, 0x82, 0xBE, 0x0A, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
bookButtons[0].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookPrevPage);
GUI_V2_BUTTON(bookButtons[1], 0x25, 0, 0, 1, 1, 1, 0x4487, 0, 0xB1, 0xBE, 0x0A, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
bookButtons[1].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookNextPage);
GUI_V2_BUTTON(bookButtons[2], 0x26, 0, 0, 1, 1, 1, 0x4487, 0, 0x8F, 0xBE, 0x21, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
bookButtons[2].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookClose);
GUI_V2_BUTTON(bookButtons[3], 0x27, 0, 0, 1, 1, 1, 0x4487, 0, 0x08, 0x08, 0x90, 0xB4, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
bookButtons[3].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookPrevPage);
GUI_V2_BUTTON(bookButtons[4], 0x28, 0, 0, 1, 1, 1, 0x4487, 0, 0xAA, 0x08, 0x8E, 0xB4, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
bookButtons[4].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookNextPage);
Button *buttonList = 0;
for (uint i = 0; i < ARRAYSIZE(bookButtons); ++i)
buttonList = _gui->addButtonToList(buttonList, &bookButtons[i]);
showBookPage();
_bookShown = true;
while (_bookShown && !shouldQuit()) {
checkInput(buttonList);
removeInputTop();
if (_bookCurPage != _bookNewPage) {
_bookCurPage = _bookNewPage;
_screen->clearPage(2);
loadBookBkgd();
showBookPage();
snd_playSoundEffect(0x64);
_screen->copyRegion(0, 0, 0, 0, 0x140, 0xC8, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
}
_system->delayMillis(10);
}
_screen->clearPage(2);
}
示例15: isCursorVisible
void DrasculaEngine::gotoObject(int pointX, int pointY) {
bool cursorVisible = isCursorVisible();
hideCursor();
if (currentChapter == 5 || currentChapter == 6) {
if (hare_se_ve == 0) {
curX = roomX;
curY = roomY;
updateRoom();
updateScreen();
return;
}
}
roomX = pointX;
roomY = pointY;
startWalking();
while (!shouldQuit()) {
updateRoom();
updateScreen();
updateEvents();
if (characterMoved == 0)
break;
pause(3);
}
if (walkToObject == 1) {
walkToObject = 0;
trackProtagonist = trackFinal;
}
updateRoom();
updateScreen();
// roomNumber -2 is end credits. Do not show cursor there
if (cursorVisible && roomNumber != -2)
showCursor();
}