Forum Discussion

renojim's avatar
renojim
Community Streaming Expert
14 years ago

roScreen, screen saver and Roku 2

I hope I'm doing something wrong, but if I have an roScreen open and the screen saver kicks in the screen basically is frozen once the screen saver is dismissed. The code still appears to be operating properly, but no updates appear on the screen. On a 1st generation unit everything works just fine (including getting the screen saver to display instead of just a blank screen). Here's some basic code that illustrates the problem:
Sub RunUserInterface()
screenFacade = CreateObject("roPosterScreen")
screenFacade.showMessage("")
screenFacade.show()
port = CreateObject("roMessagePort")
screenFacade.SetMessagePort(port)

di = CreateObject("roDeviceInfo")
m.dsize = di.GetDisplaySize()
if m.dsize.w = 1280 then
m.screen = CreateObject("roScreen")
else
m.screen = CreateObject("roScreen",false,640,480)
end if
if type(m.screen) <> "roScreen"
print "Unable to open screen"
return
end if

m.screen.SetPort(port)
m.screen.SetAlphaEnable(true)
m.screen.Clear(&h108010FF)
m.screen.Finish()

m.compositor = CreateObject("roCompositor")
m.compositor.SetDrawTo(m.screen, &h108010FF)

bm = CreateObject("roBitmap", {width:50, height:50, AlphaEnable:true})
bm.Clear(&h801010FF)
region = CreateObject("roRegion",bm,0,0,bm.GetWidth(),bm.GetHeight())
sprite = m.compositor.NewSprite(0,0,region)
print type(sprite)

while true
msg = wait(1000,port)
print "Moving..."
sprite.MoveTo(rnd(m.dsize.w-bm.GetWidth()),rnd(m.dsize.h-bm.GetHeight()))
m.compositor.Draw()
m.screen.Finish()
end while
End Sub

-JT

1 Reply

  • destruk's avatar
    destruk
    Streaming Star
    On roku2 if you change your .finish() to .swapbuffers() then it loses the background color but the sprite still animates after returning from the screensaver. --confirmed it stops updating the visible screen after returning from the screensaver if you're using .finish()