View Full Version : HUD Problems
13th Sep 2001, 08:56 AM
Jep, got Problems myself.
Textures I draw to the HUD don't show up in Game, don't know what I done wrong.
BTW what difference is there between DrawIcon and DrawTile?
(I used draw Icon & my texture was 32x128 pixels big)
Another Question I have:
How can I make something like a Progress Bar ... where I can show the amount of Health of the Player instead of Numbers ...
simulated function DrawHealth(canvas Canvas)
local float X, Y;
//code for drawing background Texture, which sadly doesn't apear in game
Canvas.Style = ERenderStyle.STY_Translucent;
Canvas.DrawColor = SolidHUDColor;
//This one is just to show the Health an normaly
//I would like to draw the ProgressBar here
Canvas.StrLen(PlayerOwner.Health, X, Y);
Canvas.SetPos(4, Canvas.ClipY - 192/2*Scale);
Canvas.Style = ERenderStyle.STY_Normal;
Canvas.DrawColor = RedColor;
Canvas.Font = MyFonts.GetMediumFont(Canvas.ClipX);
13th Sep 2001, 02:14 PM
Ok, Now i found out the solution to my second question, but still i don't see anithing on my HUD, when I try the Console command
"get HUD PlayerOwner" I allways get None, even that I made sure that the Variable gets initialized in HUDSetup().
"Get HUD Owner" also returns None, which I don't understand 'cause my Crosshair gets drawn on the HUD. Maybe its a question if the Texture is loaded ... or so ... eg for the CrossHair Texture I modified the LoadCrossHair Function from ChallangeHUD so this makes sure the CrossHair is always dynamicly loaded.
If someone knows a solution please answer ... i would be very glab about that ...
13th Sep 2001, 02:18 PM
DrawIcon is used to draw the texture once, using it's dimensions, albeit scaled. DrawIcon actually just calls DrawTile, but it saves you some code if you just want to draw the texture once. DrawTile allows you to draw the texture, tiled, over the given dimensions, and you can also just tile a segment of the texture as well.
To do something like a progress bar you could do something like this:
for (x = 0;x/xoffset <= Percentage/10;x += xoffset)
You'll want to use a relatively small texture, probably something like 2x4, and just draw it multiple times with the same y position, but increment the x the width of the texture (xoffset), until you draw your percentage.
Does this make sense to you, or do you need me to go into more detail? :)
13th Sep 2001, 05:02 PM
Yes somehow it makes sense. Perhaps you can explain which of the Parameters in DrawTile are responsible for the Area in which the Texture get Tiled ... i assume they are the 4&5 but Im not so sure ...
And regarding the Progress Message yeah youre right somehow. But I found out that in Unreal they did it with kind of percentage ...
actually I was not searching for a progressbar but some Kind of Bar which shows the Amount of Health ( i dont't know the english word for that, actually I'm german ... so excuse me please for that :) )eg. should grow or shrink with the Health the Player has.
And in Unreal they dont't draw multiple tiles, (I think so) rather they scale the texture acording to the actuall percentage of the charge an Item has in regard to the default Value.
But all this does still not solve my Problem that i still not see anything concerning the textures I draw ... sadly :(
15th Sep 2001, 02:42 PM
Yeah it'd probably be more efficient to just do one stretched draw and just calculate the width to stretch, although this would only work visually with solid color textures, but if you wanted something with a 'segmented' or any sort of textured look you would have to tile it.
15th Sep 2001, 07:10 PM
simulated function DrawBar( canvas Canvas, float W, float H, float Value, float MaxValue)
// W is width of bar when 100%.
// MaxValue is the value when value is 100%.
Canvas.DrawTile(Texture'UGC_Pack.Icons.StatusBar', W*(Value/MaxValue), H, 0, 0, 128*(Value/MaxValue),16);
the 128 is the width of the texture that contains the bar image and 16 the height
vBulletin® v3.8.7, Copyright ©2000-2014, vBulletin Solutions, Inc.