-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from britzl/master
Added drawpixels.line()
- Loading branch information
Showing
2 changed files
with
152 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ Open your game.project file and in the dependencies field under project add: | |
|
||
Main code example is [here](https://github.com/AGulev/drawpixels/blob/master/example/canvas.script) | ||
|
||
## LUA Api | ||
## Lua API | ||
First of all you need to create a table with a buffer information that contain next fields: | ||
|
||
`buffer` - buffer | ||
|
@@ -61,6 +61,7 @@ Method for drawing circle: | |
`blue` - blue channel of the color 0..255 | ||
|
||
`alpha` - alpha channel 0..255. Optional parameter for rgba textures | ||
|
||
#### drawpixels.filled_circle(buffer_info, pos_x, pos_y, diameter, red, green, blue, alpha) | ||
Method for drawing filled circle: | ||
|
||
|
@@ -79,6 +80,7 @@ Method for drawing filled circle: | |
`blue` - blue channel of the color 0..255 | ||
|
||
`alpha` - alpha channel 0..255. Optional parameter for rgba textures | ||
|
||
#### drawpixels.rect(buffer_info, pos_x, pos_y, rect_width, rect_height, red, green, blue, alpha) | ||
Method for drawing rectangle: | ||
|
||
|
@@ -99,6 +101,7 @@ Method for drawing rectangle: | |
`blue` - blue channel of the color 0..255 | ||
|
||
`alpha` - alpha channel 0..255. Optional parameter for rgba textures | ||
|
||
#### drawpixels.filled_rect(buffer_info, pos_x, pos_y, rect_width, rect_height, red, green, blue, alpha, angle) | ||
Method for drawing filled rectangle: | ||
|
||
|
@@ -121,6 +124,7 @@ Method for drawing filled rectangle: | |
`alpha` - alpha channel 0..255. Optional parameter for rgba textures | ||
|
||
`angle` - rotation angle in degrees. Optional. | ||
|
||
#### drawpixels.fill(buffer_info, red, green, blue, alpha) | ||
Fill buffer with the color: | ||
|
||
|
@@ -134,6 +138,27 @@ Fill buffer with the color: | |
|
||
`alpha` - alpha channel 0..255. Optional parameter for rgba textures | ||
|
||
#### drawpixels.line(buffer_info, x0, y0, x1, y1, red, green, blue, alpha) | ||
Draw a line between two points: | ||
|
||
`buffer_info` - buffer information | ||
|
||
`x0` - x position of one end of the line | ||
|
||
`y0` - y position of one end of the line | ||
|
||
`x1` - x position of the other end of the line | ||
|
||
`y1` - y position of the other end of the line | ||
|
||
`red` - red channel of the color 0..255 | ||
|
||
`green` - green channel of the color 0..255 | ||
|
||
`blue` - blue channel of the color 0..255 | ||
|
||
`alpha` - alpha channel 0..255. Optional parameter for rgba textures | ||
|
||
-------- | ||
|
||
If you have any questions or suggestions contact me: [email protected] |
Oops, something went wrong.