Game.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #pragma once
  9. #include <SDL/SDL.h>
  10. #include <unordered_map>
  11. #include <string>
  12. #include <vector>
  13. #include "Math.h"
  14. class Game
  15. {
  16. public:
  17. Game();
  18. bool Initialize();
  19. void RunLoop();
  20. void Shutdown();
  21. void AddActor(class Actor* actor);
  22. void RemoveActor(class Actor* actor);
  23. class Renderer* GetRenderer() { return mRenderer; }
  24. private:
  25. void ProcessInput();
  26. void UpdateGame();
  27. void GenerateOutput();
  28. void LoadData();
  29. void UnloadData();
  30. // All the actors in the game
  31. std::vector<class Actor*> mActors;
  32. // Any pending actors
  33. std::vector<class Actor*> mPendingActors;
  34. class Renderer* mRenderer;
  35. Uint32 mTicksCount;
  36. bool mIsRunning;
  37. // Track if we're updating actors right now
  38. bool mUpdatingActors;
  39. // Game-specific code
  40. class CameraActor* mCameraActor;
  41. };