-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.lua
60 lines (45 loc) · 1.02 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
local manager = require 'roomy'.new()
local state = {}
state.title = {}
function state.title:keypressed(key)
if key == 'return' then
manager:enter(state.gameplay, 'hi!')
end
end
function state.title:leave(next, ...)
print('leaving the title screen for', next, ...)
end
function state.title:draw()
love.graphics.print 'title'
end
state.gameplay = {}
function state.gameplay:keypressed(key)
if key == 'return' then
manager:enter(state.title)
elseif key == 'space' then
manager:push(state.pause)
end
end
function state.gameplay:pause(...)
print('pause', ...)
end
function state.gameplay:resume(...)
print('resume', ...)
end
function state.gameplay:draw()
love.graphics.print 'gameplay'
end
state.pause = {}
function state.pause:keypressed(key)
manager:pop(love.math.random(), love.math.random())
end
function state.pause:draw()
love.graphics.print 'pause'
end
function love.load()
manager:hook()
manager:enter(state.title)
end
function love.keypressed(key)
if key == 'escape' then love.event.quit() end
end