Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
renojim
Community Streaming Expert

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
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
1 REPLY 1
destruk
Streaming Star

Re: roScreen, screen saver and Roku 2

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()
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.