HaxeFlixel / HaxeFlixel/flixel-ui

Icons on FlxUIButtons are stamped on top of each other

Open
#200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
201
Forks
75
PR merge metrics
No merged PRs in 30d

Description

I recently updated from 1.0.2 to 2.2.0.
I've been creating some FlxUIButtons dynamically and previously I was stamping them from another FlxSprite that has all the frames. On updating it seemed that the icons were all getting stamped on top of each other.

After scratching my head and looking into it I found what I think is the issue - on line 192 of FlxUIButton it loads the new graphic, but the new bitmap isn't unique and the keys will be the same since the buttons and icon all share the same assets. When I amended it so that the new bitmap was unique the issue was resolved and the icons displayed correctly. I am not sure if there would be any problems down the line from doing this.

In summary, currently line 192 of FlxUIButton is
loadGraphic(newGraphic, true, Std.int(width), Std.int(height));
and my icons look like this:
image

If I amend that line to
loadGraphic(newGraphic, true, Std.int(width), Std.int(height), true);
my icons look like this:
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in FlxUIButton at the line 192 loadGraphic call, and compare the current arguments with the version that makes the bitmap unique. Reproduce dynamically created buttons that share icon assets, then verify that each icon displays separately without overlapping.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.