forked from Arkendorf/Kingsbowl-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
51 lines (43 loc) · 1.06 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
require "globals"
local state = require "state"
local server = require "server"
local client = require "client"
local gui = require "gui"
local menus = require "menus"
keydowntable['1'] = server.init
keydowntable['2'] = client.init
love.load = function()
font = love.graphics.newImageFont("font.png",
" ABCDEFGHIJKLMNOPQRSTUVWXYZ" ..
"abcdefghijklmnopqrstuvwxyz" ..
"0123456789!?.:", 1)
love.graphics.setFont(font)
state.game = "menu"
state.gui = gui.new(menus[1])
end
love.update = function(dt)
if state.game == "server" then
server.update(dt)
elseif state.game == "client" then
client.update(dt)
elseif state.game == "menu" then
end
state.gui:update(dt)
end
love.draw = function()
state.gui:draw()
love.graphics.print(ip.ip..":"..ip.port)
end
love.mousepressed = function(x, y, button)
state.gui:mousepressed(x, y, button)
end
love.textinput = function(t)
state.gui:textinput(t)
end
love.keypressed = function(key)
keyuptable[key]()
state.gui:keypressed(key)
end
love.keyreleased = function(key)
keydowntable[key]()
end