HaxeFlixel / HaxeFlixel/flixel

`sprite.dirty` always true on renderTile

Open Beginner friendly
#3,584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

The value of sprite.dirty is always initialized as true. This leads to calcFrame() being call in draw(), which redundantly calls checkEmptyFrame() and then does an early return:

https://github.com/HaxeFlixel/flixel/blob/0860515575f90eb008d5b6c4a8dfbca1b4d8be28/flixel/FlxSprite.hx#L1563-L1571

The issue is that dirty is never set back to false on targets that use renderTile (so most cases), therefore each draw has redundant useless function calls.

Contributor guide

Open the contributing guide

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 flixel/FlxSprite.hx at the linked lines around draw(), calcFrame(), and checkEmptyFrame(). Trace how sprite.dirty is initialized and handled for renderTile targets, then verify that repeated draws no longer perform the redundant calls while other rendering paths remain correct.

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
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.