/*
	Rogue Trader.
	Copyright (c) 2007, 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 INTROSCREEN_H
#define INTROSCREEN_H

//##############################################################################
// C Includes
//##############################################################################

#include <Windows.h>
#include <gl/gl.h>
#include "MathLibrary.h"

//##############################################################################
// Forward references
//##############################################################################

class Timer;
class MusicSystem;
class GLFont;
class GLFontManager;
class GLWindow;

//##############################################################################
// Stuff that can't be forward referenced
//##############################################################################

#include "Timer.h"
#include "GLWindowEventListener.h"

//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################
//
//
// Class Name:   IntroScreen
// Purpose:      Draws the star wars style introduction screen. Last minute bit of fun :)
//
//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################

class IntroScreen
{

 public:

        //----------------------------------------------------------------------
        // Functions
        //----------------------------------------------------------------------

        // Show the intro screen:

        static void run
        (
            const char * titleText  ,   // The title text
            const char * mainText   ,   // The main text to show
            float titleTextTime     ,   // Time the title text is on the screen for
            float mainTextTime      ,   // Time the main text is on the screen for
            float mainTextSpeed         // Speed at which the main text scrolls
        );

        // Exits the intro screen:

        static void exit();

//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################

 protected:

        //----------------------------------------------------------------------
        // Constants
        //----------------------------------------------------------------------

        // The number of background stars:

        static const unsigned NUM_STARS;

        //----------------------------------------------------------------------
        // Classes:
        //----------------------------------------------------------------------

        class IntroScreenEventListener : public GLWindowEventListener
        {
            // No unreferenced param warning
            
            #pragma warning(disable:4100)
                    
            // This class responds to the keyboard down and mouse pressed events

            void keyboardPressed( GLWindow::KeyboardKey key )
            {
                // Stop running the intro screen on a keypress

                IntroScreen::exit();
            }

            void mousePressed( int x , int y , GLWindow::MouseButton button )
            {
                // Stop running the intro screen on a mouse press

                IntroScreen::exit();
            }
            
            // Restore this to normal
            
            #pragma warning(default:4100)             
        };

        //----------------------------------------------------------------------
        // Functions:
        //----------------------------------------------------------------------

        // Draws the title text, and main text parts of the intro screen:

        static void drawTitleText   ( float timeLeft );
        static void drawMainText    ( float timeLeft );

        // Draws the background part of the intro screen:

        static void drawBackground();

        // Draws the text part of the intro screen

        static void drawText();

        //----------------------------------------------------------------------
        // Variables
        //----------------------------------------------------------------------

        // Timer which times the frame rate

        static Timer * frameTimer;

        // Continue running the intro screen ?

        static bool continueRunning;

        // Settings:

        static const char * titleText;          // title text
        static const char * mainText;           // main  text
        static float        titleTextTime;      // time the title is up for
        static float        mainTextTime;       // time the main text is up for
        static float        mainTextSpeed;      // speed at which the main text scrolls

}; // end of: class IntroScreen{}

//##############################################################################
// C++ Includes
//##############################################################################

#include "Timer.h"
#include "MusicSystem.h"
#include "GLFont.h"
#include "GLFontManager.h"
#include "GLWindow.h"
#include "GLWindowEventListener.h"

#endif // end of: ifndef INTROSCREEN_H
