I am trying to go between a 2D screen and a built in roku screen (roSearchScreen). The code I wrote below demonstrates the concept and actually works, but intermediately it gets stuck on the search screen. Anyone know what I am doing wrong ?
Library "v30/bslCore.brs"
Function Main() As Void
device = CreateObject("roDeviceInfo")
displaySize = device.GetDisplaySize()
screen = CreateObject("roScreen", True)
msgport = CreateObject("roMessagePort")
screen.SetMessagePort(msgport)
compositor = CreateObject("roCompositor")
compositor.SetDrawTo( screen, &h000000FF )
overhangColorBmp = CreateObject("roBitmap", {width: displaySize.w, height: 121, AlphaEnable: false} )
overhangColorBmp.Clear ( RGBA_to_int( 232, 232, 73, 255) )
overhangregion = CreateObject("roRegion", overhangColorBmp, 0, 0, displaySize.w, 121)
compositor.NewSprite(0, 0, overhangregion)
compositor.DrawAll()
screen.swapbuffers()
codes = bslUniversalControlEventCodes()
' Start our event loop
while true
msg = Wait(0, msgport)
if type(msg) = "roUniversalControlEvent" then
keypressed = msg.GetInt()
if keypressed = codes.BUTTON_UP_PRESSED then
ShowSearchScreen()
print "Exited Search Screen"
compositor.DrawAll()
screen.swapbuffers()
end if
end if
end while
End Function
Function ShowSearchScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roSearchScreen")
screen.SetMessagePort(port)
screen.Show()
' search screen main event loop
done = false
while done = false
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSearchScreenEvent"
screen.Close()
done = true
endif
endwhile
End Function
Function RGBA_to_int(R, G, B, A) As Integer
return &h1000000*R + &h10000*G + &h100*B + A
End Function