DT and some internal updates, base skin scrolling.

This commit is contained in:
Er2 2022-07-15 14:17:59 +03:00
parent c0a8f03063
commit f56eabf59c
6 changed files with 44 additions and 27 deletions

View File

@ -54,7 +54,7 @@ function ll.kbGet()
elseif love.keyboard.isDown 'menu' elseif love.keyboard.isDown 'menu'
then return 'm' then return 'm'
elseif mb == 0 and mpb == 1 then -- unpressed elseif mb == 0 and mpb == 1 then -- mouse unpressed
if dir == 'h' then if dir == 'h' then
if sclm < 0 or my <= sclm then if sclm < 0 or my <= sclm then
if mx <= sc1 if mx <= sc1

View File

@ -21,7 +21,9 @@ function ll.devtools()
ll.dt = true ll.dt = true
__LL = ll __LL = ll
pcall(function() require 'dev.tools' end) pcall(function() require 'dev.tools' end)
return true
end end
return false
end end
return ll return ll

View File

@ -1,7 +1,10 @@
local ll = require 'lib.main' local ll = require 'lib.main'
error = love.errhand or love.errorhandler error = love.errhand or love.errorhandler
ll.skin = require 'skins.psp' (ll)
function splash() function splash()
if not ll.mgme then return end
love.graphics.setColor(255, 255, 255, 100 / COLDIV) love.graphics.setColor(255, 255, 255, 100 / COLDIV)
if ll.mgme.screens and ll.mgme.screens[1] then if ll.mgme.screens and ll.mgme.screens[1] then
local img = love.graphics.newImage(ll.mgme.screens[1]) local img = love.graphics.newImage(ll.mgme.screens[1])
@ -11,8 +14,6 @@ function splash()
love.graphics.print('Loading '..ll.mgme.name, W / 2, H / 2) love.graphics.print('Loading '..ll.mgme.name, W / 2, H / 2)
end end
ll.skin = require 'skins.psp' (ll)
require 'll-min' require 'll-min'
llUsed = true llUsed = true
@ -26,12 +27,13 @@ else
ll.umount() ll.umount()
love.event.push('quit', 'restart') love.event.push('quit', 'restart')
end end
if love.getVersion() >= 11 then end
love.errorhandler = error if love.getVersion() >= 11
else love.errhand = error then love.errorhandler = error
end else love.errhand = error
end end
local dt = love.timer and love.timer.step() or 0
local brk = false local brk = false
while not brk and not ll.mdir do while not brk and not ll.mdir do
-- event handling -- event handling
@ -60,7 +62,11 @@ while not brk and not ll.mdir do
end end
-- update and drawing -- update and drawing
ll.skin.update() if love.timer then
love.timer.step()
dt = love.timer.getDelta()
end
ll.skin.update(dt)
love.graphics.origin() love.graphics.origin()
love.graphics.clear(0, 0, 0) love.graphics.clear(0, 0, 0)
ll.skin.draw() ll.skin.draw()

View File

@ -86,6 +86,11 @@ local function ccp()
return '' return ''
else return 'Not found' else return 'Not found'
end end
elseif cmd == 'devtools' then
if ll.devtools()
then return 'Enabled'
else return 'Already enabled'
end
else return 'Unknown command "'.. cmd .. '"' else return 'Unknown command "'.. cmd .. '"'
end end
end end
@ -117,6 +122,7 @@ local function update()
end end
end end
local oy = 0
local utf8 = require 'utf8' local utf8 = require 'utf8'
local function draw() local function draw()
love.graphics.setColor(255, 255, 255) love.graphics.setColor(255, 255, 255)
@ -132,15 +138,18 @@ local function draw()
then x = x + 8 - (x % 8) then x = x + 8 - (x % 8)
elseif chr == '\v' elseif chr == '\v'
then y = y + 1 then y = y + 1
else love.graphics.print(chr, x * cw, y * ch) else love.graphics.print(chr, x * cw, y * ch - oy)
if x >= ctw if x >= ctw
then x, y = x - ctw, y + 1 then x, y = x - ctw, y + 1
else x = x + 1 else x = x + 1
end end
end end
end end
if y * ch - oy >= H
then oy = oy + H / 4
end
if os.time() % 2 == 0 if os.time() % 2 == 0
then love.graphics.rectangle('fill', x * cw, y * ch, cw, ch) then love.graphics.rectangle('fill', x * cw, y * ch - oy, cw, ch)
end end
end end

View File

@ -1,9 +1,10 @@
return function(ll) return function(ll)
ll.cfg.pcht = ll.cfg.pcht or 60 * 5 ll.cfg.pcht = ll.cfg.pcht or 60 * 10
local pikchv, pikcha = 0, 0 local pikchv, pikcha = 0, 0
local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5)
local bg = 0
local cx, cy, cw, ch local cx, cy, cw, ch
local f, bf local f, bf
@ -25,7 +26,7 @@ function resize()
ll.kbInit('h', cx, cx + cw) ll.kbInit('h', cx, cx + cw)
end end
local function update() local function update(dt)
local sdi = ll.kbGet() local sdi = ll.kbGet()
if cdir ~= sdi then if cdir ~= sdi then
@ -46,8 +47,8 @@ local function update()
if sel > #ll.games then sel = 1 end if sel > #ll.games then sel = 1 end
end end
pikchv = pikchv + 1 pikchv = pikchv + dt
if pikchv >= ll.cfg.pcht then if pikchv >= ll.cfg.pcht / 100 then
pikchv = 0 pikchv = 0
pikcha = 0 pikcha = 0
for _, v in pairs(ll.games) do for _, v in pairs(ll.games) do
@ -59,11 +60,12 @@ local function update()
end end
end end
end end
else pikcha = math.min(255, pikcha + pikchao) else pikcha = math.min(255, pikcha + pikchao * 100 * dt)
end end
bg = (bg + dt) % 6.28
end end
local tm = 0
local function draw() local function draw()
love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV) love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV)
love.graphics.rectangle('fill', 0, 0, W, H) love.graphics.rectangle('fill', 0, 0, W, H)
@ -74,8 +76,7 @@ local function draw()
local tw, th = bf:getWidth(t), bf:getHeight(t) local tw, th = bf:getWidth(t), bf:getHeight(t)
love.graphics.print(t, W - tw - 8, H - th) love.graphics.print(t, W - tw - 8, H - th)
tm = (tm + 0.02) % 6.28 local c, pc, ps = bg, math.cos(bg), math.sin(bg)
local c, pc, ps = tm, math.cos(tm), math.sin(tm)
local oy = H / 2 local oy = H / 2
for x = 0, W + 8, 8 do for x = 0, W + 8, 8 do
c = c + 0.1 c = c + 0.1

View File

@ -10,7 +10,7 @@ local css, rcss = 2, 0
local f, bf local f, bf
ll.cfg.pcht = ll.cfg.pcht or 60 * 5 ll.cfg.pcht = ll.cfg.pcht or 60 * 10
local pikchv, pikcha = 0, 0 local pikchv, pikcha = 0, 0
local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5)
@ -36,10 +36,10 @@ end
love.window.setMode(800, 600, {resizable = true}) love.window.setMode(800, 600, {resizable = true})
local sdir local sdir
local function update() local function update(dt)
local ty = H / 2 - (ch + cg) * sel local ty = H / 2 - (ch + cg) * sel
cy = cy + (ty - cy) * 0.1 cy = cy + (ty - cy) * 5 * dt
css = css + (2 - css) * 0.2 css = css + (2 - css) * 15 * dt
rcss = 2 - css + 1 rcss = 2 - css + 1
local sdi = ll.kbGet() local sdi = ll.kbGet()
@ -72,10 +72,9 @@ local function update()
then ll.skin = require 'skins.select' (ll) then ll.skin = require 'skins.select' (ll)
end end
pikchv = pikchv + 1 pikchv = pikchv + dt
if pikchv >= ll.cfg.pcht then if pikchv >= ll.cfg.pcht / 100 then
pikchv = 0 pikchv, pikcha = 0, 0
pikcha = 0
for _, v in pairs(ll.games) do for _, v in pairs(ll.games) do
if v.dat.scr then if v.dat.scr then
v.scrprv = v.scrcur v.scrprv = v.scrcur
@ -85,7 +84,7 @@ local function update()
end end
end end
end end
else pikcha = math.min(255, pikcha + pikchao) else pikcha = math.min(255, pikcha + pikchao * 100 * dt)
end end
end end