PDA

View Full Version : Hud Stuck in Wall !?!?!???


John6000
07-15-2007, 12:14 PM
Hi, im developing a HUD and something very strange is happening (see screenshots below), wonder if anyone can help ?

Normal HUD -
http://img103.imageshack.us/img103/6634/fhgatetestb20000pv3.jpg (http://imageshack.us)

In Wall ?? - http://img103.imageshack.us/img103/5029/fhgatetestb20001bd7.jpg (http://imageshack.us)


Another In Wall ?? - http://img103.imageshack.us/img103/3668/fhgatetestb20002vn8.jpg (http://imageshack.us)

Lolmen
07-15-2007, 01:52 PM
Seem like you use some like DrawMesh or DrawRect stuff thought.

John6000
07-15-2007, 02:56 PM
//========= Copyright © 2007, StargateBFL - Half-Life 2 Modification ==========//
//
// Purpose:
//
// $NoKeywords: $
//
//================================================== ===========================//
//

//
// implementation of CHudBFL class
//
#include "cbase.h"
#include "hud.h"
#include "hud_macros.h"
#include "view.h"

#include "iclientmode.h"

#include <KeyValues.h>
#include <vgui/ISurface.h>
#include <vgui/ISystem.h>
#include <vgui_controls/AnimationController.h>

#include <vgui/ILocalize.h>

using namespace vgui;

#include "hudelement.h"
#include "hud_numericdisplay.h"

#include "ConVar.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class CHudBFL : public CHudElement, public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CHudBFL, vgui::Panel );

public:
CHudBFL( const char *pElementName );
virtual void Init( void );
virtual void VidInit( void );
virtual void Paint( void );
virtual void ApplySchemeSettings( vgui::IScheme *scheme );
virtual void Reset( void );
virtual void OnThink();
void MsgFunc_Damage( bf_read &msg );

private:

CHudTexture * m_Base;

};

DECLARE_HUDELEMENT( CHudBFL );
//DECLARE_HUD_MESSAGE( CHudBFL, Damage );

//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHudBFL::CHudBFL( const char *pElementName ) :CHudElement( pElementName ), BaseClass( NULL, "HudBFL" )
{
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );

SetHiddenBits( HIDEHUD_ALL );
}

void CHudBFL::ApplySchemeSettings( IScheme *scheme )
{
BaseClass::ApplySchemeSettings( scheme );
SetPaintBackgroundEnabled( false );

}

void CHudBFL::Paint()
{
Color ColourWhite( 255, 255, 255, 255 );

int ystart = GetTall() - m_Base->Height();
m_Base->DrawSelf(0,ystart,ColourWhite);

BaseClass::Paint();

}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudBFL::Init()
{
SetPaintBackgroundEnabled( false ); //bfl
// HOOK_HUD_MESSAGE( CHudBFL, Damage );
Reset();
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudBFL::Reset()
{

}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudBFL::VidInit()
{
m_Base = gHUD.GetIcon( "hud_base" );
Reset();
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudBFL::OnThink()
{
BaseClass::OnThink();
}

Lolmen
07-15-2007, 10:18 PM
Try without
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
in constructor and
SetPaintBackgroundEnabled( false ); in ApplySchemeSettings
Does it work without it right?

John6000
07-16-2007, 02:52 AM
Nope Still doesnt work

John6000
07-16-2007, 04:13 AM
LOL my material didnt have
"$ignorez" "1" thats why, bless you http://developer.valvesoftware.com/wiki/Team_Icons

Lolmen
07-16-2007, 09:30 PM
So as say that problem is your fault :D

Au-heppa
07-21-2007, 05:33 AM
Oh, I had the same problem, althou it was with texture. Thanks!... now I got another problem, the Health is drawn before the background hud, so I can't see the Health at all. This didn't happen before. The suit power is still drawn after the background hud, thou.

Lolmen
07-21-2007, 07:43 AM
I think, you should experementing with SetZPos( ... ) method of IPanel