Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Graphics API demo program
- os.loadAPI("GraphicsAPI")
- GraphicsAPI.drawLine( {1,5}, GraphicsAPI.packXY(8, 3), colors.lime ) -- Draw a green line from (1,5) to (8,2).
- GraphicsAPI.drawLine( {1,2}, GraphicsAPI.packXY(8, 5), colors.blue ) -- Draw a blue line from (1,2) to (8,5).
- -- This 2nd line will appear to be on top of the green line.
- -- Points are written as: { x, y }
- GraphicsAPI.drawCircle( {28,14}, 4, colors.yellow ) -- Draw a circle that is 4 characters wide centered around (28,14).
- -- Used as so: GraphicsAPI.drawCircle( midpoint, radius, color )
- GraphicsAPI.floodFill( {28,14}, colors.white ) -- Flood-fill in the yellow circle with white.
- GraphicsAPI.drawCircle( {28,14}, 4, {colors.black, "X"} ) -- Now, overlay that same circle with black X's.
- -- To write characters to screen, use a table like { color, character } in place of any color argument.
- GraphicsAPI.floodFill( {28,14}, {colors.lightBlue, "O"} ) -- Do the same to the filling, but with light blue O's instead.
- GraphicsAPI.drawRect( {9, 3}, {24, 6}, colors.purple ) -- Draw a purple, non-filled in box with the corners at (2,3) and (5,6).
- GraphicsAPI.drawRect( {26, 3}, {46, 6}, colors.white, true ) -- Draw a white, filled in box with the corners at (2,3) and (5,6).
- GraphicsAPI.writeText( "Graphics API Demo", {3, 16}, colors.lightBlue ) -- Write the words "Graphics API Demo" in light blue starting from the point (3,16)
- GraphicsAPI.writeText( "Made By KillaVanilla", {20, 14}, colors.lightGray ) -- Write the words "Made By KillaVanilla" in light grey starting from the point {15, 14}
- -- This will intersect the circle.
- GraphicsAPI.drawPoint(12, 12, colors.red) -- Draw a red dot at (12, 12)
- GraphicsAPI.update() -- Now draw all this to screen.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement