HUD Problems

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

nighthack

New Member
Sep 8, 2001
21
0
0
www.megabrain.f2s.com
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 ...

PHP:
simulated function DrawHealth(canvas Canvas)
{
	local float X, Y;

         //code for drawing background Texture, which sadly doesn't apear in game
	Canvas.SetPos(32*Scale, Canvas.ClipY-128*Scale);
	Canvas.Style = ERenderStyle.STY_Translucent;
	Canvas.DrawColor = SolidHUDColor;
	Canvas.DrawIcon(Texture'progress', Scale);

          //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);
	Canvas.DrawText(PlayerOwner.Health, False);

}
 

nighthack

New Member
Sep 8, 2001
21
0
0
www.megabrain.f2s.com
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 ...
 

ca

CHiMERiC Grandmaster
Oct 11, 1999
84
0
0
www.unrealscript.com
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)
{
Canvas.SetPos(x, 32);
DrawTile(Texture'smalltexture', 1.0);
}

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? :)
 

nighthack

New Member
Sep 8, 2001
21
0
0
www.megabrain.f2s.com
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 :(
 

ca

CHiMERiC Grandmaster
Oct 11, 1999
84
0
0
www.unrealscript.com
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.
 

Raeled

Feuer Frei!
Jul 1, 2001
161
0
0
40
Dordrecht, The Netherlands
Visit site
PHP:
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