void MainWindow::setupActions() { QAction *newGame = new QAction(this); newGame->setShortcut(Qt::CTRL + Qt::Key_N); connect(newGame, SIGNAL(triggered()), this, SLOT(startNewGame())); this->addAction(newGame); QAction *quitAction = new QAction(this); QList<QKeySequence> quitKeys; quitKeys.append(Qt::CTRL + Qt::Key_C); quitKeys.append(Qt::Key_MediaPrevious); quitAction->setShortcuts(quitKeys); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); this->addAction(quitAction); QAction *fireAction = new QAction(this); fireAction->setShortcut(Qt::Key_Space); connect(fireAction, SIGNAL(triggered()), this, SLOT(fire())); this->addAction(fireAction); pauseAction = new QAction(this); QList<QKeySequence> pauseKeys; pauseKeys.append(Qt::Key_Escape); pauseKeys.append(Qt::Key_Pause); pauseKeys.append(Qt::Key_MediaNext); pauseAction->setShortcuts(pauseKeys); connect(pauseAction, SIGNAL(triggered()), this, SLOT(toggleGamePaused())); this->addAction(pauseAction); }
Playground::Playground(QWidget *parent, int colorCount, int columns, int rows) : QGLWidget(parent) { this->scrcfg.width = this->width(); this->scrcfg.height = this->height(); this->scrcfg.bpp = 32; qsrand(QDateTime::currentDateTime().toTime_t()); colors = colorCount; colorIndeces = new GLuint[colors]; colorIndeces[0] = bindTexture(QPixmap("yasg/img/blue.png")); colorIndeces[1] = bindTexture(QPixmap("yasg/img/green.png")); colorIndeces[2] = bindTexture(QPixmap("yasg/img/pink.png")); colorIndeces[3] = bindTexture(QPixmap("yasg/img/red.png")); colorIndeces[4] = bindTexture(QPixmap("img/yellow.png")); colorCounts = new int[colors]; this->rows = rows; this->columns = columns; bubbles = new int*[columns]; for(int i = 0; i < columns; ++i) bubbles[i] = new int[rows]; calcBubbleSize(); score = 0; lastMove.type = -1; status = UNSTARTED; startNewGame(); }
void COverlappedWindow::startNewGame(int width, int height) { getGameInfo().heightGridNumber = width; getGameInfo().widthGridNumber = height; settingsGameInfo = applyedGameInfo; startNewGame(); }
void COverlappedWindow::OnCreate(HWND handle) { this->handle = handle; haccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1)); applyedDrawInfo.lineStroke = 2; applyedDrawInfo.lineIndent = 35; applyedDrawInfo.pointRadius = 7; settingsDrawInfo = applyedDrawInfo; minSettings.lineStroke = 1; minSettings.lineIndent = 10; minSettings.pointRadius = 3; minSettings.scoreboardFont = 10; maxSettings.lineStroke = 10; maxSettings.lineIndent = 100; maxSettings.pointRadius = 15; maxSettings.scoreboardFont = 40; minGameInfo.heightGridNumber = 4; minGameInfo.widthGridNumber = 4; maxGameInfo.heightGridNumber = 40; maxGameInfo.widthGridNumber = 100; startNewGame(); }
int main (void) { int menu = 0; /* initializes srand () */ init (); do { /* prints title and menu on screen */ printMainScreen (); /* requires user to choose a menu */ menu = chooseMenuItem (); switch (menu) { case START_GAME: startNewGame (); /* starts a new game */ break; case GAME_RULES: printGameRules (); /* prints the game rules */ break; case EXIT_GAME: printGoodbye (); /* prints a goodbye message */ break; } } while (menu != EXIT_GAME); return 0; }
/** Constructor. */ KMahjongg::KMahjongg( QWidget* parent, const char *name) : KMainWindow(parent, name) { boardEditor = 0; // init board widget bw = new BoardWidget( this ); setCentralWidget( bw ); previewLoad = new Preview(this); setupStatusBar(); setupKAction(); gameTimer = new GameTimer(toolBar()); toolBar()->insertWidget(ID_GAME_TIMER, gameTimer->width() , gameTimer); toolBar()->alignItemRight( ID_GAME_TIMER, true ); theHighScores = new HighScore(this); bDemoModeActive = false; connect( bw, SIGNAL( statusTextChanged(const QString&, long) ), SLOT( showStatusText(const QString&, long) ) ); connect( bw, SIGNAL( tileNumberChanged(int,int,int) ), SLOT( showTileNumber(int,int,int) ) ); connect( bw, SIGNAL( demoModeChanged(bool) ), SLOT( demoModeChanged(bool) ) ); connect( bw, SIGNAL( gameOver(unsigned short , unsigned short)), this, SLOT( gameOver(unsigned short , unsigned short))); connect(bw, SIGNAL(gameCalculated()), this, SLOT(timerReset())); // Make connections for the preview load dialog connect( previewLoad, SIGNAL( boardRedraw(bool) ), bw, SLOT( drawBoard(bool) ) ); connect( previewLoad, SIGNAL( layoutChange() ), this, SLOT( newGame() ) ); connect( previewLoad, SIGNAL( loadBackground(const QString&, bool) ), bw, SLOT(loadBackground(const QString&, bool) ) ); connect( previewLoad, SIGNAL( loadTileset(const QString &) ), bw, SLOT(loadTileset(const QString&) ) ); connect( previewLoad, SIGNAL( loadBoard(const QString&) ), SLOT(loadBoardLayout(const QString&) ) ); startNewGame( ); }
CWindow::CWindow() { whiteBrush = ::CreateSolidBrush( RGB( 0xFF, 0xFF, 0xFF) ); greyBrush = ::CreateSolidBrush( RGB( 0xD0, 0xD0, 0xD0) ); blackBrush = ::CreateSolidBrush( RGB( 0x0, 0x0, 0x0) ); sizeX = 8; sizeY = 6; blocksNum = 3; startNewGame(); }
void KMahjongg::startNewNumeric() { bool ok; int s = QInputDialog::getInt(this, i18n("New Game"), i18n("Enter game number:"), 0, 0, INT_MAX, 1, &ok); if (ok) { startNewGame(s); } }
void Kolf::loadGame() { loadedGame = KFileDialog::getOpenFileName(":savedkolf", QString::fromLatin1("application/x-kolf"), this, i18n("Pick Kolf Saved Game")); if (loadedGame.isNull()) return; isTutorial = false; startNewGame(); }
void MainWindow::handleEndedGame(int score, int level, int time) { QTime t = QTime(0, 0).addSecs(time); // TODO: check int overflow and fix 24 hours "overflow" QString timeString = t.toString("HH:mm"); canvasWidget->handleGameEnded(); startNewGame(); }
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent) ,ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->actionRestart_game, SIGNAL(triggered()), this, SLOT(restartGame())); connect(ui->actionShow_tip, SIGNAL(triggered()), this, SLOT(showTip())); connect(ui->actionStart_new_game, SIGNAL(triggered()), this, SLOT(startNewGame())); connect(ui->openGLWidget, SIGNAL(resizeParent(QSize)), this, SLOT(customResize(QSize))); }
void KMahjongg::demoMode() { if (m_demoAction->isChecked()) { loadSettings(); // In case loadGame() has changed the settings. updateState(GameState::Demo); m_gameTimer->setTime(0); m_gameTimer->pause(); m_gameView->startDemo(); } else { startNewGame(); } }
void GameWidget::keyPressEvent(QKeyEvent *event) { const int rotateStep = 2; switch (event->key()) { case Qt::Key_Up: { if (isGameStarted) { airGun->rotateTurret(-rotateStep); } if(mainMenu->isMenuStarted) { mainMenu->setPosMenuBullets(-1); } break; } case Qt::Key_Down: { if (isGameStarted) { airGun->rotateTurret(rotateStep); } if(mainMenu->isMenuStarted) { mainMenu->setPosMenuBullets(1); } break; } case Qt::Key_Space: { if(isGameStarted) { airGun->shoot(); } if(mainMenu->isMenuStarted) { switch(mainMenu->pushMenuText()) { case 0: { startNewGame(); break; } } } break; } default: QGraphicsView::keyPressEvent(event); } }
void PorkSendPage::on_startButton_clicked() { if(!isStart) { isRect = false; counter=100; isRect = false;isStart = false; clickCount = 0; isStart = true; startNewGame(); } }
KMahjongg::KMahjongg(QWidget * parent) : KXmlGuiWindow(parent) , m_gameState(GameState::Gameplay) , m_gameView(nullptr) , m_gameData(nullptr) , m_boardLayout(new KMahjonggLayout()) { //Use up to 3MB for global application pixmap cache QPixmapCache::setCacheLimit(3 * 1024); // minimum area required to display the field setMinimumSize(320, 320); // init board widget m_gameScene = new GameScene(); loadLayout(); // init game data m_gameData = new GameData(m_boardLayout->board()); // init view and add to window m_gameView = new GameView(m_gameScene, m_gameData, this); setCentralWidget(m_gameView); m_boardEditor = new Editor(); m_boardEditor->setModal(false); setupStatusBar(); setupKAction(); m_gameTimer = new KGameClock(this); connect(m_gameTimer, &KGameClock::timeChanged, this, &KMahjongg::displayTime); connect(m_gameView, &GameView::statusTextChanged, this, &KMahjongg::showStatusText); connect(m_gameView, &GameView::itemNumberChanged, this, &KMahjongg::showItemNumber); connect(m_gameView, &GameView::gameOver, this, &KMahjongg::gameOver); connect(m_gameView, &GameView::demoOrMoveListAnimationOver, this, &KMahjongg::demoOrMoveListAnimationOver); connect(m_gameView, &GameView::noMovesAvailable, this, &KMahjongg::noMovesAvailable); connect(m_gameScene, &GameScene::rotateCW, m_gameView, &GameView::angleSwitchCW); connect(m_gameScene, &GameScene::rotateCCW, m_gameView, &GameView::angleSwitchCCW); m_bLastRandomSetting = Prefs::randomLayout(); loadSettings(); m_boardEditor->setTilesetFromSettings(); startNewGame(); }
void Kolf::tutorial() { QString newfilename = KGlobal::dirs()->findResource("appdata", "tutorial.kolfgame"); if (newfilename.isNull()) return; filename = QString::null; loadedGame = newfilename; isTutorial = true; startNewGame(); loadedGame = QString::null; }
void KMahjongg::setupKAction() { KStandardGameAction::gameNew(this, SLOT(startNewGame()), actionCollection()); KStandardGameAction::load(this, SLOT(loadGame()), actionCollection()); KStandardGameAction::save(this, SLOT(saveGame()), actionCollection()); KStandardGameAction::quit(this, SLOT(close()), actionCollection()); KStandardGameAction::restart(this, SLOT(restartGame()), actionCollection()); QAction * newNumGame = actionCollection()->addAction(QStringLiteral("game_new_numeric")); newNumGame->setText(i18n("New Numbered Game...")); connect(newNumGame, &QAction::triggered, this, &KMahjongg::startNewNumeric); QAction * action = KStandardGameAction::hint(m_gameView, SLOT(helpMove()), this); actionCollection()->addAction(action->objectName(), action); QAction * shuffle = actionCollection()->addAction(QStringLiteral("move_shuffle")); shuffle->setText(i18n("Shu&ffle")); shuffle->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); connect(shuffle, &QAction::triggered, m_gameView, &GameView::shuffle); QAction * angleccw = actionCollection()->addAction(QStringLiteral("view_angleccw")); angleccw->setText(i18n("Rotate View Counterclockwise")); angleccw->setIcon(QIcon::fromTheme(QStringLiteral("object-rotate-left"))); actionCollection()->setDefaultShortcut(angleccw, Qt::Key_F); connect(angleccw, &QAction::triggered, m_gameView, &GameView::angleSwitchCCW); QAction * anglecw = actionCollection()->addAction(QStringLiteral("view_anglecw")); anglecw->setText(i18n("Rotate View Clockwise")); anglecw->setIcon(QIcon::fromTheme(QStringLiteral("object-rotate-right"))); actionCollection()->setDefaultShortcut(anglecw, Qt::Key_G); connect(anglecw, &QAction::triggered, m_gameView, &GameView::angleSwitchCW); m_demoAction = KStandardGameAction::demo(this, SLOT(demoMode()), actionCollection()); KStandardGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); m_pauseAction = KStandardGameAction::pause(this, SLOT(pause()), actionCollection()); // move m_undoAction = KStandardGameAction::undo(this, SLOT(undo()), actionCollection()); m_redoAction = KStandardGameAction::redo(this, SLOT(redo()), actionCollection()); // edit QAction * boardEdit = actionCollection()->addAction(QStringLiteral("game_board_editor")); boardEdit->setText(i18n("&Board Editor")); connect(boardEdit, &QAction::triggered, this, &KMahjongg::slotBoardEditor); // settings KStandardAction::preferences(this, SLOT(showSettings()), actionCollection()); setupGUI(qApp->desktop()->availableGeometry().size() * 0.7); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setFixedSize(ui->graphicsView->width()+10,ui->graphicsView->height()+25); m_file = menuBar()->addMenu("Game"); m_help = menuBar()->addMenu("Help"); m_newGame = new QAction(tr("&New Game"),this); //m_settings = new QAction(tr("&Settings"),this); m_exit = new QAction(tr("E&xit"),this); m_about = new QAction(tr("About arkanoid"),this); m_newGame->setShortcut(QKeySequence::New); m_newGame->setShortcut(QKeySequence::Close); QPixmap bgPix(":/img/hexagon_pattern.png"); bgPix = bgPix.scaled(800,600, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); m_scene = new QGraphicsScene(0,0,ui->graphicsView->width(),ui->graphicsView->height()); ui->graphicsView->setScene(m_scene); QPixmap blft(":/img/border_left.png"); QPixmap btop(":/img/border_top.png"); QPixmap brght(":/img/border_right.png"); blft = blft.scaled(800,25, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); btop = btop.scaled(25,600, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); brght = brght.scaled(800,25, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->graphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); ui->graphicsView->setBackgroundBrush(bgPix); ui->graphicsView->setCacheMode(QGraphicsView::CacheBackground); ui->graphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); QIcon ico(tr(":/icon.ico")); setWindowIcon(ico); connect(m_newGame,SIGNAL(triggered()),this,SLOT(startNewGame())); //connect(m_settings,SIGNAL(triggered()),this,SLOT(openSettings())); connect(m_exit,SIGNAL(triggered()),this,SLOT(close())); connect(m_about,SIGNAL(triggered()),this,SLOT(openAbout())); m_file->addAction(m_newGame); m_file->addSeparator(); //m_file->addAction(m_settings); //m_file->addSeparator(); m_file->addAction(m_exit); m_help->addAction(m_about); setCentralWidget(ui->graphicsView); }
void KMahjongg::noMovesAvailable() { m_gameTimer->pause(); updateState(GameState::Stuck); int answer = KMessageBox::questionYesNoCancel( this, i18n("Game Over: You have no moves left."), i18n("Game Over"), KGuiItem(i18n("New Game"), QIcon(actionCollection()->action(KStandardGameAction::name(KStandardGameAction::New))->icon())), KGuiItem(i18n("Restart"), QIcon(actionCollection()->action(KStandardGameAction::name(KStandardGameAction::Restart))->icon()))); if (answer == KMessageBox::Yes) { startNewGame(); } else if (answer == KMessageBox::No) { restartGame(); } }
void Game::run() { if (!load()) startNewGame(); running = true; Uint32 ticksLast = SDL_GetTicks(); running = true; while (running) { SDL_Event e; while (SDL_PollEvent(&e)) handleEvent(e); Uint32 ticksNow = SDL_GetTicks(); update(ticksNow - ticksLast); ticksLast = ticksNow; draw(); } }
MainWindow::MainWindow(QWidget *parent) : KXmlGuiWindow(parent), m_clickCount(0), m_view(new GameView(this)) { connect(m_view, &GameView::gameOver, this, &MainWindow::gameOver); connect(m_view, &GameView::rotationStarted, this, &MainWindow::rotationStarted); connect(this, SIGNAL(pause(QVariant)), m_view->rootObject(), SLOT(pause(QVariant))); m_movesLabel = new QLabel(this); m_movesLabel->setAlignment(Qt::AlignCenter); m_timeLabel = new QLabel(this); m_timeLabel->setAlignment(Qt::AlignCenter); statusBar()->insertPermanentWidget(0, m_movesLabel, 1); statusBar()->insertPermanentWidget(1, m_timeLabel, 1); // Difficulty Kg::difficulty()->addStandardLevelRange( KgDifficultyLevel::Easy, KgDifficultyLevel::VeryHard ); Kg::difficulty()->addLevel( new KgDifficultyLevel(100, QByteArray("Custom"), i18n("Custom")) ); KgDifficultyGUI::init(this); connect(Kg::difficulty(), &KgDifficulty::currentLevelChanged, this, &MainWindow::startNewGame); setCentralWidget(m_view); setupActions(); setupGUI(); setAutoSaveSettings(); qsrand(time(0)); m_gameClock = new KGameClock(this, KGameClock::MinSecOnly); connect(m_gameClock, &KGameClock::timeChanged, this, &MainWindow::updateStatusBar); m_soundStart = new KgSound(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("sounds/start.wav")), this); m_soundWin = new KgSound(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("sounds/win.wav")), this); startNewGame(); }
//First menu where you can start or load int startMenu() { Player* newPlayer; int userChoice = 0; system("cls"); color(12, 0); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); printf("~~~ ~~~\n"); printf("~~~ *** LOST IN A DUNGEON *** ~~~\n"); printf("~~~ BY ~~~\n"); printf("~~~ --- EX@W --- ~~~\n"); printf("~~~ ~~~\n"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); color(15, 0); printf("\n\n"); printf("Would you like to continue a story or start a new one? \n"); printf("-------------------------------------------------------\n"); printf("1 : New Game\n"); printf("2 : Load Game\n\n"); printf("Press enter to exit the game...\n"); userChoice = userInputInt(); switch(userChoice){ case 1: startNewGame(); break; case 2: newPlayer = loadYourGame(); displayMainMenu(newPlayer); break; case 0: exit (0); default: printf("Please enter a correct entry...\n"); Sleep(2000); startMenu(); break; } return (0); }
void LocalPrefServer::processCommand(const ServerCommand* _command, int playerNum) { GetLog() << "LocalPrefServer: Processing command of type " << _command->Type() << " from player " << playerNum << endl; switch( _command->Type() ) { case SCT_SetSettings: { const SetSettingsCommand* command = static_cast<const SetSettingsCommand*>( _command ); processSetSettings(command->Settings); break; } case SCT_Bid: { const BidCommand* command = static_cast<const BidCommand*>( _command ); processBid(command->Bid, playerNum); break; } case SCT_Drop: { const DropCommand* command = static_cast<const DropCommand*>(_command); processDrop(command->Cards, command->Contract, playerNum); break; } case SCT_Move: { const MoveCommand* command = static_cast<const MoveCommand*>(_command); processMove(command->Move, playerNum); break; } case SCT_StartServer: { startNewGame(); break; } case SCT_PlayMisereResponse: { const PlayMisereResponseCommand* command = static_cast<const PlayMisereResponseCommand*>(_command); processPlayMisereResponse(command->PlayByMyself ? PMR_PlayByMyself : PMR_HandOverCards, playerNum); break; } default: GetLog() << "Warning: unsupported command of type " << _command->Type() << " will be ignoerd." << endl; break; } }
void KMahjongg::loadSettings() { // Set the blink-matching-tiles option. m_gameView->setMatch(Prefs::showMatchingTiles()); // Load the tileset. if (!m_gameView->setTilesetPath(Prefs::tileSet())) { qCDebug(KMAHJONGG_LOG) << "An error occurred when loading the tileset " << Prefs::tileSet() << " KMahjongg will continue with the default tileset."; } // Load the background if (!m_gameView->setBackgroundPath(Prefs::background())) { qCDebug(KMAHJONGG_LOG) << "An error occurred when loading the background " << Prefs::background() << " KMahjongg will continue with the default background."; } // Maybe load a new layout and start a new game if the layout or random mode has changed. if (m_boardLayout->path() != Prefs::layout() || m_bLastRandomSetting != Prefs::randomLayout()) { // The boardlayout path will likely not be the same as the preference setting if // random layouts are set. If they are and were last time we don't want to load // a new layout or start a new game when the user may have just changed the // tileset, background or other settings. // Also, if no saved layout setting, avoid endless recursion via startNewGame. if ((!m_bLastRandomSetting || !Prefs::randomLayout()) && !Prefs::layout().isEmpty()) { // The user has changed the layout, or the random setting. // If random layouts are set a new layout will be loaded when we call // startNewGame, so no need to do so here. if (!Prefs::randomLayout()) { loadLayout(); delete m_gameData; m_gameData = new GameData(m_boardLayout->board()); m_gameView->setGameData(m_gameData); } // Track the last random setting. m_bLastRandomSetting = Prefs::randomLayout(); startNewGame(); } } saveSettings(); }
// called by main for commmand line files void Kolf::openURL(KURL url) { QString target; if (KIO::NetAccess::download(url, target, this)) { isTutorial = false; QString mimeType = KMimeType::findByPath(target)->name(); if (mimeType == "application/x-kourse") filename = target; else if (mimeType == "application/x-kolf") loadedGame = target; else { closeGame(); return; } QTimer::singleShot(10, this, SLOT(startNewGame())); } else closeGame(); }
KLinesScene::KLinesScene( QObject* parent ) : QGraphicsScene(parent), m_playFieldBorderSize(0), m_numFreeCells(FIELD_SIZE*FIELD_SIZE), m_score(0), m_bonusScore(0), m_cellSize(32), m_previewZoneVisible(true) { m_animator = new KLinesAnimator(this); connect(m_animator, &KLinesAnimator::moveFinished, this, &KLinesScene::moveAnimFinished); connect(m_animator, &KLinesAnimator::removeFinished, this, &KLinesScene::removeAnimFinished); connect(m_animator, &KLinesAnimator::bornFinished, this, &KLinesScene::bornAnimFinished); m_focusItem = new QGraphicsRectItem( QRectF(0, 0, m_cellSize, m_cellSize), 0); m_focusItem->setZValue(1.0); m_focusItem->setPen( Qt::DashLine ); m_previewItem = new PreviewItem(this); m_previewItem->setPos( 0, 0 ); m_popupItem = new KGamePopupItem; addItem(m_popupItem); startNewGame(); }
int main(int argc, char** argv) { startNewGame(); while (1) { int move; printf("Move? "); scanf("%d", &move); playerMove(move); printGameState(globalState); checkWin(globalState); computerMove(LOOK_AHEAD); printGameState(globalState); checkWin(globalState); } freeGameState(globalState); return 0; }
void KMahjongg::newGame() { startNewGame(); }
int main(void) { srand(time(NULL)); while (1) { FileFinder finder = findSaveFile(); int choice; printf("Welcome to the Gauntlet!\n"); printf("Select your option.\n"); printf("1: start a new game\n"); if (finder == EXIST) { printf("2: start a saved game\n"); printf("3: delete a saved file\n"); printf("4: quit\n"); printf(">"); scanf("%d", &choice); while(choice < 1 || choice > 5) { printf("Invalid option. Try again: \n"); printf(">"); scanf("%d", &choice); } switch (choice) { case 1: startNewGame(); break; case 2: loadSavedGameHandler(); break; case 3: DeleteSavedGameHandler(); break; case 4: return 0; } } else { printf("2: quit\n"); printf(">"); scanf("%d", &choice); while(choice < 1 || choice > 2) { printf("Invalid option. Try again: \n"); printf(">"); scanf("%d", &choice); } switch (choice) { case 1: startNewGame(); break; case 2: return 0; } } } }
void ConsoleGame::handleNewGame() { startNewGame(); }