From 0ce4f35eb295e4d6ca75ee82557756a9288ad10e Mon Sep 17 00:00:00 2001 From: Rezmason Date: Mon, 6 Jun 2022 07:49:11 -0700 Subject: [PATCH] Replacing lockImage and unlockImage with pushContext and popContext in the Lua project --- playdate/matrix_lua/main.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playdate/matrix_lua/main.lua b/playdate/matrix_lua/main.lua index 3f363e0..44563d9 100644 --- a/playdate/matrix_lua/main.lua +++ b/playdate/matrix_lua/main.lua @@ -19,22 +19,22 @@ do local fadeGradient = gfx.image.new('images/fade-gradient') local glyph = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack) + gfx.pushContext(glyph) for i = 1, numGlyphs do local column = (i - 1) % spritesheetColumns local row = floor((i - 1) / spritesheetColumns) - gfx.lockFocus(glyph) glyphSpritesheet:draw(-column * glyphWidth, -row * glyphWidth) - gfx.unlockFocus() glyphs[i] = {} for j = 1, numFades do local fade = (j - 1) / (numFades - 1) local variant = glyph:copy() glyphs[i][j] = variant - gfx.lockFocus(variant) + gfx.pushContext(variant) fadeGradient:draw(fade * (glyphWidth - fadeGradient.width), 0) - gfx.unlockFocus() + gfx.popContext() end end + gfx.popContext() end local minSpeed = 0.15