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: 
jlfreund
Visitor

DrawText on roScreen

Hi,

I have an app with an roScreen, and I can do a DrawRect, DrawObject, and DrawScaledObject successfully, however when I try DrawText, I get no output from that call.

    screen = CreateObject("roScreen", true, 1280, 720)
fontReg = CreateObject("roFontRegistry")
font = fontReg.GetDefaultFont()
screen.DrawText("Hello", 100, 100, &hFF00FF00, font)
screen.SwapBuffers()


also tried drawing text into a region (like the simple2D example) but still no output.

    drawingRegion = dfSetupDisplayRegions(screen, 100, 100, 400, 60)
s = drawingRegion.main
s.DrawText("Hello", 100, 100, &hFF00FF00, font)


It's odd that the font and fontReg variables don't seem to contain anything when printing with printAA. However I get the same output from the simple2d sample code -- which does display text correctly.

---- AA ----
Nothing from for each. Looks like : ?roFontRegistry?
------------
---- AA ----
Nothing from for each. Looks like : ?roFont?
------------


Any suggestions for getting DrawText to work?
0 Kudos
3 REPLIES 3
RokuMarkn
Visitor

Re: DrawText on roScreen

Colors are specified in RGBA order. So your color &hFF00FF00 is completely transparent. Try using FF in the low order byte.

--Mark
0 Kudos
TheEndless
Channel Surfer

Re: DrawText on roScreen

"RokuMarkn" wrote:
Colors are specified in RGBA order. So your color &hFF00FF00 is completely transparent. Try using FF in the low order byte.

--Mark

It's worth pointing out that this is the opposite of colors used on an roImageCanvas, which is ARGB.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jlfreund
Visitor

Re: DrawText on roScreen

Thanks! I was porting my layout code from roImageCanvas (which was too slow for my application). changing the color format fixed it.
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.