#ifndef Engine_Game_H
#define Engine_Game_H

#include "Prerequisites.h"
#include "Singleton.h"
#include <OgreVector3.h>

#define MAXBULLETS 25
#define MAXENEMIES 100
#define MAXWALLS 25
#define MAXLEVELOBJECTS 30
#define MAXEVENTS 500

#define FIREMENSTART 75
#define OGRESTART 92

enum GS{GS_INTRO,GS_MAINMENU,GS_GAME,GS_PAUSE,GS_GAMEOVER,GS_CREDITS};

namespace Ogre
{
	class Root;
	class RenderWindow;
	class SceneManager;
	class Camera;
	class Viewport;
	class SceneNode;
	class OverlayContainer;
}

namespace OIS
{
	class InputManager;
	class Mouse;
	class Keyboard;
}

class Player;
class Enemy;
class CollisionBox;
class DefenseWall;
class SoundManager;

class GameEvent
{
public:
	GameEvent(int aTime, int aType, Ogre::Vector3 aPos);
	int mTime;
	int mType;
	Ogre::Vector3 mPos;
	void Do();
};

namespace Engine
{
	class Game : public Singleton<Game>
	{
	protected:
		Ogre::Root* mOgreRoot;
		Ogre::RenderWindow* mOgreWindow;
		Ogre::Camera* mOgreCamera;
		Ogre::Viewport* mOgreViewport;
	public:
		Game();
		virtual ~Game();
		virtual bool initialize();
		virtual void run(GameCode* gameCode);
		static Ogre::SceneManager* mOgreSceneManager;

		//OIS Input devices
		OIS::InputManager* mInputManager;
		static OIS::Mouse*    mMouse;
		static OIS::Keyboard* mKeyboard;

		static Enemy** mEnemies;
		static Player* mPlayer;
		static CollisionBox* mBase;
		static DefenseWall** mDefenseWalls;
		static CollisionBox** mLevelBoxes;
		static int mNumLevelBoxes;
		void AddLevelObject(Ogre::Vector3 aPos, float aWidth, float aHeight);

		static float mSurvivalTime; //in msec;

		float mZoomDist;

		GameEvent* mEvents[MAXEVENTS];
		int mEventListPos;
		int mNumEvents;
		void AddEvent(int aTime, int aType, Ogre::Vector3 aPos);
	
		static int mGameState;

		Ogre::OverlayContainer* IntroMovie;
		Ogre::OverlayContainer* Credits;
		Ogre::OverlayContainer* MainMenu;
		Ogre::OverlayContainer* PauseMenu;
		Ogre::OverlayContainer* GameOverMenu;
		Ogre::OverlayContainer* TextPanel;

		static SoundManager* SoundMgr;
	};
}

#endif