Heya,
thanks for the guide. I've implemented it now to my mod, but a problem
remains. A texture I've chosen gets painted on that half-transparent
grey panel background. Now every time i change the resolution, the
texture is fine but the background scales somehow weird. I've solved
this problem by putting the SetSize and SetPos functions in the
Paint-function. Is this the only solution or am i missing out something
more elegant?
kind regards,
xs57
Code attached:
CHudImport::CHudImport(...){
Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent);
SetVisible(true);
SetAlpha(0); //changing this didn't do anything
SetProportional(false); //this is somehow related to the scaling, but
i'm not sure how
m_nImport = surface()->CreateNewTextureID();
surface()->DrawSetTextureFile(m_nImport, "HUD/bottombar", true, true);
}
void CHudImport::Paint(){
SetPaintBorderEnabled(false);
// now my resize code, where my texture is 480x96:
int width;
int height;
surface()->GetScreenSize(width, height);
width = (width-480) / 2;
height -= 96
SetPos(width, height);
SetSize(480,96);
surface()->DrawSetTexture(m_nImport);
surface()->DrawTexturedRect(0,0,480,96);
}
Grash wrote:
> Here's a good start to help you on your way.
> http://developer.valvesoftware.com/wiki/Basic_Hud_Modification
>
> --- On Tue, 5/5/09, Biz <[email protected]> wrote:
>
> From: Biz <[email protected]>
> Subject: [hlcoders] VGUI Bitmap
> To: "HLCoders List" <[email protected]>
> Date: Tuesday, May 5, 2009, 7:06 PM
>
> Heya,
>
> is it possible to display bitmaps or textures on the user screen via
> vgui ? I want to make some kind of bar on the bottom of the screen that
> shows the current weapon with images and is styled with other images -
> something like D2 or current MMOs. Can anyone please give me a code
> example on how to make an image appear on the player's screen?
> The mod is based on EP1.
>
> kind regards,
> xs57
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders