Available since LÖVE 0.10.0
It has replaced love.graphics.point.
Draws one or more points.
love.graphics.points( x, y, ... )
number xnumber ynumber ...Nothing.
love.graphics.points( points )
table points{x, y, ...}.
Nothing.
Draws one or more individually colored points.
love.graphics.points( points )
table points{point, ...}.
Nothing.
The global color set by love.graphics.setColor is modulated (multiplied) with the per-point colors.
The pixel grid is actually offset to the center of each pixel. So to get clean pixels drawn use 0.5 + integer increments.
Points are not affected by love.graphics.scale - their size is always in pixels.
Render a starfield
function love.load()
local screen_width, screen_height = love.graphics.getDimensions()
local max_stars = 100 -- how many stars we want
stars = {} -- table which will hold our stars
for i=1, max_stars do -- generate the coords of our stars
local x = love.math.random(5, screen_width-5) -- generate a "random" number for the x coord of this star
local y = love.math.random(5, screen_height-5) -- both coords are limited to the screen size, minus 5 pixels of padding
stars[i] = {x, y} -- stick the values into the table
end
end
function love.draw()
love.graphics.points(stars) -- draw all stars as points
end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.points