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


C++ quitGame函数代码示例

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


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


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