-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.lua
87 lines (74 loc) · 1.75 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require('middleclass')
require('loveframes')
require('inspect')
require('Point')
require('Clock')
require('List')
require('Map')
require('SparseMap')
require('Tween')
require('Promise')
require('utils')
require('Drawing')
require('DamageEffect')
require('Game')
require('Sidebar')
require('Item')
require('Weapon')
require('Armor')
require('MapGenerator')
require('MapItem')
require('Enemy')
require('Decoration')
require('Level')
function love.load()
math.randomseed(os.time())
love.graphics.setBackgroundColor(15, 10, 10)
loveframes.util.SetActiveSkin('Rogue')
Game.setup()
Decoration.setup()
START_GAME()
end
function START_GAME()
if current_game then
current_game.sidebar.log_window.frame:SetVisible(false)
current_game.sidebar.minimap.frame:SetVisible(false)
end
current_game = Game()
Game.start(current_game)
end
function love.draw()
-- if FPS then love.graphics.setColor(255, 255, 255) ; love.graphics.print(FPS, 0, 0) end
current_game:draw()
loveframes.draw()
end
function love.update(dt)
FPS = math.floor(1 / dt)
Clock.update(dt)
Tween.update(dt)
loveframes.update(dt)
end
function love.mousepressed(x, y, button)
loveframes.mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
loveframes.mousereleased(x, y, button)
end
function love.keypressed(key, unicode)
if utils.capture_input() then
utils.keypressed(key)
else
current_game:keypressed(key)
end
loveframes.keypressed(key, unicode)
end
function love.keyreleased(key)
current_game:keyreleased(key)
loveframes.keyreleased(key)
end
function love.quit()
if current_game and not REALLY_QUIT then
current_game.sidebar:exit_dialog()
return true
end
end