| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- // ----------------------------------------------------------------
- // From Game Programming in C++ by Sanjay Madhav
- // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
- //
- // Released under the BSD License
- // See LICENSE in root directory for full details.
- // ----------------------------------------------------------------
- #pragma once
- #include <SDL/SDL.h>
- #include <unordered_map>
- #include <string>
- #include <vector>
- #include "Math.h"
- #include "SoundEvent.h"
- class Game
- {
- public:
- Game();
- bool Initialize();
- void RunLoop();
- void Shutdown();
- void AddActor(class Actor* actor);
- void RemoveActor(class Actor* actor);
- class Renderer* GetRenderer() { return mRenderer; }
- class AudioSystem* GetAudioSystem() { return mAudioSystem; }
- private:
- void ProcessInput();
- void HandleKeyPress(int key);
- void UpdateGame();
- void GenerateOutput();
- void LoadData();
- void UnloadData();
-
- // All the actors in the game
- std::vector<class Actor*> mActors;
- // Any pending actors
- std::vector<class Actor*> mPendingActors;
- class Renderer* mRenderer;
- class AudioSystem* mAudioSystem;
- Uint32 mTicksCount;
- bool mIsRunning;
- // Track if we're updating actors right now
- bool mUpdatingActors;
- // Game-specific code
- class CameraActor* mCameraActor;
- SoundEvent mMusicEvent;
- SoundEvent mReverbSnap;
- };
|