-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.lua
More file actions
74 lines (64 loc) · 1.74 KB
/
Copy pathmain.lua
File metadata and controls
74 lines (64 loc) · 1.74 KB
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
DEBUG = true
WINDOW_PADDING = 10
SCROLL_SPEED = 400
if DEBUG then
require "lib.cupid"
end
require "lib.LoveFrames"
local game = require "game"
function love.load()
love.graphics.setNewFont(12)
love.graphics.setColor(255,255,255)
love.graphics.setBackgroundColor(0,0,0)
main_menue_bg = love.graphics.newImage('images/main_menu_background.jpg')
play_bg_image = love.graphics.newImage('images/play_background.png')
play_bg_image:setWrap("repeat", "repeat")
play_bg_quad = love.graphics.newQuad(0, 0, 1366, 768, play_bg_image:getWidth(), play_bg_image:getHeight())
other_bg = love.graphics.newImage('images/main_menu_background.jpg')
game:load()
end
function love.update(dt)
game.update(dt)
loveframes.update(dt)
end
function love.draw()
gamestate = loveframes.GetState()
if gamestate == "main_menu" then
love.graphics.draw(main_menue_bg)
elseif gamestate == "play" then
love.graphics.draw(play_bg_image, play_bg_quad, 0, 0)
else
love.graphics.draw(other_bg)
end
game.draw()
loveframes.draw()
end
function love.mousepressed(x, y, button)
game.mousepressed(x, y, button)
loveframes.mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
game.mousereleased(x, y, button)
loveframes.mousereleased(x, y, button)
end
function love.keypressed(key, unicode)
loveframes.keypressed(key, unicode)
end
function love.keyreleased(key)
gamestate = loveframes.GetState()
if gamestate == "main_menu" then
if key == "escape" then
love.event.push('quit')
end
elseif gamestate == "play" then
if key == "escape" then
game:save_map()
love.event.push('quit')
end
else
end
loveframes.keyreleased(key)
end
function love.textinput(text)
loveframes.textinput(text)
end