000
27.10.2001, 22:57
Basiror
|
#include "vgui_int.h" #include "VGUI_Font.h" #include "VGUI_ScrollPanel.h" #include "VGUI_TextImage.h"
#include "hud.h" #include "cl_util.h" #include "vgui_TeamFortressViewport.h"
#define B_TOPLEFT_X XRES(40) #define B_TOPLEFT_Y YRES(80) #define B_LENGTH XRES(124) #define B_HEIGHT YRES(24) #define B_SPACER_Y YRES(4) #define SP_TOPLEFT_X XRES(176) #define SP_TOPLEFT_Y YRES(108) #define SP_SIZE_X XRES(424) #define SP_SIZE_Y YRES(256) #define IL_TOPLEFT_X XRES(176) #define IL_TOPLEFT_Y YRES(108) #define IL_SIZE_X XRES(128) #define IL_SIZE_Y YRES(128) #define TP_TEXT_X XRES(150) #define TP_TEXT_Y YRES(80)
char *sTeams[]= { "", "Axis", "Soviets", "Spectator", "AutoSelection", "Cancle", };
char *sTeamImages[]= { "", "axis", "soviets", "", "", "", };
CTeam :: CTeam(int iTrans, int iRemoveMe, int x, int y, int wide, int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall) { memset( m_pTeamImages, 0, sizeof(m_pTeamImages) ); // Create the Scroll panel m_pScrollPanel = new CTFScrollPanel( SP_TOPLEFT_X, SP_TOPLEFT_Y, SP_SIZE_X, SP_SIZE_Y ); m_pScrollPanel->setParent(this); m_pScrollPanel->setScrollBarAutoVisible(false, false); m_pScrollPanel->setScrollBarVisible(true, true); m_pScrollPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) ); m_pScrollPanel->validate(); m_pScrollPanel->setScrollBarAutoVisible(false,true); m_pScrollPanel->setScrollBarVisible(false,false); m_pScrollPanel->validate(); int clientWide=m_pScrollPanel->getClient()->getWide(); char sz[256];// Used for strings handling within loops // Create the buttons for the Team menu for( int i=1;i<=5;i++) { int YPos = B_TOPLEFT_Y+(B_HEIGHT+B_SPACER_Y)*i; sprintf(sz,"%s",sTeams[i]); m_pButtons[i]= new CommandButton(gHUD.m_TextMessage.BufferedLocaliseTextString( sz ), B_TOPLEFT_X, YPos, B_LENGTH , B_HEIGHT); m_pButtons[i]->setParent(this); sprintf(sz,"%d",i); m_pButtons[i]->setContentAlignment( vgui::Label::a_west ); m_pButtons[i]->setBoundKey(sz[0]); m_pButtons[i]->addInputSignal( new CHandler_MenuButtonOver(this, i) ); sprintf(sz,"jointeam %d",i); if(i==5) { m_pButtons[i]->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW)); } else m_pButtons[i]->addActionSignal( new CMenuHandler_StringCommandWatch( sz, true ) ); //} // Create the Text field for the Team menu //for(int g=1;g<=2;g++) //{ m_pTeamPanel[i]= new CTransparentPanel( 255, 0, 0, clientWide, SP_SIZE_Y ); m_pTeamPanel[i]->setParent(m_pScrollPanel->getClient() ); sprintf(sz,"%s",sTeamImages[i]); m_pTeamImages[i]= new CImageLabel( sz, 0, 0, IL_SIZE_X, IL_SIZE_Y); CImageLabel *pLapel=m_pTeamImages[i]; pLapel->setParent(m_pTeamPanel[i]); pLapel->setVisible(false);
// Open up the Class Briefing File sprintf(sz, "teams/%s.txt", sTeamImages[i]); char *cText = "Class Description not available."; char *pfile = (char *)gEngfuncs.COM_LoadFile( sz, 5, NULL ); if (pfile) { cText = pfile; } // Create the Text info window TextPanel *pTextWindow = new TextPanel(cText, 128, 0, 256, 256); pTextWindow->setParent( m_pTeamPanel[i] ); } }
void CTeam::Initialize(void) { //m_bUpdatedMapName = false; m_iCurrentInfo = 0; //m_pScrollPanel->setScrollValue( 0, 0 ); m_pScrollPanel->setScrollValue( 0, 0 ); }
void CTeam::Open(void) { Update(); CMenuPanel::Open(); } void CTeam::Update(void) { for(int i=1; i<=5;i++) { if(m_pButtons[i]) { char sz[32]; sprintf(sz,"%d",i); m_pButtons[i]->setBoundKey(sz[0]); m_pButtons[i]->setVisible(true); if(m_pTeamImages[i]!=NULL) m_pTeamImages[i]->setVisible(true); else m_pTeamImages[i]->setVisible(false); } } /*for(int g=1;g<=2;g++) { //m_pTeamPanel[g]->setVisible(true); }*/
}
bool CTeam::SlotInput(int iSlot) { if ( !m_pButtons[ iSlot ] ) return false; // Is the button pushable? if ( m_pButtons[ iSlot ]->isVisible() ) { m_pButtons[ iSlot ]->fireActionSignal(); return true; } return false; }
void CTeam::SetActiveInfo(int iInput) { for(int i=1;i<=5;i++) { m_pButtons[i]->setArmed(false); m_pTeamPanel[i]->setVisible(false);
} /*for(int g=1;g<=2;g++) { }*/ m_iCurrentInfo=iInput; m_pButtons[iInput]->setArmed(true); m_pTeamPanel[iInput]->setVisible(true);
m_pScrollPanel->setScrollValue(0,0); m_pScrollPanel->validate(); }
anscheinend setzt er den inhalt vom m_pTeamPanel nicht auf visible ich versteht net warum er das zeugs net anzeigt
--
Basiror's Labs Game-Development page
Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen
|