#ifndef BLUECORE_APPLICATION_H
#define BLUECORE_APPLICATION_H

#include "RenderWindow.h"
#include "RenderDevice.h"
#include "FontManager.h"
#include "MeshManager.h"
#include "TextureManager.h"
#include "ShaderManager.h"
#include "ModelManager.h"
#include "TextureImage.h"
#include "ScriptSystem.h"
#include "RigidBodySimulation.h"
#include "SceneGraph.h"

namespace BlueCore
{
class Application : public Referenced, public sigslot::has_slots<>
{
	bool _Running;
	bool _Paused;
	
	double _SimulationTime;
	double _StartTime;
	double _LastTime;

	double _CameraPhi, _CameraTheta, _CameraRadius;
	int _LastMouseX, _LastMouseY, _LastWheel;

	ref_ptr<RenderWindow> _Window;
	ref_ptr<RenderDevice> _Device;
	ref_ptr<FontManager> _FontManager;
	ref_ptr<MeshManager> _MeshManager;
	ref_ptr<TextureManager> _TextureManager;
	ref_ptr<ScriptSystem> _ScriptSystem;
	ref_ptr<ShaderManager> _ShaderManager;
	ref_ptr<RigidBodySimulation> _Simulation;
	ref_ptr<ModelManager> _ModelManager;
	ref_ptr<RenderQueue> _RenderQueue;
	ref_ptr<SceneGraph>	_SceneGraph;
	

	void KeySlot(int key, int action);
	void MouseMoveSlot(int x, int y);
	void MouseWheelSlot(int z);

public:

	bool initialize();
	void shutdown();
	void quit();
	void run();
	void togglePause();
	
	void setSceneGraph (SceneGraph *scenegraph);
};

}

#endif /*APPLICATION_H_*/
