Results 1 to 4 of 4
  1. #1

    Default 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--------


    Health-------radar--------shields
    here-------(circle)---------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:
    --________________
    -/-------------------\
    |---health------____/
    |----gauge----/
    |-------------/
    |------------/
    |-----------| 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. #2

    Default

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

  3. #3
    MSgt. Shooter Person
    Join Date
    Oct 2004
    Posts
    474
    Gamer IDs

    Gamertag: Lexikos

    Default

    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.
    Last edited by porkmanii; 12-15-2006 at 09:18 AM.
    Quote Originally Posted by User CP
    Please contact the Administrator if your date of birth has changed.

  4. #4
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    59

    Default

    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.
    __________________
    Log: Purging garbage


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.