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'
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 sclm < 0 or my <= sclm then
if mx <= sc1

View File

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

View File

@ -1,7 +1,10 @@
local ll = require 'lib.main'
error = love.errhand or love.errorhandler
ll.skin = require 'skins.psp' (ll)
function splash()
if not ll.mgme then return end
love.graphics.setColor(255, 255, 255, 100 / COLDIV)
if ll.mgme.screens and ll.mgme.screens[1] then
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)
end
ll.skin = require 'skins.psp' (ll)
require 'll-min'
llUsed = true
@ -26,12 +27,13 @@ else
ll.umount()
love.event.push('quit', 'restart')
end
if love.getVersion() >= 11 then
love.errorhandler = error
else love.errhand = error
end
end
if love.getVersion() >= 11
then love.errorhandler = error
else love.errhand = error
end
local dt = love.timer and love.timer.step() or 0
local brk = false
while not brk and not ll.mdir do
-- event handling
@ -60,7 +62,11 @@ while not brk and not ll.mdir do
end
-- 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.clear(0, 0, 0)
ll.skin.draw()

View File

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

View File

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

View File

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