Spec-Zone.ru › LÖVE

love.graphics.point

Убрано в LÖVE 0.10.0
Заменено на love.graphics.points.


Рисует точку.

Функция

Синопсис

love.graphics.point( x, y )

Аргументы

number x
Позиция по оси X.
number y
Позиция по оси Y.

Возвращаемые значения

Ничего.

Примечания

Сетка пикселей фактически смещена к центру каждого пикселя. Для рисования целых пикселей используйте 0,5 + целые приращения.

Точки не подвержены влиянию love.graphics.scale - их размер всегда в пикселях.

Примеры

Отображение звездного поля

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()
   for i, star in ipairs(stars) do   -- loop through all of our stars
      love.graphics.point(star[1], star[2])   -- draw each point
   end
end

См. также

  • love.graphics
  • love.graphics.setPointSize
  • love.graphics.setPointStyle


© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.point

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API