Esempio n. 1
0
	CRDFile::CRDFile (std::string const crdpath, int const c_size, const bool periodic) :
		CoordinateFile (crdpath, c_size),
		_periodic(periodic) {
//			ReadLine (); // skip the first frame's header
			rewind (_file);
			LoadNext ();	// load the first frame of the file
		}
Esempio n. 2
0
void Player::SongFinished() {
	fprintf(stderr, "Song finished!\n");
	Mix_Music *last = current;
	if (next != NULL) {
		current = next;
		playCurrent();
	}

	Mix_FreeMusic(last);
	LoadNext();
}
void ResourceManager::Load()
{
    JValue * gameDate = JsonParser::ParseFile("Config/config.json");
    JValue &resource = (*gameDate)["Resource"];
    
    for (int i = 0; i < resource.GetLength(); ++i)
    {
        
        JValue * levelData = JsonParser::ParseFile(resource[i]["location"].ToString().c_str());
        
        _metaData.InsertAtLast(levelData);
        //_metaData.InsertAtFirst(levelData);
        
    }
    LoadNext();
}
Esempio n. 4
0
void LastFMUrlHandler::TunerTrackAvailable() {
  emit AsyncLoadComplete(LoadNext(service_->last_url_));
}
Esempio n. 5
0
	void CRDFile::Rewind () {
		rewind(this->_file);
		//ReadLine();
		LoadNext();
		this->_frame = 1;
	}	// rewind
Esempio n. 6
0
// |----------------------------------------------------------------------------|
// |							     Logic()									|
// |----------------------------------------------------------------------------|
// The logic function, which will be called by the main game loop.
bool LevelScreen::Logic() {
	debug ("LevelScreen: Logic() called.", 10);
    
	// Check if it's game over
	if (m_gameOver)
	{
		// Check for click
		if((InputClass::GetInstance())->IsMouseButtonPressed(0))
			m_done = true;
		return true;
	}

	// Check if it's time to load the next level
	if(m_activeBlocks <= 0)
	{
		// Display the dialogue
		if (!m_dialogue)
		{
			++m_levelNumber;
			m_dialogue = true;
			return true;
		}

		// Load next level
		LoadNext();

		// Increase speed of ball
		m_ball->IncreaseSpeed();

		// Reset ball location
		m_ball->Respawn();
	}

	// Once the new level is loaded, check for mouse click to close dialogue
	if (m_dialogue)
	{
		// Check for click
		if((InputClass::GetInstance())->IsMouseButtonPressed(0))
			m_dialogue = false;
		return true;
	}

	// Player and ball logic
	if (m_player)
		m_player->Logic();
	if (m_ball)
		m_ball->Logic();

	// Border Collisions
	if(m_ball->Collision(m_top))
        SoundClass::GetInstance()->PlayBounce();
	if(m_ball->Collision(m_left))
        SoundClass::GetInstance()->PlayBounce();
	if(m_ball->Collision(m_right))
        SoundClass::GetInstance()->PlayBounce();
	if(m_ball->CheckCollision(m_bottom))
	{
		m_ball->Respawn();
		--m_lives;
	}

	// Player Collisions
	if(m_ball->Collision(m_player))
    {
		m_ball->PlayerCollide(m_player);
        SoundClass::GetInstance()->PlayBounce();
    }

	// Block Collisions
	for (int i=0; i<m_numBlocks; ++i)
	{
		if (m_blocks[i])
		{
			if(m_ball->Collision(m_blocks[i]))
            {
                m_score += 50;
			    if(m_blocks[i]->IsDead())
			    {
				    delete m_blocks[i];
				    m_blocks[i] = 0;
				    --m_activeBlocks;
                    m_score += 50;
                    SoundClass::GetInstance()->PlayBreak();
			    }
                else
                {
                    SoundClass::GetInstance()->PlayBounce();
                }
            }
		}
	}

	// Check if we've used up all our lives
	if (m_lives <= 0)
	{
		m_gameOver = true;

        // Check for high score
        if (m_score > m_highScores[19])
        {
            m_highScoreGet = true;
            int prev_score = m_score;
            int next_score = m_score;
            for (int i=0; i<20; ++i)
            {
                if (prev_score >= m_highScores[i])
                {
                    next_score = m_highScores[i];
                    m_highScores[i] = prev_score;
                    prev_score = next_score;
                }
            }
            SaveScoresToFile();
        }
	}

	return true;
}