"happymeal" wrote:
Hello,
I'm new to Roku development and using Brightscript, but hopefully I'm not asking something that is too stupid. I've scoured the forums and documentation before asking and not come up with any answers yet. A lot of the examples that come with the SDK cover moving sprites, but none really appear to cover text
First of all, just a general outline of what I'm trying to achieve. I want to create my own text fields using an roScreen + drawText functions. I immediately noticed that the documentation stated drawText was expensive to render. What is the alternative to using drawText if my text is not static? I'm basically out to create something similar to the roPosterScreen without being restricted by its layout. i.e. when you use the arrow keys to move through options, the text updates.
I've managed this ok, however have come across my first stumbling block. The text spans across multiple lines, however drawText does not seem to want to draw it over more lines. Is it a case of having to draw each line of text independently using drawText? if so, are there any easier text components to use that handle the word wrapping for you? I've also noticed, it does not recognise the new lines or '\n' in my text.
I'll try not to add too many questions in my first post, but this would be a good start. Thanks in advance for anyone replying.
"happymeal" wrote:
Just on this front, I've not spent too long trying different solutions but am I right in saying I can treat an roBitmap object much like an roScreen and use my drawTexts\drawRects to that? Then I would use drawObject to draw that bitmap to my roScreen?
"TheEndless" wrote:"happymeal" wrote:
Just on this front, I've not spent too long trying different solutions but am I right in saying I can treat an roBitmap object much like an roScreen and use my drawTexts\drawRects to that? Then I would use drawObject to draw that bitmap to my roScreen?
You are correct. All three, roScreen, roBitmap, and roRegion implement the ifDraw2D interface. If you're trying to achieve a high framerate, be aware that drawing to a bitmap first, then drawing that bitmap to the screen will reduce the framerate if you're doing it every frame. On the flip side, if you're only drawing to the bitmap on the first frame and then reusing what was drawn, it should significantly improve the framerate.
"happymeal" wrote:This is the part that sounds perfect - how do you actually do this?
I've written my own textfield object which breaks texts across multi-lines. Rendering runs smoothly even drawing multiple lines of text to the screen every frame.
"happymeal" wrote:even means, let alone how to do it, or even why! Would this increase performance somehow?
rendering text onto sprites