#include <Ogre.h>
#include <OIS/OIS.h>
#include <OgreConfigFile.h>
#include <OgreException.h>
#include "Navicella.h"
#include "ExtendedCamera.h"

using namespace Ogre;

class PFrameListener: public FrameListener, public WindowEventListener {
	public:
		PFrameListener( RenderWindow * p_Window, Camera * p_Camera, SceneManager * p_SceneMgr );
		~PFrameListener();

		void	setSceneObject (SceneObject *SceneObject);
		void	setExtendedCamera (ExtendedCamera *cam);
		void	SetOverlayMalusPanel( String s, Real r );
		void	setPartitaFinita ( bool b );

	private:
		Camera *			m_Camera;
		RenderWindow *		m_Window;
		SceneManager *		m_SceneMgr;

		OIS::Mouse *		m_Mouse;
		OIS::Keyboard *		m_Keyboard;
		OIS::InputManager * m_InputManager;

		bool				continueRendering;
		bool				m_GiocoInizio;
		bool				m_ScenaFinale;
		bool				m_Vittoria;
		
		SceneObject *		m_Navicella;
		ExtendedCamera *	m_ExCamera;

		// variabili GUIstate
		int					m_GUIstate;
		Real				m_GUIToggle;

		// Variabili overlay
		Real				m_OverlayToggle;
		
		Overlay	*			m_OverGUI;

		static const int	GUI_RIEPILOGO	= 0;
		static const int	GUI_CONTROLLI	= 1;
		static const int	GUI_GAME		= 2;

		// timer
		Timer			*	m_Timer;
       
		void windowResized(RenderWindow * rw);
		void windowClosed(RenderWindow* rw);

		bool frameStarted(const FrameEvent& evt);
        bool frameEnded(const FrameEvent& evt);

		bool processUnbufferedKeyInput(const FrameEvent& evt);
		bool processUnbufferedMouseInput(const FrameEvent& evt);
};