Here's an example of one of my hud elements that uses an icon with a
toggleable background:

        virtual void Paint()
        {
                if ( !m_iconStamina || !m_iconSprinting) return;
                Color iconColor( 255, 255, 255, 255 );
                if (GetLocalTeam())
                {
                        if (GetLocalTeam()->GetTeamNumber() == TEAM_REBELS)
                                iconColor = COLOR_BLUE;
                        else if (GetLocalTeam()->GetTeamNumber() ==
TEAM_COMMANDOS)
                                iconColor = COLOR_GREEN;
                        else
                                iconColor = COLOR_YELLOW;
                }
                int wide, tall;
                GetSize(wide, tall);
                iconColor.SetColor(iconColor.r(), iconColor.g(),
iconColor.b(), hud_transparency.GetInt());
                if (sprintActive)
                        m_iconSprinting->DrawSelf( XRES(4), YRES(4),
XRES(tall-6), YRES(tall-6), iconColor );
                else
                        m_iconStamina->DrawSelf( XRES(4), YRES(4),
XRES(tall-6), YRES(tall-6), iconColor );

                Color barColor;

                if (m_iStamina > 65)
                        barColor = COLOR_GREEN;
                else if (m_iStamina > 35)
                        barColor = COLOR_YELLOW;
                else
                        barColor = COLOR_RED;

                barColor.SetColor(barColor.r(), barColor.g(), barColor.b(),
hud_transparency.GetInt());
                float percent = m_iStamina / 100.0;
//              DevMsg("Percent: %f %i\n", percent, m_iStamina);
                gHUD.DrawProgressBar(XRES(m_iBarPosX), YRES(m_iBarPosY),
XRES(m_iBarWidth), YRES(m_iBarHeight), percent, barColor,
CHud::HUDPB_VERTICAL_SOLID); //want stamina up and down?
                BaseClass::Paint();
        }

I can toggle the background on or off with SetBackgroundEnabled() and the
icon still draws.

-----Original Message-----
From: Andrew (British_Bomber) [mailto:[EMAIL PROTECTED]
Sent: June 29, 2005 3:13 PM
To: [email protected]
Subject: Re: [hlcoders] Making "EditablePanel" bg transparent

I have replaced the Health panel with an image rather than the
numbers, and when ever I set the background paint to false the image
dissapears.  The title remains but both the background and image
dissapear even though the image is being drawn in the Paint()
function.  I have other panels that display like that no bother but
for some reason the Health, whether it be the modified standard
element or an element I wrote from scratch never wants to show the
image when the background is hidden.

1) Is that the same kind of issue you have?

2) Has anyone had this issue and fixed it or should I just reread the
VGUI documentation?

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.6/33 - Release Date: 28/06/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.6/33 - Release Date: 28/06/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