-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
75 lines (62 loc) · 1.5 KB
/
Copy pathmain.lua
File metadata and controls
75 lines (62 loc) · 1.5 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
75
buttos = require 'buttos';
buttos.setSound("clicked.wav")
buttos.setPush(3)
_G.getOS = love.system.getOS()
local function mainConf(d)
if d.getOS == "Android" then
love.window.setFullscreen(true)
end
love.window.setTitle("Buttos example on "..d.getOS)
screenx,screeny = love.graphics.getDimensions()
end
--//
local bucket = {index=1}
bucket[1] = function()
local w,h = 120,50
local x,y = (screenx-w)/2,(screeny-h)/2
local btn = buttos.Button("Click Me!",x,y,w,h)
return btn
end
bucket[2] = function() local b = false
local w,h = 200,50
local x,y = (screenx-w)/2,(screeny-h)/2
buttos.SetBox(x,y,2,1,w,h,function(content)
content("I'm a Label!", 1,1, {label=true})
if content("Continue", 2,1) then
b = true
end
end)
return b
end
bucket[3] = function() local b = false
local w,h = 200,100
local x,y = (screenx-w)/2,(screeny-h)/2
buttos.SetBox(x,y,3,3,w,h,function(content)
content("I can streech like this",{{1,1}, {1,3}},0,{label=true})
content("Hi", {{2,1},{3,1}},0,{label=true})
if content("Click me:)", {{2,2}, {3,3}},0) then
bucket.index = 1
end
end)
end
function love.load()
mainConf(_G)
end
function love.update(dt)
local click = bucket[bucket.index]()
if click then
bucket.index = bucket.index + 1
end
end
function love.draw()
buttos.draw()
end
function love.touchpressed(...)
buttos.pressed(...)
end
function love.touchmoved(...)
buttos.moved(...)
end
function love.touchreleased(...)
buttos.released(...)
end