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: 
RokuJoel
Binge Watcher

Re: roscreen grid

"NewManLiving" wrote:
My apologies first to the moderators for including all this code.


Posting Code is a good thing.

- Joel
0 Kudos
sanyam
Visitor

Re: roscreen grid

Hi,
I am a newbie to Bright Script and have to create a grid on roScreen.
The images I want to load are not very light so those will consume a lot of memory. So how do I load and remove images from cache?
I have some text with every image(its description) which needs to be shown below the grid. Is it possible to change the description when the grid is scrolled?
Also I want to use this grid at multiple places. So I want to know how I can encapsulate it.

This post is really useful for a kick start and I really appreciate the effort that was put to write the code with those awesome comments.

I would be really thankful if someone could help me with the points that I have mentioned.
0 Kudos
NewManLiving
Visitor

Re: roscreen grid

There are really no shortcuts
We are all still learning how to do these things better
First you need to learn BS. If you want to encapsulate then You need to have a
good understanding of how to encapsulate using a pseudo object which is simply an
roassociative array. You need to understand how a function name can be
A variable. You need to understand the limited scope of the m pointer
There really is no true encapsulation in BS. Notable attempts
Have been made to write code using a hash table or dictionary to implement
Some type of inheritance.
Then you need to understand how this version of the grid works if you decide that
This method will meet your needs. Once you do all that you will have answered
Your own questions. As far as memory management. The texture manager is a good
Option. The urltranfer object can be used as well. Dig into the examples
And learn
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
leeladhar
Visitor

Re: roscreen grid

Hi NewmanLiving,

Awesome grid. I was trying to write an app which basically is like a timeline of 24 hrs.
Hours are on x axis and diff persons are on y axis.
I was just using roScreen, methods like DrawRect, Drawline and Drawtext to achieve this. Data to this was a json. I was facing lot of issue to highlight an event in timeline as the user clicks right and left on an selected row. I used to redraw the pre selected rectangle with it's color and text and highlight the next one with highlight color. But this example code has made me to think a lot on what can be done now :). I ran the example code of grid. On pressing left and right they scroll left and right, Can we have individual grid selection on key press of left and right ?
0 Kudos
luke823
Visitor

Re: roscreen grid

NewManLiving - great stuff here. Do you have any examples on how you might take this further? For example, the object encapsulation that you mention?

We at team Emby http://emby.media, would love to overhaul our Roku UI into something more modern. We're just having a hard time finding any roScreen sample code apart from what's in this thread.

Thanks!
0 Kudos
NewManLiving
Visitor

Re: roscreen grid

As far as OO there is plenty of small examples out there to Demonstrate how I implement my framework. BS is not object oriented so there is a limit as to what you can do. Some people have crafted more complex object trees using the AA but to me this might be stretching it too far. I implement inheritance by creating another object which contains the parent as a member. I just override the function pointers to point to the new methods while still retaining all that is common. But the drawback is not being able to call super or base classes and realistically there should not be more than one level of subclassing (to be liberal and call it that). So far this works good for me.

As for grid (and other examples) the point is to demonstrate one method for displaying large amounts of data efficiently
This involves a virtual buffer and region scrolling. The memory overhead is more upfront but very effective in the back. Since that example I have incorporated the texture manager into it, streamlined it and have produced a grid I personally am very pleased with even on the low-end boxes. I studied every 2D app that I'm aware of especially those with anything close to what would be called a grid to see what I liked about it and what I thought could be done better. So it was a pet project that paid off pretty well.
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
luke823
Visitor

Re: roscreen grid

is your framework available, or open source?
0 Kudos
NewManLiving
Visitor

Re: roscreen grid

No it is not open sourced at this time. It is heavily wrapped in compositor which allows me to perform complex animation ( splitting/fading grids, in-cell animated cursors, animated selectors etc... ) which simplifies things a great deal for me in not having to manage the Z order of things. The Grids are dynamic and can receive a bitmap from the manager at any time even while they are being split, scrolled, an animated in-cell cursor is active or while any other interface object is active. i have to insure that the bitmap is drawn into the proper area of the grid at the correct z order even during these times. So the compositor has become my best friend, allowing me to define the order of interface objects and then handling all the drawing. There are different opinions on its use. I look at it from the perspective that it was primarily designed for games which of course can have some of the most complex interface and interaction. Well, a really complex application interface can take full advantage of this. and I believe that under such conditions there may be a speed advantage but that is debatable
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
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.