initial commit

This commit is contained in:
Redo
2025-07-20 17:48:33 -07:00
commit 7ec3352f21
10 changed files with 257 additions and 0 deletions

View File

@ -0,0 +1,78 @@
--love 1
local le = love.event
local lg = love.graphics
local li = love.image
local lf = love.filesystem
--------------------------------------------------------------
local drawable
local function yieldImage(imagedata)
drawable = lg.newImage(imagedata)
coroutine.yield()
end
--------------------------------------------------------------
local function imageLoad(filename)
local imagedata = li.newImageData(filename..".png")
return imagedata
end
local function imageStore(imagedata, filename)
local filedata = imagedata:encode("png")
local outfile = io.open(filename..".png", "wb")
outfile:write(filedata:getString())
outfile:close()
end
--------------------------------------------------------------
local imageFixIcon = require "imagefixicon"
--------------------------------------------------------------
local function fixAllIcons()
local files = lf.getDirectoryItems("icons-unfixed")
for fileidx, filename in ipairs(files) do
local fileext = filename:match("%.[a-zA-Z0-9]+$")
if fileext==".png" then
local filepart = filename:gsub("%.[a-zA-Z0-9]+$", "")
local imagedata = imageLoad("icons-unfixed/"..filepart)
print(filepart)
local newimagedata = imageFixIcon(imagedata, fileidx, true)
imageStore(newimagedata, "icons-fixed/"..filepart)
yieldImage(newimagedata)
end
end
print("Done")
love.event.quit()
end
--------------------------------------------------------------
local cor
function love.load()
cor = coroutine.create(fixAllIcons)
--fixAllIcons()
end
function love.draw()
if drawable then
lg.draw(drawable)
end
end
function love.update(dt)
coroutine.resume(cor)
end
function love.keypressed(k)
if k=="escape" then le.quit() end
end