-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.lua
58 lines (53 loc) · 1.28 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
socket = require("socket")
json = require("dkjson")
require("util")
require("class")
require("queue")
require("globals")
require("save")
require("engine")
require("graphics")
require("input")
require("network")
require("puzzles")
require("mainloop")
local N_FRAMES = 0
function love.load()
math.randomseed(os.time())
for i=1,4 do math.random() end
read_key_file()
read_conf_file() -- TODO: stop making new config files
replay = {}
read_replay_file()
graphics_init() -- load images and set up stuff
mainloop = coroutine.create(fmainloop)
end
function love.update(dt)
if consuming_timesteps then
leftover_time = leftover_time + dt
end
joystick_ax()
if not consuming_timesteps then
key_counts()
end
gfx_q:clear()
local status, err = coroutine.resume(mainloop)
if not status then
error(err..'\n'..debug.traceback(mainloop))
end
if not consuming_timesteps then
this_frame_keys = {}
this_frame_unicodes = {}
end
this_frame_messages = {}
end
function love.draw()
love.graphics.setColor(28, 28, 28)
love.graphics.rectangle("fill",-5,-5,900,900)
love.graphics.setColor(255, 255, 255)
for i=gfx_q.first,gfx_q.last do
gfx_q[i][1](unpack(gfx_q[i][2]))
end
love.graphics.print("FPS: "..love.timer.getFPS(),315,115)
N_FRAMES = N_FRAMES + 1
end