I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:HudBase

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 11:01, 16 November 2004 by Uncommon (Talk) (HudCDeathMatch link)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2003 :: Actor >> HUD >> HudBase (Package: xInterface)

The base class of all UT2003 and UT2004 HUDs.

Properties[edit]

int TeamIndex (transient) 
ERenderStyle PassStyle (transient) 
For debugging.
HudLocalizedMessage LocalMessages[8] (transient) 
All special LocalMessages and text messages sent as 'CriticalEvent' are stored in a HudLocalizedMessage struct. Death messages and other "non-special" (bSpecial=False) LocalMessages are not stored here.
class<Actor> VoteMenuClass 
Hook for mod authors.
Material TargetMaterial 
A meterial used to mark a targetted object. Currently only used by the BR BallLauncher's secondary firing mode.
bool bShowTargeting (transient) 
Whether a target has been aquired.
vector TargetingLocation (transient) 
Where the target is.
float TargetingSize (transient) 
The target's size.
string InstructionText 
string InstructionKeyText 
float InstructTextBorderX 
float InstructTextBorderY 
float InstrDelta 
float InstrRate 
string InstructionFontName (localized) 
font InstructionFontFont 
byte FontsPrecached 
bool DoCropping 
float CroppingAmount 
Material CroppingMaterial 
string LastWeaponName 
float WeaponDrawTimer 
color WeaponDrawColor 
bool bHideWeaponName (globalconfig) 
Hides the name of the weapon the player just switched to.

Structs[edit]

DigitSet[edit]

A set of digits stored in one texture.

Material DigitTexture 
The texture containing the digits.
IntBox TextureCoords[11] 
The coordinates of the digits. 0-9, 11th element is negative sign. IntBox is one if the Built-In Struct.

SpriteWidget[edit]

Describes a single HUD element which can be drawn using the DrawSpriteWidget native function.

Material WidgetTexture 
The texture that contains the HUD element.
ERenderStyle RenderStyle 
The rendering style of this HUD element. (see Actor/Enums)
IntBox TextureCoords 
The position of the element in the specified material.
float TextureScale 
The scale that is applied to the texture, relative to a screen resolution of 640 x 480 pixels (that means: at that screen resolution a sprite with TextureScale=1.0 will be drawn one-to-one; at other screen resolutions it will be proportionally scaled up or down).
EDrawPivot DrawPivot 
Specifies the sprite's point of reference (see Object/Enums). The given pixel position corresponds with this point on the sprite (for instance, its upper-right corner).
float PosX
float PosY 
The relative screen location of the HUD element. Range from 0.0 to 1.0.
int OffsetX
int OffsetY 
Extra offset of the texture part. This is scaled with the texture, so only in 640x480 and with a TextureScale of 1.0 one unit here corresponds to an actual pixel on the screen. If you want to move the widget to the right from the position given via PosX/Y by exactly the final width of the widget you would enter exactly that width for OffsetX.
EScaleMode ScaleMode 
From what direction the scale is applied (see EScaleMode enum below). The side that is cut off 1st. (Left for the ammo count and WeaponBar.)
float Scale 
This specifies, how much of the widget is visible. This is used together with ScaleMode and cuts off a part of the widget if set to values less than 1.0.
color Tints[2] 
The draw colors that should be used when this HUD element is drawn for the different teams. Team 0 is red in UT2003 and team 1 (also used in non-team games) is blue.

NumericWidget[edit]

Describes a HUD element which can be drawn using the DrawNumericWidget native function. Draws numbers on the screen. (uses a DigitSet)

ERenderStyle RenderStyle 
The rendering style of this HUD element. (see Actor/Enums)
int MinDigitCount 
This specifies the minimum width of the numeric widget, i.e. how much space is reserved for more digits.
float TextureScale 
The scale that is applied to the texture, works like for SpriteWidgets.
EDrawPivot DrawPivot 
(see Object/Enums) This point is used as "Center" of texture
float PosX
float PosY 
The screen location of the HUD element. Range from 0.0 to 1.0
int OffsetX

int OffsetY : Additional offset which is scaled with the widget.

color Tints[2] 
The draw colors that should be used when this HUD element is drawn for the different teams.
int bPadWithZeroes 
Whether leading zeroes should fill up the minimum width specified in MinDigitCount.
int Value (transient) 
The actual number that is put on the screen when the widget is drawn.

HudLocalizedMessage[edit]

Represents a LocalMessage that should be rendered on the HUD.

The following block of variables are set when the message is entered (Message being set indicates that a message is in the list).

class<LocalMessage> Message 
The message class.
String StringMessage 
A display string for string messages.
int Switch 
The message's switch value.
PlayerReplicationInfo RelatedPRI, RelatedPRI2 
The related PRIs.
Object OptionalObject 
An optional object for the message.
float EndOfLife 
The level time index when the messages should be removed.
float LifeTime 
How long the message should be displayed.

The following block of variables are cached on first render (StringFont being set indicates that they've been rendered).

Font StringFont 
color DrawColor 
EDrawPivot DrawPivot 
LocalMessage.EStackMode StackMode 
The message's stack mode when displaying multiple messages that have the same PosX/Y. (see LocalMessage for the enum declaration)
float PosX, PosY 
Relative screen position of the message.
float DX, DY 
The actual size in pixels.
bool Drawn 
Whether the message was drawn this frame. (Used for managing stacked messages.)

Enums[edit]

EScaleMode[edit]

SM_None 
SM_Up 
SM_Down 
SM_Left 
SM_Right 

Methods[edit]

Almost all HUD functions are simulated, exceptions are mentioned below. However, since a HUD is always a client-side actor the simulated keywords don't seem to be neccessary here.

Inherited From Actor[edit]

Inherited From HUD[edit]

DrawHud (Canvas C) 
Calls the different HUD drawing stages in the following order: UpdateHud, DrawTargeting (if bShowTargetting), DrawHudPassA (with draw style STY_Alpha), DrawHudPassB (with draw style STY_Additive), DrawHudPassC (with draw style STY_Alpha again), DrawHudPassD (with draw style STY_None), DisplayLocalMessages and finally DrawWeaponName.

Native Functions[edit]

DrawSpriteWidget (Canvas C, out SpriteWidget W) [simulated, final] 
Draws the HUD element described by the SpriteWidget W.
DrawNumericWidget (Canvas C, out NumericWidget W, out DigitSet D) [simulated, final] 
Draws a number.

Drawing Functions[edit]

No draw code should be in derived HUDs' DrawHud function, they should instead override DrawHudPass[A-D] and call their base class' DrawHudPass[A-D]. This cuts down on render state changes.

Note: The DrawSpriteWidget() and DrawNumericWidget() functions will create a log warning when encountering a different draw style than the current drawing pass expects. If you need to use a different DrawStyle setting for the widget or really need to mix up DrawStyles you should use the alternate drawing pass, i.e. DrawHudPassD().

UpdateHud ( ) 
Updates the HUD right before it is rendered. You should use this to update your SpriteWidgets and NumericWidgets as well as other variables storing values for drawing the HUD.
DrawHudPassA (Canvas C) 
First drawing pass with STY_Alpha.
DrawHudPassB (Canvas C) 
Drawing pass with STY_Additive.
DrawHudPassC (Canvas C) 
Second drawing pass with STY_alpha.
DrawHudPassD (Canvas C) 
Alternate drawing pass.

Other Functions[edit]

Known Subclasses[edit]

Related Topics[edit]