示例#1
0
int main(int argc, char** argv) {

	//- Argument Extraction ------------------------------=
	//
	int opt;
	while ((opt = getopt(argc, argv, "ve")) != -1) {
		switch(opt) {
			case 'v':
				printf("\\> [Verbose Mode]\n");
				g_verbose = true;
				g_log_memory = true;
				g_log_game = true;
				break;
			case 'e':
				printf("\\> [Echo Mode]\n");
				g_echo = true;
				break;
			default:
				// You're drunk. Get help.
				printf("Usage: -p [port] | -r [relayhost:port] | -R [path]\n");
				return EXIT_SUCCESS;
		}
	}

	launchGame();

	return EXIT_SUCCESS;
}
示例#2
0
void MainMenu::treat_choice (int choice)
{
    switch (choice)
    {
    case 1: // nouvelle partie => pas de reseau
        //delete gNetwork;
        //gNetwork = NULL;
        launchGame();
        gSound->load_music ("main_menu.mp3"); // haha !
        gSound->play_music();
        break;
    case 2: // menu multi joueurs
        launchMulti();
        break;
    case 3: // menu fast game
        launchFastGame();
        break;
    case 4: // options
        launchOptions();
        break;
    case 5: // quitter le jeu
        set_leave_game_true();
        break;
    default:
        break;
    }
}
示例#3
0
文件: Library.cpp 项目: BurrrY/Client
/** Recreate the list of games displayed in the main widget.
* Sort the list alphabetically by name
*/
void Library::refreshGames()
{
    for (auto gameWidget : gamesWidgets)
    {
        gamesLayout->removeWidget(gameWidget);
        gameWidget->deleteLater();
    }

    QList<Game> gameList = db.getGames();
    std::sort(gameList.begin(), gameList.end(), [&](const Game& g1, const Game& g2){return g1.gameName < g2.gameName; });
    int row = 0, col = 0;
    for (auto game : gameList)
    {
        GridGameWidget* gameWidget = new GridGameWidget(game.gameName, 999);
        gamesLayout->addWidget(gameWidget, row, col);
        connect(gameWidget, &GridGameWidget::clicked, [=] { launchGame(game.gameName); });
        gamesWidgets.append(gameWidget);

        if (col == 3)
        {
            row++;
        }
        col = (col < 3 ? col + 1 : 0);
    }
}
void AndroidApplication::onStart()
{
	_soundEngine->start();
	//_gameEngine->setGraphicEngine(_graphicEngine);
	Log::debug("onStart");
	launchGame(APK_OK);
}
void AndroidApplication::onCreateWindow()
{
	Log::debug("On create window");
	//if (_gameEngine)
	//	_gameEngine->initGraphicEngine();
	_graphicEngine->setSurfaceCreated(true);
	launchGame(GRAPHICS_OK);
}
示例#6
0
void MainWindow::on_pushButton_newGame_clicked()
{
    // We draw the basic image of the 'pendu'
    ui->label_image->setPixmap(QPixmap( myGame.drawPendu(0) ));
    // We change the current page of stackedWidget
    ui->stackedWidget->setCurrentIndex(GAME);
    // The game starts
    launchGame();
}
void MainWindow::createActions()
{
    openCustom = new QAction(tr("&Choose Files..."), this);
    connect(openCustom, SIGNAL(triggered()), this, SLOT(loadCustomFiles()));

    openMiami = new QAction(tr("&Miami"), this);
    connect(openMiami,SIGNAL(triggered()),this,SLOT(loadMiamiFiles()));

    openFrisco = new QAction(tr("San &Francisco"), this);
    connect(openFrisco,SIGNAL(triggered()),this,SLOT(loadFriscoFiles()));

    openLosAngeles = new QAction(tr("&Los Angeles"), this);
    connect(openLosAngeles,SIGNAL(triggered()),this,SLOT(loadLosAngelesFiles()));

    openNewYork = new QAction(tr("New &York"), this);
    connect(openNewYork,SIGNAL(triggered()),this,SLOT(loadNewYorkFiles()));

    openTrain = new QAction(tr("&Desert"), this);
    connect(openTrain,SIGNAL(triggered()),this,SLOT(loadTrainFiles()));

    openIview = new QAction(tr("Car &Park"), this);
    connect(openIview,SIGNAL(triggered()),this,SLOT(loadIviewFiles()));

    openNewcastle = new QAction(tr("&Newcastle"), this);
    connect(openNewcastle,SIGNAL(triggered()),this,SLOT(loadNewcastleFiles()));

    saveAs = new QAction(tr("Save &As"),this);
    connect(saveAs, SIGNAL(triggered()), saveDialog, SLOT(exec()));

    exitAction = new QAction(tr("&Exit"),this);
    connect(exitAction,SIGNAL(triggered()),qApp,SLOT(quit()));

    launchGameAction = new QAction(tr("&Run Game"),this);
    connect(launchGameAction, SIGNAL(triggered()), this, SLOT(launchGame()));

    openGameDirAction = new QAction(tr("&Open Root Directory"),this);
    connect(openGameDirAction, SIGNAL(triggered()), this, SLOT(openGameDirectory()));

    installPatchAction = new QAction(tr("&Install Vertex Patch"),this);
    connect(installPatchAction, SIGNAL(triggered()), this, SLOT(installPatch()));

    helpTopics = new QAction(tr("Help &Topics"),this);

    aboutAction = new QAction(tr("&About"),this);
    connect(aboutAction, SIGNAL(triggered()), aboutDialog, SLOT(exec()));

    viewModelsAction = new QAction(tr("&Models"),this);
    connect(viewModelsAction, SIGNAL(triggered()), this, SLOT(viewModels()));

    viewTextureBrowserAction = new QAction(tr("&Textures"),this);
    connect(viewTextureBrowserAction, SIGNAL(triggered()), this, SLOT(viewTextureBrowser()));

    viewDefinitionEditorAction = new QAction(tr("Texture &Definitions"),this);
    connect(viewDefinitionEditorAction, SIGNAL(triggered()), this, SLOT(viewDefinitionEditor()));
};
示例#8
0
void
cpuEntrypoint()
{
   // Make a fibre, we need to be cautious not to allocate here
   //  as this fibre can be arbitrarily destroyed.
   initCoreFiber();

   // Set up an interrupt context to use with this core
   initCoreInterruptContext();

   // We set up a dummy stack on each core to help us invoke needed stuff
   auto rootStack = static_cast<uint8_t*>(coreinit::internal::sysAlloc(256, 4));
   auto core = cpu::this_core::state();
   core->gpr[1] = mem::untranslate(rootStack + 256 - 4);

   // Maybe launch the game
   if (cpu::this_core::id() == 1) {
      // Run the setup on core 1, which will also run the loader
      launchGame();

      // Trip an interrupt on core 1 to force it to schedule the loader.
      cpu::interrupt(1, cpu::GENERIC_INTERRUPT);
   }

   // Set up the default expected state for the nia/cia of idle threads.
   //  This must be kept in sync with reschedule which sets them to this
   //  for debugging purposes.
   core->nia = 0xFFFFFFFF;
   core->cia = 0xFFFFFFFF;

   // Run the scheduler loop, this is what will
   //   execute when there is nothing else to do.
   while (sRunning) {
      cpu::this_core::waitForInterrupt();
   }
}
示例#9
0
/**
The GUI loop. Handles SDL events and network communication.
*/
void UserFace::theGui(){

    init();

        while (!quit){

                SDL_Event event;
                while(SDL_PollEvent(&event)){
					if (event.type==SDL_QUIT) quit = true;
					else if (setkey && (event.type==SDL_KEYDOWN)){
						*(mSettings->cControls->setKey) = event.key.keysym.sym;
						mSettings->cControls->setButton->setCaption(keyname(event.key.keysym.sym));
						mSettings->cControls->setButton->adjustSize();
						userface.setkey = false;
					}else if (!setkey) ((SDLInput*)(gui->getInput()))->pushInput(event);
				}

                gui->logic();

                if (!gameplay.local){
                    network.recv(false);
                    if (network.status < 0){
                        switchTo(mConnect);
                        showMessage("Connection to server lost");
                    }
                }
                if (gameplay.approved) launchGame();

                gui->draw();
                SDL_Flip(gfx.screen);

                SDL_Delay(DELAY);

        }

}
示例#10
0
void w_main::on_bt_launch_clicked()
// GUI : Launch game button
{
    // Check if the game path is known

    if(readCheckerParam("Main/ExecutablePath") == "error") {
        QMessageBox::information(0, "Information", tr("To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path)"));
        return;
    }
    else {
        QString lang = getCurrentLanguage();
        QString executable;
        if(lang == "ko" || lang == "ja" || lang == "zh")
        { // Asian language have a different executable, supporting 2-bytes encoding
            executable = readCheckerParam("Main/ExecutablePath");
            QString asian_executable = executable;
            asian_executable.replace("Civ4BeyondSword.exe","Civ4BeyondSword_Asian.exe");
            QFile exe(executable);
            if(!exe.exists())
            {
                QMessageBox::information(0, "Information", tr("The executable hasn't been found. Please set the game path in the options window. (Options > Select game path)"));
                return;
            }
            QFile asian_exe(asian_executable);
            if(!asian_exe.exists())
            { // Make a question box
                QMessageBox question;
                question.setWindowTitle(tr("Asian language patch not applied"));
                question.setText(tr("You need to apply a patch on the base game for the extension to be compatible with Asian languages. The original version won't be modified. Would you like to apply it now ?"));
                question.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
                int ret = question.exec();
                switch(ret){
                    case QMessageBox::Ok:
                        system("checker\\asian_patcher.exe");
                        return;
                        break;

                    case QMessageBox::Cancel:
                        return;
                        break;

                    default:
                        return;
                        break;
                }
            }
            launchGame(asian_executable);
        }
        else
        {
            executable = readCheckerParam("Main/ExecutablePath");
            QFile exe(executable);
            if(!exe.exists())
            {
                QMessageBox::information(0, "Information", tr("The executable hasn't been found. Please set the game path in the options window. (Options > Select game path)"));
                return;
            }
            //qDebug() << "Executable checksum is " << checkMd5(executable);
            // Warn when the latest Steam version is used
            if(checkMd5(executable) == "93a64f40d3d4093faeac3e9e626f79de" && readCheckerParam("Main/DisableWarning") != "1")
            {
                QMessageBox::information(0, "Information", tr("The game version you are using is known for causing some display problems, like invisible religion icons. Please read the 'note for Steam users' on our website to fix the problem. The website help page will now open.")+ "\n\n" + tr("You can disable this warning in the options."));
                openURL("http://anewdawn.sourceforge.net/pages/install/");
                return;
            }
            launchGame(executable);
        }

    }

    // Check if the launcher should quit

    if(readCheckerParam("Main/QuitLauncher") == "1") {
        qApp->exit();
    }
    else {
        this->setWindowState(Qt::WindowMinimized);
    }
}
示例#11
0
int main(int argc, char** argv) {
    if(argc < 2) {
        fprintf(stderr, "Nombre d'arguments incorrects. Vous devez inclure un fichier de configuration.");
        return 0;
    }

    /* debug, pour savoir dans quel fichier on est. ici, dans ./ARKANOPONG.
    char cwd[256];

    if (getcwd(cwd, sizeof(cwd)) == NULL)
      perror("getcwd() error");
    else
      printf("ŵd :  %s\n _____ \n", cwd);

    end debug */


    int nbPlayer;
    int isIa;
    char * configFile;

    char theme[C_MAX];
    char themePath[C_MAX];
    configFile = argv[1];

    /* le menu */
    printf("---------------------------- \n");
    printf("Bienvenue dans Arkanopong !\n");
    printf("---------------------------- \n");

    printf("Vous jouez avec le fichier de niveau : %s\n", configFile);


    printf("Souhaitez vous jouer seul [1] ou à deux [2] ? \n");
    if(!scanf("%d", &nbPlayer) || nbPlayer > 2 || nbPlayer < 0) {
        fprintf(stderr, "Saisie incorrecte\n");
        return 0;
    }
    isIa = (nbPlayer == 1) ? 1 : 0;

    // listing et choix du thème à utiliser

    DIR * dp = NULL;
    struct dirent * readFile = NULL;
    dp = opendir(THEMES_DIR);
    if (NULL == dp) {
        fprintf(stderr, "Erreur lors de l'ouverture du repertoires de thèmes.\n");
        return 0;
    }
    printf("--- THEMES DISPONIBLES ---\n");
    while (NULL != (readFile  = readdir(dp))) {
        if(strcmp (readFile->d_name, ".") && strcmp (readFile->d_name, "..")) {
            printf("\t%s\n", readFile->d_name);
        }
    }
    printf("---------------------------- \n");

    printf("Quel thème souhaitez-vous utiliser ? \n");
    if(scanf("%s", theme)) {
        //sprintf(theme, "default"); // a suppr
        strcpy (themePath, THEMES_DIR);
        strcat(themePath, theme);

        // lancement du jeu
        launchGame(configFile, themePath, isIa);
    }
    free(readFile);
    free(dp);
    return EXIT_SUCCESS;
}
void AndroidApplication::onResume()
{
	Log::debug("onResume");
	launchGame(APK_OK);
}
示例#13
0
int		main(void)
{
  if (launchGame() == -1)
    return (-1);
  return (0);
}