-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
52 lines (44 loc) · 1.5 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
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Your code here
local widget = require("widget")
local slide = require("modules.slide_menu")
local toast = require("modules.toast")
local _W = display.contentWidth
-- { "image/btn.png", "image/btn_press.png", "image/btn2.png" }
--local data = { default = "image/btn.png", over = { "image/btn_press.png", "image/btn.png", "image/btn2_press.png" }, text = { "a", "b", "c" } }
local group = display.newGroup()
local data = {}
data.over = {}
data.default = {}
data.text = {}
data.bg = "image/bgstyle2.png"
data.back_image_press = "image/back_press.png"
data.back_image = "image/back.png"
data.event = function() print("123"); toast.new("123", 3000) return true end
for i = 1, 6 do
local name = "image/slide_menu" .. i .. ".png"
local name2 = "image/slide_menu" .. i .. "_press.png"
table.insert(data.over, name2)
table.insert(data.default, name)
table.insert(data.text, "text" .. i)
end
local function back_event(e)
print(e.phase)
if ("ended" == e.phase) then
slide:show_slide_menu()
end
end
local back_button = widget.newButton{
defaultFile = data.back_image,
overFile = data.back_image_press,
-- label = "button",
onEvent = back_event,
}
back_button.y = 0
back_button.x = _W - back_button.width * 0.5
group:insert(back_button)
group:insert(slide:new(data))