The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Geting a Gauge to work on the HUD

  • Filter
  • Time
  • Show
Clear All
new posts

  • Geting a Gauge to work on the HUD

    Alright, here's the story... I am trying to get 3 different gauges to go up and down (corresponding with the health, adrenaline, and shields). I also have a radar in the middle, here's an ASCII sketch:

    ---------Adrenaline here--------


    I have looked at how the gauges are implemented on the lightening and shield guns, but there is one small problem: they used only rectangles... My gauges look something close to this:
    |-----------| radar

    Does anyone know a way to lower and/or raise these gauges (outside progs that do animations that I could pull into UED after completion and then use Uscript to finish it off perhaps?). I am using Unreall 2k4, before anyone asks, thanks!

  • #2
    Look at the way the Cicada draws those "rockets loaded" indicators beside the crosshair. Sounds pretty much like the same thing.


    • #3
      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.
      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:
          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.


      • #4
        yeah, would be my advice too, use a drawtile function. If necessary, split the texture in parts. Don't use animated textures, these are worse than some layers of drawtiles in a postRender() function... imo.