Engine
Class Canvas

source: C:\XIII\Engine\Classes\Canvas.uc
Core.Object
   |
   +--Engine.Canvas
Direct Known Subclasses:None

class Canvas
extends Core.Object

//============================================================================= // Canvas: A drawing canvas. // This is a built-in Unreal class and it shouldn't be modified. // // Notes. // To determine size of a drawable object, set Style to STY_None, // remember CurX, draw the thing, then inspect CurX and CurYL. //=============================================================================
Variables
 color BorderColor
           Border color around tiles.
 float CineFrameAlpha
           Viewport that owns the canvas.
 float CineFrameDelay
           Viewport that owns the canvas.
 ClipX, ClipY
           Bottom right clipping region.
 CurX, CurY
           Current position for drawing.
 float CurYL
           Largest Y size since DrawText.
 color DrawColor
           Color for drawing.
 font Font
           Font for DrawText.
 font MedFont
           Medium system font.
 OrgX, OrgY
           Origin for drawing.
 SizeX, SizeY
           Zero-based actual dimensions.
 font SmallFont
           Small system font.
 SpaceX, SpaceY
           Spacing for after Draw*.
 byte Style
           Drawing style STY_None means don't draw.
 viewport Viewport
           Viewport that owns the canvas.
 float Z
           Z location. 1=no screenflash, 2=yes screenflash.
 bool bCenter
           Whether to center the text.
 bool bDialogWindow
           to add some display to the window
 bool bNoRestoreState
           No restore state.
 bool bNoSmooth
           Don't bilinear filter.
 bool bTextShadow
           Draw the text w/ a shadow (1 pixel down right, color *0.3)
 bool bUseBorder
           Draw border around tiles.


Function Summary
 void DealWithResetEvent()
     
// UnrealScript functions.
 void DrawActor(Actor A, bool WireFrame, optional bool, optional float)
 void DrawCineFrame(bool bOnOff)
     
//::iKi::
 void DrawIcon(Texture Tex, float Scale)
 void DrawLine(float X1, float Y1, float X2, float Y2, color LineColor)
 void DrawMsgboxBackground(bool bOnlyCenter, float _OrgX, float _OrgY, float _LineWidth, float _LineHeight, float _Width, float _Height)
     
// NL1306
 void DrawPattern(Texture Tex, float XL, float YL, float Scale)
 void DrawPortal(int X, int Y, int Width, int Height, Actor CamActor, vector CamLocation, rotator CamRotation, optional int, optional bool)
 void DrawRect(Texture Tex, float RectX, float RectY)
 void DrawText(string Text, optional bool)
 void DrawTextClipped(string Text, optional bool)
 void DrawTextJustified(string String, byte Justification, float x1, float y1, float x2, float y2)
 void DrawTile(Material Tex, float XL, float YL, float U, float V, float UL, float VL)
 void DrawTileClipped(Material Tex, float XL, float YL, float U, float V, float UL, float VL)
 void DrawTileJustified(Material Mat, byte Justification, float XL, float YL)
 void DrawTileScaled(Material Mat, float XScale, float YScale)
 void DrawTileStretched(Material Mat, float XL, float YL)
     
// These are helper functions.  They use the whole texture only.  If you need better support, use DrawTile
 int GetScreenHeight()
 Color MakeColor(byte R, byte G, byte B, optional byte)
     
{
	local Color C;

	C.R = R;
	C.G = G;
	C.B = B;
	if ( A == 0 )
		A = 255;
	C.A = A;
	return C;
}*/
 Color MakeColor(byte R, byte G, byte B, optional byte)
     
{
	local Color C;

	C.R = R;
	C.G = G;
	C.B = B;
	if ( A == 0 )
		A = 255;
	C.A = A;
	return C;
}*/
 void SetClip(float X, float Y)
     
{
	ClipX = X;
	ClipY = Y;
}*/
 void SetClip(float X, float Y)
     
{
	ClipX = X;
	ClipY = Y;
}*/
 void SetDrawColor(byte R, byte G, byte B, optional byte)
     
{
	local Color C;

	C.R = R;
	C.G = G;
	C.B = B;
	if ( A == 0 )
		A = 255;
	C.A = A;
	DrawColor = C;
}*/
 void SetDrawColor(byte R, byte G, byte B, optional byte)
     
{
	local Color C;

	C.R = R;
	C.G = G;
	C.B = B;
	if ( A == 0 )
		A = 255;
	C.A = A;
	DrawColor = C;
}*/
 void SetOrigin(float X, float Y)
     
{
	OrgX = X;
	OrgY = Y;
}*/
 void SetOrigin(float X, float Y)
     
{
	OrgX = X;
	OrgY = Y;
}*/
 void SetPos(float X, float Y)
     
{
	CurX = X;
	CurY = Y;
}*/
 void SetPos(float X, float Y)
     
{
	CurX = X;
	CurY = Y;
}*/
 void StrLen(string String, out float, out float)
     
// native functions.
 void TextSize(string String, out float, out float)



Source Code


00001	//=============================================================================
00002	// Canvas: A drawing canvas.
00003	// This is a built-in Unreal class and it shouldn't be modified.
00004	//
00005	// Notes.
00006	//   To determine size of a drawable object, set Style to STY_None,
00007	//   remember CurX, draw the thing, then inspect CurX and CurYL.
00008	//=============================================================================
00009	class Canvas extends Object
00010		native
00011		noexport;
00012	
00013	// Modifiable properties.
00014	var font    Font;            // Font for DrawText.
00015	var float   SpaceX, SpaceY;  // Spacing for after Draw*.
00016	var float   OrgX, OrgY;      // Origin for drawing.
00017	var float   ClipX, ClipY;    // Bottom right clipping region.
00018	var float   CurX, CurY;      // Current position for drawing.
00019	var float   Z;               // Z location. 1=no screenflash, 2=yes screenflash.
00020	var byte    Style;           // Drawing style STY_None means don't draw.
00021	var float   CurYL;           // Largest Y size since DrawText.
00022	var color   DrawColor;       // Color for drawing.
00023	var bool    bCenter;         // Whether to center the text.
00024	var bool    bNoSmooth;       // Don't bilinear filter.
00025	var bool	  bUseBorder;      // Draw border around tiles.
00026	var bool    bNoRestoreState; // No restore state.
00027	var bool    bDialogWindow;   // to add some display to the window
00028	var bool    bTextShadow;     // Draw the text w/ a shadow (1 pixel down right, color *0.3)
00029	
00030	var color   BorderColor;     // Border color around tiles.
00031	var const int SizeX, SizeY;  // Zero-based actual dimensions.
00032	
00033	// Stock fonts.
00034	var font SmallFont;          // Small system font.
00035	var font MedFont;           // Medium system font.
00036	
00037	// Internal.
00038	var const viewport Viewport; // Viewport that owns the canvas.
00039	
00040	//::iKi::
00041	var float CineFrameAlpha;
00042	var float CineFrameDelay;
00043	// native functions.
00044	native(464) static final function StrLen( coerce string String, out float XL, out float YL );
00045	native(465) static final function DrawText( coerce string Text, optional bool CR );
00046	native(466) static final function DrawTile( Material Tex, float XL, float YL, float U, float V, float UL, float VL );
00047	native(467) static final function DrawActor( Actor A, bool WireFrame, optional bool ClearZ, optional float DisplayFOV );
00048	native(468) static final function DrawTileClipped( Material Tex, float XL, float YL, float U, float V, float UL, float VL );
00049	native(469) static final function DrawTextClipped( coerce string Text, optional bool bCheckHotKey );
00050	native(470) static final function TextSize( coerce string String, out float XL, out float YL );
00051	native(480) static final function DrawPortal( int X, int Y, int Width, int Height, actor CamActor, vector CamLocation, rotator CamRotation, optional int FOV, optional bool ClearZ );
00052	native(240) static final function DrawLine( float X1, float Y1, float X2, float Y2, color LineColor );
00053	
00054	native(239) static final function WrapStringToArray(string Text, out array<string> OutArray, float dx, string EOL);
00055	
00056	// These are helper functions.  They use the whole texture only.  If you need better support, use DrawTile
00057	native(241) static final function DrawTileStretched(material Mat, float XL, float YL);
00058	native(257) static final function DrawTileJustified(material Mat, byte Justification, float XL, float YL);
00059	native(253) static final function DrawTileScaled(material Mat, float XScale, float YScale);
00060	native(268) static final function DrawTextJustified(coerce string String, byte Justification, float x1, float y1, float x2, float y2);
00061	
00062	//::iKi::
00063	native(238) static final function DrawCineFrame(bool bOnOff);
00064	
00065	// NL1306
00066	native static final function DrawMsgboxBackground(bool bOnlyCenter, float _OrgX, float _OrgY, float _LineWidth, float _LineHeight, float _Width, float _Height);
00067	// LN
00068	
00069	// UnrealScript functions.
00070	native(285) static final function DealWithResetEvent();
00071	event Reset()
00072	{
00073	    /* --> turned into native function call
00074		Font        = Default.Font;
00075		SpaceX      = Default.SpaceX;
00076		SpaceY      = Default.SpaceY;
00077		OrgX        = Default.OrgX;
00078		OrgY        = Default.OrgY;
00079		CurX        = Default.CurX;
00080		CurY        = Default.CurY;
00081		Style       = Default.Style;
00082		DrawColor   = Default.DrawColor;
00083		CurYL       = Default.CurYL;
00084		bCenter     = false;
00085		bNoSmooth   = false;
00086		Z           = 1.0;
00087	    */
00088	    DealWithResetEvent();
00089	}
00090	
00091	
00092	/*native(269) static final function SetPos( float X, float Y )
00093	{
00094		CurX = X;
00095		CurY = Y;
00096	}*/
00097	native(269) static final function SetPos( float X, float Y );
00098	
00099	/*native(270) static final function SetOrigin( float X, float Y )
00100	{
00101		OrgX = X;
00102		OrgY = Y;
00103	}*/
00104	native(270) static final function SetOrigin( float X, float Y );
00105	/*native(271) static final function SetClip( float X, float Y )
00106	{
00107		ClipX = X;
00108		ClipY = Y;
00109	}*/
00110	native(271) static final function SetClip( float X, float Y );
00111	
00112	native static final function int GetScreenHeight();
00113	
00114	final function DrawPattern( texture Tex, float XL, float YL, float Scale )
00115	{
00116		DrawTile( Tex, XL, YL, (CurX-OrgX)*Scale, (CurY-OrgY)*Scale, XL*Scale, YL*Scale );
00117	}
00118	final function DrawIcon( texture Tex, float Scale )
00119	{
00120		if ( Tex != None )
00121			DrawTile( Tex, Tex.USize*Scale, Tex.VSize*Scale, 0, 0, Tex.USize, Tex.VSize );
00122	}
00123	final function DrawRect( texture Tex, float RectX, float RectY )
00124	{
00125		DrawTile( Tex, RectX, RectY, 0, 0, Tex.USize, Tex.VSize );
00126	}
00127	
00128	
00129	/*native(273) static final function SetDrawColor(byte R, byte G, byte B, optional byte A)
00130	{
00131		local Color C;
00132	
00133		C.R = R;
00134		C.G = G;
00135		C.B = B;
00136		if ( A == 0 )
00137			A = 255;
00138		C.A = A;
00139		DrawColor = C;
00140	}*/
00141	native(273) static final function SetDrawColor(byte R, byte G, byte B, optional byte A);
00142	
00143	/*native(274) static final function Color MakeColor(byte R, byte G, byte B, optional byte A)
00144	{
00145		local Color C;
00146	
00147		C.R = R;
00148		C.G = G;
00149		C.B = B;
00150		if ( A == 0 )
00151			A = 255;
00152		C.A = A;
00153		return C;
00154	}*/
00155	native(274) static final function Color MakeColor(byte R, byte G, byte B, optional byte A);
00156	
00157	defaultproperties
00158	{
00159	     Z=1.000000
00160	     Style=1
00161	     DrawColor=(B=127,G=127,R=127,A=255)
00162	     CineFrameDelay=1.000000
00163	}

End Source Code