/*
 * JamSpookGame.h
 *
 *  Created on: Aug 8, 2019
 *      Author: fredrick
 */

#ifndef JAMSPOOKGAME_H_
#define JAMSPOOKGAME_H_

#include <memory>
#include <functional>
#include <vector>
#include <string>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <SDL2/SDL.h>

#include <ecos/core/Log.h>
#include <ecos/core/Game.h>
#include <ecos/core/IDCache.h>
#include <ecos/core/Entity.h>
#include <ecos/core/SceneGraph.h>
#include <ecos/core/Window.h>
#include <ecos/core/SysCall.h>
#include <ecos/core/BroadcastObservable.h>
#include <ecos/core/CycleRegulationSystem.h>
#include <ecos/utility/FileSystem.h>
#include <ecos/utility/Random.h>
#include <ecos/asset/AssetSystem.h>
#include <ecos/asset/AssetFileSystem.h>
#include <ecos/physics/PhysicsSystem.h>
#include <ecos/physics/loaders/CollisionShapeLoader.h>
#include <ecos/animation/AnimationSystem.h>
#include <ecos/interaction/InteractionSystem.h>
#include <ecos/graphics/GraphicsSystem.h>
#include <ecos/graphics/RenderLayer.h>
#include <ecos/graphics/RenderLayerFactory.h>
#include <ecos/graphics/assets/ShaderAsset.h>
#include <ecos/graphics/ShaderProgram.h>
#include <ecos/graphics/ShaderProgramFactory.h>
#include <ecos/graphics/DevILSystem.h>
#include <ecos/graphics/GL4Renderer.h>
#include <ecos/graphics/camera/CameraFactory.h>
#include <ecos/graphics/camera/Camera.h>
#include <ecos/graphics/loaders/MeshLoader.h>
#include <ecos/graphics/loaders/ShaderLoader.h>
#include <ecos/graphics/loaders/ShaderProgramLoader.h>
#include <ecos/graphics/loaders/TextureBlankLoader.h>
#include <ecos/graphics/loaders/TextureFileLoader.h>
#include <ecos/sound/SoundSystem.h>
#include <ecos/sound/loaders/SoundEffectLoader.h>

#include "entities/LightingFactory.h"
#include "entities/Jump180Factory.h"
#include "entities/GoalFactory.h"
#include "entities/BallFactory.h"
#include "entities/BoxFactory.h"

namespace JamSpook {

using std::unique_ptr;
using std::make_unique;
using std::shared_ptr;
using std::make_shared;
using std::static_pointer_cast;
using std::dynamic_pointer_cast;
using std::bind;
using std::vector;
using std::string;
using std::to_string;
using glm::ivec2;
using glm::vec2;
using glm::vec3;
using glm::vec4;
using glm::mat4;
using glm::translate;
using glm::normalize;

using ecos::core::logging::Log;
using ecos::core::logging::LogLevel;
using ecos::core::Game;
using ecos::core::GameState;
using ecos::core::IDCache;
using ecos::core::SceneGraph;
using ecos::core::SysCall;
using ecos::core::BroadcastObservable;
using ecos::core::Window;
using ecos::core::CycleRegulationSystem;
using ecos::utility::getWorkingPath;
using ecos::utility::getRealPath;
using ecos::utility::getFloatInRange;
using ecos::utility::getIntInRange;
using ecos::asset::AssetSystem;
using ecos::asset::AssetFileSystem;
using ecos::physics::PhysicsSystem;
using ecos::physics::CollisionShapeLoader;
using ecos::graphics::TextureBlankLoader;
using ecos::animation::AnimationSystem;
using ecos::interaction::InteractionSystem;
using ecos::interaction::InputDeviceState;
using ecos::interaction::ButtonState;
using ecos::graphics::GraphicsSystem;
using ecos::graphics::RenderLayer;
using ecos::graphics::RenderLayerFactory;
using ecos::graphics::ShaderAsset;
using ecos::graphics::ShaderProgram;
using ecos::graphics::ShaderProgramFactory;
using ecos::graphics::DevILSystem;
using ecos::graphics::Renderer;
using ecos::graphics::GL4Renderer;
using ecos::graphics::Camera;
using ecos::graphics::CameraFactory;
using ecos::graphics::MeshLoader;
using ecos::graphics::ShaderLoader;
using ecos::graphics::ShaderProgramLoader;
using ecos::graphics::TextureFileLoader;
using ecos::graphics::TextureBlankLoader;
using ecos::graphics::ShaderType;
using ecos::graphics::ShaderAsset;
using ecos::graphics::ShaderProgram;
using ecos::asset::DataManagementMode;
using ecos::sound::SoundSystem;
using ecos::sound::SoundEffectLoader;

class JamSpookGame:
        public Game
{
private:
    shared_ptr<Window> mWindow;
    BroadcastObservable<const SysCall>::CallbackID mCallbackId;
    BroadcastObservable<const InputDeviceState>::CallbackID mInputDeviceCallbackId;
    shared_ptr<GL4Renderer> mRenderer;
    shared_ptr<Camera> mCamera;

public:
    JamSpookGame();
    virtual ~JamSpookGame();

    virtual void load();
    virtual void update();

    void set();
    void reset();

    void menu();

    void onSysCall(const SysCall sysCall);
    void onInputDeviceStateChange(const InputDeviceState inputDeviceState);
};

} // namespace JamSpook

#endif // JAMSPOOKGAME_H_
