3 ms·
from processing import LEFT, mouse_x, mouse_y, mouse_button Now you don't have to prefix things with `processing` just like you don't in your Ruby version.
by shazow 15y ago
from processing import LEFT, mouse_x, mouse_y, mouse_button
Now you don't have to prefix things with `processing` just like you don't in your Ruby version.
- kragen 15y agoIf the program used them in several places, that would be an improvement, but it doesn't. It's maybe a little bit atypical, but nearly all of the things it calls from Processing, it calls in exactly one site: the above, plus color_mode, no_stroke, smooth, background, and rect. It does call fill from four call sites, but that was because there's no reasonable way to return a list of four arguments from a method in Ruby, as far as I can tell.
- zwp 15y ago> way to return a list of four arguments from a method p, q, r, s = * method_that_returns_array_of_4_things * aka "splat operator"
- kragen 15y agoThat's great, thanks! And that works for method calls too. So now I can replace set_color_from @cells[x][y] with fill *color_from(@cells[x][y]), reducing the number of side-effecting methods by one, and now I'm calling every Processing function in at most one place.