Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Lunarovich

Hello, I would like to change the canvas in order to draw entities on a separate canvas and switch back to the ig.main() set canvas.

Also, I would like to know if there is an easy/standard way to blit/paste an entire secondary canvas element - not the one set with ig.main(), but the one created with, e.g. ig.$new() - in the primary canvas - the one set by ig.main().

1 decade ago by drhayes

I&039;m gonna look up more info about your first question. Just so I understand it, you want to render a bunch of your entities to a separate canvas and then, presumably, blit that secondary canvas back to your primary in #ig.system.canvas? Is that so you can apply some sort of effect to them or something?

EDIT: I would experiment with overriding ig.system.canvas and ig.system.context when those entities are drawing themselves. Or manually calling their draw methods somehow after setting those properties yourself. Just a guess, though.

For your second, yes: call getImageData on the second canvas and save it in a var. Then, pass that to a call to putImageData on the other canvas.

1 decade ago by Lunarovich

Thanks on your answers.

"Is that so you can apply some sort of effect to them or something?"
Yes, exactly :) Namely, I would like to use composite modes (destination-over, source-atop etc.) on the single layer, that is, without affecting other layers.

If you take, for example, impact++ lighting system, you'll see that lamps make background lighter. This is OK for interior scenes, but is totally unacceptable for the exterior scenes, such as sky, mountains, etc. You cannot light the mountain miles away with a flashlight :)
Page 1 of 1
« first « previous next › last »