@@ -13,16 +13,16 @@ sub init()
13
13
14
14
' Caption Style
15
15
m .fontSizeDict = { "Default" : 60 , "Large" : 60 , "Extra Large" : 70 , "Medium" : 50 , "Small" : 40 }
16
- m .percentageDict = { "Default" : 1.0 , "100%" : 1.0 , "75%" : 0.75 , "25%" : 0.25 , "Off" : 0 }
16
+ m .percentageDict = { "Default" : 1.0 , "100%" : 1.0 , "75%" : 0.75 , "50%" : 0.5 , " 25%" : 0.25 , "Off" : 0 }
17
17
m .textColorDict = { "Default" : & HFFFFFFFF , "White" : & HFFFFFFFF , "Black" : & H000000FF , "Red" : & HFF0000FF , "Green" : & H008000FF , "Blue" : & H0000FFFF , "Yellow" : & HFFFF00FF , "Magenta" : & HFF00FFFF , "Cyan" : & H00FFFFFF }
18
- m .outlColorDict = { "Default" : & H000000FF , "White" : & HFFFFFFFF , "Black" : & H000000FF , "Red" : & HFF0000FF , "Green" : & H008000FF , "Blue" : & H0000FFFF , "Yellow" : & HFFFF00FF , "Magenta" : & HFF00FFFF , "Cyan" : & H00FFFFFF }
18
+ m .bgColorDict = { "Default" : & H000000FF , "White" : & HFFFFFFFF , "Black" : & H000000FF , "Red" : & HFF0000FF , "Green" : & H008000FF , "Blue" : & H0000FFFF , "Yellow" : & HFFFF00FF , "Magenta" : & HFF00FFFF , "Cyan" : & H00FFFFFF }
19
19
20
20
m .settings = CreateObject ("roDeviceInfo " )
21
21
m .fontSize = m .fontSizeDict [m .settings .GetCaptionsOption ("Text/Size" )]
22
22
m .textColor = m .textColorDict [m .settings .GetCaptionsOption ("Text/Color" )]
23
23
m .textOpac = m .percentageDict [m .settings .GetCaptionsOption ("Text/Opacity" )]
24
- m .outlColor = m .outlColorDict [m .settings .GetCaptionsOption ("Background/Color" )]
25
- m .outlOpac = m .percentageDict [m .settings .GetCaptionsOption ("Background/Opacity" )]
24
+ m .bgColor = m .bgColorDict [m .settings .GetCaptionsOption ("Background/Color" )]
25
+ m .bgOpac = m .percentageDict [m .settings .GetCaptionsOption ("Background/Opacity" )]
26
26
setFont ()
27
27
end sub
28
28
@@ -57,27 +57,37 @@ function newlabel(txt):
57
57
label = CreateObject ("roSGNode " , "Label" )
58
58
label .text = txt
59
59
label .font = m .font
60
- label .color = m .outlColor
61
- label .opacity = m .outlOpac
62
- label .height = 108
60
+ label .color = m .textColor
61
+ label .opacity = m .textOpac
63
62
return label
64
63
end function
65
64
66
- function newlayout (labels )
67
- invis = CreateObject ("roSGNode " , "Label" )
68
- invis .visible = False
69
- l = labels .count ()
65
+ function newLayoutGroup (labels )
70
66
newlg = CreateObject ("roSGNode " , "LayoutGroup" )
71
- for i = 0 to 7 - l
72
- newlg .appendchild (invis .clone (True ))
73
- end for
74
67
newlg .appendchildren (labels )
75
68
newlg .horizalignment = "center"
76
69
newlg .vertalignment = "bottom"
77
-
78
70
return newlg
79
71
end function
80
72
73
+ function newRect (lg )
74
+ rectLG = CreateObject ("roSGNode " , "LayoutGroup" )
75
+ rectxy = lg .BoundingRect ()
76
+ rect = CreateObject ("roSGNode " , "Rectangle" )
77
+ rect .color = m .bgColor
78
+ rect .opacity = m .bgOpac
79
+ rect .width = rectxy .width + 50
80
+ rect .height = rectxy .height
81
+ if lg .getchildCount () = 0
82
+ rect .width = 0
83
+ rect .height = 0
84
+ end if
85
+ rectLG .horizalignment = "center"
86
+ rectLG .vertalignment = "bottom"
87
+ rectLG .appendchild (rect )
88
+ return rectLG
89
+ end function
90
+
81
91
82
92
sub updateCaption ()
83
93
m .top .currentCaption = []
@@ -94,19 +104,9 @@ sub updateCaption ()
94
104
for each text in texts
95
105
labels .push (newlabel (text ))
96
106
end for
97
- lg = newlayout (labels )
98
- lglist = []
99
- coords = [[- 1 , - 1 ], [- 1 , 0 ], [- 1 , 1 ], [0 , - 1 ], [0 , 1 ], [1 , - 1 ], [1 , 0 ], [1 , 1 ], [0 , 0 ]]
100
- for p = 0 to 8
101
- lgg = lg .clone (True )
102
- lgg .translation = [coords [p ][0 ] * 5 , coords [p ][1 ] * 5 ]
103
- lglist .push (lgg )
104
- end for
105
- for q = 0 to 7
106
- lglist [8 ].getchild (q ).color = m .textColor
107
- lglist [8 ].getchild (q ).opacity = m .textOpac
108
- end for
109
- m .top .currentCaption = lglist
107
+ lines = newLayoutGroup (labels )
108
+ rect = newRect (lines )
109
+ m .top .currentCaption = [rect , lines ]
110
110
else if right (m .top .playerState , 4 ) = "Wait"
111
111
m .top .playerState = "playingOn"
112
112
else
0 commit comments