Hi,
I've been recently working on getting multiple schemes to work into my
MOD. Basically every time you switch teams, i reload the scheme you have
with the one corresponding to your team, so your VGUI's "skin" changes
to fit your team.
I've ran into quite a few problems, but right now the one i'm working on
has me boggled and if anyone has any ideas on how to fix it I'd
appreciate the help:
I'm trying to get my scoreboard title to show up in red. The Scheme res
file says that all the "Label.something" elements have my custom colors,
namely the text is supposed to show up in red and not in orange. When i
first join my game i start in a game room type of place where you have
no weapons and must walk into a certain area to join a team. In that
area i am using the default scheme. When you join a team it reloads the
scheme based on your team.
I've been using ApplySchemeSettings and basically the Scoreboard class
reloads it's scheme every time it is Reset(). I've made up a function in
the C_BasePlayer class that returns the right name for the scheme called
GetSchemeName(bool withExtension). Here's the code in Reset():

char szSchemeName[128];
   C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
   vgui::HScheme scheme;
   if (pPlayer) {
       strcpy(szSchemeName,"resource/");
       strcat(szSchemeName,pPlayer->GetSchemeName(true));
       scheme = vgui::scheme()->LoadSchemeFromFile(
szSchemeName,pPlayer->GetSchemeName(false) );
   }
   else {
       strcpy(szSchemeName,"resource/ClientScheme.res");
       scheme = vgui::scheme()->LoadSchemeFromFile( szSchemeName,
"ClientScheme" );
   }
   // set the scheme before any child control is created
   SetScheme(scheme);
   ApplySchemeSettings(vgui::scheme()->GetIScheme( scheme ));
   m_pPlayerList->SetScheme(scheme);
   m_pPlayerList->SetVerticalScrollbar(true);
   //Warning("CClientScoreBoardDialog::Reset()\n");

Here i realise i am not telling the Title Label to update it's scheme,
but i thought VGUI would do that automatically... This is what disturbs
me, why isn't it propagating on it's own the Scheme settings...
Anyways, i added this code:
vgui::Label* pTitle = (vgui::Label*)(FindChildByName("ServerName"));
   if (pTitle)
       pTitle->SetScheme(scheme);
   else
       Warning("Couldn't Find Child Named \"ServerName\" in
CClientScoreBoardDialog::Reset()\n");

The code produces no warning, yet the text color doesn't change for the
title Label. I am at a loss as to why this is happening, the Label
function "ApplySchemeSettings()" is protected... So i decided to
un-protect it and see what would happen when i called it along with
SetScheme.. Turns out the linker gives me an error (wich was
predictable) about unresolved external...

So Valve, anyone else, how do i get this title to change it's scheme?




-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.5 - Release Date: 03/02/2005



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to