#ifndef LEVELSTATE_H
#define LEVELSTATE_H

#include <GL/freeglut.h>
#include "View.h"
#include "Camera.h"
#include "GameState.h"
#include "Level.h"
#include "GBuffer.h"
#include "EdgeBuffer.h"
#include "EdgeLightBuffer.h"
#include "FinalBuffer.h"
#include "BlurBuffer.h"
#include "audiere.h"
using namespace audiere;

class LevelState : public GameState
{
private:
	View *m_view;
	Camera *m_camera;
	Level *m_level;

	vector<Vector4 *> m_edgeLights;

	AudioDevicePtr* device;
	OutputStreamPtr* pulse;

	int curLevel;
	float m_time;
	int pulseCtr;
	int numLevels;

	GBuffer *gBuffer;
	EdgeBuffer *edgeBuffer;
	EdgeLightBuffer *edgeLightBuffer;
	FinalBuffer *finalBuffer;
	BlurBuffer *finalBlurBuffer;

	void drawText();
	void checkLevelEnd();
	void loadLevel(int levelNum);

public:
	LevelState();

	virtual void resize(int nWidth, int nHeight);
	virtual void tick(int nFps);
	virtual void onclick();

	void setLevel(int levelNum) { curLevel = levelNum; loadLevel(levelNum); }
};

#endif