love-loader/main.lua

72 lines
1.5 KiB
Lua
Raw Normal View History

2022-05-30 07:33:56 +00:00
local ll = require 'lib.main'
error = love.errhand or love.errorhandler
function splash()
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])
love.graphics.draw(img, 0, 0, 0, W / img:getWidth(), H / img:getHeight())
2022-04-28 18:35:21 +00:00
end
2022-05-30 07:33:56 +00:00
love.graphics.setColor(255, 255, 255, 255)
love.graphics.print('Loading '..ll.mgme.name, W / 2, H / 2)
2022-04-28 18:35:21 +00:00
end
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
ll.skin = require 'skins.psp' (ll)
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
require 'll-min'
llUsed = true
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
if love.errorhandler
then love.errorhandler = error
else love.errhand = error
2022-04-27 18:32:52 +00:00
end
2022-04-28 18:35:21 +00:00
local brk = false
2022-05-30 07:33:56 +00:00
while not brk and not ll.mdir do
2022-04-27 18:32:52 +00:00
-- event handling
love.event.pump()
2022-05-30 07:33:56 +00:00
for n, a,b,c in love.event.poll() do
if n == 'quit'
or (n == 'keypressed' and a == 'escape')
then ll.umount()
2022-04-28 18:35:21 +00:00
love.event.push('quit')
brk = true; break
end
2022-05-30 07:33:56 +00:00
love.handlers[n](a,b,c)
2022-04-27 18:32:52 +00:00
end
-- update and drawing
2022-05-30 07:33:56 +00:00
ll.skin.update()
2022-04-27 18:32:52 +00:00
love.graphics.origin()
love.graphics.clear(0, 0, 0)
2022-05-30 07:33:56 +00:00
ll.skin.draw()
2022-04-27 18:32:52 +00:00
love.graphics.present()
love.timer.sleep(0.001)
end
2022-05-30 07:33:56 +00:00
if ll.mdir then
2022-04-28 18:35:21 +00:00
love.graphics.setNewFont()
resize = nil
2022-05-30 07:33:56 +00:00
love.graphics.clear(0, 0, 0)
splash()
love.graphics.present()
if ll.skin.lovecb then
for _, v in pairs(ll.skin.lovecb)
do love[v] = nil
end
end
love.filesystem.setIdentity(ll.mgme.dir)
local f, err = load(love.filesystem.read(ll.mgme.main), ll.mgme.name)
if not f then error(err)
else xpcall(f, function(e)
error(e)
llHome()
end)
end
love.resize(love.graphics.getDimensions())
2022-04-28 18:35:21 +00:00
end