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

Demos - initTheme()

Hey All,

So going through the demos, I'm trying to figure out how to get my images to display on the Roku channel I'm developing. I really only see one application that sets images beyond the default colors, and it's the SimpleVideoPlayer app. Looking at the code, I see the initTheme() called, which sets the images (in fact I see this method in most demos). When I copy this code into my project, no images are set when the project loads. Is there another step that needs to happen to get the images to display?

Here is what the initTheme() method does:

Sub initTheme()

app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")

theme.OverhangOffsetSD_X = "72"
theme.OverhangOffsetSD_Y = "25"
theme.OverhangSliceSD = "pkg:/images/Overhang_BackgroundSlice_Blue_SD43.png"
theme.OverhangLogoSD = "pkg:/images/Logo_Overhang_Roku_SDK_SD43.png"

theme.OverhangOffsetHD_X = "123"
theme.OverhangOffsetHD_Y = "48"
theme.OverhangSliceHD = "pkg:/images/Overhang_BackgroundSlice_Blue_HD.png"
theme.OverhangLogoHD = "pkg:/images/Logo_Overhang_Roku_SDK_HD.png"

app.SetTheme(theme)

End Sub


Thanks
Bud
0 Kudos
14 REPLIES 14
TheEndless
Channel Surfer

Re: Demos - initTheme()

Maybe a silly question, but do you have you images named the same and in the same path as specified in the code?

For example:
"pkg:/images/Overhang_BackgroundSlice_Blue_SD43.png"

is looking for an image named "Overhang_BackgroundSlice_Blue_SD43.png" in the "images" folder under the root of your zipped package.
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
stratcat96
Visitor

Re: Demos - initTheme()

as Endless said, basically if you just copied the code to your own project leaving the package of the example behind, you need to repoint to the sources of your own images (and have them in a folder within your zip file)
0 Kudos

Re: Demos - initTheme()

"brocker" wrote:
I'm trying to figure out how to get my images to display on the Roku channel I'm developing.


The images that show up on the channel list screen are specified in the manifest file.
mm_icon_focus_hd=pkg:/images/mm_icon_focus_hd.png
mm_icon_side_hd=pkg:/images/mm_icon_side_hd.png
mm_icon_focus_sd=pkg:/images/mm_icon_focus_sd.png
mm_icon_side_sd=pkg:/images/mm_icon_side_sd.png

The theme is used to set the logo and overhang images at the top of the screen once someone has selected your channel from the channel list (such as for the roPosterScreen object).
0 Kudos
destruk
Streaming Star

Re: Demos - initTheme()

You need to also call the routine to set the theme.
0 Kudos
brocker
Visitor

Re: Demos - initTheme()

Thanks folks,

So yes, I changed the images to be my own, but posted the demo code so it would be familiar. Sorry for the confusion.

Destruk - What is the routine to set the theme? I was guessing that the "initTheme()" simply tells the Roku box what the images are, but that there then is a method that sets the theme to the UI when called. It's that second piece that I'm not fully understanding.

I see in the demos, there is a method called "showHomeScreen" that has different logic in each project, so not 100% positive of the SIMPLEST way to set the theme.

Is that something you can point me to?

Thanks!
Bud
0 Kudos
TheEndless
Channel Surfer

Re: Demos - initTheme()

"brocker" wrote:
Thanks folks,

So yes, I changed the images to be my own, but posted the demo code so it would be familiar. Sorry for the confusion.

Destruk - What is the routine to set the theme? I was guessing that the "initTheme()" simply tells the Roku box what the images are, but that there then is a method that sets the theme to the UI when called. It's that second piece that I'm not fully understanding.

I see in the demos, there is a method called "showHomeScreen" that has different logic in each project, so not 100% positive of the SIMPLEST way to set the theme.

Is that something you can point me to?

Thanks!
Bud

I'm not destruk, but... typically, the call to initTheme() should be the first call in your Main/RunUserInterface routine. In the SimpleVideoPlayer example, you'll see that call on line 8 of appMain.brs.

The name "initTheme" isn't inherent or special. It's just what the example author chose to call it, because that's what it does. The same is true for the "showHomeScreen" method. It's just a descriptive name that the author chose, that in most of the examples contains the code that displays the main screen of the channel/app.

Aside from the entry points Main, RunUserInterface, RunScreenSaver, and RunScreenSaverSettings (see section 2.5 of the component reference), any functions you define in your code need to be explicitly called by your code.
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
brocker
Visitor

Re: Demos - initTheme()

Awesome, thanks Endless!

So in the SimpleVideoPlayer, after initTheme() is called, it then calls showSprintboardScreen(), which looks like it does the actual placement of images into the UI, specifically with the "screen.SetContent()". Is this a correct assesment?

Thanks
Bud
0 Kudos
TheEndless
Channel Surfer

Re: Demos - initTheme()

"brocker" wrote:
Awesome, thanks Endless!

So in the SimpleVideoPlayer, after initTheme() is called, it then calls showSprintboardScreen(), which looks like it does the actual placement of images into the UI, specifically with the "screen.SetContent()". Is this a correct assesment?

Thanks
Bud

Not quite. The call to initTheme actually pulls the images into the UI. The "screenFacade" lines display a "retrieving..." screen while the channel is loading, and that screen should have all of the images that you set in the initTheme function. If you experiment with moving the initTheme call before and after the screenFacade lines, you can see the difference. The call to "showSpringboardScreen" creates and displays the details screen for the video in the example. The "SetContent" tells the springboard what information to show on that details screen. Section 4.4 of the component reference explains how that information is displayed.
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
brocker
Visitor

Re: Demos - initTheme()

Thanks again. So I've been working with it and think I have it working, but to be honest not 100% why. I basically just stole code from other projects and now it's displaying, but I'll go back to 4.4 and read that as I'd like to understand what's happening.

Best
Bud
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.