Difference between revisions of "Lua API:Graphics"
m (Add to Lua) |
(fix ordering and constants) |
||
Line 2: | Line 2: | ||
== Methods == | == Methods == | ||
+ | |||
+ | === graphics.textSize === | ||
+ | number, number graphics.textSize(string text) | ||
+ | Returns the width and height of the specified text. | ||
+ | |||
+ | === graphics.drawText === | ||
+ | graphics.drawText(number x, number y, string text, [number r, number g, number b, [number a]]) | ||
+ | Draws the specified text at (x,y). Providing the color is optional, if not provided defaults to white. | ||
=== graphics.drawLine === | === graphics.drawLine === | ||
− | + | 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) | + | Draws a line from (x1,y1) to (x2,y2). Providing the color is optional, if not provided defaults to white. |
=== graphics.drawRect === | === graphics.drawRect === | ||
− | + | 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 | + | Draws a hollow rectangle at (x,y) with the specified width and height. Providing the color is optional, if not provided defaults to white. |
+ | |||
+ | === graphics.fillRect === | ||
+ | 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 the specified width and height. Providing the color is optional, if not provided defaults to white. | ||
=== graphics.drawCircle === | === graphics.drawCircle === | ||
− | + | 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) | + | Draws a hollow circle at (x,y) with radius of (radiusW,radiusH). Providing the color is optional, if not provided defaults to white. |
=== graphics.fillCircle === | === graphics.fillCircle === | ||
− | + | 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) | + | Draws a filled circle at (x,y) with radius of (radiusW,radiusH). Providing the color is optional, if not provided defaults to white. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Constants == | == Constants == | ||
− | + | ; graphics.WIDTH | |
− | + | The complete window width including side buttons, usually 629. | |
− | + | ; graphics.HEIGHT | |
− | ; | + | The complete window height including the bottom area, usually 424. |
− | |||
[[Category:Lua]] | [[Category:Lua]] |
Revision as of 01:30, 15 March 2014
Various methods that allow lua to draw on the simulation screen.
Contents
Methods
graphics.textSize
number, number graphics.textSize(string text)
Returns the width and height of the specified text.
graphics.drawText
graphics.drawText(number x, number y, string text, [number r, number g, number b, [number a]])
Draws the specified text at (x,y). Providing the color is optional, if not provided defaults to white.
graphics.drawLine
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). Providing the color is optional, if not provided defaults to white.
graphics.drawRect
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 the specified width and height. Providing the color is optional, if not provided defaults to white.
graphics.fillRect
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 the specified width and height. Providing the color is optional, if not provided defaults to white.
graphics.drawCircle
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). Providing the color is optional, if not provided defaults to white.
graphics.fillCircle
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). Providing the color is optional, if not provided defaults to white.
Constants
- graphics.WIDTH
The complete window width including side buttons, usually 629.
- graphics.HEIGHT
The complete window height including the bottom area, usually 424.