Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. struct TextureManager final
  2. {
  3. Texture& Get(...);
  4. };
  5.  
  6. struct AudioManager final
  7. {
  8. Sound& Get(...);
  9. };
  10.  
  11. struct Game;
  12.  
  13. class GlobalResources final
  14. {
  15. public:
  16. static TextureManager& GetTextureManager() {return *this->textureManager;}
  17. static AudioManager& GetAudioManager() {return *this->audioManager;}
  18. static Game& GetGameInstance() {return *this->gameInstance;}
  19.  
  20. static void ProvideTextureManager(TextureManager& manager);
  21. // ...
  22.  
  23. private:
  24. static TextureManager* textureManager;
  25. static AudioManager* audioManager;
  26. static Game* gameInstance;
  27. };
  28.  
  29. struct Game final
  30. {
  31. TextureManager textureManager;
  32. AudioManager audioManager;
  33.  
  34. Game()
  35. {
  36. GlobalResources::ProvideTextureManager(this->textureManager);
  37. GlobalResources::ProvideAudioManager(this->audioManager);
  38. GlobalResources::ProvideGameInstance(*this);
  39. }
  40. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement