(→Examples: syntax highlighting) |
m (→See also: formatting) |
||
Line 38: | Line 38: | ||
* [[Graphics]] |
* [[Graphics]] |
||
* [[DrawState|Draw state]] |
* [[DrawState|Draw state]] |
||
− | * [[Pget|pget]] |
+ | * [[Pget|<code>pget()</code>]] |
[[Category:Reference]] |
[[Category:Reference]] |
||
[[Category:API]] |
[[Category:API]] |
Revision as of 12:02, 15 June 2018
pset( x, y, [c] )
- Sets a pixel in the graphics buffer.
- x
-
- The x coordinate.
- y
-
- The y coordinate.
- c
-
- The color value. If not specified, uses the current color of the draw state.
The pset()
function sets a pixel in the graphics buffer.
This operation is affected by the draw state.
Examples
pset(10, 10, 7) -- sets (10, 10) to white
print(pget(10, 10), 0, 96, 7) -- prints 7
pset(10, 10, 8) -- sets (10, 10) to red
print(pget(10, 10), 0, 104, 7) -- prints 8
Repeatedly fill the screen with randomly colored pixels:
function _update()
-- _update() is required for game loop
end
function _draw()
for x=0,127 do
for y=0,127 do
pset(x, y, rnd(16))
end
end
end