marrus-sh / jelli

A game engine! Currently being developed.
MIT License
1 stars 0 forks source link

Automate `Letters` image onload processing #68

Open marrus-sh opened 7 years ago

marrus-sh commented 7 years ago

Namely, through source.addEventListener("load", ltrs.clearColor.bind(ltrs), false).

marrus-sh commented 7 years ago

Ideally, Letters should detect any changes to the source element, and redraw whenever this occurs. Perhaps a toggle controlling this behaviour would be useful?

marrus-sh commented 7 years ago

(Note that this may also require resizing the canvas.)

marrus-sh commented 7 years ago

In line with ^, letter_width and letter_height should be redone with getters and setters which allow for them to be changed, triggering a complete redraw. This might be overkill though, because at this point you might as well just create a new Letters object?

marrus-sh commented 7 years ago

The alternate approach to this would be to clone source's image data after it is loaded and not allow any changes whatsoever, but this might also mean dropping support for initially-unloaded <img>s