/*
	Trig Wars.
	Copyright (c) 2008, Darragh Coy.
	All rights reserved.
	Original work(s), source code & author(s) details available at: http://www.darraghcoy.com

	Redistribution and use in source and binary forms, with or without modification, are permitted 
	provided that the following conditions are met:

		* 	Redistributions of source code must retain the above copyright notice, this list of 
			conditions and the following disclaimer.
		* 	Redistributions in binary form must reproduce the above copyright notice, this list of 
			conditions and the following disclaimer in the documentation.
		* 	Neither the name of the author nor the names of contributors may be used to endorse or 
			promote products derived from this software without specific prior written permission.
		* 	The use of any third party libraries, modules or data files provided with the source 
			form of the program must follow and respect the individual licensing terms of these 
			components. You do not have permission to modify or circumvent the licensing terms for 
			provided third party components unless the third party licenses specifically allow this. 
			If you do not agree to the terms of provided third party components then you do not have 
			permission to use them in your derived work(s).
		* 	The terms of this license do not apply to separate (but related) distributions if supplied 
			by the author(s), only to the contents of this source distribution, derived works, and the 
			binaries produced by either modified or unmodified versions of the source code. The terms 
			of this license do not also apply to any third party libraries or components provided with 
			the source distribution. Such third party elements are licensed under their own separate 
			agreements.

	THIS SOFTWARE IS PROVIDED BY DARRAGH COY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
	ARE DISCLAIMED. IN NO EVENT SHALL DARRAGH COY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
	OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef GAME_HUD_H
#define GAME_HUD_H

//=====================================================================================================================
//=====================================================================================================================

#include "Graphics\Texture.h"
#include "Graphics\BitmapFont.h"
#include "Graphics\VertexShader.h"
#include "Graphics\PixelShader.h"
#include "Graphics\VertexFormat.h"
#include "Graphics\ShaderUniform.h"

//=====================================================================================================================
//=====================================================================================================================

namespace Game
{
	//=================================================================================================================
	//=================================================================================================================
	
	class Window;
	class Camera2D;
	class EnemyWaspManager;
	class EnemyFactoryManager;
	class EnemyPredatorManager;
	class PlayerShip;

	//=================================================================================================================
	/// @brief		Class representing the game hud. Draws the map & player score etc. for every frame.
	//=================================================================================================================
	
	class GameHud : public ObjectBase
	{
		public:

			//=========================================================================================================
			// Functions
			//=========================================================================================================

				/// Creates the map display

				GameHud();

				/// Destroys the map display

				~GameHud();
				
				/// Draws the HUD display:
				
				void Draw();

				/// Tells the object to announce it's type name: this is the type name without the Game:: namespace

				virtual const char * GetTypeName() const;

		private:

			//=========================================================================================================
			// Constants
			//=========================================================================================================

				//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
				/// Size of the map display. This is half extent size from it's center 
				/// Coordinates are given in the native resolution of the screen.
				//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

				static const Vec2f MAP_SIZE;
				
				//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
				/// Size of the map frame. This is the position of it's center. 
				/// Coordinates are given in the native resolution of the screen.
				//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

				static const Vec2f MAP_FRAME_SIZE;
				
				/// Number of units to draw for the health bar:
				
				static const unsigned HEALTH_BAR_UNITS;
				
				/// Size of each health bar unit
				
				static const Vec2f HEALTH_UNIT_SIZE;
				
				/// Horizontal spacing between each health bar unit
				
				static const float HEALTH_UNIT_SPACING;
				
			//=========================================================================================================
			// Functions
			//=========================================================================================================
			
				/// Draws the player's score:
				
				void DrawScore();
				
				/// Draws the map display

				void DrawMap();	
				
				/// Draws the health bar:
				
				void DrawHealthBar();
				
				/// Draws the instructions
				
				void DrawInstructions();
				
				/// Draws the game over message
				
				void DrawGameOver();
				
				/// Draws the game won message
				
				void DrawGameWon();
				
				/// Draws the game paused message
				
				void DrawGamePaused();				

			//=========================================================================================================
			// Variables
			//=========================================================================================================

				/// The 'camera' used by the map display. This is used to get projection matrices for the HUD

				Camera2D * m_camera;

				/// Wasp manager used by the game

				EnemyWaspManager * m_wasp_mgr;

				/// Factory manager used by the game

				EnemyFactoryManager * m_factory_mgr;
				
				/// Predator manager used by the game

				EnemyPredatorManager * m_predator_mgr;
				
				/// A reference to the player's ship
				
				PlayerShip * m_player;	

				/// Texture used for the map frame

				Texture m_frame_tex;
				
				/// Texture used for health bar units
				
				Texture m_health_unit_tex;
				
				/// Font to draw the hud elements with
				
				BitmapFont m_font;
				
				/// Font to draw large amounts of readable text
				
				BitmapFont m_reading_font;

				/// Font to draw large amounts of readable text: shadow
				
				BitmapFont m_reading_shadow_font;
				
				/// Smaller font for instructions etc
				
				BitmapFont m_small_font;
				
				/// Vertex format to use when drawing sprites
				
				VertexFormat m_vf;
				
				/// Pixel shader to use for drawing sprites
				
				PixelShader m_ps;
				
				/// Vertex shader to use for drawing sprites
				
				VertexShader m_vs;
				
				/// Transform uniform on the vertex shader
				
				ShaderUniform m_u_transform;
				
				/// True if all our resources are valid
				
				bool m_valid_resources;
	};

};

#endif 