Come on, somebody out there must have textured a hud element successfully.
Any ideas?

-Gabe

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gabe Volker
Sent: Monday, March 07, 2005 5:31 PM
To: [email protected]
Subject: [hlcoders] Texturing a HuD Element -- need help

Hello again, I am still running into difficulties with texturing hud
elements.

I have tried both PaintBackgroundType 1 and 2, and my texture keeps showing
up as a black box, which when i pull up a weapon -- the box seems to be
behind it. Do I need to do a MoveToFront here?

The texture also shows up fine if I display it using an ImagePanel element
on a menu loaded from a res file. What could cause it not to show up
correctly in a hud element? Has anyone else had this?

Additionally, I did track down the m_nBgTextureId1 variable in the Panel
class, but I do not see where you can put a value into that variable. There
is no SetTexture() function, nor any other function where an argument is
passed and set as m_nBgTextureId1's value.

Here is some of my code:

CHudAmmoBg::CHudAmmoBg( const char *pElementName ) : CHudElement(
pElementName ), BaseClass(NULL, "HudAmmoBg")
{
        DevMsg("Ammo Bg Loaded\n");

        vgui::Panel *pParent = g_pClientMode->GetViewport();
        SetParent( pParent );

        m_nTextureID = vgui::surface()->CreateNewTextureID();
        vgui::surface()->DrawSetTextureFile( m_nTextureID, "vgui/ammobg" ,
true, true);

SetHiddenBits( HIDEHUD_PLAYERDEAD );
}

void CHudAmmoBg::ApplySchemeSettings( IScheme *scheme )
{
        BaseClass::ApplySchemeSettings( scheme );
        SetPaintBackgroundEnabled( true );
}

void CHudAmmoBg::Paint( void )
{

        vgui::surface()->DrawSetTexture( m_nTextureID );
        vgui::surface()->DrawTexturedRect( 0, 0, 100, 100 );
}

I have placed the ammobg.vtf & .vmt in resource/vgui/ammobg, AND in
materials/vgui/ammobg (this is the appropriate place I believe) and the
results are the same.

Thanks,
-Gabe

Alfred Reynolds wrote:

PaintBackgroundType type 0 simply draws a filled rect of BgColor(), type
1 draws a background texture filling the entire background (drawn from
m_nBgTextureId1), type 2 draws a filled in rect of BgColor() with
rounded corners (4 textures, one on each corner). See
vgui2\controls\Panel.cpp for details.

- Alfred


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


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

Reply via email to