c_cpp AssetManager.cpp

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp AssetManager.cpp相关的知识,希望对你有一定的参考价值。

class AssetManager
{
        static AssetManager* instance;

public:
        static AssetManager* instance();

        static void release();

        void setPath(const std::string& thePath);

        sf::Texture* getTexture(const std::string& theName);
        sf::Texture* getTexture(const std::string& theName, sf::Texture* theTexture);
        sf::Texture* getTextureFromImage(const std::string& theName, const sf::Image* theImage, const sf::IntRect& theRect = sf::IntRect());

        void deleteTexture(const std::string& theName);
        void deleteTexture(const sf::Texture* theTexture);

        sf::Image* getImage(const std::string& theName);
        sf::Image* getImageFromTexture(const std::string& theName, const sf::Texture* theTexture);

        void deleteImage(const std::string& theName);
        void deleteImage(const sf::Image* theImage);

        sf::Font* getFont(const std::string& theName);

        void deleteFont(const std::string& theName);
        void deleteFont(const sf::Font* theFont);

        sf::SoundBuffer* getSoundBuffer(const std::string& theName);

        void deleteSoundBuffer(const std::string& theName);
        void deleteSoundBuffer(const sf::SoundBuffer* theSoundBuffer);

        sf::Music* getMusic(const std::string& theName);

        void deleteMusic(const std::string& theName);
        void deleteMusic(const sf::Music* theMusic);

        ConfigReader* getConfig(const std::string& theName);

        void deleteConfig(const std::string& theName);
        void deleteConfig(const ConfigReader* theConfig);

        void cleanup();

private:
        // Variables
        ///////////////////////////////////////////////////////////////////////////
        /// Directorio maestro donde buscar recursos
        std::string m_masterDir;
        /// Mapa de registro de todas las texturas
        std::map<std::string, sf::Texture*> m_textures;
        /// Mapa de registro de todas las imágenes
        std::map<std::string, sf::Image*> m_images;
        /// Mapa de registro de todas las fuentes
        std::map<std::string, sf::Font*> m_fonts;
        /// Mapa de registro de todos los buffers de sonido
        std::map<std::string, sf::SoundBuffer*> m_sounds;
        /// Mapa de registro de toda la música
        std::map<std::string, sf::Music*> m_music;
        /// Mapa de registro de todos los archivos de configuraciones
        std::map<std::string, ConfigReader*> m_configs;


        AssetManager();
        AssetManager(const AssetManager&);
        AssetManager& operator=(const AssetManager&);
        ~AssetManager();
}; // class AssetManager

以上是关于c_cpp AssetManager.cpp的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp 130.周围地区

c_cpp 200.岛屿数量

c_cpp 127.单词阶梯

c_cpp MOFSET

c_cpp MOFSET

c_cpp 31.下一个排列