#ifndef _H_GAME_H
#define _H_GAME_H

#include <SDL_events.h>
#include <memory>
#include <utility/events.h>

#include "gameplay/camera.h"

class InputHandler;
class Scene;
class Text;
class ResourceManager;
class Renderer;
class AudioEngine;
class GLWindow;

enum { GAME_QUITTING = 0, GAME_RUNNING = 1, GAME_MENU = 2, GAME_PLAYING = 4 };

class Game {
public:
  Game() {}
  bool init();

  bool loadDebugScene();

  void captureInput(SDL_Event &e);
  void executeInputs();

  void update(double deltaTime);
  void render();

  const unsigned getGameState() const { return game_state; }

  const unsigned getWindowWidth() const;
  const unsigned getWindowHeight() const;

  void quit();
  ~Game();

private:
  unsigned game_state = GAME_QUITTING;

  std::shared_ptr<GLWindow> window;

  std::unique_ptr<Camera> camera;
  std::shared_ptr<Scene> currentScene;
  std::shared_ptr<InputHandler> inputHandler;
  std::shared_ptr<ResourceManager> resourceManager;
  std::shared_ptr<Renderer> renderer;
  std::shared_ptr<Text> textHandler;
  std::shared_ptr<AudioEngine> audioEngine;
  std::shared_ptr<EventManager> globalEventManager;
};

#endif
