If you use SpriteWidgets (a structure used by the original HUD), the "Scale" property can be used to make it act like a "gauge". The widget's ScaleMode determines which side it is scaled from (i.e. top-to-bottom, left-to-right, etc.).
For an example, have a look at how the weapon charge bar is implemented in XInterface.HudCDeathMatch (the base UT2004 HUD.) RechargeBar is the name of the SpriteWidget, and it is drawn in DrawChargeBar().
Alternatively, you could use an approach similar to the Lightning Gun charge bar - just mess with the source texture coords a bit. All textures are rectangular, after all.
Code:
native(466) final function DrawTile( material Mat,
float XL, float YL, float U, float V, float UL, float VL );
XL/YL are destination width/height, U and V are the source X and Y co-ordinates within the material (Mat), and UL/VL are the source width/height. So if you wanted to scale from the bottom of the texture, upward, use something like:
Code:
Canvas.DrawTile(myTexture,
myTexture.USize, myTexture.VSize * Scale, // dest width, height
0, myTexture.VSize * (1.0 - Scale), // source x, y
myTexture.USize, myTexture.VSize * Scale); // source width, height
Scale would be between 0.0 and 1.0 (how much of the texture to use.) You'd also need to offset the drawing position.Y by VSize*(1-Scale).
Edit: The Cicada uses the DrawTile approach, but even knowing how it works, it's a bit tricky to figure out from the code alone.
Edit2: Oh, by the way, gauges like these don't require any kind of animated texture, just a bit of UScript.
Bookmarks