Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxBitmapText alpha not displaying as intended #1877

Closed
KnotUntied opened this issue Jun 29, 2016 · 4 comments
Closed

FlxBitmapText alpha not displaying as intended #1877

KnotUntied opened this issue Jun 29, 2016 · 4 comments

Comments

@KnotUntied
Copy link

KnotUntied commented Jun 29, 2016

  • Flixel version: 4.0.1
  • OpenFL version: 3.6.1
  • Lime version: 2.9.1
  • Affected targets: Noted on Flash, so far

Code snippet reproducing the issue:

package;

import flixel.FlxState;

class PlayState extends FlxState
{
    override public function create():Void
    {
        var test1 = new FlxBitmapText(gmfont);
        test1.text = "WORLD";
        test1.x = 50;
        test1.y = 200;
        test1.alpha = 0;
        add(test1);

        var test2 = new FlxBitmapText(gmfont);
        test2.text = "WORLD";
        test2.x = 100;
        test2.y = 200;
        test2.alpha = 0.1;
        add(test2);

        var test3 = new FlxBitmapText(gmfont);
        test3.text = "WORLD";
        test3.x = 150;
        test3.y = 200;
        test3.alpha = 1;
        add(test3);
    }
}

Observed behavior:
test1 displays as expected, zero alpha, invisible. test3 also, one alpha, opaque. test2, however, is opaque, despite having an alpha of 0.1. (The same happens with values 0<x<1.)
Expected behavior:
Aforementioned bitmap texts should display with their respective alphas.

I will provide more details if inquired.

@Gama11
Copy link
Member

Gama11 commented Jun 29, 2016

Looks like I can reproduce this in the FlxBitmapText demo.

@KnotUntied
Copy link
Author

Found the fix. Only reason I didn't bother doing a pull request is because it's a one-liner.

override private function set_alpha(value:Float):Float
{
    super.set_alpha(value); // This was forgotten, apparently.
    alpha = value;
    if (FlxG.renderBlit)
    {
        pendingTextBitmapChange = true;
    }
    return value;
}

@Gama11 Gama11 closed this as completed in 5f76de6 Jul 26, 2016
@JoeCreates
Copy link
Member

Any idea why the original alpha = value wasnt working?

@Gama11
Copy link
Member

Gama11 commented Jul 26, 2016

I think the assignment was working, it's probably more about the updateColorTransform(); call in super.

Aurel300 pushed a commit to larsiusprime/haxeflixel that referenced this issue Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants