Beispiel #1
0
void AssassinWar::initGameSettingDlg()
{
    m_pGameSettingDlg = new GameSettingDlg(this);
    m_pGameSettingDlg->initialize();
    connect(m_pGameSettingDlg, SIGNAL(createGame()), this, SLOT(hostGame()));
    connect(m_pGameSettingDlg, SIGNAL(cancelCreateGame()), this, SLOT(showMainWin()));
}
Beispiel #2
0
void MainMenuUserInterface::processSelection(U32 index)
{
   switch(index)
   {
      case 0:
         gQueryServersUserInterface.activate();
         break;
      case 1:
         hostGame(false, Address(IPProtocol, Address::Any, 28000));
         break;
      case 2:
         gInstructionsUserInterface.activate();
         break;
      case 3:
         gOptionsMenuUserInterface.activate();
         break;
      case 4:
         gCreditsUserInterface.activate();
         break;
   }
}
Beispiel #3
0
void multiPlayer(GlobalState* globalData) {
    int connect = 0;
    int hostOrFind = 0; // 0 host game, 1 find game
    char* mySelections[2] = {"Host Game", "Find Game"};
    setupXbee();
    printMenu(mySelections, BLACK, GRAY, WHITE, YELLOW, 2);
    prints(25, 7, YELLOW, GRAY, "Multiplayer", 1);
    processPrintCursor(globalData, 2, BLACK, YELLOW);
    switch (hostOrFind) {
        case 0:
            prints(3, 48, YELLOW, GRAY, "Waiting for players...", 1);
            hostGame();
            break;
        case 1:
            prints(3, 88, YELLOW, GRAY, "Looking for games...", 1);
            findGame();
            break;
        case 0xFF:
            return;
            break;
    }



    setupGame();

    //    // Find other players
    //    while (!connect) {
    //        connect = findPlayer();
    //    }
    //
    //    // NOTE: Need to build something to determine who goes first
    //    // Compare Xbee ID's perhaps?
    //
    //    // Begin game
    //    while (!game.gameOver && connect) {
    //        if (game.turn) {
    //            // Pick Move
    //            game.myMove = pickMove(globalData);
    //            // Send Move
    //            sendMove();
    //            // Receive new score after opponent takes damage
    //            game.oppScore = receiveScore();
    //            printGame(globalData);
    //            prints(0, 10, RED, BLACK, "                    ", 1);
    //            prints(0, 10, RED, BLACK, "Opponent took damage:", 1);
    //            prints(0, 21, RED, BLACK, "-", 1);
    //            integerprint(6, 21, RED, BLACK, game.myMove, 1);
    //        } else {
    //            // Receive player move and take damage
    //            game.myScore = attack(receiveMove(), game.myScore);
    //            prints(0, 10, RED, BLACK, "                    ", 1);
    //            prints(0, 10, RED, BLACK, "Taken damage:", 1);
    //            prints(0, 21, RED, BLACK, "-", 1);
    //            integerprint(6, 21, RED, BLACK, game.oppMove, 1);
    //            // Send new score
    //            sendScore();
    //        }
    //        prints(0, 45, YELLOW, BLACK, "        ", 1);
    //        integerprint(0, 45, YELLOW, BLACK, game.myScore, 1);
    //        prints(0, 75, WHITE, BLACK, "        ", 1);
    //        integerprint(0, 75, WHITE, BLACK, game.oppScore, 1);
    //        // Check game status
    //        game.gameOver = gameStatus();
    //        game.turn =!game.turn;
    //    }
    //    if (!connect) {
    //        printBSOD();
    //    } else {
    //        printResults();
    //    }
}