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

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : WinOptions.cpp
00006 //      Author                  : Cedric Stanus
00007 //      Date                    : 28/08/2003
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #include "Common/Time.h"
00012 #include "Common/LocalizedString.h"
00013 #include "Render/Render.h"
00014 #include "Render/Font.h"
00015 
00016 #include "Mod_Aeternis_Client/A_Interface.h"
00017 
00018 #include "Mod_Aeternis_Client/A_WinOptions.h"
00019 
00020 #define GUIDIR( __gui ) KStr( "GUI/%s/%s", GETLANGUAGEPREFIX(), __gui )
00021 #define BUTTONLANGUAGE          GUIDIR("Language")
00022 #define BUTTONLANGUAGEHL        GUIDIR("Language_HL")
00023 #define BUTTONLANGUAGEC         GUIDIR("Language_C")
00024 #define BUTTONVIDEO                     GUIDIR("OptionsVideo")
00025 #define BUTTONVIDEOHL           GUIDIR("OptionsVideo_HL")
00026 #define BUTTONVIDEOC            GUIDIR("OptionsVideo_C")
00027 #define BUTTONSOUND                     GUIDIR("OptionsSound")
00028 #define BUTTONSOUNDHL           GUIDIR("OptionsSound_HL")
00029 #define BUTTONSOUNDC            GUIDIR("OptionsSound_C")
00030 #define BUTTONCONTROLLERS       GUIDIR("OptionsControllers")
00031 #define BUTTONCONTROLLERSHL     GUIDIR("OptionsControllers_HL")
00032 #define BUTTONCONTROLLERSC      GUIDIR("OptionsControllers_C")
00033 #define BUTTONBACK                      GUIDIR("Return")
00034 #define BUTTONBACKHL            GUIDIR("Return_HL")
00035 #define BUTTONBACKC                     GUIDIR("Return_C")
00036 
00037 //------------------------------------------------------------------------------------------
00038 //------------------------------------------------------------------------------------------
00039 //------------------------------------------------------------------------------------------
00040 KAWinOptions::KAWinOptions( KWin* pFather, KFPt& Pos, KFPt& Size, KInterface* pInterface )
00041 : KWin( pFather, Pos, Size, pInterface )
00042 {
00043         m_BackGround = KSHADER_NO;
00044 
00045         KFPt    ButtonSize = KFPt( 0.25f, 0.04f );
00046                 
00047         // Button Language
00048         m_pButtonLanguage = new KButton( this, KFPt( 0.5f, 0.5f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00049         // Button Video
00050         m_pButtonVideo = new KButton( this, KFPt( 0.5f, 0.6f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00051         m_pButtonVideo->Enable( false );
00052         // Button Sound
00053         m_pButtonSound = new KButton( this, KFPt( 0.5f, 0.7f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00054         // Button Controllers
00055         m_pButtonControllers = new KButton( this, KFPt( 0.5f, 0.8f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00056         // Button Back
00057         m_pButtonBack = new KButton( this, KFPt( 0.5f, 0.9f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00058 }
00059 
00060 //------------------------------------------------------------------------------------------
00061 KAWinOptions::~KAWinOptions()
00062 {
00063 }
00064 
00065 //------------------------------------------------------------------------------------------
00066 void KAWinOptions::Display()
00067 {
00068         u8              FadeAlpha = (u8)(255.0f * GetFade());
00069 
00070         m_pInterface->ShowMouse();
00071         DrawQuad( 0.0f, 0.0f, 1.0f, 1.0f, m_BackGround, KRGBA( 255, 255, 255, FadeAlpha ) );
00072 }
00073 
00074 //------------------------------------------------------------------------------------------
00075 void KAWinOptions::Manage()
00076 {
00077         // Language
00078         if( m_pButtonLanguage->IsClicked() )
00079         {
00080                 m_pButtonLanguage->Reset() ;
00081                 ((KAInterface*)m_pInterface)->SetWin( KAIW_OPTIONS_LANGUAGE );
00082         }
00083 
00084         // Audio
00085         if( m_pButtonSound->IsClicked() )
00086         {
00087                 m_pButtonSound->Reset() ;
00088                 ((KAInterface*)m_pInterface)->SetWin( KAIW_OPTIONS_AUDIO );
00089         }
00090 
00091         // Controllers
00092         if( m_pButtonControllers->IsClicked() )
00093         {
00094                 m_pButtonControllers->Reset() ;
00095                 ((KAInterface*)m_pInterface)->SetWin( KAIW_OPTIONS_CONTROLLERS );
00096         }
00097 
00098         // Back
00099         if( m_pButtonBack->IsClicked() )
00100         {
00101                 m_pButtonBack->Reset() ;
00102                 if(m_pInterface->IsInGame())
00103                         ((KAInterface*)m_pInterface)->SetWin( KAIW_GAME );
00104                 else
00105                         ((KAInterface*)m_pInterface)->SetWin( KAIW_START );
00106         }
00107 }
00108 
00109 //------------------------------------------------------------------------------------------
00110 void KAWinOptions::Load()
00111 {
00112         KWin::Load();
00113 
00114         m_BackGround = m_pRender->GetpShaderBank()->LoadShader( GUIDIR("Options_bg") );
00115         m_pButtonLanguage->SetShaders( BUTTONLANGUAGE, BUTTONLANGUAGEHL, BUTTONLANGUAGEC );
00116         m_pButtonVideo->SetShaders( BUTTONVIDEO, BUTTONVIDEOHL, BUTTONVIDEOC );
00117         m_pButtonSound->SetShaders( BUTTONSOUND, BUTTONSOUNDHL, BUTTONSOUNDC );
00118         m_pButtonControllers->SetShaders( BUTTONCONTROLLERS, BUTTONCONTROLLERSHL, BUTTONCONTROLLERSC );
00119         m_pButtonBack->SetShaders( BUTTONBACK, BUTTONBACKHL, BUTTONBACKC );
00120 }
00121 
00122 //------------------------------------------------------------------------------------------
00123 void KAWinOptions::Unload()
00124 {
00125         KWin::Unload();
00126 
00127         m_pRender->GetpShaderBank()->UnloadShader( m_BackGround );
00128 }

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