/*
	Lan Wars.
	Copyright (c) 2009, 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 BITMAP_FONT_SETTINGS_H
#define BITMAP_FONT_SETTINGS_H

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

#include "Graphics\VertexShader.h"
#include "Graphics\PixelShader.h"
#include "Graphics\ShaderUniform.h"

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

namespace Game
{
    //=================================================================================================================
    /// @brief		This simple structure holds settings for a font. Font's can be rendered with different settings
    ///				if required. All font's have default settings which is read from their XML files however, if this
    ///				is not required.
	//=================================================================================================================

    struct BitmapFontSettings
    {
		public:
    
			//=========================================================================================================
			// Variables
			//=========================================================================================================
	    
				/// Size of the font: 
				
				float m_size;
				
				/// Color of the font:
				
				Color m_color;
				
				/// Spacing between font characters: this is in addition to character metrics spacing
				
				float m_char_spacing;
				
				/// Spacing between font lines: this is in addition to the standard height of each font character
				
				float m_line_spacing;
				
				/// How much of a full character width white space takes up: typically 0.35
				
				float m_whitespace_width_pc;
		    
				/// Vertex shader to use: must define a uniform for viewing and projection matrices etc. this is 'Transform' for default settings
		        
				VertexShader m_vertex_shader;
		        
				/// Pixel shader to use:
		        
				PixelShader m_pixel_shader;
				
				/// Shader uniform on the vertex shader that is used to set the current transform in use
				
				ShaderUniform m_u_transform;
				
			//=========================================================================================================
			// Functions
			//=========================================================================================================				

                //=====================================================================================================
                /// @brief		Constructor. Creates a font settings block with the given settings
                /// @param		size - Size of the font with the custom settings.
                /// @param		color - Color of the font with the custom settings.
                /// @param		char_spacing - Spacing beweeen font characters
                /// @param		line_spacing - Spacing between lines
                /// @param		whitespace_width_pc - how much of a full character width (in percent) white space 
                ///				takes up. Usually 0.35
                /// @param		ps - pixel shader to use
                /// @param		vs - vertex shader to use, must have a 'Transform' uniform on it.
                /// @param		u_transform - shader uniform on the vertex shader that sets the current transform
                //=====================================================================================================

                BitmapFontSettings
                ( 
					float					size				= 32.0f				, 
					const Color &			color				= Color::White()	, 
					float					char_spacing		= 4					, 
					float					line_spacing		= 24				, 
					float					whitespace_width_pc	= 0.35f				,
					const PixelShader &		ps					= PixelShader()		,
					const VertexShader &	vs					= VertexShader()	,
					const ShaderUniform &	u_transform			= ShaderUniform()
				)
                {
                    m_size					= size;
                    m_color					= color;
                    m_char_spacing			= char_spacing;
                    m_line_spacing			= line_spacing;
                    m_whitespace_width_pc	= whitespace_width_pc;
                    m_pixel_shader			= ps;
                    m_vertex_shader			= vs;
                    m_u_transform			= u_transform;               
                }
                
                //=====================================================================================================
                /// @brief		Copy constructor. Creates a font settings block from another one.
                /// @param		other - other font settings block to create from
                //=====================================================================================================
                
                BitmapFontSettings( const BitmapFontSettings & other )
                {
                    m_size					= other.m_size;
                    m_color					= other.m_color;
                    m_char_spacing			= other.m_char_spacing;                    
                    m_line_spacing			= other.m_line_spacing;
                    m_whitespace_width_pc	= other.m_whitespace_width_pc;
                    m_pixel_shader			= other.m_pixel_shader;
                    m_vertex_shader			= other.m_vertex_shader;
                    m_u_transform			= other.m_u_transform;
                }
                
                //=====================================================================================================
                /// @brief		Assignment operator. Assigns this font settings block to another one.
                /// @param		other - other font settings block to assign from
                /// @returns	This font settings block
                //=====================================================================================================
                
                BitmapFontSettings & operator = ( const BitmapFontSettings & other )
                {
                    m_size					= other.m_size;
                    m_color					= other.m_color;
                    m_char_spacing			= other.m_char_spacing;                    
                    m_line_spacing			= other.m_line_spacing;
                    m_whitespace_width_pc	= other.m_whitespace_width_pc;
                    m_pixel_shader			= other.m_pixel_shader;
                    m_vertex_shader			= other.m_vertex_shader;
                    m_u_transform			= other.m_u_transform;
                }                
	};
}
    
#endif