--
[ Picked text/plain from multipart/alternative ]
Thanks heaps, got it all working nicely now :)
One final question, is there a way to activate build mode for the HUD?
SHIFT+ALT+CTRL+B doesn't work (all I do is crouch, prone, sprint :P)
On 7/22/06, Michael Kramer <[EMAIL PROTECTED]> wrote:
>
> --
> [ Picked text/plain from multipart/alternative ]
> Alright here is what I have:
>
> This is how I have the background for my Health Bar
>
> First off, my health bar has rounded edges, so I have three different
> images:
>
> vgui::ImagePanel *healthLeft;
> vgui::ImagePanel *healthBg;
> vgui::ImagePanel *healthRight;
>
> Each image is 5px X 5px (8X8 In vtf)
>
> I set it up like so:
> vgui::Panel *pParent = g_pClientMode->GetViewport();
> SetParent( pParent );
>
> healthLeft = vgui::SETUP_PANEL(new vgui::ImagePanel(parent,
> "HealthLeft"));
> healthLeft->SetImage("health_left");
> healthBg = vgui::SETUP_PANEL(new vgui::ImagePanel(parent, "HealthBg"));
> healthBg->SetImage("health_bg");
> healthRight = vgui::SETUP_PANEL(new vgui::ImagePanel(parent,
> "HealthRight"));
> healthRight->SetImage("health_right");
>
> Then Under a seperate Function ( Init() )
> I have
>
> C_BasePlayer *local = C_BasePlayer::GetLocalPlayer();
> int health = max( local->GetHealth(), 0 );
>
> healthLeft->SetSize(XRES(5),YRES(5));
> healthLeft->GetImage()->SetSize(XRES(5),YRES(5));
> healthLeft->SetPos(XRES(8),YRES(35));
> healthLeft->SetZPos(1);
>
> healthBg->SetSize(XRES((health - 5) * 2),YRES(5));
> healthBg->GetImage()->SetSize(XRES(health),YRES(5)); //Streches the bg to
> match health
> healthBg->SetPos(XRES(13),YRES(35));
> healthBg->SetZPos(1);
>
> healthRight->SetSize(XRES(5),YRES(5));
> healthRight->GetImage()->SetSize(XRES(5),YRES(5));
> healthRight->SetPos(healthBg->GetWide()+ XRES(10),YRES(35)); //Places the
> right image after the bg.
> healthRight->SetZPos(2);
>
> I call the Init() Function in Paint( void ), I do this so that if the
> player
> changes the Resolution in game, everything will get aligned and scaled
> properly.
>
>
>
> Remember that you need to position and scale everything in 640x480, and
> using the XRES and YRES functions it will scale accurately for the other
> resolutions.
>
> Hopefully this will help.
> --
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
--
Matt Stafford (Wraiyth)
http://wraiyth.freesuperhost.com
NightFall HL2 Mod - http://nightfall.nigredostudios.com
--
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders