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

librokudev update (rdTAP, rdClass, rdCSS?)

Happy holidays from GandK! For an early end-of-year present, we bring you two new additions to librokudev, rdTAP and rdClass.

rdTAP is a BrightScript implementation of the TAP protocol for communication between unit tests and a test harness. It has the following features:

  • Implements much of the TAP protocol

  • Includes it's own test harness with summary output

  • Output using prints to the debug console, to an array, or to a buffer to be used later.

The best documentation is most likely through it's test suite, in the source/librokudev/source/tests/ directory.

rdClass is a class creating function, and supports the following:

  • Allows you to specify a tracked unique class name

  • Define class attributes and set their access methods in multiple ways (and multiple names, it desired)

  • Optionally define attribute types, with type checking done on all attribute writes

  • If type checking is active, the ability to automatically coerce most types between boolean, string, int and float

  • Default attribute values

  • FULL INHERITANCE

  • Optimized to be quite fast in comparison to manually creating objects though functions (but still slower)

There's rudimentary documentation in the /docs/rdClass.txt file. but similar to above, you can get a good idea of it's use by looking through the test suite at the location listed above. It's been optimized to be quite fast when creating objects, and most the work is done the very first time an object is created. Subsequent requests for a class of the same name are VERY quick, but still slower than defining your own class creation functions. If you have created your own inheritance system, this is probably faster.

If you think you've found a bug in either piece of software, please let us know, and submitting a test would be helpful (they both have copious test suites). If you want to contribute, please let us know, we want librokudev to be a more community based project.

You can see the repository at https://github.com/rokudev/librokudev

Happy holidays, and we hope you enjoy!
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
1 REPLY 1
kbenson
Visitor

Re: librokudev update (rdTAP, rdClass, rdCSS?)

Updated original post to actually contain link to repo at github (duh).

Also, in talking to Geoff the other night, we came up with an idea for another component, rdCSS. The idea is, you could define "classes" (in the CSS sense) and assign roImageCanvas attributes to them, to be used later to auto-set roImageCanvas attributes as specified.

e.g.


function cssDefs() as object
return {
commonImage: {
url: "http://some.common.image/path.jpg"
}
large: {
targetRect: { w: 500, h: 500 }
}
small: {
targetRect: { w: 200, h: 200 }
}
red: {
color: "#FF0000"
}
left: {
targetTranslation: { x:100 }
}
right: {
targetTranslation: { x:800 }
}
top: {
targetTranslation: { y:100 }
}
bottom: {
targetTranslation: { y:500 }
}

}
end function


It will merge any class names together to make the roImageCanvas object, as well as any params supplied as an optional third argument. Right most class names would take precedence (overwriting duplicate values), and of course anything specified manually would override any classes.


canvas.addLayer(1, rdCSS(["top","left", "large", "commonimage"]))
canvas.addLayer(2, rdCSS(["top","left","small"], { url: "http://some.url/path.jpg" }))
canvas.addLayer(2, rdCSS(["bottom","right"], { url: "http://some.url/otherpath.png" }))


Make sense? Anyone have any interest, see any problems, want to offer suggestions?
-- GandK Labs
Check out Reversi! in the channel store!
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.