-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.lua
73 lines (57 loc) · 1.72 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require("globals")
local log = require("lib.log")
local pprint = require("lib.pprint")
local scenes = require("lib.scenes")
local skyscraper = require("lib.skyscraper")
local splash = require("lib.splash")
local configs = require("helpers.config")
local input = require("helpers.input")
local utils = require("helpers.utils")
log.start()
local user_config, skyscraper_config = configs.user_config, configs.skyscraper_config
local theme = configs.theme
local font = love.graphics.newFont(
theme:read("main", "FONT") or "assets/ChakraPetch-Regular.ttf",
theme:read_number("main", "FONT_SIZE") or 20)
love.graphics.setFont(font)
local footer = require("lib.gui.footer")()
local w_width, w_height = love.window.getMode()
function love.load(args)
splash.load()
if #args > 0 then
local res = args[1]
if res then
_G.resolution = res
res = utils.split(res, "x")
love.window.setMode(tonumber(res[1]) or 640, tonumber(res[2]) or 480)
w_width, w_height = love.window.getMode()
end
end
-- Debug mode
local debug = user_config:read("main", "debug")
if debug ~= "1" then
_G.print = function() end
setmetatable(pprint, { __call = function() end })
end
scenes:load("main")
skyscraper.init(
skyscraper_config.path,
user_config:read("overrides", "binary") or "bin/Skyscraper.aarch64")
input.load()
footer:updatePosition(w_width * 0.5 - footer.width * 0.5 - 20, w_height - footer.height - 10)
end
function love.update(dt)
timer.update(dt)
input.update(dt)
scenes:update(dt)
input.onEvent(function(key)
scenes:keypressed(key)
end)
end
function love.draw()
splash.draw()
if splash.finished then
scenes:draw()
footer:draw()
end
end