forked from MLJWare/Opcode-LD42
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
31 lines (24 loc) · 762 Bytes
/
main.lua
File metadata and controls
31 lines (24 loc) · 762 Bytes
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
love.graphics.setDefaultFilter("nearest", "nearest")
function math.round(x) return math.floor(x + 0.5) end
function math.trunc(x) return (x > 0) and math.floor(x) or math.ceil(x) end
function table.count(t, v) local c=0 for i=1,#t do c=c+(t[i]==v and 1 or 0) end return c end
require "setup_display"
local main = require "app.main"
local function pcall2 (where, fn, ...)
local status, msg = pcall(fn, ...)
if not status then
love.window.showMessageBox("Error in "..where, msg.."\nExitting game.", "error")
love.event.quit(-1)
end
end
function love.load(arg)
if main.load then
pcall2("load", main.load, arg)
end
end
function love.update(dt)
pcall2("update", main.update, dt)
end
function love.draw()
pcall2("draw", main.draw)
end