/******************************************************** * ContentManager.h * * * * XFX ContentManager definition file * * Copyright © XFX Team. All Rights Reserved * ********************************************************/ #ifndef _XFX_CONTENT_CONTENTMANAGER_ #define _XFX_CONTENT_CONTENTMANAGER_ #include #include #include #include #include #include #include using namespace System; using namespace System::Collections::Generic; using namespace System::IO; namespace XFX { namespace Content { /// /// The ContentManager is the run-time component which loads managed /// objects from the binary files produced by the design time content pipeline. /// It also manages the lifespan of the loaded objects, disposing the content /// manager will also dispose any assets which are themselves System.IDisposable. /// class ContentManager : public IDisposable, public Object { private: List disposableAssets; //Dictionary loadedAssets; bool disposed; IServiceProvider* _provider; protected: virtual void Dispose(bool disposing); virtual Stream OpenStream(char* assetName); template T ReadAsset(char* assetName); //! usage: T ReadAsset(assetName); where T is the preferred type, i.e. Texture2D public: char* RootDirectory; ContentManager(IServiceProvider* provider); ContentManager(IServiceProvider* provider, char* rootDirectory); virtual ~ContentManager(); void Dispose(); template T Load(char* assetName); //! usage: T Load(assetName); where T is the preferred type, i.e. Texture2D virtual void Unload(); }; } } #endif //_XFX_CONTENT_CONTENTMANAGER_