Skip to content

Instantly share code, notes, and snippets.

View keharriso's full-sized avatar

Kevin Harrison keharriso

  • 07:03 (UTC -04:00)
View GitHub Profile
@steveRoll-git
steveRoll-git / main.lua
Created September 17, 2022 19:26
löve - fluid simulation using verlet integration
local love = love
local lg = love.graphics
local random = love.math.random
local function dist(x1, y1, x2, y2)
return math.sqrt((x2 - x1)^2 + (y2 - y1)^2)
end
local function length(x, y)
return math.sqrt(x^2 + y^2)
end
@gvx
gvx / roundrect.lua
Created February 18, 2014 15:13
Rounded rectangles
function love.graphics.roundrect(mode, x, y, width, height, xround, yround)
local points = {}
local precision = (xround + yround) * .1
local tI, hP = table.insert, .5*math.pi
if xround > width*.5 then xround = width*.5 end
if yround > height*.5 then yround = height*.5 end
local X1, Y1, X2, Y2 = x + xround, y + yround, x + width - xround, y + height - yround
local sin, cos = math.sin, math.cos
for i = 0, precision do
local a = (i/precision-1)*hP