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

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.

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)

“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).

You need to also call the routine to set the theme.

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

“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.

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

“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.

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

“brocker” wrote:
I basically just stole code from other projects and now it’s displaying

That’s actually the best way to go about learning the framework and how to customize it for your projects. Good luck with your investigations!

Why do the example init the theme before displaying the screen? Can’t the roAppManager be set before creating the screen?

I am centralizing all my themes to one initTheme function in the appMain file. I am not using them for each screen. Is this a bad idea?

“guidamedia2” wrote:
Why do the example init the theme before displaying the screen? Can’t the roAppManager be set before creating the screen?

I am centralizing all my themes to one initTheme function in the appMain file. I am not using them for each screen. Is this a bad idea?
I’ve read your post several times now, and can’t quite figure out what you’re asking. All three of your questions seem to contradict one another. You have to initialize your theme before displaying a screen, otherwise it won’t have the theme applied to it. And generally speaking, your theme should be centralized. There are very few situations where you’d want different themes for different screens.

In the examples in the SDK, they have the initializing of the screen in a separate function. I was wondering, beside organizing code, if there is an advantage to that.

“guidamedia2” wrote:
In the examples in the SDK, they have the initializing of the screen in a separate function. I was wondering, beside organizing code, if there is an advantage to that.
Not really. It just makes it easier to manage.