Exemplo n.º 1
0
static Mix_Music* Get_Mix_Music(VALUE obj)
{
    Music* mus = GetMusic(obj);
    if(mus->music == NULL)
        rb_raise(eSDLError, "Wave data is already disposed");
    return mus->music;
}
Exemplo n.º 2
0
    /// Populates this collection of assets with more specific types
    /// of data as specified in the generic collection of assets.
    /// @param[in]  assets - The generic asset data to populate from.
    /// @return True if all assets are successfully populated; false otherwise.
    bool Assets::Populate(const std::vector<Asset>& assets)
    {
        for (const auto& asset : assets)
        {
            switch (asset.Type)
            {
                case RESOURCES::AssetType::FONT:
                {
                    std::shared_ptr<GRAPHICS::GUI::Font> font = GetFont(asset.Id, asset.BinaryData);
                    if (!font)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::MUSIC:
                {
                    std::shared_ptr<sf::Music> music = GetMusic(asset.Id, asset.BinaryData);
                    if (!music)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::SHADER:
                {
                    std::shared_ptr<sf::Shader> shader = GetShader(asset.Id, asset.BinaryData);
                    if (!shader)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::SOUND_EFFECT:
                {
                    std::shared_ptr<sf::SoundBuffer> sound = GetSound(asset.Id, asset.BinaryData);
                    if (!sound)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::TEXTURE:
                {
                    std::shared_ptr<GRAPHICS::Texture> texture = GetTexture(asset.Id, asset.BinaryData);
                    if (!texture)
                    {
                        return false;
                    }
                    break;
                }
            }
        }

        return true;
    }
Exemplo n.º 3
0
static int music_dispose(lua_State *L)
{
	Mix_Music *music = GetMusic(L, 1);
	if ( music ) {
		Mix_FreeMusic(music);
		*(Mix_Music **)lua_touserdata(L, 1) = NULL;
		printf("freed music\n");
	}
	return 0;
}
Exemplo n.º 4
0
static int music_play(lua_State *L)
{
	int loop = -1;
	if ( lua_isnumber(L, 2) ) {
		loop = (int)lua_tonumber(L, 2);
	}

	Mix_PlayMusic(GetMusic(L, 1), loop);

	return SDLua_Self(L);
}
Exemplo n.º 5
0
/**
 * Spielt nächstes Stück ab
 */
void MusicPlayer::PlayNext()
{
    std::string song = list.getNextSong();

    // Am Ende der Liste angekommen?
    if(song.empty())
    {
        Stop();
        return;
    }

    // Evtl ein Siedlerstück ("sNN")?
    if(song.length() == 3)
    {
        unsigned int nr = atoi(song.substr(1).c_str());
        if( nr <= 14)
        {
            // Siedlerstück abspielen (falls es geladen wurde)
            if(GetMusic(sng_lst, nr - 1))
                GetMusic(sng_lst, nr - 1)->Play(1);
        }
        return;
    }

    // anderes benutzerdefiniertes Stück abspielen
    // in "sng" speichern, daher evtl. altes Stück erstmal löschen
    sng.clear();

    LOG.write("lade \"%s\": ") % song;

    // Neues Stück laden
    if(libsiedler2::loader::LoadSND(song, sng) != 0 )
    {
        Stop();
        return;
    }

    // Und abspielen
    dynamic_cast<glArchivItem_Music*>(sng.get(0))->Play(1);
}
Exemplo n.º 6
0
void
AudioManager::MusicPlay( const Ogre::String& name )
{
    if( m_Initialized )
    {
        boost::recursive_mutex::scoped_lock lock( m_UpdateMutex );

        AudioManager::Music* music = GetMusic( name );
        if( music == NULL )
        {
            LOG_ERROR( "No music found with name \"" + name + "\"." );
            return;
        }

        m_Music.SetLoop( music->loop );
        m_Music.Play( music->file );
    }
}
Exemplo n.º 7
0
    /// Loads assets in the specified asset package into this collection.
    /// @param[in]  asset_package - The package of assets to load.
    /// @return True if all assets in the package are loaded successfully; false otherwise.
    bool Assets::Load(const AssetPackageDefinition& asset_package)
    {
        // PROTECT AGAINST THIS CLASS BEING USED BY MULTIPLE THREADS.
        std::lock_guard<std::recursive_mutex> lock(AssetMutex);

        // LOAD EACH ASSET IN THE PACKAGE.
        for (const AssetDefinition& asset_definition : asset_package.Assets)
        {
            // LOAD THE ASSET BASED ON IT'S TYPE.
            bool asset_loaded = false;
            switch (asset_definition.Type)
            {
                case AssetType::FONT:
                    // LOAD THE FONT.
                    asset_loaded = static_cast<bool>(GetFont(asset_definition.Id));
                    break;
                case AssetType::MUSIC:
                    // LOAD THE MUSIC.
                    asset_loaded = static_cast<bool>(GetMusic(asset_definition.Id));
                    break;
                case AssetType::SHADER:
                    // LOAD THE SHADER.
                    asset_loaded = static_cast<bool>(GetShader(asset_definition.Id));
                    break;
                default:
                    // The asset can be loaded if it's type isn't known.
                    asset_loaded = false;
            }

            // ABORT IF THE ASSET FAILED TO BE LOADED.
            if (!asset_loaded)
            {
                return false;
            }
        }

        // INDICATE THAT ALL ASSETS WERE LOADED SUCCESSFULLY.
        return true;
    }
Exemplo n.º 8
0
/**
 *  Konstruktor von @p dskCredits.
 *
 *  @author siegi44
 */
dskCredits::dskCredits(void) : Desktop(LOADER.GetImageN("setup013", 0))
{
    // Zurück
    AddTextButton(0, 300, 550, 200, 22,   TC_RED1, _("Back"), NormalFont);

    // "Die Siedler II.5 RTTR"
    AddText(1, 400, 10, _("Return To The Roots"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);

    // "Credits"
    AddText(2, 400, 33, _("Credits"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);

    CreditsEntry entry = CreditsEntry();
    entry.title = "Florian Doersch (FloSoft):";
    entry.picId = 1;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Project management")));
    entry.lines.push_back(CreditsEntry::Line(_("Server management")));
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
    entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
    entry.lines.push_back(CreditsEntry::Line(_("Website Programming")));
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Oliver Siebert (Oliverr):";
    entry.picId = 4;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Project management")));
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Stefan Schüchl (Z-Stef):";
    entry.picId = 6;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
    entry.lines.push_back(CreditsEntry::Line(_("Website Programming")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Patrick Haak (Demophobie):";
    entry.picId = 0;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Jonas Trampe (NastX):";
    entry.picId = 3;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
    entry.lines.push_back(CreditsEntry::Line(_("Mapping")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Jan-Henrik Kluth (jh):";
    entry.picId = 2;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
    entry.lines.push_back(CreditsEntry::Line(_("Artificial Intelligence (AI)")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Christopher Kuehnel (Spikeone):";
    entry.picId = 5;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Additional graphics")));
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
    entry.lines.push_back(CreditsEntry::Line(_("Mapping")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Marcus Ströbel (Maqs):";
    entry.picId = -1;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = "Alex Grund (Flamefire):";
    entry.picId = -1;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = _("Additional Programming:");
    entry.picId = -1;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line("Siegfried Oleg Pammer (siegi44)"));
    entry.lines.push_back(CreditsEntry::Line("Lienhart Woitok (liwo)"));
    entry.lines.push_back(CreditsEntry::Line("Christoph Erhardt (Airhardt)"));
    entry.lines.push_back(CreditsEntry::Line("Divan"));
    entry.lines.push_back(CreditsEntry::Line("Cat666"));
    entry.lines.push_back(CreditsEntry::Line("Devil"));
    entry.lines.push_back(CreditsEntry::Line("Ikhar Beq (PoC)"));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = _("Additional Graphics:");
    entry.picId = -1;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line("Marcus Bullin (Parasit)"));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = _("Other Support:");
    entry.picId = -1;
    entry.lastLine = "";
    entry.lines.push_back(CreditsEntry::Line("muhahahaha"));
    entry.lines.push_back(CreditsEntry::Line("Sotham"));
    entry.lines.push_back(CreditsEntry::Line("Fenan"));
    entry.lines.push_back(CreditsEntry::Line("Phil Groenewold (Phil333)"));
    entry.lines.push_back(CreditsEntry::Line("Marc Vester (xaser)"));

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = _("Donators");
    entry.picId = -1;
    entry.lines.push_back(CreditsEntry::Line(_("various anonymous donators")));
    entry.lines.push_back(CreditsEntry::Line("Markus Becker"));
    entry.lines.push_back(CreditsEntry::Line("Karsten Backhaus (K-Duke)"));
    entry.lines.push_back(CreditsEntry::Line("Patrick Haak (Demophobie)"));
    entry.lines.push_back(CreditsEntry::Line("Gilles Bordelais"));
    entry.lines.push_back(CreditsEntry::Line("Dominic Jonas"));
    entry.lines.push_back(CreditsEntry::Line("Rene Hopf"));
    entry.lines.push_back(CreditsEntry::Line("Christopher Kuehnel (Spikeone)"));
    entry.lines.push_back(CreditsEntry::Line("Philipp Strathausen"));

    entry.lines.push_back(CreditsEntry::Line("Max Skuratov", 1));
    entry.lines.push_back(CreditsEntry::Line("Marius Loewe", 1));
    entry.lines.push_back(CreditsEntry::Line("Eric Lutter", 1));
    entry.lines.push_back(CreditsEntry::Line("Bob Kromonos Achten", 1));
    entry.lines.push_back(CreditsEntry::Line("morlock", 1));
    entry.lines.push_back(CreditsEntry::Line("Hans Gabathuler", 1));
    entry.lines.push_back(CreditsEntry::Line("Jan Montag", 1));
    entry.lines.push_back(CreditsEntry::Line("Patrick Schefczyk", 1));
    entry.lastLine = _("Thank you for your donations!");

    this->entries.push_back(entry);
    entry.lines.clear();

    entry.title = _("We hope you enjoy playing Return To The Roots!");
    entry.picId = -1;
    entry.lines.push_back(CreditsEntry::Line(_("Thank you!")));
    entry.lastLine = _("THE END");

    this->entries.push_back(entry);
    entry.lines.clear();

    bool nations[NAT_COUNT] = { true, true, true, true, false };

    LOADER.LoadFilesAtGame(0, nations);

    this->itCurEntry = entries.begin();
    startTime = bobTime = bobSpawnTime = VIDEODRIVER.GetTickCount();

    GetMusic(sng_lst, 8)->Play(0);
}
Exemplo n.º 9
0
static VALUE Music_create(Mix_Music* music)
{
    VALUE newobj = Music_s_alloc(cMusic);
    GetMusic(newobj)->music = music;
    return newobj;
}