Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Draw Class Reference

General drawing functions. More...

Public Member Functions

void Sprite (integer sprite, integer animation, integer frame, number x, number y, integer flipX, integer flipY, number scaleX, number scaleY, number rotation, boolean useInteger, integer paletteID)
 Draws a sprite.
void SpriteBasic (Entity entity, number x, number y)
 Draws a sprite based on an entity's current values (Sprite, CurrentAnimation, CurrentFrame, X, Y, Direction, ScaleX, ScaleY, Rotation).
void Animator (integer animator, number x, number y, integer flipX, integer flipY, number scaleX=1.0, number scaleY=1.0, number rotation=0.0)
 Draws an animator based on its current values (Sprite, CurrentAnimation, CurrentFrame) and other provided values.
void AnimatorBasic (integer animator, Entity entity, number x, number y)
 Draws an animator based on its current values (Sprite, CurrentAnimation, CurrentFrame) and an entity's other values (X, Y, Direction, ScaleX, ScaleY, Rotation).
void SpritePart (integer sprite, integer animation, integer frame, number x, number y, integer partX, integer partY, integer partW, integer partH, integer flipX, integer flipY, number scaleX, number scaleY, number rotation, number useInteger, integer paletteID)
 Draws part of a sprite.
void Image (integer image, number x, number y, integer paletteID)
 Draws an image.
void ImagePart (integer image, integer partX, integer partY, integer partW, integer partH, number x, number y, integer paletteID)
 Draws part of an image.
void ImageSized (integer image, number x, number y, number width, number height, integer paletteID)
 Draws an image, but sized.
void ImagePartSized (integer image, integer partX, integer partY, integer partW, integer partH, number x, number y, number width, number height, integer paletteID)
 Draws part of an image, but sized.
void Layer (integer layerIndex)
 Draws a layer.
void View (integer viewIndex, number x, number y)
 Draws a view.
void ViewPart (integer viewIndex, number x, number y, integer partX, integer partY, integer partW, integer partH)
 Draws part of a view.
void ViewSized (integer viewIndex, number x, number y, number width, number height)
 Draws a view, but sized.
void ViewPartSized (integer viewIndex, number x, number y, integer partX, integer partY, integer partW, integer partH, number width, number height)
 Draws part of a view, but sized.
void Video ()
void VideoPart ()
void VideoSized ()
void VideoPartSized ()
void Tile (integer ID, number x, number y, integer flipX, integer flipY, number scaleX, number scaleY, number rotation, integer paletteID)
 Draws a tile.
void Texture (integer texture, number x, number y)
 Draws a texture.
void TextureSized (integer texture, number x, number y, number width, number height)
 Draws a texture, but sized.
void TexturePart (integer texture, integer partX, integer partY, integer partW, integer partH, number x, number y)
 Draws part of a texture.
void SetTextAlign (integer baseline)
 Sets the text drawing horizontal alignment. The initial value is left.
void SetTextBaseline (integer baseline)
 Sets the text drawing vertical alignment. The initial value is top.
void SetTextAdvance (number ascent)
 Sets the character spacing multiplier. The initial value is 1.0.
void SetTextLineAscent (number ascent)
 Sets the line height multiplier. The initial value is 1.25.
array MeasureText (array outArray, Font font, string text, number fontSize)
 Measures UTF-8 text using a font and stores max width and max height into the array.
array MeasureTextWrapped (array outArray, Font font, string text, number maxWidth, integer maxLines, number fontSize)
 Measures wrapped UTF-8 text using a font and stores max width and max height into the array.
void Text (Font font, string text, number x, number y, number fontSize, integer paletteID)
 Draws UTF-8 text using a font.
void TextWrapped (Font font, string text, number x, number y, number maxWidth, integer maxLines, number fontSize, integer paletteID)
 Draws wrapped UTF-8 text using a font.
void TextEllipsis (Font font, string text, number x, number y, number maxWidth, integer maxLines, number fontSize, integer paletteID)
 Draws UTF-8 text using a font, but adds ellipsis if the text doesn't fit in maxWidth.
void Glyph (Font font, integer codepoint, number x, number y, number fontSize, integer paletteID)
 Draws a glyph for a given code point.
void TextArray (integer sprite, integer animation, number x, number y, array string, integer startFrame, integer endFrame, integer align, integer spacing, array charOffsetsX, array charOffsetsY, integer paletteID)
 Draws a series of sprites based on a converted sprite string.
void SetBlendColor (integer hex, number alpha)
 Sets the color to be used for drawing and blending.
void SetTextureBlend (boolean doBlend)
 Sets whether to use color and alpha blending on sprites, images, and textures.
void SetBlendMode (BlendMode blendMode)
 Sets the blend mode used for drawing.
void SetBlendFactor (BlendFactor sourceFactor, BlendFactor destinationFactor)
 Sets the blend factors used for drawing. (Only for hardware-rendering).
void SetBlendFactorExtended (BlendFactor sourceColorFactor, BlendFactor destinationColorFactor, BlendFactor sourceAlphaFactor, BlendFactor destinationAlphaFactor)
 Sets all the blend factors used for drawing. (Only for hardware-rendering).
void SetCompareColor (integer hex)
 Sets the Comparison Color to draw over for Comparison Drawing.
void SetTintColor (integer hex, number amount)
 Sets the color to be used for tinting.
void SetTintMode (TintMode tintMode)
 Sets the tint mode used for drawing.
void UseTinting (boolean useTinting)
 Sets whether to use color tinting when drawing.
void SetShader (Shader shader)
 Sets the current shader.
void SetFilter (Filter filterType)
 Sets the current filter type.
void UseStencil (boolean enabled)
 Enables or disables stencil operations.
void SetStencilTestFunction (StencilTest stencilTest)
 Sets the current stencil test function.
void SetStencilPassOperation (StencilTest stencilOp)
 Sets the stencil operation for when the stencil test passes.
void SetStencilFailOperation (StencilTest stencilOp)
 Sets the stencil operation for when the stencil test fails.
void SetStencilValue (integer value)
 Sets the stencil value.
void SetStencilMask (integer mask)
 Sets the mask used for all stencil tests.
void ClearStencil ()
 Clears the stencil.
void SetDotMask (integer mask)
 Sets the dot mask.
void SetHorizontalDotMask (integer mask)
 Sets the horizontal dot mask.
void SetVerticalDotMask (integer mask)
 Sets the vertical dot mask.
void SetHorizontalDotMaskOffset (integer offsetH)
 Sets the offset of the horizontal dot mask.
void SetVerticalDotMaskOffset (integer offsetV)
 Sets the offset of the vertical dot mask.
void Line (number x1, number y1, number x2, number y2)
 Draws a line.
void Circle (number x, number y, number radius)
 Draws a circle.
void Ellipse (number x, number y, number width, number height)
 Draws an ellipse.
void Triangle (number x1, number y1, number x2, number y2, number x3, number y3)
 Draws a triangle.
void TriangleBlend (number x1, number y1, number x2, number y2, number x3, number y3, integer color1, integer color2, integer color3)
 Draws a triangle, blending the colors at the vertices. (Colors are multiplied by the global Draw Blend Color, do Draw.SetBlendColor`(0xFFFFFF, 1.0)` if you want the vertex colors unaffected.).
void Quad (number x1, number y1, number x2, number y2, number x3, number y3, number x4, number y4)
 Draws a quad.
void QuadBlend (number x1, number y1, number x2, number y2, number x3, number y3, number x4, number y4, integer color1, integer color2, integer color3, integer color4)
 Draws a quad, blending the colors at the vertices. (Colors are multiplied by the global Draw Blend Color, do Draw.SetBlendColor`(0xFFFFFF, 1.0)` if you want the vertex colors unaffected.).
void TriangleTextured (integer image, number x1, number y1, number x2, number y2, number x3, number y3, integer color1, integer color2, integer color3, number u1, number v1, number u2, number v2, number u3, number v3)
 Draws a textured triangle.
void QuadTextured (integer image, number x1, number y1, number x2, number y2, number x3, number y3, number x4, number y4, integer color1, integer color2, integer color3, integer color4, number u1, number v1, number u2, number v2, number u3, number v3, number u4, number v4)
 Draws a textured quad.
void Rectangle (number x, number y, number width, number height)
 Draws a rectangle.
void CircleStroke (number x, number y, number radius, number thickness)
 Draws a circle outline.
void EllipseStroke (number x, number y, number width, number height)
 Draws an ellipse outline.
void TriangleStroke (number x1, number y1, number x2, number y2, number x3, number y3)
 Draws a triangle outline.
void RectangleStroke (number x, number y, number width, number height)
 Draws a rectangle outline.
void UseFillSmoothing (boolean smoothFill)
 Sets whether to use smoothing when drawing filled shapes. (hardware-renderer only).
void UseStrokeSmoothing (boolean smoothStroke)
 Sets whether to use smoothing when drawing un-filled shapes. (hardware-renderer only).
void SetClip (number x, number y, number width, number height)
 Sets the region in which drawing will occur.
void ClearClip ()
 Resets the drawing region.
integer GetClipX ()
 Gets the X position in which drawing starts to occur.
integer GetClipY ()
 Gets the Y position in which drawing starts to occur.
integer GetClipWidth ()
 Gets the width in which drawing occurs.
integer GetClipHeight ()
 Gets the height in which drawing occurs.
void Save ()
 Saves the current transform matrix to the stack.
void Scale (number x, number y, number z=1.0)
 Scales the view.
void Rotate (number x, number y, number z)
 Rotates the view.
void Rotate (number angle)
 Rotates the view.
void Restore ()
 Restores the last saved transform matrix from the stack.
void Translate (number x, number y, number z=0.0)
 Translates the view.
void SetTextureTarget (integer texture)
 Sets the current render target.
void Clear ()
 Clears the screen.
void ResetTextureTarget ()
 Resets the current render target.
void UseSpriteDeform (boolean useDeform)
 Sets whether to use sprite deform when drawing.
void SetSpriteDeformLine (integer deformIndex, decimal deformValue)
 Sets the sprite deform line at the specified line index.
void UseDepthTesting (boolean useDepthTesting)
 Sets whether to do depth tests when drawing.
integer GetCurrentDrawGroup ()
 Gets the draw group currently being drawn.
void CopyScreen (integer texture)
 Copies the contents of the screen into a texture.

Detailed Description

General drawing functions.

Draw provides functions to draw images, sprites, and textures; as well as primitives, such as lines, rectangles, ellipses and polygons. You may also apply basic transformations like translation, scaling, and rotation.

Member Function Documentation

◆ Animator()

void Draw.Animator ( integer animator,
number x,
number y,
integer flipX,
integer flipY,
number scaleX = 1.0,
number scaleY = 1.0,
number rotation = 0.0 )

Draws an animator based on its current values (Sprite, CurrentAnimation, CurrentFrame) and other provided values.

Parameters
animatorThe animator to draw.
xX position of where to draw the sprite.
yY position of where to draw the sprite.
flipXWhether to flip the sprite horizontally.
flipYWhether to flip the sprite vertically.
scaleXScale multiplier of the sprite horizontally.
scaleYScale multiplier of the sprite vertically.
rotationRotation of the drawn sprite, from 0-511.

◆ AnimatorBasic()

void Draw.AnimatorBasic ( integer animator,
Entity entity,
number x,
number y )

Draws an animator based on its current values (Sprite, CurrentAnimation, CurrentFrame) and an entity's other values (X, Y, Direction, ScaleX, ScaleY, Rotation).

Parameters
animatorThe animator to draw.
entityThe entity to pull other values from.
xX position of where to draw the sprite, otherwise uses the entity's X value.
yY position of where to draw the sprite, otherwise uses the entity's Y value.

◆ Circle()

void Draw.Circle ( number x,
number y,
number radius )

Draws a circle.

Parameters
xCenter X position of where to draw the circle.
yCenter Y position of where to draw the circle.
radiusRadius of the circle.

◆ CircleStroke()

void Draw.CircleStroke ( number x,
number y,
number radius,
number thickness )

Draws a circle outline.

Parameters
xCenter X position of where to draw the circle.
yCenter Y position of where to draw the circle.
radiusRadius of the circle.
thicknessThickness of the circle.

◆ CopyScreen()

void Draw.CopyScreen ( integer texture)

Copies the contents of the screen into a texture.

Parameters
textureTexture index.

◆ Ellipse()

void Draw.Ellipse ( number x,
number y,
number width,
number height )

Draws an ellipse.

Parameters
xX position of where to draw the ellipse.
yY position of where to draw the ellipse.
widthWidth to draw the ellipse at.
heightHeight to draw the ellipse at.

◆ EllipseStroke()

void Draw.EllipseStroke ( number x,
number y,
number width,
number height )

Draws an ellipse outline.

Parameters
xX position of where to draw the ellipse.
yY position of where to draw the ellipse.
widthWidth to draw the ellipse at.
heightHeight to draw the ellipse at.

◆ GetClipHeight()

integer Draw.GetClipHeight ( )

Gets the height in which drawing occurs.

Returns
The height if clipping is enabled, else 0.

◆ GetClipWidth()

integer Draw.GetClipWidth ( )

Gets the width in which drawing occurs.

Returns
The width if clipping is enabled, else 0.

◆ GetClipX()

integer Draw.GetClipX ( )

Gets the X position in which drawing starts to occur.

Returns
The X position if clipping is enabled, else 0.

◆ GetClipY()

integer Draw.GetClipY ( )

Gets the Y position in which drawing starts to occur.

Returns
The Y position if clipping is enabled, else 0.

◆ GetCurrentDrawGroup()

integer Draw.GetCurrentDrawGroup ( )

Gets the draw group currently being drawn.

Returns
Returns an integer value.

◆ Glyph()

void Draw.Glyph ( Font font,
integer codepoint,
number x,
number y,
number fontSize,
integer paletteID )

Draws a glyph for a given code point.

Parameters
fontThe Font.
codepointCode point to draw.
xX position of where to draw the glyph.
yY position of where to draw the glyph.
fontSizeThe size of the font. If this argument is not given, this uses the pixels per unit value that the font was configured with.
paletteIDWhich palette index to use.

◆ Image()

void Draw.Image ( integer image,
number x,
number y,
integer paletteID )

Draws an image.

Parameters
imageIndex of the loaded image.
xX position of where to draw the image.
yY position of where to draw the image.
paletteIDWhich palette index to use.

◆ ImagePart()

void Draw.ImagePart ( integer image,
integer partX,
integer partY,
integer partW,
integer partH,
number x,
number y,
integer paletteID )

Draws part of an image.

Parameters
imageIndex of the loaded image.
partXX coordinate of part of image to draw.
partYY coordinate of part of image to draw.
partWWidth of part of image to draw.
partHHeight of part of image to draw.
xX position of where to draw the image.
yY position of where to draw the image.
paletteIDWhich palette index to use.

◆ ImagePartSized()

void Draw.ImagePartSized ( integer image,
integer partX,
integer partY,
integer partW,
integer partH,
number x,
number y,
number width,
number height,
integer paletteID )

Draws part of an image, but sized.

Parameters
imageIndex of the loaded image.
partXX coordinate of part of image to draw.
partYY coordinate of part of image to draw.
partWWidth of part of image to draw.
partHHeight of part of image to draw.
xX position of where to draw the image.
yY position of where to draw the image.
widthWidth to draw the image.
heightHeight to draw the image.
paletteIDWhich palette index to use.

◆ ImageSized()

void Draw.ImageSized ( integer image,
number x,
number y,
number width,
number height,
integer paletteID )

Draws an image, but sized.

Parameters
imageIndex of the loaded image.
xX position of where to draw the image.
yY position of where to draw the image.
widthWidth to draw the image.
heightHeight to draw the image.
paletteIDWhich palette index to use.

◆ Layer()

void Draw.Layer ( integer layerIndex)

Draws a layer.

Parameters
layerIndexIndex of layer.

◆ Line()

void Draw.Line ( number x1,
number y1,
number x2,
number y2 )

Draws a line.

Parameters
x1X position of where to start drawing the line.
y1Y position of where to start drawing the line.
x2X position of where to end drawing the line.
y2Y position of where to end drawing the line.

◆ MeasureText()

array Draw.MeasureText ( array outArray,
Font font,
string text,
number fontSize )

Measures UTF-8 text using a font and stores max width and max height into the array.

Parameters
outArrayArray to output size values to.
fontThe Font to be used as text.
textText to measure.
fontSizeThe size of the font. If this argument is not given, this uses the pixels per unit value that the font was configured with.
Returns
Returns the array inputted into the function.

◆ MeasureTextWrapped()

array Draw.MeasureTextWrapped ( array outArray,
Font font,
string text,
number maxWidth,
integer maxLines,
number fontSize )

Measures wrapped UTF-8 text using a font and stores max width and max height into the array.

Parameters
outArrayArray to output size values to.
fontThe Font to be used as text.
textText to measure.
maxWidthMax width that a line can be.
maxLinesMax number of lines to measure. Use null to measure all lines.
fontSizeThe size of the font. If this argument is not given, this uses the pixels per unit value that the font was configured with.
Returns
Returns the array inputted into the function.

◆ Quad()

void Draw.Quad ( number x1,
number y1,
number x2,
number y2,
number x3,
number y3,
number x4,
number y4 )

Draws a quad.

Parameters
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.
x4X position of the fourth vertex.
y4Y position of the fourth vertex.

◆ QuadBlend()

void Draw.QuadBlend ( number x1,
number y1,
number x2,
number y2,
number x3,
number y3,
number x4,
number y4,
integer color1,
integer color2,
integer color3,
integer color4 )

Draws a quad, blending the colors at the vertices. (Colors are multiplied by the global Draw Blend Color, do Draw.SetBlendColor`(0xFFFFFF, 1.0)` if you want the vertex colors unaffected.).

Parameters
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.
x4X position of the fourth vertex.
y4Y position of the fourth vertex.
color1Color of the first vertex.
color2Color of the second vertex.
color3Color of the third vertex.
color4Color of the fourth vertex.

◆ QuadTextured()

void Draw.QuadTextured ( integer image,
number x1,
number y1,
number x2,
number y2,
number x3,
number y3,
number x4,
number y4,
integer color1,
integer color2,
integer color3,
integer color4,
number u1,
number v1,
number u2,
number v2,
number u3,
number v3,
number u4,
number v4 )

Draws a textured quad.

Parameters
imageImage to draw quad with.
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.
x4X position of the fourth vertex.
y4Y position of the fourth vertex.
color1Color of the first vertex.
color2Color of the second vertex.
color3Color of the third vertex.
color4Color of the fourth vertex.
u1Texture U of the first vertex.
v1Texture V of the first vertex.
u2Texture U of the second vertex.
v2Texture V of the second vertex.
u3Texture U of the third vertex.
v3Texture V of the third vertex.
u4Texture U of the fourth vertex.
v4Texture V of the fourth vertex.

◆ Rectangle()

void Draw.Rectangle ( number x,
number y,
number width,
number height )

Draws a rectangle.

Parameters
xX position of where to draw the rectangle.
yY position of where to draw the rectangle.
widthWidth to draw the rectangle at.
heightHeight to draw the rectangle at.

◆ RectangleStroke()

void Draw.RectangleStroke ( number x,
number y,
number width,
number height )

Draws a rectangle outline.

Parameters
xX position of where to draw the rectangle.
yY position of where to draw the rectangle.
widthWidth to draw the rectangle at.
heightHeight to draw the rectangle at.

◆ Rotate() [1/2]

void Draw.Rotate ( number angle)

Rotates the view.

Parameters
angleDesired rotation angle.

◆ Rotate() [2/2]

void Draw.Rotate ( number x,
number y,
number z )

Rotates the view.

Parameters
xDesired X angle.
yDesired Y angle.
zDesired Z angle.

◆ Scale()

void Draw.Scale ( number x,
number y,
number z = 1.0 )

Scales the view.

Parameters
xDesired X scale.
yDesired Y scale.
zDesired Z scale.

◆ SetBlendColor()

void Draw.SetBlendColor ( integer hex,
number alpha )

Sets the color to be used for drawing and blending.

Parameters
hexHexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
alphaOpacity to use for drawing, 0.0 to 1.0.

◆ SetBlendFactor()

void Draw.SetBlendFactor ( BlendFactor sourceFactor,
BlendFactor destinationFactor )

Sets the blend factors used for drawing. (Only for hardware-rendering).

Parameters
sourceFactorSource factor for blending.
destinationFactorDestination facto for blending.

◆ SetBlendFactorExtended()

void Draw.SetBlendFactorExtended ( BlendFactor sourceColorFactor,
BlendFactor destinationColorFactor,
BlendFactor sourceAlphaFactor,
BlendFactor destinationAlphaFactor )

Sets all the blend factors used for drawing. (Only for hardware-rendering).

Parameters
sourceColorFactorSource factor for blending color.
destinationColorFactorDestination factor for blending color.
sourceAlphaFactorSource factor for blending alpha.
destinationAlphaFactorDestination factor for blending alpha.

◆ SetBlendMode()

void Draw.SetBlendMode ( BlendMode blendMode)

Sets the blend mode used for drawing.

Parameters
blendModeThe desired blend mode.

◆ SetClip()

void Draw.SetClip ( number x,
number y,
number width,
number height )

Sets the region in which drawing will occur.

Parameters
xX position of where to start the draw region.
yY position of where to start the draw region.
widthWidth of the draw region.
heightHeight of the draw region.

◆ SetCompareColor()

void Draw.SetCompareColor ( integer hex)

Sets the Comparison Color to draw over for Comparison Drawing.

Parameters
hexHexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)

◆ SetDotMask()

void Draw.SetDotMask ( integer mask)

Sets the dot mask.

Parameters
maskThe mask.

◆ SetFilter()

void Draw.SetFilter ( Filter filterType)

Sets the current filter type.

Parameters
filterTypeThe filter type.

◆ SetHorizontalDotMask()

void Draw.SetHorizontalDotMask ( integer mask)

Sets the horizontal dot mask.

Parameters
maskThe mask.

◆ SetHorizontalDotMaskOffset()

void Draw.SetHorizontalDotMaskOffset ( integer offsetH)

Sets the offset of the horizontal dot mask.

Parameters
offsetHThe offset.

◆ SetShader()

void Draw.SetShader ( Shader shader)

Sets the current shader.

Parameters
shaderThe shader, or null to unset the shader.

◆ SetSpriteDeformLine()

void Draw.SetSpriteDeformLine ( integer deformIndex,
decimal deformValue )

Sets the sprite deform line at the specified line index.

Parameters
deformIndexIndex of deform line. (0 = top of screen, 1 = the line below it, 2 = etc.)
deformValueDeform value.

◆ SetStencilFailOperation()

void Draw.SetStencilFailOperation ( StencilTest stencilOp)

Sets the stencil operation for when the stencil test fails.

Parameters
stencilOpOne of the stencil operations.

◆ SetStencilMask()

void Draw.SetStencilMask ( integer mask)

Sets the mask used for all stencil tests.

Parameters
maskThe stencil mask. This value is clamped by the stencil buffer's bit depth.

◆ SetStencilPassOperation()

void Draw.SetStencilPassOperation ( StencilTest stencilOp)

Sets the stencil operation for when the stencil test passes.

Parameters
stencilOpOne of the stencil operation.

◆ SetStencilTestFunction()

void Draw.SetStencilTestFunction ( StencilTest stencilTest)

Sets the current stencil test function.

Parameters
stencilTestOne of the stencil test functions.

◆ SetStencilValue()

void Draw.SetStencilValue ( integer value)

Sets the stencil value.

Parameters
valueThe stencil value. This value is clamped by the stencil buffer's bit depth.

◆ SetTextAdvance()

void Draw.SetTextAdvance ( number ascent)

Sets the character spacing multiplier. The initial value is 1.0.

This does not affect text drawn using a Font.

Parameters
ascentMultiplier for character spacing.

◆ SetTextAlign()

void Draw.SetTextAlign ( integer baseline)

Sets the text drawing horizontal alignment. The initial value is left.

This does not affect text drawn using a Font.

Parameters
baseline0 for left, 1 for center, 2 for right.

◆ SetTextBaseline()

void Draw.SetTextBaseline ( integer baseline)

Sets the text drawing vertical alignment. The initial value is top.

This does not affect text drawn using a Font.

Parameters
baseline0 for top, 1 for baseline, 2 for bottom.

◆ SetTextLineAscent()

void Draw.SetTextLineAscent ( number ascent)

Sets the line height multiplier. The initial value is 1.25.

This does not affect text drawn using a Font.

Parameters
ascentMultiplier for line height.

◆ SetTextureBlend()

void Draw.SetTextureBlend ( boolean doBlend)

Sets whether to use color and alpha blending on sprites, images, and textures.

Parameters
doBlendWhether to use blending.

◆ SetTextureTarget()

void Draw.SetTextureTarget ( integer texture)

Sets the current render target.

Parameters
textureThe texture target.

◆ SetTintColor()

void Draw.SetTintColor ( integer hex,
number amount )

Sets the color to be used for tinting.

Parameters
hexHexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
amountTint amount, from 0.0 to 1.0.

◆ SetTintMode()

void Draw.SetTintMode ( TintMode tintMode)

Sets the tint mode used for drawing.

Parameters
tintModeThe desired tint mode.

◆ SetVerticalDotMask()

void Draw.SetVerticalDotMask ( integer mask)

Sets the vertical dot mask.

Parameters
maskThe mask.

◆ SetVerticalDotMaskOffset()

void Draw.SetVerticalDotMaskOffset ( integer offsetV)

Sets the offset of the vertical dot mask.

Parameters
offsetVThe offset.

◆ Sprite()

void Draw.Sprite ( integer sprite,
integer animation,
integer frame,
number x,
number y,
integer flipX,
integer flipY,
number scaleX,
number scaleY,
number rotation,
boolean useInteger,
integer paletteID )

Draws a sprite.

Parameters
spriteIndex of the loaded sprite.
animationIndex of the animation entry.
frameIndex of the frame in the animation entry.
xX position of where to draw the sprite.
yY position of where to draw the sprite.
flipXWhether to flip the sprite horizontally.
flipYWhether to flip the sprite vertically.
scaleXScale multiplier of the sprite horizontally.
scaleYScale multiplier of the sprite vertically.
rotationRotation of the drawn sprite in radians, or in integer if useInteger is true.
useIntegerWhether the rotation argument is already in radians.
paletteIDWhich palette index to use.

◆ SpriteBasic()

void Draw.SpriteBasic ( Entity entity,
number x,
number y )

Draws a sprite based on an entity's current values (Sprite, CurrentAnimation, CurrentFrame, X, Y, Direction, ScaleX, ScaleY, Rotation).

Parameters
entityThe entity to draw.
xX position of where to draw the sprite, otherwise uses the entity's X value.
yY position of where to draw the sprite, otherwise uses the entity's Y value.

◆ SpritePart()

void Draw.SpritePart ( integer sprite,
integer animation,
integer frame,
number x,
number y,
integer partX,
integer partY,
integer partW,
integer partH,
integer flipX,
integer flipY,
number scaleX,
number scaleY,
number rotation,
number useInteger,
integer paletteID )

Draws part of a sprite.

Parameters
spriteIndex of the loaded sprite.
animationIndex of the animation entry.
frameIndex of the frame in the animation entry.
xX position of where to draw the sprite.
yY position of where to draw the sprite.
partXX coordinate of part of frame to draw.
partYY coordinate of part of frame to draw.
partWWidth of part of frame to draw.
partHHeight of part of frame to draw.
flipXWhether to flip the sprite horizontally.
flipYWhether to flip the sprite vertically.
scaleXScale multiplier of the sprite horizontally.
scaleYScale multiplier of the sprite vertically.
rotationRotation of the drawn sprite in radians, or in integer if useInteger is true.
useIntegerWhether the rotation argument is already in radians.
paletteIDWhich palette index to use.

◆ Text()

void Draw.Text ( Font font,
string text,
number x,
number y,
number fontSize,
integer paletteID )

Draws UTF-8 text using a font.

Parameters
fontThe Font to be used as text.
textText to draw.
xX position of where to draw the text.
yY position of where to draw the text.
fontSizeThe size of the font. If this argument is not given, this uses the pixels per unit value that the font was configured with.
paletteIDWhich palette index to use.

◆ TextArray()

void Draw.TextArray ( integer sprite,
integer animation,
number x,
number y,
array string,
integer startFrame,
integer endFrame,
integer align,
integer spacing,
array charOffsetsX,
array charOffsetsY,
integer paletteID )

Draws a series of sprites based on a converted sprite string.

Parameters
spriteThe index of the loaded sprite to be used as text.
animationThe animation index.
xThe X value to begin drawing.
yThe Y value to begin drawing.
stringThe array containing frame indexes.
startFrameThe index to begin drawing.
endFrameThe index to end drawing.
alignThe text alignment.
spacingThe space between drawn sprites.
charOffsetsXThe X offsets at which to draw per frame. Must also have charOffsetsY to be used.
charOffsetsYThe Y offsets at which to draw per frame.
paletteIDWhich palette index to use.

◆ TextEllipsis()

void Draw.TextEllipsis ( Font font,
string text,
number x,
number y,
number maxWidth,
integer maxLines,
number fontSize,
integer paletteID )

Draws UTF-8 text using a font, but adds ellipsis if the text doesn't fit in maxWidth.

Parameters
fontThe Font to be used as text.
textText to draw.
xX position of where to draw the text.
yY position of where to draw the text.
maxWidthMax width the text can draw in.
maxLinesMax lines of text to draw. Use null to draw all lines.
fontSizeThe size of the font. If this argument is not given, this uses the pixels per unit value that the font was configured with.
paletteIDWhich palette index to use.

◆ Texture()

void Draw.Texture ( integer texture,
number x,
number y )

Draws a texture.

Parameters
textureTexture index.
xX position of where to draw the texture.
yY position of where to draw the texture.

◆ TexturePart()

void Draw.TexturePart ( integer texture,
integer partX,
integer partY,
integer partW,
integer partH,
number x,
number y )

Draws part of a texture.

Parameters
textureTexture index.
partXX coordinate of part of texture to draw.
partYY coordinate of part of texture to draw.
partWWidth of part of texture to draw.
partHHeight of part of texture to draw.
xX position of where to draw the texture.
yY position of where to draw the texture.

◆ TextureSized()

void Draw.TextureSized ( integer texture,
number x,
number y,
number width,
number height )

Draws a texture, but sized.

Parameters
textureTexture index.
xX position of where to draw the texture.
yY position of where to draw the texture.
widthWidth to draw the texture.
heightHeight to draw the texture.

◆ TextWrapped()

void Draw.TextWrapped ( Font font,
string text,
number x,
number y,
number maxWidth,
integer maxLines,
number fontSize,
integer paletteID )

Draws wrapped UTF-8 text using a font.

Parameters
fontThe Font to be used as text.
textText to draw.
xX position of where to draw the text.
yY position of where to draw the text.
maxWidthMax width the text can draw in.
maxLinesMax lines of text to draw. Use null to draw all lines.
fontSizeThe size of the font. If this argument is not given, this uses the pixels per unit value that the font was configured with.
paletteIDWhich palette index to use.

◆ Tile()

void Draw.Tile ( integer ID,
number x,
number y,
integer flipX,
integer flipY,
number scaleX,
number scaleY,
number rotation,
integer paletteID )

Draws a tile.

Parameters
IDID of the tile to draw.
xX position of where to draw the tile.
yY position of where to draw the tile.
flipXWhether to flip the tile horizontally.
flipYWhether to flip the tile vertically.
scaleXHorizontal scale multiplier of the tile.
scaleYVertical scale multiplier of the tile.
rotationRotation of the drawn tile in radians.
paletteIDWhich palette index to use.

◆ Translate()

void Draw.Translate ( number x,
number y,
number z = 0.0 )

Translates the view.

Parameters
xDesired X translation.
yDesired Y translation.
zDesired Z translation.

◆ Triangle()

void Draw.Triangle ( number x1,
number y1,
number x2,
number y2,
number x3,
number y3 )

Draws a triangle.

Parameters
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.

◆ TriangleBlend()

void Draw.TriangleBlend ( number x1,
number y1,
number x2,
number y2,
number x3,
number y3,
integer color1,
integer color2,
integer color3 )

Draws a triangle, blending the colors at the vertices. (Colors are multiplied by the global Draw Blend Color, do Draw.SetBlendColor`(0xFFFFFF, 1.0)` if you want the vertex colors unaffected.).

Parameters
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.
color1Color of the first vertex.
color2Color of the second vertex.
color3Color of the third vertex.

◆ TriangleStroke()

void Draw.TriangleStroke ( number x1,
number y1,
number x2,
number y2,
number x3,
number y3 )

Draws a triangle outline.

Parameters
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.

◆ TriangleTextured()

void Draw.TriangleTextured ( integer image,
number x1,
number y1,
number x2,
number y2,
number x3,
number y3,
integer color1,
integer color2,
integer color3,
number u1,
number v1,
number u2,
number v2,
number u3,
number v3 )

Draws a textured triangle.

Parameters
imageImage to draw triangle with.
x1X position of the first vertex.
y1Y position of the first vertex.
x2X position of the second vertex.
y2Y position of the second vertex.
x3X position of the third vertex.
y3Y position of the third vertex.
color1Color of the first vertex.
color2Color of the second vertex.
color3Color of the third vertex.
u1Texture U of the first vertex.
v1Texture V of the first vertex.
u2Texture U of the second vertex.
v2Texture V of the second vertex.
u3Texture U of the third vertex.
v3Texture V of the third vertex.

◆ UseDepthTesting()

void Draw.UseDepthTesting ( boolean useDepthTesting)

Sets whether to do depth tests when drawing.

Parameters
useDepthTestingWhether to do depth tests when drawing.

◆ UseFillSmoothing()

void Draw.UseFillSmoothing ( boolean smoothFill)

Sets whether to use smoothing when drawing filled shapes. (hardware-renderer only).

Parameters
smoothFillWhether to use smoothing.

◆ UseSpriteDeform()

void Draw.UseSpriteDeform ( boolean useDeform)

Sets whether to use sprite deform when drawing.

Parameters
useDeformWhether to use sprite deform when drawing.

◆ UseStencil()

void Draw.UseStencil ( boolean enabled)

Enables or disables stencil operations.

Parameters
enabledWhether to enable or disable stencil operations.

◆ UseStrokeSmoothing()

void Draw.UseStrokeSmoothing ( boolean smoothStroke)

Sets whether to use smoothing when drawing un-filled shapes. (hardware-renderer only).

Parameters
smoothStrokeWhether to use smoothing.

◆ UseTinting()

void Draw.UseTinting ( boolean useTinting)

Sets whether to use color tinting when drawing.

Parameters
useTintingWhether to use color tinting when drawing.

◆ View()

void Draw.View ( integer viewIndex,
number x,
number y )

Draws a view.

Parameters
viewIndexIndex of the view.
xX position of where to draw the view.
yY position of where to draw the view.

◆ ViewPart()

void Draw.ViewPart ( integer viewIndex,
number x,
number y,
integer partX,
integer partY,
integer partW,
integer partH )

Draws part of a view.

Parameters
viewIndexIndex of the view.
xX position of where to draw the view.
yY position of where to draw the view.
partXX coordinate of part of view to draw.
partYY coordinate of part of view to draw.
partWWidth of part of view to draw.
partHHeight of part of view to draw.

◆ ViewPartSized()

void Draw.ViewPartSized ( integer viewIndex,
number x,
number y,
integer partX,
integer partY,
integer partW,
integer partH,
number width,
number height )

Draws part of a view, but sized.

Parameters
viewIndexIndex of the view.
xX position of where to draw the view.
yY position of where to draw the view.
partXX coordinate of part of view to draw.
partYY coordinate of part of view to draw.
partWWidth of part of view to draw.
partHHeight of part of view to draw.
widthWidth to draw the view.
heightHeight to draw the view.

◆ ViewSized()

void Draw.ViewSized ( integer viewIndex,
number x,
number y,
number width,
number height )

Draws a view, but sized.

Parameters
viewIndexIndex of the view.
xX position of where to draw the view.
yY position of where to draw the view.
widthWidth to draw the view.
heightHeight to draw the view.