mirror of
https://github.com/smogon/sprites.git
synced 2026-03-21 17:35:13 -05:00
wip pad trainers to 80x80
need to use tup config variables for compression settings, its too expensive for development otherwise
This commit is contained in:
parent
429b673621
commit
c76e5e415a
31
Tupfile.lua
31
Tupfile.lua
|
|
@ -64,3 +64,34 @@ local files =
|
|||
fbsprite(files, "build/smogon/fbsprites/xy/%B.png")
|
||||
twittersprite(files, "build/smogon/twittersprites/xy/%B.png")
|
||||
|
||||
-- Trainers
|
||||
|
||||
function padtrainer(input, output)
|
||||
return "convert " .. input .. " -background transparent -gravity center -extent 80x80 " .. output
|
||||
end
|
||||
|
||||
-- TODO: move some of these to util, when we figure out the precise abstractions desired
|
||||
|
||||
function compresspng(filename, opts)
|
||||
local cmds = {}
|
||||
if opts.optipng then
|
||||
cmds += "optipng -q " .. opts.optipng .. " " .. filename
|
||||
end
|
||||
if opts.advpng then
|
||||
cmds += "advpng -q " .. opts.advpng .. " " .. filename
|
||||
end
|
||||
return cmds
|
||||
end
|
||||
|
||||
function makecmd(cmds)
|
||||
return table.concat(flatten(cmds), " && ")
|
||||
end
|
||||
|
||||
tup.foreach_rule(
|
||||
{"src/canonical/trainers/*"},
|
||||
"^ pad trainer %f^ " .. makecmd{padtrainer("%f", "%o"), compresspng("%f", {})},
|
||||
{"build/padded-trainers/canonical/%b"}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,3 +19,21 @@ function astable(table)
|
|||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
-- Adapted from premake
|
||||
function flatten(arr)
|
||||
local result = { }
|
||||
|
||||
local function flatten(arr)
|
||||
for v in iter(arr) do
|
||||
if type(v) == "table" then
|
||||
flatten(v)
|
||||
else
|
||||
table.insert(result, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
flatten(arr)
|
||||
return result
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user