Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct TextureManager final
- {
- Texture& Get(...);
- };
- struct AudioManager final
- {
- Sound& Get(...);
- };
- struct Game;
- class GlobalResources final
- {
- public:
- static TextureManager& GetTextureManager() {return *this->textureManager;}
- static AudioManager& GetAudioManager() {return *this->audioManager;}
- static Game& GetGameInstance() {return *this->gameInstance;}
- static void ProvideTextureManager(TextureManager& manager);
- // ...
- private:
- static TextureManager* textureManager;
- static AudioManager* audioManager;
- static Game* gameInstance;
- };
- struct Game final
- {
- TextureManager textureManager;
- AudioManager audioManager;
- Game()
- {
- GlobalResources::ProvideTextureManager(this->textureManager);
- GlobalResources::ProvideAudioManager(this->audioManager);
- GlobalResources::ProvideGameInstance(*this);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement