Love Loader v2.1
Bugfixes. Removed cross-engine support, only Love2D. Added filesystem and keyboard modules in LibLL. Remade input handling in skins. Files and broken folders are not shows in game list. Add MOBILE variable and auto-fullscreen on mobile phones.
This commit is contained in:
parent
f562b23197
commit
e46bc230a6
13 changed files with 242 additions and 153 deletions
|
@ -1,7 +1,5 @@
|
|||
return function(ll)
|
||||
|
||||
-- Classic UI from Love Loader v1
|
||||
|
||||
ll.cfg.pcht = ll.cfg.pcht or 60 * 5
|
||||
|
||||
local pikchv, pikcha = 0, 0
|
||||
|
@ -10,8 +8,8 @@ local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5)
|
|||
local cx, cy, cw, ch
|
||||
local f, bf
|
||||
|
||||
local mx, mb, mpb = 0, 0, 0
|
||||
local cdir, sel = 0, 1
|
||||
local sel = 1
|
||||
local cdir
|
||||
|
||||
function resize()
|
||||
cw = W / 1.25
|
||||
|
@ -23,40 +21,25 @@ function resize()
|
|||
|
||||
f = love.graphics.newFont(th / 3)
|
||||
bf = love.graphics.newFont(th / 2)
|
||||
|
||||
ll.kbInit('h', cx, cx + cw)
|
||||
end
|
||||
|
||||
local function update()
|
||||
mx = love.mouse.getX()
|
||||
mpb = mb
|
||||
if love.mouse.isDown(1) then mb = 1
|
||||
else mb = 0 end
|
||||
|
||||
local sdi = 0
|
||||
if mpb == 1 and mb == 0 then
|
||||
if mx <= cx
|
||||
then sdi = 1
|
||||
elseif mx >= cx + cw
|
||||
then sdi = 2
|
||||
else sdi = 3
|
||||
end
|
||||
end
|
||||
|
||||
if love.keyboard.isScancodeDown('left', 'a')
|
||||
then sdi = 1
|
||||
elseif love.keyboard.isScancodeDown('right', 'd')
|
||||
then sdi = 2
|
||||
elseif love.keyboard.isScancodeDown('return', 'space')
|
||||
then sdi = 3
|
||||
end
|
||||
local sdi = ll.kbGet()
|
||||
|
||||
if cdir ~= sdi then
|
||||
cdir = sdi
|
||||
if sdi == 1
|
||||
if sdi == '<'
|
||||
then sel = sel - 1
|
||||
elseif sdi == 2
|
||||
elseif sdi == '>'
|
||||
then sel = sel + 1
|
||||
elseif sdi == 3 and ll.games[sel]
|
||||
elseif sdi == 'o' and ll.games[sel]
|
||||
then ll.mount(ll.games[sel])
|
||||
|
||||
elseif sdi == 'm'
|
||||
and love.mouse.getX() >= W - 8
|
||||
then ll.devtools()
|
||||
end
|
||||
|
||||
if sel < 1 then sel = #ll.games end
|
||||
|
@ -78,11 +61,6 @@ local function update()
|
|||
end
|
||||
else pikcha = math.min(255, pikcha + pikchao)
|
||||
end
|
||||
|
||||
if love.keyboard.isDown 'menu'
|
||||
and mx >= W - 8
|
||||
then pcall(select(2, pcall(require, 'dev.devtools')), ll)
|
||||
end
|
||||
end
|
||||
|
||||
local tm = 0
|
||||
|
|
|
@ -15,6 +15,9 @@ ll.cfg.pcht = ll.cfg.pcht or 60 * 5
|
|||
local pikchv, pikcha = 0, 0
|
||||
local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5)
|
||||
|
||||
local logger = ''
|
||||
local chc = '<>><m><'
|
||||
|
||||
function resize()
|
||||
r = math.min(W, H) / 30
|
||||
|
||||
|
@ -26,57 +29,38 @@ function resize()
|
|||
|
||||
f = love.graphics.setNewFont(math.min(W, H) / 30)
|
||||
bf = love.graphics.newFont(math.min(W, H) / 20)
|
||||
|
||||
ll.kbInit('v', H / 2 - ch, H / 2 + ch + cg, cx + cw * 2)
|
||||
end
|
||||
|
||||
love.window.setMode(800, 600, {resizable = true})
|
||||
|
||||
local my, mb, mpb
|
||||
|
||||
local sdir = 0
|
||||
local sdir
|
||||
local function update()
|
||||
local ty = H / 2 - (ch + cg) * sel
|
||||
cy = cy + (ty - cy) * 0.1
|
||||
css = css + (2 - css) * 0.2
|
||||
rcss = 2 - css + 1
|
||||
|
||||
local sdi
|
||||
|
||||
my = love.mouse.getY()
|
||||
mpb = mb
|
||||
if love.mouse.isDown(1) then mb = 1
|
||||
else mb = 0
|
||||
end
|
||||
if mb == 0 and mpb == 1 then
|
||||
if my <= H / 2 - ch
|
||||
then sdi = 1
|
||||
elseif my >= H / 2 + ch + cg
|
||||
then sdi = 2
|
||||
else sdi = 3
|
||||
end
|
||||
elseif love.keyboard.isScancodeDown('up', 'w')
|
||||
then sdi = 1
|
||||
elseif love.keyboard.isScancodeDown('down', 's')
|
||||
then sdi = 2
|
||||
elseif love.keyboard.isScancodeDown('return', 'space')
|
||||
then sdi = 3
|
||||
else sdi = 0
|
||||
end
|
||||
local sdi = ll.kbGet()
|
||||
|
||||
if sdi ~= sdir then
|
||||
if sdi ~= 0
|
||||
if sdi
|
||||
then rcss = css
|
||||
css = 1
|
||||
if sdi == 3
|
||||
then css = 1.5
|
||||
end
|
||||
psel = sel
|
||||
logger = logger .. sdi
|
||||
if logger == chc then
|
||||
resize()
|
||||
ll.devtools()
|
||||
end
|
||||
end
|
||||
sdir = sdi
|
||||
if sdi == 1
|
||||
if sdi == '<'
|
||||
then sel = sel - 1
|
||||
elseif sdi == 2
|
||||
elseif sdi == '>'
|
||||
then sel = sel + 1
|
||||
elseif sdi == 3 and ll.games[sel]
|
||||
elseif sdi == 'o' and ll.games[sel]
|
||||
then ll.mount(ll.games[sel])
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue