Posted 21 July 2016 - 06:26 AM
Okay, more of a grid drawing function, but it works pretty well.
In my program PAIN, it draws a grid which helps indicate where you are on the canvas. So I decided, why not upload the part of PAIN that draws the grid as an easy-to-use API?
vBhrJPw3
HOW TO USE:
This API draws a custom grid between two sets of coordinates. That's it.
Here's a basic use of it.
Here's a test program I cobbled together to demonstrate it.
In my program PAIN, it draws a grid which helps indicate where you are on the canvas. So I decided, why not upload the part of PAIN that draws the grid as an easy-to-use API?
vBhrJPw3
HOW TO USE:
Spoiler
There's a basic how-to in the API file, but I'll put something here as well.This API draws a custom grid between two sets of coordinates. That's it.
Here's a basic use of it.
os.loadAPI("grid") --that is the name of the API
local x1, y1 = 3,2 --This is the top-left coordinates.
local x2, y2 = 12,10 --This is the bottom-right coordinates.
local g = { --This is the grid that will be drawn
"+---",
"|...",
"|...",
}
local xscroll, yscroll = 0, 0 --These translate the grid.
grid.drawGrid(x1, y1, x2, y2, g) --This will draw grid 'g' at (3,2) --> (12,10)
Here's a test program I cobbled together to demonstrate it.
pastebin get FfSi0fd9 test
Make sure to have the grid API in the root directory ("/") and name it "grid".Edited on 21 July 2016 - 04:27 AM