mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-19 22:49:29 -07:00
Replacing lockImage and unlockImage with pushContext and popContext in the Lua project
This commit is contained in:
@@ -19,22 +19,22 @@ do
|
|||||||
local fadeGradient = gfx.image.new('images/fade-gradient')
|
local fadeGradient = gfx.image.new('images/fade-gradient')
|
||||||
local glyph = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack)
|
local glyph = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack)
|
||||||
|
|
||||||
|
gfx.pushContext(glyph)
|
||||||
for i = 1, numGlyphs do
|
for i = 1, numGlyphs do
|
||||||
local column = (i - 1) % spritesheetColumns
|
local column = (i - 1) % spritesheetColumns
|
||||||
local row = floor((i - 1) / spritesheetColumns)
|
local row = floor((i - 1) / spritesheetColumns)
|
||||||
gfx.lockFocus(glyph)
|
|
||||||
glyphSpritesheet:draw(-column * glyphWidth, -row * glyphWidth)
|
glyphSpritesheet:draw(-column * glyphWidth, -row * glyphWidth)
|
||||||
gfx.unlockFocus()
|
|
||||||
glyphs[i] = {}
|
glyphs[i] = {}
|
||||||
for j = 1, numFades do
|
for j = 1, numFades do
|
||||||
local fade = (j - 1) / (numFades - 1)
|
local fade = (j - 1) / (numFades - 1)
|
||||||
local variant = glyph:copy()
|
local variant = glyph:copy()
|
||||||
glyphs[i][j] = variant
|
glyphs[i][j] = variant
|
||||||
gfx.lockFocus(variant)
|
gfx.pushContext(variant)
|
||||||
fadeGradient:draw(fade * (glyphWidth - fadeGradient.width), 0)
|
fadeGradient:draw(fade * (glyphWidth - fadeGradient.width), 0)
|
||||||
gfx.unlockFocus()
|
gfx.popContext()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
gfx.popContext()
|
||||||
end
|
end
|
||||||
|
|
||||||
local minSpeed <const> = 0.15
|
local minSpeed <const> = 0.15
|
||||||
|
|||||||
Reference in New Issue
Block a user