From 1ccca258d698fdb16dff7792e0c5c6a536b4fcfe Mon Sep 17 00:00:00 2001 From: Juan Xavier Gomez Date: Tue, 2 Jul 2024 11:34:02 -0400 Subject: [PATCH] Allow to draw a filled circle with outline --- pdParticles.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pdParticles.lua b/pdParticles.lua index 4f4f100..d1ba70a 100644 --- a/pdParticles.lua +++ b/pdParticles.lua @@ -138,6 +138,24 @@ function Particle:getColour() return self.colour end + +-- colour +function Particle:setStrokeColor(colour) + self.strokeColour = colour +end + +function Particle:getStrokeColor() + return self.strokeColour +end + +function Particle:setStrokeColour(colour) + self.strokeColour = colour +end + +function Particle:getStrokeColour() + return self.strokeColour +end + -- bounds function Particle:setBounds(x1, y1, x2, y2) self.bounds = {x1,y1,x2,y2} @@ -268,7 +286,14 @@ function ParticleCircle:update() for part = 1, #self.particles, 1 do local circ = self.particles[part] if circ.thickness < 1 then + playdate.graphics.setColor(self.colour) playdate.graphics.fillCircleAtPoint(circ.x,circ.y,circ.size) + elseif self.strokeColour ~= nil then + playdate.graphics.setColor(self.colour) + playdate.graphics.fillCircleAtPoint(circ.x,circ.y,circ.size) + playdate.graphics.setLineWidth(circ.thickness) + playdate.graphics.setColor(self.strokeColour) + playdate.graphics.drawCircleAtPoint(circ.x, circ.y, circ.size) else playdate.graphics.setLineWidth(circ.thickness) playdate.graphics.drawCircleAtPoint(circ.x, circ.y, circ.size)