本文整理汇总了C++中quitGame函数的典型用法代码示例。如果您正苦于以下问题:C++ quitGame函数的具体用法?C++ quitGame怎么用?C++ quitGame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quitGame函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Scene
void StarkEngine::mainLoop() {
// Load the initial scene
_scene = new Scene(_gfx);
while (!shouldQuit()) {
// Process events
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
// Handle any buttons, keys and joystick operations
if (e.type == Common::EVENT_KEYDOWN) {
if (e.kbd.ascii == 'q') {
quitGame();
break;
} else {
//handleChars(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
}
}
/*if (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_KEYUP) {
handleControls(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
}*/
// Check for "Hard" quit"
//if (e.type == Common::EVENT_QUIT)
// return;
/*if (event.type == Common::EVENT_SCREEN_CHANGED)
_refreshDrawNeeded = true;*/
}
updateDisplayScene();
g_system->delayMillis(50);
}
}
开发者ID:Snejp,项目名称:tlj-residual,代码行数:31,代码来源:stark.cpp
示例2: QGraphicsScene
void MainWindow::showEvent(QShowEvent *)
{
// Setting the QGraphicsScene
scene = new QGraphicsScene(0,0,width(),ui->graphicsView->height());
ui->graphicsView->setScene(scene);
scene->setBackgroundBrush(QBrush(QImage(":/image/background.png")));
// Create world
world = new b2World(b2Vec2(0.0f, -9.8f)); //橫跟直的重力
// Setting Size
GameItem::setGlobalSize(QSizeF(32,18),size()); //size of BOX2D windowsize
QSound *music =new QSound("angrybird.wav");
music->play();
initial();
// Timer
connect(&timer,SIGNAL(timeout()), this, SLOT(tick()));
connect(this,SIGNAL(quitGame()), this, SLOT(QUITSLOT()));
//connect(&timerpig, SIGNAL(timeout()), this, SLOT(deletepig()));
timer.start(100/6);
//timerpig.start(1000);
//create the restart button
/*QPushButton *restartButton = new QPushButton;
restartButton->setGeometry(QRect(QPoint(100,50),QSize(100, 100)));
QPixmap pixmap(":/image/restart.jpg");
QIcon ButtonIcon(pixmap);
restartButton->setIcon(ButtonIcon);
restartButton->setIconSize(pixmap.rect().size());
scene->addWidget(restartButton);
connect(restartButton,SIGNAL(clicked(bool)),this,SLOT(restart()));*/
}
开发者ID:Amyya,项目名称:pd2-Angrybird,代码行数:33,代码来源:mainwindow.cpp
示例3: switch
void RingworldDemoGame::processEvent(Event &event) {
if (event.eventType == EVENT_KEYPRESS) {
switch (event.kbd.keycode) {
case Common::KEYCODE_F1:
// F1 - Help
MessageDialog::show(DEMO_HELP_MSG, OK_BTN_STRING);
break;
case Common::KEYCODE_F2: {
// F2 - Sound Options
ConfigDialog *dlg = new ConfigDialog();
dlg->runModal();
delete dlg;
g_globals->_soundManager.syncSounds();
g_globals->_events.setCursorFromFlag();
break;
}
case Common::KEYCODE_F3:
// F3 - Quit
quitGame();
event.handled = false;
break;
default:
break;
}
} else if (event.eventType == EVENT_BUTTON_DOWN) {
pauseGame();
event.handled = true;
}
}
开发者ID:CatalystG,项目名称:scummvm,代码行数:32,代码来源:ringworld_demo.cpp
示例4: debugC
void ToucheEngine::op_setFlag() {
debugC(9, kDebugOpcodes, "ToucheEngine::op_setFlag()");
uint16 flag = _script.readNextWord();
int16 val = *_script.stackDataPtr;
_flagsTable[flag] = val;
switch (flag) {
case 104:
_currentKeyCharNum = val;
break;
case 611:
if (val != 0)
quitGame();
break;
case 612:
_flagsTable[613] = getRandomNumber(val);
break;
case 614:
case 615:
_fullRedrawCounter = 1;
break;
case 618:
showCursor(val == 0);
break;
case 619:
debug(0, "Unknown music flag %d", val);
break;
}
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:28,代码来源:opcodes.cpp
示例5: pause
/** Method to handle key presses. WASD keys move the main character, arrow keys shoot fireballs, and other keys can access start, pause, and quit */
void MainWindow::keyPressEvent(QKeyEvent *e) {
if(gameInProgress) {
if(e->key() == Qt::Key_D) {
game->getNinja()->moveRight();
}
if(e->key() == Qt::Key_A) {
game->getNinja()->moveLeft();
}
if(e->key() == Qt::Key_W) {
game->getNinja()->jump();
}
if(e->key() == Qt::Key_Right) {
game->fireball(0);
}
if(e->key() == Qt::Key_Left) {
game->fireball(1);
}
if(e->key() == Qt::Key_Up) {
game->fireball(2);
}
if(e->key() == Qt::Key_Down) {
game->fireball(3);
}
if(e->key() == Qt::Key_P) {
pause();
}
}
if(e->key() == Qt::Key_F1) {
startSlot();
}
if(e->key() == Qt::Key_Escape) {
quitGame();
}
}
开发者ID:trevorar,项目名称:sidescroller_project,代码行数:35,代码来源:mainwindow.cpp
示例6: endGame
static void endGame(void)
{
videomode(VIDEOMODE_80x24);
mixedTextMode();
speakNoMoreMoves();
cputsxy(0, 0, " No more moves - GAME OVER!!");
gotoxy(0,1);
cprintf( " You made it to level %u", getLevel());
cputsxy(0, 3, " Play again (Y/N)?");
while (true) {
switch (cgetc()) {
case 'y':
case 'Y':
return;
case 'n':
case 'N':
case CH_ESC:
case 'q':
case 'Q':
quitGame();
break;
default:
badThingHappened();
break;
}
}
}
开发者ID:jeremysrand,项目名称:a2bejwld,代码行数:32,代码来源:ui.c
示例7: while
void StarkEngine::mainLoop() {
while (!shouldQuit()) {
_frameLimiter->startFrame();
processEvents();
if (_userInterface->shouldExit()) {
quitGame();
break;
}
if (_userInterface->hasQuitToMainMenuRequest()) {
_userInterface->performQuitToMainMenu();
}
if (_resourceProvider->hasLocationChangeRequest()) {
_global->setNormalSpeed();
_resourceProvider->performLocationChange();
}
updateDisplayScene();
// Swap buffers
_frameLimiter->delayBeforeSwap();
_gfx->flipBuffer();
}
}
开发者ID:orangeforest11,项目名称:residualvm,代码行数:27,代码来源:stark.cpp
示例8: if
void EndlessGameWidget::dealPressed(QPointF mousePos, Qt::MouseButton button)
{
// Choose the correct item at press position
currentPos = mousePos;
if (flame->in(mousePos, gameboardInfo->width(), gameboardInfo->height()))
itemAtPressPos = flame;
else if (star->in(mousePos, gameboardInfo->width(), gameboardInfo->height()))
itemAtPressPos = star;
else if (hint->in(mousePos, gameboardInfo->width(), gameboardInfo->height()))
itemAtPressPos = hint;
else if (resetItem->in(mousePos,
gameboardInfo->width(),
gameboardInfo->height()))
itemAtPressPos = resetItem;
else if (exitItem->in(mousePos, gameboardInfo->width(), gameboardInfo->height()))
itemAtPressPos = exitItem;
else
itemAtPressPos = NULL;
// Quit if it's a right button
// May be abandoned later
if (button == Qt::RightButton)
{
quitGame();
return;
}
// Let the gesture controller to deal the press event
gestureController->dealPressed(mousePos);
}
开发者ID:tecton,项目名称:HexGame,代码行数:30,代码来源:endlessgamewidget.cpp
示例9: initGraphics
void GagEngine::Init()
{
initGraphics(_SCREEN_WIDTH, _SCREEN_HEIGHT, true, &_SCREEN_FORMAT);
//DEBUG: load files from uncompressed file system
_archive.reset(new Common::FSDirectory(ConfMan.get("path") + '/' + "Gag01", 2, false));
// _archive.reset(new CdfArchive("Gag01.cdf", false));
//DEBUG
#ifdef DEBUG_SKIM_SCRIPT
_script = "GAG_CMD_CLEAN.CFG";
// _section = "CFG";
Common::Error script_error = StateScript();
debug("skim debug: ");
for(std::set<Common::String>::iterator it = G_STRING_SET.begin(); it != G_STRING_SET.end(); ++it)
debug("\t%s", it->c_str());
quitGame();
_state = GS_ACTIVE;
#endif
// ExtractCdf("Gag01.cdf");
// ExtractCdf("Gag02.cdf");
// ExtractCdf("gag01.cdf");
// ExtractCdf("GAG3.cdf");
// ExtractCdf("GARY.cdf");
// BitmapTest();
// AnimationTest();
// AnimationTuckerTest();
}
开发者ID:superg,项目名称:scummvm,代码行数:29,代码来源:gag.cpp
示例10: startgame
void MainWindow::showEvent(QShowEvent *){
//初始化
startgame();
//計時器
connect(&timer,SIGNAL(timeout()),this,SLOT(tick()));
connect(this,SIGNAL(quitGame()),this,SLOT(QUITSLOT()));
timer.start(10);
}
开发者ID:F74046072,项目名称:pd2-Angrybird,代码行数:8,代码来源:mainwindow.cpp
示例11: QGraphicsScene
void MainWindow::showEvent(QShowEvent *)
{
// Setting the QGraphicsScene
scene = new QGraphicsScene(0,0,width()*2,height()*2);
QPixmap bg;
bg.load(":/image/backgroung.png");
bg = bg.scaled(width()*2,height()*2);
scene->addPixmap(bg);
ui->graphicsView->setScene(scene);
ui->graphicsView-> scale(0.5,0.5);
for(int i=0;i<10;i++){
scorenumberPic[i].load("://image/number_"+QString::number(i)+".png");
scorenumberPic[i]=scorenumberPic[i].scaled(scorenumberPic[i].width()*4,scorenumberPic[i].height()*4);
}
button = new QPushButton("",this);
QPixmap icon;
icon.load(":/image/restart.png");
icon = icon.scaled(800,800);
button->setIcon(icon);
button->setIconSize(QSize(70,70));
button->setGeometry(10,10,70,70);
button->setFlat(true);
button->show();
connect(button,SIGNAL(clicked(bool)),this,SLOT(restart()));
button1 = new QPushButton("",this);
icon.load(":/image/exit.png");
icon = icon.scaled(800,800);
button1->setIcon(icon);
button1->setIconSize(QSize(70,70));
button1->setGeometry(100,10,70,70);
button1->setFlat(true);
button1->show();
connect(button1,SIGNAL(clicked(bool)),this,SLOT(quitgame()));
// Create world
world = new b2World(b2Vec2(0.0f, -9.8f));
world->SetContactListener(&listener);
// Setting Size
GameItem::setGlobalSize(QSizeF(32,18),size());
// Create ground (You can edit here)
itemList.push_back(new Land(32,-17,64,0,QPixmap(":/ground.pn").scaled(width()*2,height()/6.0),world,scene));
//itemList.push_back(new Land(32,1.5,3,35,QPixmap(":/ground.pn").scaled(width(),height()/6.0),world,scene));//r bound
//itemList.push_back(new Land(0,1.5,3,35,QPixmap(":/ground.pn").scaled(width(),height()/6.0),world,scene));//l bound
createStage();
createBird(blue);
// Timer
connect(&timer,SIGNAL(timeout()),this,SLOT(tick()));
connect(&timer,SIGNAL(timeout()),this,SLOT(showScore()));
timer.start(100/6);
connect(this,SIGNAL(quitGame()),this,SLOT(QUITSLOT()));
connect(&timer_z,SIGNAL(timeout()),this,SLOT(zoomIn()));
connect(&timer_f,SIGNAL(timeout()),this,SLOT(followBird()));
connect(&timer_waiter,SIGNAL(timeout()),this,SLOT(createBird()));
}
开发者ID:EvanChenPrograming,项目名称:pd2-Angrybird,代码行数:56,代码来源:mainwindow.cpp
示例12: QGraphicsScene
void MainWindow::showEvent(QShowEvent *)
{
// Setting the QGraphicsScene
//scene = new QGraphicsScene(0,0,width(),ui->graphicsView->height());
scene = new QGraphicsScene(0,0,1920,1080);
ui->graphicsView->setScene(scene);
// Create world
world = new b2World(b2Vec2(0.0f, -9.8f));
// Setting Size
GameItem::setGlobalSize(QSizeF(32,18),size());
// Create ground (You can edit here)
itemList.push_back(new Land(16,1.5,32,3,QPixmap(":/ground.png").scaled(width(),height()/6.0),world,scene));
shoot.setPixmap(QPixmap(":/shot.png"));
scene->addItem(&shoot);
shoot.setPos(QPointF(500,500));
// Create bird (You can edit here)
birdie[0] = new Bird(1,4,0.27f,&timer,QPixmap(":/red.png").scaled(height()/9.0,height()/9.0) ,world,scene,red);
birdie[1] = new Bird(2,4,0.27f,&timer,QPixmap(":/blue.png").scaled(height()/9.0,height()/9.0) ,world,scene,blue);
birdie[2] = new Bird(3,4,0.27f,&timer,QPixmap(":/yellow.png").scaled(height()/9.0,height()/9.0),world,scene,yellow);
birdie[3] = new Bird(4,4,0.27f,&timer,QPixmap(":/black.png").scaled(height()/9.0,height()/9.0) ,world,scene,black);
birdie[7] = new Bird(25,4,0.27f,&timer,QPixmap(":/pig.png").scaled(height()/9.0,height()/9.0) ,world,scene,pig);
avaliable[7]=true;
shootpos->setX(150);
shootpos->setY(200);
birdie[0]->SetPosion(shootpos);
birdie[0]->g_body->SetAwake(false);
// Setting the Velocity
for (int i=0;i<4;i++){
avaliable[i]=true;
shooted [i]=false;
birdie[i]->setLinearVelocity(b2Vec2(0,0));
itemList.push_back(birdie[i]);
}
for(int i=4;i<7;i++)avaliable[i]=false;
// Timer
connect(&timer,SIGNAL(timeout()),this,SLOT(tick()));
connect(&sleep,SIGNAL(timeout()),this,SLOT(Ready()));
connect(this,SIGNAL(quitGame()),this,SLOT(QUITSLOT()));
connect(ui->QuiButton,SIGNAL(released()),this,SLOT(QUITSLOT()));
connect(ui->RetryButton,SIGNAL(released()),this,SLOT(Retry()));
timer.start(100/6);
}
开发者ID:yih6208,项目名称:pd2-Angrybird,代码行数:55,代码来源:mainwindow.cpp
示例13: setparam
void MainWindow::showEvent(QShowEvent *)
{
setparam();
setGame();
// Timer
connect(&timer,SIGNAL(timeout()),this,SLOT(tick()));
connect(this,SIGNAL(quitGame()),this,SLOT(QUITSLOT()));
timer.start(100/6);
}
开发者ID:SunnyChing,项目名称:pd2-Angrybird,代码行数:11,代码来源:mainwindow.cpp
示例14: usage
void usage() {
cout << "Usage: lost_penguins [OPTIONS]\n\n";
cout << " -datadir Changes the data directory. Default: data/\n";
cout << " -animfile Changes the animation file name. Default: animation_data.anim\n";
cout << " -w, -width Changes resolution (width) of game. Default: 640\n";
cout << " -h, -height Changes resolution (height) of game. Default: 480\n";
cout << " -fs, -full Enable fullscreen. Default: disabled\n";
cout << " -map Load specified map from data dir. Default: disabled (map1 as a fallback)\n";
cout << " -scenario Load specified Scenario from data dir. Default: lv1\n";
cout << " -h, --help Show this text \n";
quitGame(4);
}
开发者ID:jjermann,项目名称:lost_penguins,代码行数:12,代码来源:lost_penguins.cpp
示例15: doQuit
static void doQuit()
{
if (game.previousStatus == IN_TITLE)
{
quitGame();
}
else
{
game.menu = initYesNoMenu(_("Exit the game?"), &quitToTitle, &showMainMenu);
game.drawMenu = &drawYesNoMenu;
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:14,代码来源:main_menu.c
示例16: main
/* main function of the game. */
int main( int argc, char* args[] ){
/*need to free mainGame, file_slots, and screen*/
int gui=((argc>1)&&(!strcmp(args[1],"gui")))?1:0;
srand ((unsigned int)time(NULL) );
standart_fail = 0;
loadChess(gui); /* generic function to load the game with all the functions specific per chess*/
if(standart_fail){ return 1;}
if(gui==0){
(*mainGame->ConsoleMain)(mainGame->gameInfo);
}
else{
/*Initialize all SDL subsystems - where are 8 subsystems composing the SDL=GUI */
if( SDL_Init( SDL_INIT_VIDEO ) == -1 ){SDL_InitError(); (*mainGame->deleteGameFunc)(gui); deleteSlots(SLOT_NUM); standart_fail=true; return 1;}
/*THE GUI TREE ROOT */
screen = BuildWindow(SCREEN_WIDTH, SCREEN_HEIGHT);
/* never deleted (as long as we don't quit - quit button) */
if(standart_fail){(*mainGame->deleteGameFunc)(gui) ; deleteSlots(SLOT_NUM); return 1;}
showMenu();
if(standart_fail){return quitGame(gui);}
handleEvents(screen);
}
return quitGame(gui);
}
开发者ID:tuval10,项目名称:Chess,代码行数:24,代码来源:gui.c
示例17: restart
void MainWindow::keyPressEvent(QKeyEvent* event){
if(event->key()==Qt::Key_Z && birdsitua==3 && birdskill==1){ //放開後飛行中還沒用技能
std::cout << "skill" << std::endl ;
birdList[color]->skill();
std::cout << "skill2" << std::endl ;
movetimer->start(1000);
birdsitua = 0; //放完技能
}
if(event->key()==Qt::Key_R){
restart();
}
if(event->key()==Qt::Key_Q){
quitGame();
}
}
开发者ID:Amyya,项目名称:pd2-Angrybird,代码行数:15,代码来源:mainwindow.cpp
示例18: switch
void Ringworld2Game::processEvent(Event &event) {
if (event.eventType == EVENT_KEYPRESS) {
switch (event.kbd.keycode) {
case Common::KEYCODE_F1:
// F1 - Help
HelpDialog::show();
break;
case Common::KEYCODE_F2:
// F2 - Sound Options
SoundDialog::execute();
break;
case Common::KEYCODE_F3:
// F3 - Quit
quitGame();
event.handled = false;
break;
case Common::KEYCODE_F4:
// F4 - Restart
restartGame();
g_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F7:
// F7 - Restore
restoreGame();
g_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F8:
// F8 - Credits
warning("TODO: Show Credits");
break;
case Common::KEYCODE_F10:
// F10 - Pause
GfxDialog::setPalette();
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
g_globals->_events.setCursorFromFlag();
break;
default:
break;
}
}
}
开发者ID:rkmarvin,项目名称:scummvm,代码行数:48,代码来源:ringworld2_logic.cpp
示例19: switch
void RingworldGame::processEvent(Event &event) {
if (event.eventType == EVENT_KEYPRESS) {
switch (event.kbd.keycode) {
case Common::KEYCODE_F1:
// F1 - Help
MessageDialog::show(HELP_MSG, OK_BTN_STRING);
break;
case Common::KEYCODE_F2: {
// F2 - Sound Options
ConfigDialog *dlg = new ConfigDialog();
dlg->runModal();
delete dlg;
_globals->_soundManager.syncSounds();
_globals->_events.setCursorFromFlag();
break;
}
case Common::KEYCODE_F3:
// F3 - Quit
quitGame();
event.handled = false;
break;
case Common::KEYCODE_F4:
// F4 - Restart
restartGame();
_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F7:
// F7 - Restore
restoreGame();
_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F10:
// F10 - Pause
GfxDialog::setPalette();
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
_globals->_events.setCursorFromFlag();
break;
default:
break;
}
}
}
开发者ID:TomFrost,项目名称:scummvm,代码行数:48,代码来源:ringworld_logic.cpp
示例20: main
int main(int argc, char* argv[]) {
cout << "Starting Lost Penguins!\n";
//Clean exit on Windows close...
atexit(SDL_Quit);
cout << "Loading configuration file...\n";
//Maybe: add some more location checks...
if (readConfig("/usr/local/etc/lost_penguins.conf")) cout << "Loaded /usr/local/etc/lost_penguins.conf...\n";
else cout << "Configuration files not found! Set default parameters...\n";
parseInput(argc,argv);
if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_AUDIO)==0) {
cout << "Initialized SDL...\n";
} else {
cout << "Couldn't initialize SDL!\n";
exit(-1);
}
SDL_ShowCursor(SDL_DISABLE);
//Change directory to datadir
cout << "ImageCache...\n";
imgcache=new ImageCache();
cout << "SoundCache...\n";
sndcache=new SoundCache();
cout << "GraphicsEngine...\n";
gfxeng=new GraphicsEngine();
cout << "SoundEngine...\n";
sfxeng=new SoundsEngine();
cout << "Fonts...\n";
font=new Font(imgcache->loadImage(1,"font_arial_white_16_01.png").surface);
font2=new Font(imgcache->loadImage(1,"font_arial_red_16_01.png").surface);
cout << "InputHandler...\n";
input=new InputHandler();
cout << "Initializing Scenario...\n";
scenario=new Scenario();
startScreen();
while (true) {
input->update();
scenario->physic->update();
gfxeng->draw();
SDL_Delay(1);
}
quitGame(-2);
}
开发者ID:jjermann,项目名称:lost_penguins,代码行数:48,代码来源:lost_penguins.cpp
注:本文中的quitGame函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论