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: 
360tv
Streaming Star

orScreen.Drawtext memory limitation? (or something)

so I'm working on a new thing using roScreen and drawing text on it, swapping buffers, and moving the x axis for the length [font.GetOneLineWidth(text, screen.GetWidth())] to give it a craw function along the bottom of the screen. At the same time, I have weather information along the side of the screen that updates periodically. I had everything working quite perfectly in a limited testing situation.
The problem I'm having is when I have a REALLY long string (1800 chars, or 13000px) , which is how I planned on having for a news craw, it'll lockup after a while, or somehow blank out other text I had rendered on the screen.

		else if (msg = invalid)
if (screensize = 1)
if (weathertimer.TotalSeconds() <= 30)
for each obj in weatherxml.overlay
screen.DrawText(obj.text.gettext(), strtoi(obj.X.gettext()), strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
'print weathertimer.totalseconds()
next
else if (weathertimer.totalseconds() > 30)
print "Weather marK"
for each obj in weatherxml.overlay
screen.DrawText(obj.text.gettext(), strtoi(obj.X.gettext()), strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
next
weatherxml.clear()
weathermark = 0
weathertimer.mark()
end if

if (newstimer.totalseconds() >= 2) and (newstimer.totalseconds() <= 6)
for each obj in newsxml.overlay
newscount = strtoi(obj.count.gettext())
screen.DrawText(obj.text.gettext(), strtoi(obj.X.gettext()), strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
next
else if (newstimer.totalseconds() >= 6) and (Xcrawl < newslenght +200 ) ' newslenght is font.GetOneLineWidth.
xcrawl = xcrawl + 1
print xcrawl
for each obj in newsxml.overlay
newscount = strtoi(obj.count.gettext())
screen.DrawText(obj.text.gettext() , strtoi(obj.X.gettext()) - xcrawl , strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
next
else if (Xcrawl >= (newslenght +200 ))
print xcrawl
print "News Mark"
newsxml.clear()
newstimer.mark()
newsmark = 0
xcrawl = 0
end if

screen.Clear(&h00000000)
screen.SwapBuffers()


this code works perfectly with a craw of about 150 char with the weather on screen coming to about 640 char. without the weather data on screen the craw can get to about 800 - 1000 char but will lock up after that. my Roku box also is slow to respond to input at that point.
0 Kudos
3 REPLIES 3
360tv
Streaming Star

Re: orScreen.Drawtext memory limitation? (or something)

So, I dunno... I moved screen.Clear(&h00000000) to the top of the loop and it's working.

else if (msg = invalid)
if (screensize = 1)
if (weathertimer.TotalSeconds() <= 30)
for each obj in weatherxml.overlay
screen.DrawText(obj.text.gettext(), strtoi(obj.X.gettext()), strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
'print weathertimer.totalseconds()
next
else if (weathertimer.totalseconds() > 30)
print "Weather marK"
for each obj in weatherxml.overlay
screen.DrawText(obj.text.gettext(), strtoi(obj.X.gettext()), strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
next
weatherxml.clear()
weathermark = 0
weathertimer.mark()
end if

if (newstimer.totalseconds() >= 2) and (newstimer.totalseconds() <= 6)
for each obj in newsxml.overlay
newscount = strtoi(obj.count.gettext())
screen.DrawText(obj.text.gettext(), strtoi(obj.X.gettext()), strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
next
else if (newstimer.totalseconds() >= 6) and (Xcrawl < newslenght +200 ) ' newslenght is font.GetOneLineWidth.
xcrawl = xcrawl + 1
print xcrawl
for each obj in newsxml.overlay
newscount = strtoi(obj.count.gettext())
screen.DrawText(obj.text.gettext() , strtoi(obj.X.gettext()) - xcrawl , strtoi(obj.Y.gettext()), &hFFFFFFFF, font)
next
else if (Xcrawl >= (newslenght +200 ))
print xcrawl
print "News Mark"
newsxml.clear()
newstimer.mark()
newsmark = 0
xcrawl = 0
end if

screen.Clear(&h00000000)
screen.SwapBuffers()
0 Kudos
RokuJoel
Binge Watcher

Re: orScreen.Drawtext memory limitation? (or something)

if screen.clear() is the last thing before you call swapbuffers in each iteration in your loop, I'm surprised you were seeing anything at all on the screen, since that would be the last draw operation, unless you are calling swapbuffers somewhere else in the loop as well.

- Joel
0 Kudos
360tv
Streaming Star

Re: orScreen.Drawtext memory limitation? (or something)

I might have been. I've just started using orScreen a week ago. So I'm learning how to use it.
0 Kudos