return function(ll) local skins = { require 'skins.psp', require 'skins.gui', require 'skins.base', require 'skins.select', } local sel = 1 local sk, ssel local cx, cw, ch local scx, scy = 1, 1 local tscx, tscy local canv local resz, l function load(nunl) l = true resize = nil assert(skins[sel], 'Skin does not exists') sk = skins[sel](ll) love.resize(love.graphics.getDimensions()) sk.update() if not nunl then if sk.lovecb then for _, v in pairs(sk.lovecb) do love[v] = nil end end resize = resz love.resize(love.graphics.getDimensions()) love.graphics.setCanvas(canv) love.graphics.setColor(0, 0, 0) love.graphics.rectangle('fill', 0, 0, W, H) love.graphics.setColor(255, 255, 255) sk.draw() love.graphics.setCanvas() else ll.skin = sk end l = false end function resize() cx = math.min(W, H) / 8 cw, ch = W - cx * 2.5, H - cx * 1.5 tscx, tscy = cw / W, ch / H canv = love.graphics.newCanvas(W, H) if not l then load() end ll.kbInit('h', cx, W - cx) end resz = resize local d local function update() if not sk then load() end scx = scx + (tscx - scx) * 0.1 scy = scy + (tscy - scy) * 0.1 if ssel and scx > 0.99 and scy > 0.99 then load(true) end local nd = ll.kbGet() if nd ~= d then d = nd local ns = sel if d == '<' then ns = sel - 1 elseif d == '>' then ns = sel + 1 elseif d == 'o' then ssel = true tscx, tscy = 1, 1 end if ns < 1 then ns = #skins end if ns > #skins then ns = 1 end if sel ~= ns then sel = ns load() end end end local function draw() local w, h = W * scx, H * scy local x, y, r = (W - w) / 2, (H - h) / 2, math.min(W - w, H - h) / 8 love.graphics.setColor(100 / COLDIV, 100 / COLDIV, 100 / COLDIV) love.graphics.rectangle('fill', 0, 0, W, H) love.graphics.setColor(255, 255, 255) love.graphics.stencil(function() love.graphics.rectangle('fill', x, y, w, h, r) end) love.graphics.setStencilTest('greater', 0) love.graphics.draw(canv, x, y, 0, scx, scy) love.graphics.setStencilTest() love.graphics.rectangle('line', x, y, w, h, r) end -- execute if loaded from other skin if ll.skin then load() resize() update() end return { draw = draw, update = update, } end