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

Open sourced BRS libs - librokudev

Now that the next phase of the contest has started, I guess it's worth mentioning that we are going to open source much, possibly all, of our KidPaint app. At a bare minimum, we'll be releasing the back-end libraries that we wrote.

Here's our current list:


  • rdBitWise.brs - Some missing BrightScript core ops, such as right shift and xor

  • rdByteArray.brs - Extra ByteArray functions, such as BAcopy, BAtoINT, INTtoBA, INTtoHEX, BAtoSTR

  • rdCRC.brs - Standard CRC32 Cyclic Redundancy Check computation

  • rdPNG.brs - Load color indexed PNG file and change palette color and transparency values

  • rdTempfile.brs - Temporary filename creator, guarantees returned name is unique

  • rdLine.brs - Create ImageCanvas ready line object of arbitrary color when provided two points

  • rdShape.brs - Create ImageCanvas ready shape object of arbitrary color scaled and rotated

  • rdConsole.brs - ImageCanvas based console with up/down automatic scrolling and specifiable number of visible messages

  • rdFunctional.brs - Functional programming methods/functions such as map and apply

  • rdDebug.brs - Dump (almost) any data to debug console, including deep data structures

  • rdBRS.brs - Convert data structure into BrightScript compatible string capable of being eval'ed (for serialization)


The goal of this is to extend BrightScript and the existing component library in the common areas that are redone by many developers. By making it open source and easily accessible (Github or something similar), we increase it's use, which we hope will encourage contribution. We would be very happy to merge in the helper functions and general classes other Roku developers have created, so that we can create one "community standard library" that everyone can share and rely on.

Currently, we are calling it "librokudev", and all files within and classes/functions exported should begin with "rd" to prevent namespace conflicts as much as possible with any app it might be included in (with the possible exception of low-level functions such "xor", for which the "rd" prefix may not make sense).

Notes:


  • rdShape should be abstracted to rdPNGImage or something similar, as it requires PNG images to work on in it's current form. An alternate rdShape utilizing rdLine is a possibility.

  • rdDebug isn't quite a print anything tool yet, but I have thoughts on how to GREATLY simplify it, and some common programming techniques in BrightScript in general through a general boxing function.

  • rdBRS isn't quite complete, but is mostly done (we didn't quite finish it by the contest deadline).

  • rdPNG does allow arbitrary color and transparency pixel manipulation, but should be extended to be more robust and easily support multiple color/transparency pixels (very simple).


Everything else listed is functional and works as advertised. These are in use in our KidPaint channel -- for example, we allow choosing colors for the shapes, but we only include a single filled and outlined version of each shape in black, and dynamically create new PNGs in tmp:/ with the correct color palette entry as needed. We only included a set number of colors in the application for simplicity and because of time constraints, not technical limitations; an arbitrary color picker is planned for the future. Of course, much of this wouldn't be required with drawing primitives built in .... *cough* *cough* 🙂

-- Team GandK
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
7 REPLIES 7
TheEndless
Channel Surfer

Re: Open sourced BRS libs - librokudev

Very cool! Looking forward to seeing this!

I've built up a pretty decent utility class as well that covers a few of these, and includes a number of other functions, that I've been considering posting here. Nothing quite so formalized as what you've listed here, but it might be worthwhile for some.
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
jbrave
Channel Surfer

Re: Open sourced BRS libs - librokudev

Awesome. KidPaint is the bomb. Needs a way to save paintings though, either to an online server or locally somehow.

Please keep creating more kid friendly apps like this!

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
GandK-Geoff
Visitor

Re: Open sourced BRS libs - librokudev

"jbrave" wrote:
Awesome. KidPaint is the bomb.


Thanks!

"jbrave" wrote:
Needs a way to save paintings though, either to an online server or locally somehow.


We were working on that when time ran out on the contest clock, so that feature is definitely on the short list. 🙂

"jbrave" wrote:
Please keep creating more kid friendly apps like this!


We'd love to ... and thank you for cheering us on!
0 Kudos
SolveLLC
Visitor

Re: Open sourced BRS libs - librokudev

Kudos guys, that's a serious amount of work.
0 Kudos
jbrave
Channel Surfer

Re: Open sourced BRS libs - librokudev

How soon do you think those lib's will be available? Esp. interested in rdPNG.brs

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
kbenson
Visitor

Re: Open sourced BRS libs - librokudev

Tonight's the first time we met to work on Roku items since the contest deadline, and that's our first order of business. Geoff has just finished documenting the coding standards, and now he converting some of the libs. I've got a few updates and refactors as well, so it probably won't be completed until the next time we meet, Sunday. If you really want access to anything we listed, PM me and I'll see about getting you a copy, but know that it's not necessarily what will end up on GitHub in a few days.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
kbenson
Visitor

Re: Open sourced BRS libs - librokudev

Initial release:

Code is available on GitHub, http://github.com/rokudev/librokudev

In addition to the files mentioned in the announce,ent, this release contains:


  • rdSerialize.brs - Convert data structure into BrightScript compatible string capable of being used in eval

  • rdJSON.brs - Parse and build JSON data structures


rdBRS.brs has been renamed rdSerialize.brs

All code is BSD licensed, so use as you please. More coming soon.

Please review the README and TODO before use, they outline some future changes.

To install, just drop the /source/rokudev_src folder into the /source folder of your channel, and the /rokudev_files into the base folder for your channel.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos