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: 

What is the best way to use roScreen?

I need to draw roScreen at 30 to 60 frames per second so what will be the best way to use roScreen?? Should it be CPU friendly or Memory friendly??

I have 4 images and a text line to draw on screen. 3 images remain same with every screen draw, 1 changes every 20 seconds, whereas text location is changed on every screen draw.

Here are the 2 approaches that I have in my mind:

1- Create roBitmap objects from images stored in tmp directory on every screen draw and pass to DrawScaledObject method. (Memory friendly but CPU utilization will be quite much I think)

screen.DrawScaledObject(x,y, xfactor, yfactor, CreateObject("roBitmap", "path to image file")) 'will be called for each image and text so 5 times in one screen draw

2- Create roBitmap objects from images and store them and change only when required (never for 3 images, after 20 seconds for 1 image, text will not be stored as image as it will be changed for every screen draw))

m.img1 = CreateObject("roBitmap", "img1")
m.img2 = CreateObject("roBitmap", "img2")
m.img3 = CreateObject("roBitmap", "img3")
m.img4 = CreateObject("roBitmap", "img4")

and in screen draw function

screen.DrawScaledObject(x,y, xfactor, yfactor, m.img1) 'same for other images


Although 2nd way seems more reasonable but I am also using roVideoPlayer along with roScreen so memory consumption can be the issue too which is the case in 2nd method.

So what is the better method to draw roScreen? Any suggestions are most welcome...
0 Kudos