#ifndef _BREAKOUTAPP_H_
#define _BREAKOUTAPP_H_

#include "TSingleton.h"
#include "IEventListener.h"

#include <vector>
#include "Visualisation.h"
#include "SDL.h"

#include "IScene.h"

class BreakoutApp : public TSingleton<BreakoutApp>, public IEventListener
{
	public:
	BreakoutApp();
	~BreakoutApp();

	void Run();

	void Draw();
	void Update();

	void Initialise();
	void Shutdown();

	virtual bool HandleEvent(IEvent* pEvent);

	SDL_Surface* GetScreen() { return m_pScreen; }
	SpriteID GetBoxSpriteFromHealth(unsigned int health) 
	{
		if(health >= m_vBoxSprites.size())
			health = health % m_vBoxSprites.size();
		
		return m_vBoxSprites[health];
	}

	protected:
	enum eSceneType
	{
		eGameScene = 0,
		eMainMenuScene,
		ePauseScene,
		eGameOverScene,
		eSplashScreenScene,
		eErrorScene,
		eNumSceneTypes
	};

	void InitialiseScenes();
	void ChangeScene(const eSceneType &sceneType);

	bool m_bQuitGame;

	int m_bgMusicID;
	eSceneType m_currentScene;
	IScene* m_sceneArray[eNumSceneTypes];
	std::vector<SpriteID> m_vBoxSprites;	

	//SDL settings
	SDL_Surface* m_pScreen;
};

#endif
