I love the smell of UnrealEd crashing in the morning. – tarquin

UE2:Canvas (UT2004)

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 12:48, 20 March 2011 by Wormbo (Talk | contribs) (added variable descriptions)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2004 Object >> Canvas
Package: 
Engine
This class in other games:
RTNP, U1, UT, U2XMP, UE2Runtime, U2, UT2003, UDK, UT3

This class represents the drawing canvas on the screen after the world has been rendered. You cannot create objects of this class. Instead, certain engine events, such as Hud.PostRender() or InteractionMaster.Process_PostRender, pass a Canvas object as a parameter that is passed on to any other drawing functions called from those events.

If you have the choice and it doesn't make your code much more complex, try grouping draw calls with the same material and render style. Switching between different materials or styles can cost some performance, which is why the HudBase class splits up the main rendering into several stages with fixed render styles.

Properties[edit]

bCenter[edit]

Type: bool

Whether to center the text drawn with DrawText().

bForceAlpha[edit]

Type: bool

Force all text and texture drawing to use ForcedAlpha as draw color alpha value.

bNoSmooth[edit]

Type: bool

(not used)

bRenderLevel[edit]

Type: bool

Whether to render the world. This property is reset every tick. The last chance to turn off level rendering is during the various PreRender() calls of Interactions and GUIComponents. Usually you don't have any reason to turn of world rendering, unless you are going to cover the entire screen and don't want to waste performance rendering something that wouldn't be seen anyway.

Default value: True

ClipX[edit]

Type: float

Width of clipping region.

ClipY[edit]

Type: float

Height of clipping region.

ColorModulate[edit]

Type: Object.Plane

DrawColor is multiplied by this before drawing textures, text or screen actors.

Default value:

Member Value
W 1.0
X 1.0
Y 1.0
Z 1.0

CurX[edit]

Type: float

Current X position for drawing.

CurY[edit]

Type: float

Current Y position for drawing.

CurYL[edit]

Type: float

Largest width of recently drawn text, unless DrawText() is called with the CR parameter being True.

DrawColor[edit]

Type: Object.Color

Color for drawing.

Default value:

Member Value
A 255
B 127
G 127
R 127

Font[edit]

Type: Font

Font for text drawing.

Default value: DefaultFont

FontScaleX[edit]

Type: float

Width scale for text drawing. Note that scaling isn't exact, so you should determine text size with StrLen() or TextSize() after setting scale if you need precise values.

Default value: 1.0

FontScaleY[edit]

Type: float

Height scale for text drawing. Note that scaling isn't exact, so you should determine text size with StrLen() or TextSize() after setting scale if you need precise values.

Default value: 1.0

ForcedAlpha[edit]

Type: float

Forced alpha value if bForceAlpha is set. This replaces the value of DrawColor.A * ColorModulate.W for texture and text drawing.

MedFont[edit]

Type: Font

A default medium-sized font.

MedFontName[edit]

Type: string

Modifiers: localized

Name of a default medium-sized font.

Default value: "UT2003Fonts.FontMono800x600"

OrgX[edit]

Type: float

Left start of the clipping region and origin for drawing.

OrgY[edit]

Type: float

Top start of the clipping region and origin for drawing.

pCanvasUtil[edit]

Type: pointer

Modifiers: const

(internal stuff, disregard)

Default value: 0

SizeX[edit]

Type: int

Modifiers: const

Width of the entire drawing area.

SizeY[edit]

Type: int

Modifiers: const

Height of the entire drawing area.

SmallFont[edit]

Type: Font

A default small font.

SmallFontName[edit]

Type: string

Modifiers: localized

Name of a default small font.

Default value: "UT2003Fonts.FontMono"

SpaceX[edit]

Type: float

Additional horizontal spacing after text characters and drawn textures.

SpaceY[edit]

Type: float

Additional vertical spacing below text lines.

Style[edit]

Type: byte

Drawing style for text and Textures. 0 means don't draw. Note that other styles do not affect drawing non-Texture materials. You will have to use a FinalBlend in those cases. The values correspond to the Actor.ERenderStyle enum constants.

Default value: 1 (STY_Normal)

TinyFont[edit]

Type: Font

A default tiny font.

TinyFontName[edit]

Type: string

Modifiers: localized

Name of a default tiny font.

Default value: "UT2003Fonts.FontMono"

Viewport[edit]

Type: Viewport

Modifiers: const

Viewport (Player) that owns the canvas. You can access the local PlayerController via Viewport.Actor.

Z[edit]

Type: float

(not used)

Default value: 1.0

Functions[edit]

Static native functions[edit]

WrapText[edit]

static native final function WrapText (out string Text, out string Line, float dx, Font F, float FontScaleX)


Other static functions[edit]

MakeColor[edit]

static final function Object.Color MakeColor (byte R, byte G, byte B, optional byte A)


Native functions[edit]

Clear[edit]

native final function Clear (optional bool ClearRGB, optional bool ClearZ)


DrawActor[edit]

native(467) final function DrawActor (Actor A, bool WireFrame, optional bool ClearZ, optional float DisplayFOV)


DrawActorClipped[edit]

native final function DrawActorClipped (Actor A, bool WireFrame, float Left, float Top, float Width, float Height, optional bool ClearZ, optional float DisplayFOV)


DrawPortal[edit]

native(480) final function DrawPortal (int X, int Y, int Width, int Height, Actor CamActor, Object.Vector CamLocation, Object.Rotator CamRotation, optional int FOV, optional bool ClearZ)


DrawScreenActor[edit]

native final function DrawScreenActor (Actor A, optional float FOV, optional bool WireFrame, optional bool ClearZ)


DrawText[edit]

native(465) final function DrawText (coerce string Text, optional bool CR)


DrawTextClipped[edit]

native(469) final function DrawTextClipped (coerce string Text, optional bool bCheckHotKey)


DrawTextJustified[edit]

native final function DrawTextJustified (coerce string String, byte Justification, float x1, float y1, float x2, float y2)


DrawTile[edit]

native(466) final function DrawTile (Material Mat, float XL, float YL, float U, float V, float UL, float VL)


DrawTileClipped[edit]

native(468) final function DrawTileClipped (Material Mat, float XL, float YL, float U, float V, float UL, float VL)


DrawTileJustified[edit]

native final function DrawTileJustified (Material Mat, byte Justification, float XL, float YL)


DrawTilePartialStretched[edit]

native final function DrawTilePartialStretched (Material Mat, float XL, float YL)


DrawTileScaled[edit]

native final function DrawTileScaled (Material Mat, float XScale, float YScale)


DrawTileStretched[edit]

native final function DrawTileStretched (Material Mat, float XL, float YL)


GetCameraLocation[edit]

native final function GetCameraLocation (out Object.Vector CameraLocation, out Object.Rotator CameraRotation)


SetScreenLight[edit]

native final function SetScreenLight (int index, Object.Vector Position, Object.Color lightcolor, float radius)


SetScreenProjector[edit]

native final function SetScreenProjector (int index, Object.Vector Position, Object.Color color, float radius, Texture tex)


StrLen[edit]

native(464) final function StrLen (coerce string String, out float XL, out float YL)


TextSize[edit]

native(470) final function TextSize (coerce string String, out float XL, out float YL)


WorldToScreen[edit]

native final function Object.Vector WorldToScreen (Object.Vector WorldLoc)


WrapStringToArray[edit]

native final function WrapStringToArray (string Text, out array<stringOutArray, float dx, optional string EOL)


Events[edit]

Reset[edit]

event Reset ()


Other instance functions[edit]

DrawBox[edit]

final simulated function DrawBox (Canvas canvas, float width, float height)


DrawBracket[edit]

final simulated function DrawBracket (float width, float height, float bracket_size)


DrawHorizontal[edit]

final function DrawHorizontal (float Y, float width)


DrawIcon[edit]

final function DrawIcon (Texture Tex, float Scale)


DrawLine[edit]

final function DrawLine (int direction, float size)


DrawPattern[edit]

final function DrawPattern (Material Tex, float XL, float YL, float Scale)


DrawRect[edit]

final function DrawRect (Texture Tex, float RectX, float RectY)


DrawScreenText[edit]

simulated function DrawScreenText (string Text, float X, float Y, Object.EDrawPivot Pivot)


DrawVertical[edit]

final function DrawVertical (float X, float height)


SetClip[edit]

final function SetClip (float X, float Y)


SetDrawColor[edit]

final function SetDrawColor (byte R, byte G, byte B, optional byte A)


SetOrigin[edit]

final function SetOrigin (float X, float Y)


SetPos[edit]

final function SetPos (float X, float Y)