Difference between revisions of "Lua API:Graphics"

From The Powder Toy
Jump to: navigation, search
m (Handle Constants better)
m (Work? Nah.)
Line 1: Line 1:
Description goes here.
+
Various methods that allow lua to draw on the simulation screen.
  
 
== Methods ==
 
== Methods ==
  
 
=== graphics.drawLine ===
 
=== graphics.drawLine ===
  graphics.drawLine()
+
nil graphics.drawLine(number x1, number y1, number x2, number y2, [number r, number g, number b, [number a]])
 
+
Draws a line from (x1,y1) to (x2,y2) using either the color specified or white.
  
 
=== graphics.drawRect ===
 
=== graphics.drawRect ===
  graphics.drawRect()
+
nil graphics.drawRect(number x, number y, number width, number height, [number r, number g, number b, [number a]])
 
+
Draws a hollow rectangle at (x,y) with width and height using either the color specified or white.
  
 
=== graphics.drawCircle ===
 
=== graphics.drawCircle ===
  graphics.drawCircle()
+
nil graphics.drawCircle(number x, number y, number radiusW, number radiusH , [number r, number g, number b, [number a]])
 
+
Draws a hollow circle at (x,y) with radius of (radiusW,radiusH) using either the color specified or white.
  
 
=== graphics.fillCircle ===
 
=== graphics.fillCircle ===
  graphics.fillCircle()
+
nil graphics.fillCircle(number x, number y, number radiusW, number radiusH , [number r, number g, number b, [number a]])
 
+
Draws a filled circle at (x,y) with radius of (radiusW,radiusH) using either the color specified or white.
  
 
=== graphics.fillRect ===
 
=== graphics.fillRect ===
  graphics.fillRect()
+
nil graphics.fillRect(number x, number y, number width, number height, [number r, number g, number b, [number a]])
 
+
Draws a filled rectangle at (x,y) with width and height using either the color specified or white.
  
 
=== graphics.textSize ===
 
=== graphics.textSize ===
  graphics.textSize()
+
number, number graphics.textSize(string text)
 
+
Returns the width and height of the specified text.
  
 
=== graphics.drawText ===
 
=== graphics.drawText ===
  graphics.drawText()
+
nil graphics.drawText(number x, number y, string text, [number r, number g, number b, [number a]])
 
+
Draws the text specified at (x,y) using either the color specified or white.
  
 
== Constants ==
 
== Constants ==

Revision as of 22:21, 27 October 2013

Various methods that allow lua to draw on the simulation screen.

Methods

graphics.drawLine

nil graphics.drawLine(number x1, number y1, number x2, number y2, [number r, number g, number b, [number a]])

Draws a line from (x1,y1) to (x2,y2) using either the color specified or white.

graphics.drawRect

nil graphics.drawRect(number x, number y, number width, number height, [number r, number g, number b, [number a]])

Draws a hollow rectangle at (x,y) with width and height using either the color specified or white.

graphics.drawCircle

nil graphics.drawCircle(number x, number y, number radiusW, number radiusH , [number r, number g, number b, [number a]])

Draws a hollow circle at (x,y) with radius of (radiusW,radiusH) using either the color specified or white.

graphics.fillCircle

nil graphics.fillCircle(number x, number y, number radiusW, number radiusH , [number r, number g, number b, [number a]])

Draws a filled circle at (x,y) with radius of (radiusW,radiusH) using either the color specified or white.

graphics.fillRect

nil graphics.fillRect(number x, number y, number width, number height, [number r, number g, number b, [number a]])

Draws a filled rectangle at (x,y) with width and height using either the color specified or white.

graphics.textSize

number, number graphics.textSize(string text)

Returns the width and height of the specified text.

graphics.drawText

nil graphics.drawText(number x, number y, string text, [number r, number g, number b, [number a]])

Draws the text specified at (x,y) using either the color specified or white.

Constants

Any of these constants can be accessed with graphics.<constant name here>

Uncatergorized

WIDTH
HEIGHT