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: 
destruk
Streaming Star

Scenegraph Layout simplification?

For ease of editing, is it at all possible to have your main/brs source file that starts and exits scenegraph mode, and to simply have a single component to run the entire channel?  So the main.brs, a component folder, and within thatfolder have a single brs script and single xml file with all the screens nested in a total of 3 files?
Or is there some specific reason that every little thing needs a brs and xml file - for 10-20 separate component subfolders?

Alternately, is it possible to have multiple components specified in a single xml file?
0 Kudos
3 REPLIES 3
NB_
Roku Guru

Re: Scenegraph Layout simplification?

You can have as many files as you please or as few as your app needs allow.

  1. There is no need to do subfolders and that's likely counterproductive.

  2. You need one XML file per each custom component - that is necessary when modifying built-in behavior, e.g. to define `onKeyEvent()` handler for it or observer event handlers. Currently there is no way to create custom component w/o XML file - though minor things like adding or observing fields can be done from "outside" (another component/thread), using a "stock" component (no need to create custom)

  3. You don't need one BRS file per custom component, though that often is practical. Instead you could ostensibly include the brs code inside the xml. .brs files don't have to reside in the same folder, since you have to provide explicit URI anyway. And you can use more than one .brs per component (e.g. the same file included in multiple places like a library; but don't get carried away).
0 Kudos
destruk
Streaming Star

Re: Scenegraph Layout simplification?

Thanks RokuNB!  It looks like a much smarter system so I'll need to run some experiments with structure to find one I can more easily work with.
0 Kudos
EnTerr
Roku Guru

Re: Scenegraph Layout simplification?

Half a year ago i made strides toward "more humane" way of using RSG, see
https://forums.roku.com/viewtopic.php?f ... 85#p539269
I neither polished nor published my underlying code - but basically i confirmed a small wrapper library can be used to avoid subclassing in XML and do the work instead in pure B/S
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.