Always snap to grid
Difference between revisions of "UE3:Canvas (UT3)"
(added a few descriptions) |
(added function descriptions for texture drawing) |
||
Line 160: | Line 160: | ||
{{code|native final function '''Draw2DLine''' ([[float]] '''X1''', [[float]] '''Y1''', [[float]] '''X2''', [[float]] '''Y2''', {{tl|Color|Object|structs}} '''LineColor''')}} | {{code|native final function '''Draw2DLine''' ([[float]] '''X1''', [[float]] '''Y1''', [[float]] '''X2''', [[float]] '''Y2''', {{tl|Color|Object|structs}} '''LineColor''')}} | ||
− | Draws a line from (X1,Y1) to (X2,Y2). | + | Draws a line on the canvas from (X1,Y1) to (X2,Y2). |
====DrawColorizedTile==== | ====DrawColorizedTile==== | ||
{{code|native final function '''DrawColorizedTile''' ({{cl|Texture2D}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''', {{tl|LinearColor|Object|structs}} '''LColor''')}} | {{code|native final function '''DrawColorizedTile''' ({{cl|Texture2D}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''', {{tl|LinearColor|Object|structs}} '''LColor''')}} | ||
− | + | Draws a part of a texture using the specified draw color. The current canvas position is used as upper left corner of the area to cover with the texture tile. | |
+ | |||
+ | '''Parameters:''' | ||
+ | * ''Tex'' - The texture to draw. | ||
+ | * ''XL'', ''YL'' - Width and height of the canvas area to draw the tile to. The tile is stretched to fit the area. | ||
+ | * ''U'', ''V'' - Origin coordinates of the texture area. Bottom/right end of texture area for negative UL/VL values. | ||
+ | * ''UL'', ''VL'' - Width and height of the texture area. Negative values mirror the tile in the corresponding direction. | ||
+ | * ''LColor'' - The color to use for drawing the tile. | ||
====DrawMaterialTile==== | ====DrawMaterialTile==== | ||
{{code|native final function '''DrawMaterialTile''' ({{cl|MaterialInterface}} '''Mat''', [[float]] '''XL''', [[float]] '''YL''', optional [[float]] '''U''', optional [[float]] '''V''', optional [[float]] '''UL''', optional [[float]] '''VL''')}} | {{code|native final function '''DrawMaterialTile''' ({{cl|MaterialInterface}} '''Mat''', [[float]] '''XL''', [[float]] '''YL''', optional [[float]] '''U''', optional [[float]] '''V''', optional [[float]] '''UL''', optional [[float]] '''VL''')}} | ||
− | Draws the emissive channel of a material to | + | Draws a part of the emissive channel of a material. The current canvas position is used as upper left corner of the area to cover with the material tile. |
'''Parameters:''' | '''Parameters:''' | ||
− | * ''Mat'' - The material which contains the emissive expression to | + | * ''Mat'' - The material which contains the emissive expression to draw. |
− | * ''XL'' | + | * ''XL'', ''YL'' - Width and height of the canvas area to draw the tile to. The tile is stretched to fit the area. |
− | + | * ''U'', ''V'' - Origin coordinates of the material area. Bottom/right end of material area for negative UL/VL values. | |
− | * ''U'' | + | * ''UL'', ''VL'' - Width and height of the material area. Negative values mirror the tile in the corresponding direction. |
− | + | ||
− | * ''UL'' | + | |
− | + | ||
====DrawMaterialTileClipped==== | ====DrawMaterialTileClipped==== | ||
{{code|native final function '''DrawMaterialTileClipped''' ({{cl|MaterialInterface}} '''Mat''', [[float]] '''XL''', [[float]] '''YL''', optional [[float]] '''U''', optional [[float]] '''V''', optional [[float]] '''UL''', optional [[float]] '''VL''')}} | {{code|native final function '''DrawMaterialTileClipped''' ({{cl|MaterialInterface}} '''Mat''', [[float]] '''XL''', [[float]] '''YL''', optional [[float]] '''U''', optional [[float]] '''V''', optional [[float]] '''UL''', optional [[float]] '''VL''')}} | ||
− | + | Same as {{tl|DrawMaterialTile}}, but cuts off the drawing area at the edges of the canvas clipping region defined by OrgX/Y and ClipX/Y. | |
====DrawRotatedMaterialTile==== | ====DrawRotatedMaterialTile==== | ||
{{code|native final function '''DrawRotatedMaterialTile''' ({{cl|MaterialInterface}} '''Mat''', {{tl|Rotator|Object|structs}} '''Rotation''', [[float]] '''XL''', [[float]] '''YL''', optional [[float]] '''U''', optional [[float]] '''V''', optional [[float]] '''UL''', optional [[float]] '''VL''', optional [[float]] '''AnchorX''', optional [[float]] '''AnchorY''')}} | {{code|native final function '''DrawRotatedMaterialTile''' ({{cl|MaterialInterface}} '''Mat''', {{tl|Rotator|Object|structs}} '''Rotation''', [[float]] '''XL''', [[float]] '''YL''', optional [[float]] '''U''', optional [[float]] '''V''', optional [[float]] '''UL''', optional [[float]] '''VL''', optional [[float]] '''AnchorX''', optional [[float]] '''AnchorY''')}} | ||
− | + | Same as {{tl|DrawMaterialTile}}, but additionally rotates the canvas draw area by the angle specified in ''Rotation.Yaw''. The rotation anchor position on the drawing area is specified through AnchorX/Y and defaults to the center of the draw area. The anchor position is specified with relative values, so (0.0,0.0) is the top left corner, (0.5,0.5) is the center and (1.0,1.0) is the bottom right corner. Values outside the drawing area are also supported. | |
====DrawRotatedTile==== | ====DrawRotatedTile==== | ||
{{code|native final function '''DrawRotatedTile''' ({{cl|Texture2D}} '''Tex''', {{tl|Rotator|Object|structs}} '''Rotation''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''', optional [[float]] '''AnchorX''', optional [[float]] '''AnchorY''')}} | {{code|native final function '''DrawRotatedTile''' ({{cl|Texture2D}} '''Tex''', {{tl|Rotator|Object|structs}} '''Rotation''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''', optional [[float]] '''AnchorX''', optional [[float]] '''AnchorY''')}} | ||
− | + | Same as {{tl|DrawTile}}, but additionally rotates the canvas draw area by the angle specified in ''Rotation.Yaw''. The rotation anchor position on the drawing area is specified through AnchorX/Y and defaults to the center of the draw area. The anchor position is specified with relative values, so (0.0,0.0) is the top left corner, (0.5,0.5) is the center and (1.0,1.0) is the bottom right corner. Values outside the drawing area are also supported. | |
====DrawText==== | ====DrawText==== | ||
Line 219: | Line 223: | ||
{{code|native final function '''DrawTile''' ({{cl|Texture2D}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''')}} | {{code|native final function '''DrawTile''' ({{cl|Texture2D}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''')}} | ||
− | + | Draws a part of a texture. The current canvas position is used as upper left corner of the area to cover with the texture tile. | |
+ | |||
+ | '''Parameters:''' | ||
+ | * ''Tex'' - The texture to draw. | ||
+ | * ''XL'', ''YL'' - Width and height of the canvas area to draw the tile to. The tile is stretched to fit the area. | ||
+ | * ''U'', ''V'' - Origin coordinates of the texture area. Bottom/right end of texture area for negative UL/VL values. | ||
+ | * ''UL'', ''VL'' - Width and height of the texture area. Negative values mirror the tile in the corresponding direction. | ||
====DrawTileClipped==== | ====DrawTileClipped==== | ||
{{code|native(468) final function '''DrawTileClipped''' ({{cl|Texture2D}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''')}} | {{code|native(468) final function '''DrawTileClipped''' ({{cl|Texture2D}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''')}} | ||
− | + | Same as {{tl|DrawTile}}, but cuts off the drawing area at the edges of the canvas clipping region defined by OrgX/Y and ClipX/Y. | |
====DrawTileNew==== | ====DrawTileNew==== | ||
{{code|native final function '''DrawTileNew''' ({{cl|Texture}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''')}} | {{code|native final function '''DrawTileNew''' ({{cl|Texture}} '''Tex''', [[float]] '''XL''', [[float]] '''YL''', [[float]] '''U''', [[float]] '''V''', [[float]] '''UL''', [[float]] '''VL''')}} | ||
− | + | Same as {{tl|DrawTile}}, but also accepts other texture objects, such as {{cl|TextureMovie}} or render targets, including {{cl|ScriptedTexture}}s. | |
====DrawTileStretched==== | ====DrawTileStretched==== | ||
Line 299: | Line 309: | ||
{{code|final function '''DrawRect''' ([[float]] '''RectX''', [[float]] '''RectY''', optional {{cl|Texture2D}} '''Tex''')}} | {{code|final function '''DrawRect''' ([[float]] '''RectX''', [[float]] '''RectY''', optional {{cl|Texture2D}} '''Tex''')}} | ||
− | + | Draws a rectangle of the specified size in pixels at the current canvas position. If a texture is specified, it will be stretched to the rectangle size, otherwise the rectangle is drawn using the {{tl|DefaultTexture}}, which is entirely white. | |
====DrawTextRA==== | ====DrawTextRA==== | ||
Line 309: | Line 319: | ||
{{code|final function '''DrawTexture''' ({{cl|Texture2D}} '''Tex''', [[float]] '''Scale''')}} | {{code|final function '''DrawTexture''' ({{cl|Texture2D}} '''Tex''', [[float]] '''Scale''')}} | ||
− | + | Draws the specified texture at the current canvas position. | |
====MakeIcon==== | ====MakeIcon==== |
Latest revision as of 03:42, 4 October 2008
Object >> Canvas |
Contents
- 1 Properties
- 2 Structs
- 3 Functions
- 3.1 Native functions
- 3.1.1 DeProject
- 3.1.2 Draw2DLine
- 3.1.3 DrawColorizedTile
- 3.1.4 DrawMaterialTile
- 3.1.5 DrawMaterialTileClipped
- 3.1.6 DrawRotatedMaterialTile
- 3.1.7 DrawRotatedTile
- 3.1.8 DrawText
- 3.1.9 DrawTextClipped
- 3.1.10 DrawTextureDoubleLine
- 3.1.11 DrawTextureLine
- 3.1.12 DrawTile
- 3.1.13 DrawTileClipped
- 3.1.14 DrawTileNew
- 3.1.15 DrawTileStretched
- 3.1.16 PopTransform
- 3.1.17 Project
- 3.1.18 PushTranslationMatrix
- 3.1.19 SetDrawColor
- 3.1.20 SetPos
- 3.1.21 StrLen
- 3.1.22 TextSize
- 3.2 Events
- 3.3 Other instance functions
- 3.1 Native functions
A drawing canvas for the HUD and for ScriptedTextures.
A canvas can define a clipping region through OrgX/Y and ClipX/Y, which is used as reference coordinate system for all drawing operations. The drawing position, CurX/Y, is relative to the origin of the clipping region. Drawing functions with "clipped" in their name will limit drawing to the clipping region, others only use the origin as offset and still draw to the entire canvas.
Properties[edit]
bCenter[edit]
Type: bool
Whether to center the text.
bNoSmooth[edit]
Type: bool
Don't bilinear filter.
Canvas[edit]
Type: pointer{FCanvas}
Modifiers: native, const
ClipX[edit]
Type: float
Width of the clipping region.
ClipY[edit]
Type: float
Height of the clipping region.
ColorModulate[edit]
Type: Object.Plane
Default value:
Member | Value |
---|---|
W | 1.0 |
X | 1.0 |
Y | 1.0 |
Z | 1.0 |
CurX[edit]
Type: float
Horizontal coordinate of current drawing position.
CurY[edit]
Type: float
Vertical coordinate of the current drawing position.
CurYL[edit]
Type: float
Height of the last DrawText output.
DefaultTexture[edit]
Type: Texture2D
Default value: Texture2D'EngineResources.WhiteSquareTexture'
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 DrawText.
Default value: Font'EngineFonts.SmallFont'
OrgX[edit]
Type: float
Offset of the clipping region from the left side of the screen.
OrgY[edit]
Type: float
Offset of the clipping region from the top side of the screen.
SceneView[edit]
Type: pointer{FSceneView}
Modifiers: native, const
SizeX[edit]
Type: int
Modifiers: const
Width of the screen in pixels.
SizeY[edit]
Type: int
Modifiers: const
Height of the screen in pixels.
Structs[edit]
CanvasIcon[edit]
Holds texture information with UV coordinates as well.
- Texture2D Texture
- Source texture
- float U
- Offset from the left side of the texture region.
- float V
- Offset from the top side of the texture region.
- float UL
- Texture region width.
- float VL
- Texture region height.
Functions[edit]
Native functions[edit]
DeProject[edit]
Converts local (screen) coordinates to global (world) coordinates.
Draw2DLine[edit]
Draws a line on the canvas from (X1,Y1) to (X2,Y2).
DrawColorizedTile[edit]
Draws a part of a texture using the specified draw color. The current canvas position is used as upper left corner of the area to cover with the texture tile.
Parameters:
- Tex - The texture to draw.
- XL, YL - Width and height of the canvas area to draw the tile to. The tile is stretched to fit the area.
- U, V - Origin coordinates of the texture area. Bottom/right end of texture area for negative UL/VL values.
- UL, VL - Width and height of the texture area. Negative values mirror the tile in the corresponding direction.
- LColor - The color to use for drawing the tile.
DrawMaterialTile[edit]
Draws a part of the emissive channel of a material. The current canvas position is used as upper left corner of the area to cover with the material tile.
Parameters:
- Mat - The material which contains the emissive expression to draw.
- XL, YL - Width and height of the canvas area to draw the tile to. The tile is stretched to fit the area.
- U, V - Origin coordinates of the material area. Bottom/right end of material area for negative UL/VL values.
- UL, VL - Width and height of the material area. Negative values mirror the tile in the corresponding direction.
DrawMaterialTileClipped[edit]
Same as DrawMaterialTile, but cuts off the drawing area at the edges of the canvas clipping region defined by OrgX/Y and ClipX/Y.
DrawRotatedMaterialTile[edit]
Same as DrawMaterialTile, but additionally rotates the canvas draw area by the angle specified in Rotation.Yaw. The rotation anchor position on the drawing area is specified through AnchorX/Y and defaults to the center of the draw area. The anchor position is specified with relative values, so (0.0,0.0) is the top left corner, (0.5,0.5) is the center and (1.0,1.0) is the bottom right corner. Values outside the drawing area are also supported.
DrawRotatedTile[edit]
Same as DrawTile, but additionally rotates the canvas draw area by the angle specified in Rotation.Yaw. The rotation anchor position on the drawing area is specified through AnchorX/Y and defaults to the center of the draw area. The anchor position is specified with relative values, so (0.0,0.0) is the top left corner, (0.5,0.5) is the center and (1.0,1.0) is the bottom right corner. Values outside the drawing area are also supported.
DrawText[edit]
DrawTextClipped[edit]
DrawTextureDoubleLine[edit]
DrawTextureLine[edit]
DrawTile[edit]
Draws a part of a texture. The current canvas position is used as upper left corner of the area to cover with the texture tile.
Parameters:
- Tex - The texture to draw.
- XL, YL - Width and height of the canvas area to draw the tile to. The tile is stretched to fit the area.
- U, V - Origin coordinates of the texture area. Bottom/right end of texture area for negative UL/VL values.
- UL, VL - Width and height of the texture area. Negative values mirror the tile in the corresponding direction.
DrawTileClipped[edit]
Same as DrawTile, but cuts off the drawing area at the edges of the canvas clipping region defined by OrgX/Y and ClipX/Y.
DrawTileNew[edit]
Same as DrawTile, but also accepts other texture objects, such as TextureMovie or render targets, including ScriptedTextures.
DrawTileStretched[edit]
PopTransform[edit]
Pops the topmost matrix from the canvas transform stack.
Project[edit]
Converts global (world) coordinates to local (screen) coordinates.
PushTranslationMatrix[edit]
Pushes a translation matrix onto the canvas.
Parameters:
- TranslationVector - Translation vector to use to create the translation matrix.
SetDrawColor[edit]
SetPos[edit]
StrLen[edit]
TextSize[edit]
Events[edit]
Reset[edit]
Other instance functions[edit]
DrawBox[edit]
DrawIcon[edit]
Draw a CanvasIcon at the desired canvas position.
DrawIconSection[edit]
Draw a subsection of a CanvasIcon at the desired canvas position.
DrawRect[edit]
Draws a rectangle of the specified size in pixels at the current canvas position. If a texture is specified, it will be stretched to the rectangle size, otherwise the rectangle is drawn using the DefaultTexture, which is entirely white.
DrawTextRA[edit]
Draws text right aligned from the current position.
DrawTexture[edit]
Draws the specified texture at the current canvas position.
MakeIcon[edit]
Fake CanvasIcon constructor.