Difference between revisions of "love.graphics.points"
m |
|||
Line 34: | Line 34: | ||
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param|table|points|A table containing multiple individually colored points, in the form of <code>{ | + | {{param|table|points|A table containing multiple individually colored points, in the form of <code>{point, ...}</code>.}} |
{{subparam|table|point|A table containing the position and color of the first point, in the form of <code>{x, y, r, g, b, a}</code>. The color components are optional.}} | {{subparam|table|point|A table containing the position and color of the first point, in the form of <code>{x, y, r, g, b, a}</code>. The color components are optional.}} | ||
{{subparam|table|...|Additional tables containing the position and color of more points, in the form of <code>{x, y, r, g, b, a}</code>. The color components are optional.}} | {{subparam|table|...|Additional tables containing the position and color of more points, in the form of <code>{x, y, r, g, b, a}</code>. The color components are optional.}} |
Revision as of 17:50, 17 December 2015
Available since LÖVE 0.10.0 |
It has replaced love.graphics.point. |
Draws one or more points.
Contents
Function
Synopsis
love.graphics.points( x, y, ... )
Arguments
number x
- The position of the first point on the x-axis.
number y
- The position of the first point on the y-axis.
number ...
- The x and y coordinates of additional points.
Returns
Nothing.
Function
Synopsis
love.graphics.points( points )
Arguments
table points
- A table containing multiple point positions, in the form of
{x, y, ...}
.
Returns
Nothing.
Function
Draws one or more individually colored points.
Synopsis
love.graphics.points( points )
Arguments
table points
- A table containing multiple individually colored points, in the form of
{point, ...}
.
Returns
Nothing.
Notes
The global color set by love.graphics.setColor is modulated (multiplied) with the per-point colors.
Notes
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.
Examples
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
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info