These functions can be used inside a drawing or animation handler to draw primitive shapes such as lines and rectangles, or resources such as sprites and images.

The screen coordinates range from 0 to 639, across the screen from left-to-right, and from 0 to 479 top-to-bottom.

These functions draw pixels, primitive shapes, and resources like sprites and images. Some of these functions check the current values of the drawing properties to decide which colors, fonts, or styles to use, so you may have to set these properties before calling a function to get the desired results.

More advanced primitive drawing functions are provided as part of the Vertex Buffer system.

Properties


Functions




property DrawingColor = COLOR_WHITE

The color used by shape and sprite drawing functions.




property DrawingTransparencyMode = TRANSPARENCY_ALPHA

Transparency mode used by sprite drawing functions.

See Also...




property DrawingScale = 1000

Scale level used by sprite drawing functions.

See Also...




property DrawingPriority = -1

Priority at which to draw sprites drawn with sprite drawing functions.

See Also...




property DrawingJustify = 0

Justification used by text drawing functions.

Notes

The constants LEFT_JUST, CENTER_JUST, and RIGHT_JUST are defined in the standard script file "Constants.s".




property DrawingFont = none

Font that is used by text drawing functions.




property DrawingTextColor = WHITE

Color that is used by text drawing functions.




property DrawingAbsolute = true

Determines whether the drawing functions use absolute or relative coordinates.




function ScreenWidth

Returns the width of the screen, in pixels.




function ScreenHeight

Returns the height of the screen, in pixels.




function DrawPixel (ScreenX, ScreenY)

Sets a pixel to drawColor.

Parameters

ScreenX X coordinate.

ScreenY Ycoordinate.




function GetPixel (ScreenX, ScreenY)

Get the color value of a pixel.

Parameters

ScreenX X coordinate.

ScreenY Y coordinate.




function DrawSprite (ScreenX, ScreenY, Sprite, Frame)

Draws a frame of a sprite at the given coordinates.

Parameters

ScreenX X coordinate.

ScreenY Y coordinate.

Sprite Sprite resource index.

Frame Sprite frame index.




function DrawImage (ScreenX, ScreenY, Sprite)

Draws an image, or frame 0 of a sprite, at the specified location.

Parameters

ScreenX X coordinate.

ScreenY Y coordinate.

Sprite Sprite resource index.
Notes

This script can be found in the standard file Draw.s.

See Also...




function DrawLine (PointAX, PointAY, PointBX, PointBY)

Draws a line between points A and B on the screen.

Parameters

PointAX X coordinate of first point.

PointAY Y coordinate of first point.

PointBX X coordinate of second point.

PointBY Y coordinate of second point.
Notes

This script can be found in the standard file Draw.s.




function DrawHorizontalLine (PointAX, PointsCommonY, PointBX)

Draws a horizontal line between two points.

Parameters

PointAX X coordinate of first point.

PointsCommonY Y coordinate of both points.

PointBX X coordinate of first point.
Notes

This script can be found in the standard file Draw.s.




function DrawVerticalLine (PointsCommonX, PointAY, PointBY)

Draws a vertical line between two points.

Parameters

PointsCommonX X coordinate of both points.

PointAY Y coordinate of first point.

PointBY Y coordinate of second point.
Notes

This script can be found in the standard file Draw.s.




function DrawRectangle (Left, Top, Right, Bottom)

Draws a rectangle given any two opposite corners. The rectangle is filled with the current DrawingColor.

Parameters

Left Left boundary of rectangle.

Top Top boundary of rectangle.

Right Right boundary of rectangle.

Bottom Bottom boundary of rectangle.
Notes

This script will reset the vertex buffer.

This script can be found in the standard file Draw.s.




function DrawCircleOutline (x1, y1, radius)

Draws the outline of a circle.

Parameters

x1 Center X coordinate.

y1 Center Y coordinate.

radius Radius of the circle.
Notes

This script can be found in the standard file Draw.s.




function DrawCircle (x1, y1, radius, color)

Draws a filled circle.

Parameters

x1 Center X coordinate.

y1 Center Y coordinate.

radius Radius of the circle.

color Color
Notes

This script can be found in the standard file Draw.s.




function DrawText (BaseX, BaseY, String)

Draws a string beginning at the given position.

Parameters

BaseX Absolute base x-position.

BaseY Absolute base y-position of the first character in the first line.

String Index of string to draw.




function WrapText (String, Width)

Prepares to draw a string with line wrapping. The string can then be drawn using the DrawWrappedText function.

Parameters

String Index of string to wrap.

Width Width in pixels to wrap the string.
Returns

Final height of wrapped text.




function DrawWrappedText (BaseX, BaseY)

Draws the string that was last wrapped with the wrapText function.

Parameters

BaseX Absolute base x-position.

BaseY Absolute base y-position of the first character in the first line.