"skitdev" wrote:
I'm not sure why it was necessary, but it appears to be the culprit. I can set layers to invalid or use clearLayer to clear them away.
"NewManLiving" wrote:
zOrder is a z-order specifier with higher z-orders closer to the viewer. Negative z-orders are "behind the display" and are thus invisible
Sub Main()
hideL = -1 ' ? Behind the video plane
backL = 0
helloL = 1
videoL = 2 ' Transparent layer is 2
coverL = 3
playerRect = { x: 120, y: 250, w: 380, h:212 }
punchRect = playerRect
coverRect = { x: playerRect.x + 75, y: playerRect.y + 75 , w: playerRect.w - 150, h: playerRect.h - 150 }
back = { Color:"#FFFFFFFF", CompositionMode:"Source"}
hello ={
Text:"Press Ok To Toggle, Back To Exit"
TextAttrs:{Color:"#FFCCCCCC", Font:"Medium",
HAlign:"HCenter", VAlign:"VCenter",
Direction:"LeftToRight"}
TargetRect:{x:450,y:325,w:500,h:60}
}
video = {
Color: "#00000000"
TargetRect: punchRect
CompositionMode: "Source" }
cover = {
Color: "#FFFFFFFF"
TargetRect: coverRect
CompositionMode: "Source" }
content = {
Stream: {
url: "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"
}
StreamFormat: "hls"
SwitchingStrategy: "full-adaptation"
}
canvas = CreateObject( "roImageCanvas" )
port = CreateObject( "roMessagePort" )
canvas.SetMessagePort(port)
VPlayer = CreateObject( "roVideoPlayer" )
VPlayer.SetMessagePort( port )
VPlayer.SetDestinationRect( playerRect )
VPlayer.AddContent( content )
canvas.SetLayer( backL , back )
canvas.SetLayer( videoL, video )
canvas.SetLayer( helloL, hello )
canvas.SetLayer( coverL, cover )
coverShowing = True
canvas.Show()
VPlayer.Play()
while(true)
msg = wait(0,port)
if type(msg) = "roImageCanvasEvent" then
if (msg.isRemoteKeyPressed()) then
i = msg.GetIndex()
print "Key Pressed - " ; msg.GetIndex()
if (i = 0) then
' Up - Close the screen.
VPlayer.Stop()
canvas.close()
else if i = 6
canvas.AllowUpdates( False )
if coverShowing
canvas.ClearLayer( coverL )
canvas.SetLayer( hideL, cover )
else
canvas.SetLayer( coverL, cover )
end if
coverShowing = not coverShowing
canvas.AllowUpdates( True )
canvas.Show()
end if
else if (msg.isScreenClosed()) then
print "Closed"
return
end if
else if type(msg) = "roVideoPlayerEvent" then
print msg.GetIndex(), msg.GetMessage()
end if
end while
"NewManLiving" wrote:
By the way, this also applies to sprite z orders in roScreen. Fankly, I don't think that negative sprites and layers are even drawn, what would be the point ? In the example would one use both clear and then set the cleared layer to a negative layer ? Of course not, but it demonstrates that you can have negative layers under the transparent video layer. However, you can also swap into a negative layer with the same results
hideL = 9 ' ? Behind the Background Source plane
backL = 10
helloL = 11
videoL = 12 ' Transparent layer is 12
coverL = 13
"NewManLiving" wrote:
SetLayer(zOrder as Integer, contentMetaData as Object) as Void
zOrder is a z-order specifier with higher z-orders closer to the viewer. Negative z-orders are "behind the display" and are thus invisible
if(code = 6)'OK ' Code needs to be 6 for allowupdates to ever be false. So if code is not 6 then allowupdates false will never be called
canvas.allowUpdates(false)
canvas.allowUpdates(true)
canvas.show()
Now you may be testing this and therefore have your code set up that way, but allowupdates is set to false only when code = 6 and then turned right back on again at the bottom where there is no check on any code so if the user presses another key outside of the ones you check for then the bottom two lines will be called for every other button that is pressed as well
For example if you pressed 6 then allowupdates = false , but set right back to true at the bottom where it falls out of the if statement. Then if you press 3 allowupdates = false will never get called because you did not press 6, but it will always get set right back to true again at the bottom of the if statement
at the top allowupdates false will never be called if you press any other button but 6,
"TheEndless" wrote:"NewManLiving" wrote:
By the way, this also applies to sprite z orders in roScreen. Fankly, I don't think that negative sprites and layers are even drawn, what would be the point ? In the example would one use both clear and then set the cleared layer to a negative layer ? Of course not, but it demonstrates that you can have negative layers under the transparent video layer. However, you can also swap into a negative layer with the same results
Actually, that's a function of you having a fullscreen layer with a CompositionMode of "Source" on top of the negative layer, which will replace any pixels that are behind it. It is not putting the layers behind the video plane, but rather under that Source layer. You'll get the same results if you move all of your layers forward.. For example:hideL = 9 ' ? Behind the Background Source plane
backL = 10
helloL = 11
videoL = 12 ' Transparent layer is 12
coverL = 13
"skitdev" wrote:
This is the part that I think I'm having trouble understanding. When you specify a layer as "source" what is using as the source?