forked from gessl/urMus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurTapper.lua
More file actions
108 lines (88 loc) · 3.12 KB
/
Copy pathurTapper.lua
File metadata and controls
108 lines (88 loc) · 3.12 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
-- urTapperware.lua
-- scratch pad for new stuff to add to urVen2, borrowed heavily from urVen code
-- focus on using touch for programming, avoid menu or buttons
-- A multipurpose non-programming environment aimed towards giving the user the ability
-- To create a increasingly more complex application without any coding on the users side.
-- The basis of the script is contained in this file while most of the features are contained
-- the accompianing scripts, listed below.
-- ==================================
-- = setup Global var and constants =
-- ==================================
CREATION_MARGIN = 40 -- margin for creating via tapping
INITSIZE = 140 -- initial size for regions
MENUHOLDWAIT = 0.5 -- seconds to wait for hold to menu
FADEINTIME = .2 -- seconds for things to fade in, TESTING for now
EPSILON = 0.001 --small number for rounding
FreeAllRegions()
showMenu = false
dofile(SystemPath("urTapperMenu.lua"))
-- ============
-- = Backdrop =
-- ============
function TouchDown(self)
end
function TouchUp(self)
local x,y = InputPosition()
if showMenu == true then
menu:dismiss()
showMenu = false
return
end
if x>CREATION_MARGIN and x<ScreenWidth()-CREATION_MARGIN and
y>CREATION_MARGIN and y<ScreenHeight()-CREATION_MARGIN then
cmdlist = {{'move',test,'hello this is ok'},
{'resize',test,'yes very good'},
{'increment',test,'not in the least'},
{'cancel',dismissMenu,nil}}
menu = loadSimpleMenu(cmdlist, 'Select an action to evoke')
menu:present(x,y)
showMenu = true
end
end
function test(message)
DPrint(message)
end
function dismissMenu()
menu:dismiss()
showMenu = false
end
function Move(self)
-- menu:dismiss()
end
function Leave(self)
end
backdrop = Region('region', 'backdrop', UIParent)
backdrop:SetWidth(ScreenWidth())
backdrop:SetHeight(ScreenHeight())
backdrop:SetLayer("BACKGROUND")
backdrop:SetAnchor('BOTTOMLEFT',0,0)
backdrop:Handle("OnTouchDown", TouchDown)
backdrop:Handle("OnTouchUp", TouchUp)
backdrop:Handle("OnDoubleTap", DoubleTap)
backdrop:Handle("OnEnter", Enter)
backdrop:Handle("OnLeave", Leave)
backdrop:Handle("OnMove", Move)
backdrop:EnableInput(true)
backdrop:SetClipRegion(0,0,ScreenWidth(),ScreenHeight())
backdrop:EnableClipping(true)
backdrop.player = {}
-- backdrop.t = backdrop:Texture("tw_gridback.jpg")
backdrop.t = backdrop:Texture("tw_paperback.jpg")
backdrop.t:SetTexCoord(0,ScreenWidth()/1024.0,1.0,0.0)
backdrop.t:SetBlendMode("BLEND")
backdrop:Show()
----------------- v11.pagebutton -------------------
local pagebutton=Region('region', 'pagebutton', UIParent)
pagebutton:SetWidth(pagersize)
pagebutton:SetHeight(pagersize)
pagebutton:SetLayer("TOOLTIP")
pagebutton:SetAnchor('BOTTOMLEFT',ScreenWidth()-pagersize-4,ScreenHeight()-pagersize-4)
pagebutton:EnableClamping(true)
pagebutton:Handle("OnTouchDown", FlipPage)
pagebutton.texture = pagebutton:Texture("circlebutton-16.png")
pagebutton.texture:SetGradientColor("TOP",255,255,255,255,255,255,255,255)
pagebutton.texture:SetGradientColor("BOTTOM",255,255,255,255,255,255,255,255)
pagebutton.texture:SetBlendMode("BLEND")
pagebutton.texture:SetTexCoord(0,1.0,0,1.0)
pagebutton:EnableInput(true)
pagebutton:Show()