コード例 #1
0
ファイル: GameProcess.cpp プロジェクト: Flash2307/PlayGround
void GameProcess::readyReadStandardOutput()
{
    QString line = this->currentGame.readAllStandardOutput();
    QTextStream stream( &line );
    QString command;
    int userIndex = -1;
    int score = 0;

    std::vector< UserScore > scores;

    qDebug() << "called ";

    while( !stream.atEnd() )
    {
        stream >> command;
        stream >> userIndex;
        stream >> score;

        if( command == ScoreCommandName )
        {
            scores.emplace_back( gameConfig.gameName, userIndex, score );
        }
    }

    if( !scores.empty() )
    {
        emit saveScores( scores );
    }
}
コード例 #2
0
ファイル: main.c プロジェクト: OscarHMG/Educational-Program
void inputScores(){
	char *name;
	int n1_1P,n2_1P,n3_1P, ex_1P;
	int n1_2P,n2_2P,n3_2P, ex_2P;
	int final_prom;
	name = (char *)malloc(50 * sizeof(char));
	printf("Name: ");
	fgets(name, 50, stdin);
	quitEnter(name);
	fflush(stdin);
	printf("Nota #1 1er Parcial: ");
	scanf("%d",&n1_1P);
	printf("Nota #2 1er Parcial: ");
	scanf("%d",&n2_1P);
	printf("Nota #3 1er Parcial: ");
	scanf("%d",&n3_1P);
	printf("Examen 1er Parcial: ");
	scanf("%d",&ex_1P);
	printf("Nota #1 2do Parcial: ");
	scanf("%d",&n1_2P);
	printf("Nota #2 2do Parcial: ");
	scanf("%d",&n2_2P);
	printf("Nota #3 2do Parcial: ");
	scanf("%d",&n3_2P);
	printf("Examen 2do Parcial: ");
	scanf("%d",&ex_2P);
	fflush(stdin);
	saveScores(name,n1_1P,n2_1P,n3_1P,ex_1P,n1_2P,n2_2P,n3_2P,ex_2P);
	printf("\t\t\t\nIngreso de estudiante ha sido exitoso...\n\n");
}
コード例 #3
0
void GameScores::addScore(int type, int score, std::string name)
{
    switch (type)
    {
        case (GameModel::gameTypeNormal): currentScore=addScoreNormal(score, name); break;
        case (GameModel::gameTypeMotion): currentScore=addScoreMotion(score, name) + 10; break;
        case (GameModel::gameTypeClassic): currentScore=addScoreClassic(score, name) + 20; break;
    }
    saveScores();
}
コード例 #4
0
ファイル: save.c プロジェクト: BPaden/garglk
/*----------------------------------------------------------------------*/
static void saveGame(AFILE saveFile) {
  /* Save tag, version of interpreter, name and uid of game */
  saveGameInfo(saveFile);

  /* Save current values */
  saveCurrentValues(saveFile);

  saveAttributeArea(saveFile);
  saveAdmin(saveFile);

  saveEventQueue(saveFile);

  saveScores(saveFile);

  saveStrings(saveFile);
  saveSets(saveFile);
}
コード例 #5
0
/* insertHiScore
 Input: Player thePlayer The player to be inserted
		HighScores* hiScores The group of high scores
 Output: none
 Adds the player's score and intials to the high score table
*/
void insertHiScore ( Player thePlayer, HighScores* hiScores)
{
	int setScore; /* index of where the plaer will be inserted */

	if ( hiScores->numScores == MAX_SCORES )
	{
		setScore = hiScores->numScores-1;
		
	}
	else
	{
		hiScores->numScores++;
		setScore = hiScores->numScores -1;
	}
	
	hiScores->record[setScore].score= thePlayer.score;
	strcpy ( hiScores->record[ setScore ].initials, thePlayer.initials);
	sortScores( hiScores );
	
	saveScores ( hiScores);
}
コード例 #6
0
ファイル: SIDlg.cpp プロジェクト: shooshx/happysolver
void GameWidget::loadScores()
{
    QSettings reg("Happy Cube Solver", "Happy Cube Solver (QT)");

    reg.beginGroup("SI");
    QStringList keys = reg.allKeys();
    if (keys.isEmpty())
    {
        loadDefaultScores();
        reg.endGroup();
        saveScores();
        return;
    }

    m_scores.clear();
    for(QStringList::const_iterator it = keys.constBegin(); it != keys.constEnd(); ++it)
    {
        m_scores.append(Score(*it, reg.value(*it, -1).toInt()));
    }
    qSort(m_scores);

    reg.endGroup();
}
コード例 #7
0
ファイル: SIDlg.cpp プロジェクト: shooshx/happysolver
void GameWidget::endGame()
{
    if (m_score >= m_scores.last().score)
    {
        QString name = QInputDialog::getText(this, "Happy Cube Space Invaders!", 
            "<b style=\"font-size:24pt\">What is your name ?!");
        m_scores.append(Score(name, m_score));
        qSort(m_scores);
        m_scores.removeLast();
        saveScores();
    }

    setTextFormat(Qt::RichText);
    setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

    QString msg("<font face=\"Courier\"><b style=\"font-size:72pt\">Game Over!</b><br><b style=\"font-size:24pt\">");
    for (TScoreList::const_iterator it = m_scores.constBegin(); it != m_scores.constEnd(); ++it)
    {
        msg += QString("%1.......%2<br>").arg(it->name, -22, '.').arg(humanCount(it->score).c_str(), 13, QChar('.'));
    }
    msg += "</font>";

    setText(msg);
}
コード例 #8
0
void GameScores::reset()
{
    loadScores("data/reset_scores.dat");
    saveScores();
}