00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "Common/Time.h"
00012 #include "Common/Game.h"
00013 #include "Common/Command.h"
00014 #include "Render/Render.h"
00015 #include "Render/Font.h"
00016 #include "Common/LocalizedString.h"
00017
00018 #include "Mod_Aeternis_Client/A_Interface.h"
00019 #include "Mod_Aeternis_Client/A_WinGame.h"
00020 #include "Mod_Aeternis_Client/A_WinHUD.h"
00021
00022 #define GUIDIR( __gui ) KStr( "GUI/%s/%s", GETLANGUAGEPREFIX(), __gui )
00023
00024 #define BUTTONRETURNGAME GUIDIR("Return")
00025 #define BUTTONRETURNGAMEHL GUIDIR("Return_hl")
00026 #define BUTTONRETURNGAMEC GUIDIR("Return_c")
00027
00028 #define BUTTONOPTIONSGAME GUIDIR("Options")
00029 #define BUTTONOPTIONSGAMEHL GUIDIR("Options_hl")
00030 #define BUTTONOPTIONSGAMEC GUIDIR("Options_c")
00031
00032 #define BUTTONQUITMENU GUIDIR("BackMenu")
00033 #define BUTTONQUITMENUHL GUIDIR("BackMenu_hl")
00034 #define BUTTONQUITMENUC GUIDIR("BackMenu_c")
00035
00036 #define BUTTONQUITGAME GUIDIR("Quit")
00037 #define BUTTONQUITGAMEHL GUIDIR("Quit_hl")
00038 #define BUTTONQUITGAMEC GUIDIR("Quit_c")
00039
00040
00041
00042
00043 KAWinGame::KAWinGame( KWin* pFather, KFPt& Pos, KFPt& Size, KInterface* pInterface )
00044 : KWin( pFather, Pos, Size, pInterface )
00045 {
00046 m_hBackGround = KSHADER_NO;
00047
00048 KFPt ButtonSize = KFPt( 0.25f, 0.04f );
00049 m_pButtonReturnGame = new KButton( this, KFPt( 0.3f, 0.1f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00050 m_pButtonOptions = new KButton( this, KFPt( 0.3f, 0.168f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00051 m_pButtonReturnMenu = new KButton( this, KFPt( 0.3f, 0.232f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00052 m_pButtonQuit = new KButton( this, KFPt( 0.3f, 0.305f ) - ButtonSize / 2, ButtonSize, m_pInterface );
00053
00054 m_bConnect = true;
00055 }
00056
00057
00058 KAWinGame::~KAWinGame()
00059 {
00060 }
00061
00062
00063 void KAWinGame::Display()
00064 {
00065 u8 FadeAlpha = (u8)(255.0f * GetFade());
00066
00067 m_pInterface->ShowMouse();
00068
00069 DrawQuad( m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_hBackGround, KRGBA( 255, 255, 255, FadeAlpha ) );
00070
00071
00072
00073
00074
00075
00076 }
00077
00078
00079 void KAWinGame::Manage()
00080 {
00081 if( m_pButtonReturnGame->IsClicked() )
00082 {
00083 m_pButtonReturnGame->Reset();
00084 ((KAInterface*)m_pInterface)->SetWin( KAIW_NONE );
00085 }
00086
00087 if( m_pButtonOptions->IsClicked() )
00088 {
00089 m_pButtonOptions->Reset();
00090 ((KAInterface*)m_pInterface)->SetWin( KAIW_OPTIONS );
00091 }
00092
00093 if( m_pButtonReturnMenu->IsClicked() )
00094 {
00095 m_pButtonReturnMenu->Reset();
00096
00097 if( m_bConnect )
00098 {
00099 m_bConnect = false;
00100 g_pGame->GetpCommand()->ExecCommand( KStr("disconnect"), KStr("") );
00101 }
00102 }
00103
00104 if( m_pButtonQuit->IsClicked() )
00105 {
00106 m_pButtonQuit->Reset();
00107 PostQuitMessage(0);
00108 }
00109 }
00110
00111
00112 void KAWinGame::Load()
00113 {
00114 KWin::Load();
00115
00116 m_bConnect = true;
00117
00118 m_hBackGround = m_pRender->GetpShaderBank()->LoadShader( "GUI/WinGame" );
00119 m_pButtonReturnGame->SetShaders( BUTTONRETURNGAME, BUTTONRETURNGAMEHL, BUTTONRETURNGAMEC );
00120 m_pButtonOptions->SetShaders( BUTTONOPTIONSGAME, BUTTONOPTIONSGAMEHL, BUTTONOPTIONSGAMEC );
00121 m_pButtonReturnMenu->SetShaders( BUTTONQUITMENU, BUTTONQUITMENUHL, BUTTONQUITMENUC );
00122 m_pButtonQuit->SetShaders( BUTTONQUITGAME, BUTTONQUITGAMEHL, BUTTONQUITGAMEC );
00123 }
00124
00125
00126 void KAWinGame::Unload()
00127 {
00128 KWin::Unload();
00129
00130 m_pRender->GetpShaderBank()->UnloadShader( m_hBackGround );
00131 }
00132