FlixelCommunity / flixel

Community fork of Adam “Atomic” Saltsman's popular game engine Flixel. Distilled from a variety of Flash games he worked on over the last couple years, including Gravity Hook, Fathom and Canabalt, its primary function is to provide some useful base classes that you can extend to make your own game objects.
http://flixelcommunity.org/
Other
84 stars 17 forks source link

Fix blurry text problem #136

Closed Dovyski closed 2 years ago

Dovyski commented 11 years ago

Single and multi-line text work fine with "right", "left" and "center" alignment. The "justify", however, is not working.

Fix: https://github.com/FlixelCommunity/flixel/issues/108

IQAndreas commented 11 years ago

The change looks good (tested and verified).

The only problem is, rather than still be blurry, "justify" does not work at all. I haven't tested it, but this should be fixable by changing line 266 to the following:

var numTextFields:uint = (this.alignment == "justify") ? 1 : nl;
while (i < numTextFields)

Could you test and add that to the commit?

We can fix the "justify" blurriness in a future release (I don't see any way of fixing this other than breaking each word down into individual TextFields), but at least blurry is better than nothing. For now, to me this looks good enough to merge.

IQAndreas commented 11 years ago

Also, instead of creating a new TextField for each line/word, what if inside the calcFrame function:

(I realize I abused bullet points here, but that sentence was getting really long, and that helped break it up)

Dovyski commented 11 years ago

The change you suggested to line 266 did not work (it rendered just a single line of text, even on multi-line ones).

About the change to the calcFrame, I agree. I guess the reason why the original author used a Vector was because he didn't want to mess with the rendering process, placing all the code within a while. Or he didn't thought about that at all.

The code needs refactoring and I prefer to write the fix from ground up, using your approach. What do you think?

IQAndreas commented 11 years ago

The code needs refactoring and I prefer to write the fix from ground up, using your approach. What do you think?

If you have time for it, go for it. Since changing the rendering process shouldn't break any existing code, it would be possible to fit it into this release.

Dovyski commented 11 years ago

I have some free time next week, will focus on that.

IQAndreas commented 11 years ago

I realized we pushed further changes to FlxText up until the next release, however, shall we include this fix in 2.56 since the code is already written, and aside from "justify" is working (which is much better than it was before)?

I have tested this in the sandbox, so I can confirm that it works, so I'm ready to merge if you are.

Dovyski commented 11 years ago

I've pushed it up to the next release because of that "justify" problem. I'm not a fan of trading one bug for another, so I think we should keep this issue out of the 2.56 release.

The current FlxText has the blur problem, but at least it's fully functional regarding the alignments.

greysondn commented 2 years ago

O.o Are we not dead?

Dovyski commented 2 years ago

I would say we are and HaxeFlixel is the way to go, but having this PR open on my Github dashboard was killing me 😝