cykod / Quintus

HTML5 Game Engine
http://html5quintus.com
GNU General Public License v2.0
1.41k stars 401 forks source link

Fix for UI.Text align #122

Closed mpkorstanje closed 10 years ago

mpkorstanje commented 10 years ago

align is used to both set the alignment in the front string and to physically move the location where the font string is to be. The end result is that align is always centered.

This fixes this by making the default alignment centred and removing the physical positioning of the text.Bounding points are adjusted accordingly.

ghost commented 10 years ago

Can you make a screenshot of this please? so i can better recreate the issue, track the problem, and test the fix. Thanks.

mpkorstanje commented 10 years ago

Ah sorry about that. Didn't have time to do it properly earlier.

Have a look here: https://github.com/mpkorstanje/Quintus/tree/master/examples/text_allign

Left: Quintus centers all text on the y coordinate of the sprite regardless of alignment. Right: What it looks like after patch. Text alligns left, right or center of it's y coordinate.

mpkorstanje commented 10 years ago

Okay. Hold on this one for a bit. I had a look at what Cykod said in #77 and I'm doing this wrong. I should be moving cx, cy about.

I must have been misunderstanding something about how Quintus does its coordinate system. Issue is still there but this fix isn't the right one.

mpkorstanje commented 10 years ago

All fixed up. BitShock, it's all yours now. Example has been updated. Left the bad, right the good stuff.

https://github.com/mpkorstanje/Quintus/tree/master/examples/text_allign

ghost commented 10 years ago

Alright i tested it and it's fine ready to merge. But first delete your custom comments and fix the typos (if any) and correct the indentation please. Thank you.

mpkorstanje commented 10 years ago

@Bitshock its as clean as it gets.