-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangelog.lua
49 lines (42 loc) · 1.07 KB
/
changelog.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
local changelog = {}
local changebanner;
local selection;
local pointer;
local function menu()
mode = require 'menu'
mode.load()
end
local options = {
{['text'] = 'Return to Menu', ['action'] = menu},
{['text'] = 'Exit Game', ['action'] = love.event.quit}
}
function changelog.load()
background = love.graphics.newImage(MAINBG)
changebanner = love.graphics.newImage(CHANGELOG)
selection = 1
pointer = love.graphics.newImage(POINTER)
mode = changelog
end
function changelog.draw()
love.graphics.draw(background)
love.graphics.draw(changebanner, 400,10)
for i=1,#options do
if i == selection then
love.graphics.draw(pointer, 500, 470 + i * 30)
end
love.graphics.printf(options[i].text,0,470 + i * 30, love.graphics.getWidth(), 'center')
end
end
function changelog.update()
return mode
end
function changelog.keypressed(key)
if key == 'up' then
selection = (selection - 2) % (#options) + 1
elseif key == 'down' then
selection = (selection) % (#options) + 1
elseif key == 'return' then
options[selection].action()
end
end
return changelog