Open mucaho opened 8 years ago
I've thought about this in the past, and I think the best approach would be to create a new "ImageText" component that uses a spritemap, as per approach #2.
That would be useful even outside of WebGL, since games often want custom bitmap fonts.
The idea of automatically rendering a specified style of font using canvas to a bitmap font would complement this approach well.
Since you guys seem experienced with webGL (and I'm not). I see a lot of examples online of demo's that manipulate images (brightness, hue, saturation, blur) using webgl shaders. How hard is it to add these kind of things to crafty?
This way I could recolor/saturate sprites dynamically with the minimal amount of real assets needed.
@matthijsgroen Did you manage to get this to work? I'd like to apply a hue-rotation filter to my images, but I'm not able to find a solution at this moment.
Or perhaps this has been added to the API already? I can't seem to find it in the docs in that case.
Text is still missing in order to have all display components run on any display backend (see comment). Possible implementations:
Actually approach#1 could be used to create a texture dynamically for all the required letters and fonts at loading time. Then approach#2 can be used to draw individual letters from this dynamically created texture during runtime.