From: JC Date: Mon, 31 Jul 2023 00:02:19 +0000 (-0500) Subject: Draw many rectangles X-Git-Url: https://git.jacobcasper.com/?a=commitdiff_plain;h=52fc2291ccb86e6518bfd3bb8ce839fd3cb93492;p=life-pd.git Draw many rectangles For loop iteration, table iteration, and rectangles drawn diagonally --- diff --git a/source/main.lua b/source/main.lua index c5dbbd8..5cedb2d 100644 --- a/source/main.lua +++ b/source/main.lua @@ -1,11 +1,16 @@ local pd = playdate local gfx = playdate.graphics -local r = pd.geometry.rect.new(0, 0, 32, 32) +local rects = {} +for i=1, 10 do + rects[i] = pd.geometry.rect.new(32 * (i-1), 32 * (i-1), 32, 32) +end function playdate.update() - gfx.drawRect(r) + for i,r in ipairs(rects) do + gfx.drawRect(r) + end if playdate.buttonJustPressed("a") then playdate.display.setInverted(not playdate.display.getInverted()) end