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

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : WinOptionsLanguage.cpp
00006 //      Author                  : Cedric Stanus
00007 //      Date                    : 05/09/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 #include "Client/GameClient.h"
00016 #include "Mod_Aeternis_Client/A_Interface.h"
00017 #include "Mod_Aeternis_Client/A_WinOptionsLanguage.h"
00018 
00019 #define GUIDIR( __gui ) KStr( "GUI/%s/%s", GETLANGUAGEPREFIX(), __gui )
00020 #define BUTTONENGLISH           "GUI/English"
00021 #define BUTTONFRENCH            "GUI/French"
00022 #define BUTTONITALIAN           "GUI/Italian"
00023 #define BUTTONGERMAN            "GUI/German"
00024 #define BUTTONSPANISH           "GUI/Spanish"
00025 
00026 #define BUTTONBACK                      GUIDIR("Return")
00027 #define BUTTONBACKHL            GUIDIR("Return_HL")
00028 #define BUTTONBACKC                     GUIDIR("Return_C")
00029 
00030 //------------------------------------------------------------------------------------------
00031 KAWinOptionsLanguage::KAWinOptionsLanguage( KWin* pFather, KFPt& Pos, KFPt& Size, KInterface* pInterface )
00032 : KWin( pFather, Pos, Size, pInterface )
00033 {
00034         KFPt ButtonSize = KFPt( 0.15f, 0.12f );
00035         
00036         m_BackGround = KSHADER_NO;
00037 
00038         m_pButtonEnglish        = new KButton( this, KFPt( 0.2f, 0.35f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00039         m_pButtonFrench         = new KButton( this, KFPt( 0.5f, 0.35f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00040         m_pButtonGerman         = new KButton( this, KFPt( 0.8f, 0.35f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00041         m_pButtonItalian        = new KButton( this, KFPt( 0.3f, 0.65f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00042         m_pButtonSpanish        = new KButton( this, KFPt( 0.7f, 0.65f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00043         
00044         m_pButtonGerman->Enable( false );
00045         m_pButtonItalian->Enable( false );
00046         m_pButtonSpanish->Enable( false );
00047 
00048         // Button Back
00049         m_pButtonBack = new KButton( this, KFPt( 0.8f, 0.9f ) - ButtonSize / 2, KFPt( 0.25f, 0.04f ), m_pInterface );
00050 }
00051 
00052 //------------------------------------------------------------------------------------------
00053 KAWinOptionsLanguage::~KAWinOptionsLanguage()
00054 {
00055 }
00056 
00057 //------------------------------------------------------------------------------------------
00058 void KAWinOptionsLanguage::Display()
00059 {
00060         u8              FadeAlpha = (u8)(255.0f * GetFade());
00061 
00062         m_pInterface->ShowMouse();
00063         DrawQuad( 0.0f, 0.0f, 1.0f, 1.0f, m_BackGround, KRGBA( 255, 255, 255, FadeAlpha ) );
00064 
00065         E_LANGUAGE language = GETLANGUAGE() ;
00066 
00067         KCOLOR  Color = KRGBA( 156, 191, 249, FadeAlpha / 2 );
00068         KFPt ButtonSize = KFPt( 0.15f, 0.12f );
00069 
00070         switch(language)
00071         {
00072                 case E_LANGUAGE_ENGLISH :
00073                 {
00074                         KFPt new_Pos = KFPt( 0.2f, 0.35f ) - ButtonSize / 2 - KFPt( 0.01f, 0.01f ) ;
00075                         DrawQuad( new_Pos.x, new_Pos.y, ButtonSize.x + 0.02f, ButtonSize.y + 0.02f, KSHADER_NO, Color, KRGB_BLACK, KRM_MODULATE );
00076                 }
00077                 break ;
00078                 case E_LANGUAGE_FRENCH :
00079                 {               
00080                         KFPt new_Pos = KFPt( 0.5f, 0.35f ) - ButtonSize / 2 - KFPt( 0.01f, 0.01f ) ;
00081                         DrawQuad( new_Pos.x, new_Pos.y, ButtonSize.x + 0.02f, ButtonSize.y + 0.02f, KSHADER_NO, Color, KRGB_BLACK, KRM_MODULATE );
00082                 }
00083                 break ;
00084                 case E_LANGUAGE_GERMAN :
00085                 {
00086                         KFPt new_Pos = KFPt( 0.8f, 0.35f ) - ButtonSize / 2 - KFPt( 0.01f, 0.01f ) ;
00087                         DrawQuad( new_Pos.x, new_Pos.y, ButtonSize.x + 0.02f, ButtonSize.y + 0.02f, KSHADER_NO, Color, KRGB_BLACK, KRM_MODULATE );
00088                 }
00089                 break ;
00090                 case E_LANGUAGE_ITALIAN :
00091                 {               
00092                         KFPt new_Pos = KFPt( 0.3f, 0.65f ) - ButtonSize / 2 - KFPt( 0.01f, 0.01f ) ;
00093                         DrawQuad( new_Pos.x, new_Pos.y, ButtonSize.x + 0.02f, ButtonSize.y + 0.02f, KSHADER_NO, Color, KRGB_BLACK, KRM_MODULATE );
00094                 }
00095                 break ;
00096                 case E_LANGUAGE_SPANISH :
00097                 {
00098                         KFPt new_Pos = KFPt( 0.7f, 0.65f ) - ButtonSize / 2 - KFPt( 0.01f, 0.01f ) ;
00099                         DrawQuad( new_Pos.x, new_Pos.y, ButtonSize.x + 0.02f, ButtonSize.y + 0.02f, KSHADER_NO, Color, KRGB_BLACK, KRM_MODULATE );
00100                 }
00101                 break ;
00102         }
00103 }
00104 
00105 //------------------------------------------------------------------------------------------
00106 void KAWinOptionsLanguage::Manage()
00107 {
00108         if( m_pButtonFrench->IsClicked() )
00109         {
00110                 m_pButtonFrench->Reset() ;
00111                 SETLANGUAGELOCALSTRING(E_LANGUAGE_FRENCH) ;
00112                 g_pGame->GetpIniFile()->WriteString( "GENERAL", "Language", (char*)GETLANGUAGEPREFIX2(E_LANGUAGE_FRENCH) );
00113 
00114                 Unload();
00115                 Load();
00116         }
00117         if( m_pButtonEnglish->IsClicked() )
00118         {
00119                 m_pButtonEnglish->Reset() ;
00120                 SETLANGUAGELOCALSTRING(E_LANGUAGE_ENGLISH) ;
00121                 g_pGame->GetpIniFile()->WriteString( "GENERAL", "Language", (char*)GETLANGUAGEPREFIX2(E_LANGUAGE_ENGLISH) );
00122 
00123                 Unload();
00124                 Load();
00125         }
00126         if( m_pButtonItalian->IsClicked() )
00127         {
00128                 m_pButtonItalian->Reset() ;
00129                 SETLANGUAGELOCALSTRING(E_LANGUAGE_ITALIAN) ;
00130                 g_pGame->GetpIniFile()->WriteString( "GENERAL", "Language", (char*)GETLANGUAGEPREFIX2(E_LANGUAGE_ITALIAN) );
00131 
00132                 Unload();
00133                 Load();
00134         }
00135         if( m_pButtonGerman->IsClicked() )
00136         {
00137                 m_pButtonGerman->Reset() ;
00138                 SETLANGUAGELOCALSTRING(E_LANGUAGE_GERMAN) ;
00139                 g_pGame->GetpIniFile()->WriteString( "GENERAL", "Language", (char*)GETLANGUAGEPREFIX2(E_LANGUAGE_GERMAN) );
00140 
00141                 Unload();
00142                 Load();
00143         }
00144         if( m_pButtonSpanish->IsClicked() )
00145         {
00146                 m_pButtonSpanish->Reset() ;
00147                 SETLANGUAGELOCALSTRING(E_LANGUAGE_SPANISH) ;
00148                 g_pGame->GetpIniFile()->WriteString( "GENERAL", "Language", (char*)GETLANGUAGEPREFIX2(E_LANGUAGE_SPANISH) );
00149 
00150                 Unload();
00151                 Load();
00152         }
00153 
00154         // Back
00155         if( m_pButtonBack->IsClicked() )
00156         {
00157                 m_pButtonBack->Reset() ;
00158                 ((KAInterface*)m_pInterface)->SetWin( KAIW_OPTIONS );
00159         }
00160 }
00161 
00162 //------------------------------------------------------------------------------------------
00163 void KAWinOptionsLanguage::Load()
00164 {
00165         KWin::Load();
00166 
00167         m_BackGround = m_pRender->GetpShaderBank()->LoadShader( GUIDIR("Language_bg") );
00168         m_pButtonEnglish->SetShaders( BUTTONENGLISH, BUTTONENGLISH, BUTTONENGLISH );
00169         m_pButtonFrench->SetShaders( BUTTONFRENCH, BUTTONFRENCH, BUTTONFRENCH );
00170         m_pButtonGerman->SetShaders( BUTTONGERMAN, BUTTONGERMAN, BUTTONGERMAN );
00171         m_pButtonItalian->SetShaders( BUTTONITALIAN, BUTTONITALIAN, BUTTONITALIAN );
00172         m_pButtonSpanish->SetShaders( BUTTONSPANISH, BUTTONSPANISH, BUTTONSPANISH );
00173         
00174         m_pButtonBack->Unload();
00175         m_pButtonBack->SetShaders( BUTTONBACK, BUTTONBACKHL, BUTTONBACKC ) ;
00176         m_pButtonBack->Load();
00177 }
00178 
00179 //------------------------------------------------------------------------------------------
00180 void KAWinOptionsLanguage::Unload()
00181 {
00182         KWin::Unload();
00183 
00184         m_pRender->GetpShaderBank()->UnloadShader( m_BackGround );
00185 }

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