Today I finally made fonts work, and all the problems were due to bad conversions between different units of measure.
In the end I managed to make them work, but I was not satisfied, I wanted to make them easy to adapt to the screen.
So I added an anchor system like the one for sprites, and I also made so that the text is correctly aligned to the border it is anchored to...much like the "align text" in Word.
I also added a new parameter called Depth to both the sprites and the text. It allows to decide in which "depth plane" the image will be, so that it is possible to decide what will be rendered in front of the other stuff.
It supports alpha, but only 0% or 100% alpha, which means that 10 overlapping sprites with 10% alpha and different colors will NOT blend as expected, but a text in front of a sprite, or vice versa, will be nicely blend.
Edit:
In the evening I managed to precalculate and preallocate all the memory used by the text glyphs, so now it avoids multiple allocations.
Faster and does not require to free memory, which is always good, it just needs to resize the memory every frame.

Nessun commento:
Posta un commento