Closed dethe closed 8 years ago
The idea seems good, but I'm a little confused about your proposed way of doing it. If you're drawing to an offscreen canvas, you'll later want to copy the contents of that canvas to the screen. How would you do that with your proposed method?
Treat the canvas as an image and draw it like any other image.
So... would you say that the context block also declares a variable to be used in the scope it appears in?
No, you initialize an image, pass it to the context, draw on it, then use the image wherever you like. That's how I'm getting around the scope problem for now, we'll see how it works in practice.
Ah, so the context block needs to take an image as an argument. I guess that makes sense, then.
Fixed in #1276
Would like two new blocks, one
wb-expression
which creates a new, blank image (given a width and height), and onewb-context
which takes an image and creates a temporary<canvas>
and context based on that image, allowing us to draw on it. Combined we could then create re-usable images for things like tiling or sprites.