-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easy to re-render a wordcram, without re-parsing all the text #17
Comments
This is done - it works. In retrospect, I'm not sure it's a feature WordCram should have. The main motivation was to avoid re-loading the URL. (Loading a file from the harddrive is plenty fast, and so is parsing text with cue.language.) That can also be accomplished in-sketch, by caching the contents, or saving the file. Also, WebPage can be made to cache its text, and you can construct a WordCram with your own WebPage object. This code complicates the internals a bit, and given the motivation and work-arounds, I'm not sure it's worth it. |
See the cache-web-pages branch for an alternative. Here's about how a sketch would look: import wordcram.*;
import wordcram.text.*; // <- Ick: it requires an extra import
WebPage webPage; // <- global variable for the WebPage
void setup() {
webPage = new WebPage("http://en.wikipedia.org/wiki/Special:Random", this);
// Ick: have to pass `this` to WebPage, so it can load the URL. ------^
// Could improve that: WordCram.getEngine() could set a ref to parent on all the components.
}
void draw() {
new WordCram(this) // <- Look Ma, a new WordCram every frame!
.fromText(webPage) // <- Not in love with this method name
.drawAll();
} |
@danbernier thanks for writing down your thoughts, because I totally forgot all this stuff. |
I'm thinking something like this:
(...except in java, not ruby.)
We want a way to reset the progress when you're drawing incrementally (call
reset_words
when you're done), and a way to reset it if you just calldraw
again.The text was updated successfully, but these errors were encountered: