forked from xuxiandi/LoveFrames-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.lua
81 lines (53 loc) · 1.48 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
function love.load()
tween = require("libraries.third-party.tween")
loveframes = require("libraries.loveframes")
require("libraries.demo")
bgimage = love.graphics.newImage("resources/images/bg.png")
end
function love.update(dt)
loveframes.update(dt)
tween.update(dt)
end
function love.draw()
local width = love.graphics.getWidth()
local height = love.graphics.getHeight()
local scalex = width/bgimage:getWidth()
local scaley = height/bgimage:getHeight()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(bgimage, 0, 0, 0, scalex, scaley)
loveframes.draw()
end
function love.mousepressed(x, y, button)
loveframes.mousepressed(x, y, button)
local hoverobject = loveframes.hoverobject
if hoverobject and hoverobject.menu_example and button == "r" then
if hoverobject.menu then
hoverobject.menu:Remove()
hoverobject.menu = nil
end
createMenus(x, y)
end
end
function love.mousereleased(x, y, button)
loveframes.mousereleased(x, y, button)
end
function love.wheelmoved(x, y)
loveframes.wheelmoved(x, y)
end
function love.keypressed(key, isrepeat)
loveframes.keypressed(key, isrepeat)
if key == "f1" then
local debug = loveframes.config["DEBUG"]
loveframes.config["DEBUG"] = not debug
elseif key == "f2" then
loveframes.util.RemoveAll()
demo.CreateToolbar()
demo.CreateExamplesList()
end
end
function love.keyreleased(key)
loveframes.keyreleased(key)
end
function love.textinput(text)
loveframes.textinput(text)
end