FANDOM


Draw Unlock
This library originated from Touch Lua and scripts using it will only work correctly in Touch Lua.

Draw is a premium Touch Lua library introduced in the 1.1 update that costs $4.99 to unlock. It allows users to draw on a special drawing panel called the "Graphics screen". It also allows use of the gyroscope and allows tracking the touch screen.

Library functionsEdit

Function name Arguments Returns Description Origin
draw.setscreen number screen nil Changes the current screen. Use 1 to switch to the Graphics screen. Use 0 to switch to the Output screen. Touch Lua 1.1
draw.getsize None numbers width, height Returns the fixed size of the screen. Touch Lua 1.1
draw.getport None numbers width, height Returns the size of the current screen orientation. Touch Lua 1.1
draw.settitle string text None Changes the graphics screen title to the string given. Touch Lua 1.1
draw.beginframe None None Starts a drawing buffer. All drawing functions called after draw.beginframe has been called will only be drawn to the screen after draw.endframe has been called. Touch Lua 1.1
draw.endframe None None All drawing functions called after draw.beginframe has been called will drawn to the screen at once. Allows graphical applications to run faster. Touch Lua 1.1
draw.clear optional color table color None Clears the Graphics screen, using the color white or the color given. Touch Lua 1.1
draw.moveto numbers x, y, color table color None Moves the current point on the Graphics screen to the coordinates x, y. Touch Lua 1.1
draw.point numbers x, y, color table color None Draws a point onto the Graphics screen. Touch Lua 1.1
draw.line numbers x1, y1,x2,y2, color table color None Draws a line onto the Graphics screen. Touch Lua 1.1
draw.lineto numbers x,y, color table color None Draws a line from the current point to the given coordinates onto the Graphics screen. Touch Lua 1.1
draw.string string string, numbers xleft, ytop, color table color None Draws a string onto the Graphics screen. Touch Lua 1.1
draw.stringsize string text numbers width, height Calculates the width and height the text given would be drawn using draw.string. Useful if you need to recognize the current font size, for example. Touch Lua 1.1.1
draw.stringinrect string text, numbers x1, y1, x2, y2, color table color None Draws a string completely inside a rectangle on the Graphics screen. Touch Lua 1.1.1
draw.rect numbers x1, y1, x2, y2, color table color None Draws a rectangle outline on the Graphics screen. Touch Lua 1.1
draw.fillrect numbers x1, y1, x2, y2, color table color nil Draws a filled rectangle on the Graphics screen. Touch Lua 1.1
draw.circle numbers xc, yc, radius, color table color nil Draws a circle outline on the Graphics screen. Touch Lua 1.1
draw.fillcircle numbers xc, yc, radius, color table color nil Draws a filled circle on the Graphics screen. Touch Lua 1.1
draw.arc numbers xc, yc, radius, s, e, rotation, color table color nil Draws an arc outline on the Graphics screen. Touch Lua 1.1
draw.fillarc numbers xc, yc, radius, s, e, rotation, color table color nil Draws a filled arc on the Graphics screen. Touch Lua 1.1
draw.ellipse numbers x1, y1, x2, y2, color table color nil Draws an ellipse outline on the Graphics screen. Touch Lua 1.1
draw.fillellipse numbers x1, y1, x2, y2, color table color nil Draws a filled ellipse on the Graphics screen. Touch Lua 1.1
draw.polygon numbers xc, yc, radius, sides, rotation, color table color nil Draws a polygon outline on the Graphics screen. Touch Lua 1.1
draw.fillpolygon numbers xc, yc, radius, sides, rotation, color table color nil Draws a filled polygon on the Graphics screen. Touch Lua 1.1
draw.star numbers xc, yc, ir, or, v, rotation, color table color nil Draws a star outline on the Graphics screen. Touch Lua 1.1
draw.fillstar numbers xc, yc, ir, or, v, rotation, color table color nil Draws a filled star on the Graphics screen. Touch Lua 1.1
draw.triangle numbers x1, y1, x2, y2, x3, y3, color table color nil Draws a triangle outline on the Graphics screen. Useful for 3D graphs. Touch Lua 1.1
draw.filltriangle numbers x1, y1, x2, y2, x3, y3, color table color nil Draws a filled triangle on the Graphics screen. Useful for 3D graphics. Touch Lua 1.1
draw.roundedrect numbers x1, y1, x2, y2, radius, color table color nil Draws a rounded rectangle outline on the Graphics screen. Touch Lua 1.1
draw.fillroundedrect numbers x1, y1, x2, y2, radius, color table color nil Draws a filled rounded rectangle on the Graphics screen. Touch Lua 1.1
draw.setfont string name, number size nil Changes the drawn text font and size. Touch Lua 1.1
draw.setlinestyle number width, string style nil Changes the drawn line width and style. Touch Lua 1.1
draw.setantialias boolean flag nil Changes the anti-alias. Touch Lua 1.1
draw.getantialias None boolean flag Returns the set anti-alias. Touch Lua 1.1
draw.enablerefresh None None Enables automatic refreshing of the screen. Touch Lua 1.1
draw.disablerefresh None None disables automatic refreshing of the screen. Touch Lua 1.1
draw.waittouch None numbers xpos, ypos Waits until user taps on the screen and returns the position on the screen that the user tapped on. Useful for menus. Touch Lua 1.1
draw.tracktouches functions start, hold, end nil Register touch handling functions for use with draw.doevents. Useful for games and interactive applications. Touch Lua 1.1.3
draw.doevents None nil Does the touch events set with draw.tracktouches. Touch Lua 1.1.3
draw.clearevents None None Resets the touch events set with draw.tracktouches. Touch Lua 1.1.3
draw.setclip numbers x1, y1, x2, y2 nil Force draw clipping to the zone given, causing drawn items to the screen to get cut off. Touch Lua 1.3.1
draw.clearclip None None Resets the draw clipping, restoring the ability to draw anywhere on the screen without getting cut off. Touch Lua 1.3.1
draw.cacheimage string location numbers xs, ys Loads an image into RAM allowing that image to be drawn faster in the feature. It is also used to determine the size of an image. Touch Lua 1.3.1
draw.image string location, numbers x1, y1 nil Draws a saved image to the screen. Touch Lua 1.3.1
draw.tiledimage string location, numbers x1, y1, x2, y2 nil Draws a saved image to the screen. It is tiled to fill the region given. Touch Lua 1.3.1
draw.transformedimage string location, numbers x, y, size, rotation None Draw an image to the screen. The image drawn is scaled and rotated according to the variables given. Touch Lua 1.3.1
draw.imagesave string location, numbers x1, y1, x2, y2 boolean success Saves the image in the given zone to the hard drive. Touch Lua 1.3.1
draw.setclearcolor color table color None Sets the transparent color used for backgrounds, and also clears the screen with the color. It is used for transparent backgrounds when creating images. Touch Lua 1.3.1
draw.clearscreen None None This function clears the screen to be transparent. The transparent color will be used to represent transparent backgrounds when creating images. Touch Lua 1.3.1
draw.clearrect numbers x1, y1, x2, y2 None This function sets a region of the screen to be the transparent color. The transparent color will be used to represent transparent backgrounds when creating images. Touch Lua 1.3.1


ColorsEdit

The draw library also includes fourteen default colors for use with the draw library functions. The same colors and color system is included with the Turtle library.

List of colors and their RGB valuesEdit

All of these colors have full alpha values.

  • draw.cyan (0, 255, 255)
  • draw.purple (127, 0, 127)
  • draw.lightgray (170, 170, 170)
  • draw.orange (255, 127, 0)
  • draw.white (255, 255, 255)
  • draw.magenta (255, 0, 255)
  • draw.green (0, 255, 0)
  • draw.gray (127, 127, 127)
  • draw.red (255, 0, 0)
  • draw.darkgray (85, 85, 85)
  • draw.brown (153, 102, 51)
  • draw.yellow (255, 255, 0)
  • draw.blue (0, 0, 255)
  • draw.black (0, 0, 0)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.