-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.lua
117 lines (89 loc) · 2.35 KB
/
input.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
input = {}
function input.keypressed(pressed_key)
if screen.state == "info" then
-- if pressed_key == "return" or pressed_key == "escape" or pressed_key == "space" then
-- game.map()
-- return
-- end
choice.update(pressed_key)
return
end
-- if pressed_key == 'escape' then
-- love.event.quit()
-- return
-- end
if screen.state == "title" then
game.info(text.header[1], text.info[1])
sound.stop(sound.intro)
sound.play(sound.start)
return
end
if screen.state == "file" then
game.map()
return
end
if screen.state == "intro" then
game.logo()
return
end
if screen.state == "logo" then
game.title()
return
end
if screen.state == "death" then
love.load()
game.title()
return
end
if screen.state == "terminal" then
if pressed_key == "left" or pressed_key == "right" then
cursor.move(pressed_key)
elseif pressed_key == "up" or pressed_key == "down" then
terminal.move(pressed_key)
elseif pressed_key == "backspace" then
terminal.erase()
elseif pressed_key == "return" then
terminal.enter()
elseif pressed_key == "escape" then
game.map()
end
return
end
if screen.state == "map" then
if pressed_key == "tab" then
--screen.tip.help = false
if screen.tip.show == true then
sound.tip.hide:seek(0)
sound.tip.hide:play()
screen.tip.show = false
else
sound.tip.show:seek(0)
sound.tip.show:play()
screen.tip.show = true
end
return
end
if pressed_key == "escape" then
game.terminal()
return
end
if pressed_key == "space" then
cycle.switch()
turn.next()
return
end
if pressed_key == "f" then
fog.switch()
return
end
player.keypressed(pressed_key)
return
end
end
function input.textinput(text)
if screen.state == "terminal" then
terminal.write(text)
end
end
function input.update(dt)
end