D:/Zythum/DinoKod/Mod_Aeternis_Client/A_WinStart.cpp

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : WinStart.cpp
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 15/05/2003
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #include "Common/Time.h"
00012 #include "Common/Math.h"
00013 #include "Common/LocalizedString.h"
00014 #include "Render/Render.h"
00015 #include "Render/Font.h"
00016 
00017 #include "Mod_Aeternis_Client/A_Interface.h"
00018 
00019 #include "Mod_Aeternis_Client/A_WinStart.h"
00020 
00021 #define GUIDIR( __gui ) KStr( "GUI/%s/%s", GETLANGUAGEPREFIX(), __gui )
00022 /*#define       BUTTONPLAY              GUIDIR("Play")
00023 #define BUTTONPLAYHL    GUIDIR("Play_HL")
00024 #define BUTTONPLAYC             GUIDIR("Play_C")*/
00025 #define BUTTONMULTI             GUIDIR("Multi")
00026 #define BUTTONMULTIHL   GUIDIR("Multi_HL")
00027 #define BUTTONMULTIC    GUIDIR("Multi_C")
00028 #define BUTTONOPTIONS   GUIDIR("Options")
00029 #define BUTTONOPTIONSHL GUIDIR("Options_HL")
00030 #define BUTTONOPTIONSC  GUIDIR("Options_C")
00031 #define BUTTONCONTACT   GUIDIR("Contacter")
00032 #define BUTTONCONTACTHL GUIDIR("Contacter_HL")
00033 #define BUTTONCONTACTC  GUIDIR("Contacter_C")
00034 #define BUTTONCREDITS   GUIDIR("Credits")
00035 #define BUTTONCREDITSHL GUIDIR("Credits_HL")
00036 #define BUTTONCREDITSC  GUIDIR("Credits_C")
00037 #define BUTTONQUIT              GUIDIR("Quit")
00038 #define BUTTONQUITHL    GUIDIR("Quit_HL")
00039 #define BUTTONQUITC             GUIDIR("Quit_C")
00040 
00041 
00042 //------------------------------------------------------------------------------------------
00043 //------------------------------------------------------------------------------------------
00044 //------------------------------------------------------------------------------------------
00045 KAWinStart::KAWinStart( KWin* pFather, KFPt& Pos, KFPt& Size, KInterface* pInterface )
00046 : KWin( pFather, Pos, Size, pInterface )
00047 {
00048         m_BackGround = KSHADER_NO;
00049 
00050         KFPt    ButtonSize = KFPt( 0.25f, 0.04f );
00051         // Button Play
00052 //      m_pButtonPlay = new KButton( this, KFPt( 0.5f, 0.4f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00053 //      m_pButtonPlay->Enable( false );
00054         // Button Multi
00055         m_pButtonMulti = new KButton( this, KFPt( 0.5f, 0.5f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00056         // Button Options
00057         m_pButtonOptions = new KButton( this, KFPt( 0.5f, 0.6f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00058         // Button Credits
00059         m_pButtonContact = new KButton( this, KFPt( 0.5f, 0.7f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00060         // Button Credits
00061         m_pButtonCredits = new KButton( this, KFPt( 0.5f, 0.8f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00062         // Button Quit
00063         m_pButtonQuit = new KButton( this, KFPt( 0.5f, 0.9f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00064 }
00065 
00066 //------------------------------------------------------------------------------------------
00067 KAWinStart::~KAWinStart()
00068 {
00069 }
00070 
00071 //------------------------------------------------------------------------------------------
00072 void KAWinStart::Display()
00073 {
00074         u8              FadeAlpha = (u8)(255.0f * GetFade());
00075         float   pTU[4] = {0.0f, 1.0f, 0.0f, 1.0f};
00076         float   pTV[4] = {0.0f, 0.0f, 1.0f, 1.0f};
00077 
00078         m_pInterface->ShowMouse();
00079         DrawQuad( 0.0f, 0.0f, 1.0f, 1.0f, m_BackGround, KRGBA( 255, 255, 255, FadeAlpha ), KRGB_BLACK/*KRGB( 255, 0, 0 )*/ );
00080 
00081         float   a = (float)g_Time.GetTime() / 1000.0f;
00082         float   c = FastCos( a );
00083         float   s = FastSin( a );
00084         pTU[0] = c * 0.25f;
00085         pTV[0] = s * 0.25f;
00086         pTU[1] = -c * 0.25f + 1.0f;
00087         pTV[1] = -s * 0.25f;
00088         pTU[2] = c * 0.25f;
00089         pTV[2] = s * 0.25f + 1.0f;
00090         pTU[3] = -c * 0.25f + 1.0f;
00091         pTV[3] = -s * 0.25f + 1.0f;
00092 
00093         DrawQuad( 0.0f, 0.0f, 1.0f, 1.0f, m_BackGround, KRGBA( 255, 255, 255, u8(FadeAlpha * 0.2f) ), KRGB_BLACK, KRM_NORMAL, pTU, pTV );
00094 
00095         pTU[0] = c * 0.25f;
00096         pTV[0] = -s * 0.25f;
00097         pTU[1] = -c * 0.25f + 1.0f;
00098         pTV[1] = s * 0.25f;
00099         pTU[2] = c * 0.25f;
00100         pTV[2] = -s * 0.25f + 1.0f;
00101         pTU[3] = -c * 0.25f + 1.0f;
00102         pTV[3] = s * 0.25f + 1.0f;
00103 
00104         DrawQuad( 0.0f, 0.0f, 1.0f, 1.0f, m_BackGround, KRGBA( 255, 255, 255, u8(FadeAlpha * 0.2f) ), KRGB_BLACK, KRM_NORMAL, pTU, pTV );
00105         //      DrawQuad( 0.0f, 0.0f, 1.0f, 1.0f, g_hTest, KRGBA( 255, 255, 255, FadeAlpha ) );
00106 }
00107 
00108 //------------------------------------------------------------------------------------------
00109 void KAWinStart::Manage()
00110 {
00111         // SOLO
00112 /*      if( m_pButtonPlay->IsClicked() )
00113         {
00114                 m_pButtonPlay->Reset();
00115         }
00116 */
00117         // MULTI
00118         if( m_pButtonMulti->IsClicked() )
00119         {
00120                 m_pButtonMulti->Reset();
00121                 ((KAInterface*)m_pInterface)->SetWin( KAIW_MULTIPLAYER );
00122         }
00123 
00124         // OPTIONS
00125         if( m_pButtonOptions->IsClicked() )
00126         {
00127                 m_pButtonOptions->Reset();
00128                 ((KAInterface*)m_pInterface)->SetWin( KAIW_OPTIONS );
00129         }
00130 
00131         // CONTACT
00132         if( m_pButtonContact->IsClicked() )
00133         {
00134                 m_pButtonContact->Reset();
00135                 ((KAInterface*)m_pInterface)->SetWin( KAIW_CONTACT );
00136         }
00137 
00138         // QUIT
00139         if( m_pButtonCredits->IsClicked() )
00140         {
00141                 m_pButtonCredits->Reset();
00142                 ((KAInterface*)m_pInterface)->SetWin( KAIW_CREDITS );
00143         }
00144 
00145         // QUIT
00146         if( m_pButtonQuit->IsClicked() )
00147         {
00148                 m_pButtonQuit->Reset();
00149                 PostQuitMessage(0);
00150         }
00151 }
00152 
00153 //------------------------------------------------------------------------------------------
00154 void KAWinStart::Load()
00155 {
00156         KWin::Load();
00157 
00158         m_BackGround = m_pRender->GetpShaderBank()->LoadShader( "GUI/Background" );
00159 //      m_pButtonPlay->SetShaders( BUTTONPLAY, BUTTONPLAYHL, BUTTONPLAYC );
00160         m_pButtonMulti->SetShaders( BUTTONMULTI, BUTTONMULTIHL, BUTTONMULTIC );
00161         m_pButtonOptions->SetShaders( BUTTONOPTIONS, BUTTONOPTIONSHL, BUTTONOPTIONSC );
00162         m_pButtonContact->SetShaders( BUTTONCONTACT, BUTTONCONTACTHL, BUTTONCONTACTC );
00163         m_pButtonCredits->SetShaders( BUTTONCREDITS, BUTTONCREDITSHL, BUTTONCREDITSC );
00164         m_pButtonQuit->SetShaders( BUTTONQUIT, BUTTONQUITHL, BUTTONQUITC );
00165 }
00166 
00167 //------------------------------------------------------------------------------------------
00168 void KAWinStart::Unload()
00169 {
00170         KWin::Unload();
00171 
00172         m_pRender->GetpShaderBank()->UnloadShader( m_BackGround );
00173 }

Generated on Sun Mar 25 20:02:14 2007 for Zythum Project by  doxygen 1.5.1-p1