/**
 *  Triangles
 *  Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "State.hpp"
#include "Player.hpp"
#include "Foreground.hpp"
#include "Camera.hpp"
#include "Wormhole.hpp"
#include "Star.hpp"
#include "../ltbl/lighting/LightSystem.h"

class IngameState: public State
{
	public:
		IngameState();
		virtual ~IngameState();
		void init() final;
		/**
		* @brief Method casted whenever the ga		me's resolution changes.
		*/
		void refresh() final;
		void coreThink(const sf::Event& event) final;
		void coreInput() final;
		void coreUpdate(sf::Time delta) final;
		void coreRender() final;

	private:
		Player _player;
		Foreground _foreground;
		Camera _camera;
		sf::Sprite _background;
		
		sf::Shader _unshadowShader;
		sf::Shader _lightOverShapeShader;
		sf::Shader _normalsShader;
		sf::Texture _penumbraTexture;
		ltbl::LightSystem _lightSystem;
		
		bool _cameraMode;
		bool _paused;
		sf::RectangleShape _pauseFrame;
		sf::Sprite _wasted;
		sf::Shader _blurV;
		sf::Shader _blurH;
		
		sf::Sprite _noshaders;
		
		sf::Music _music;
		
		float _blurSize;
		float _frameAlpha;
		
		sf::Sound _marioSound;
		sf::Sound _dotaSound;
		sf::RenderTexture _backgroundH;
		sf::RenderTexture _backgroundV;
		
		sf::Text _statsTime;
		sf::Text _statsHull;
		sf::Text _statsStars;
		
		sf::Clock _totalTime;
		
		Wormhole _wormhole;
		std::vector<Star> _star;
		unsigned _starsCollected;
		unsigned _starsCount;
};

