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

Prevent setting a FlxSprite to an invalid frame #174

Merged
merged 6 commits into from
Sep 23, 2013

Commits on Aug 21, 2013

  1. Prevent setting a FlxSprite to an invalid frame

    Fixes FlixelCommunity#13
    
    Prevents an "out of range" frame number from being set either by an
    animation, or by manually setting the `frame` property.
    
    Adds new getter/setter `numFrames` where user can manually specify how
    many frames an animation has (in case some frame are empty).
    
    To go hand in hand with this is the read-only property `maxFrames` which
    calculates how many frames can fit on that sprite sheet. NOTE: it rounds
    up, so sprites may "hang off the edge" if the sheet is the wrong
    dimensions. This may be fixed in the future depending on how other
    applications handle "overhanging frames".
    IQAndreas committed Aug 21, 2013
    Configuration menu
    Copy the full SHA
    ea4a1d9 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2013

  1. Remove unused property frames

    It wasn't being used anywhere, and I'm assuming since it is public, that
    it was meant to be read-only.
    IQAndreas committed Aug 23, 2013
    Configuration menu
    Copy the full SHA
    e07ed00 View commit details
    Browse the repository at this point in the history
  2. Cache value for maxFrames

    No need to re-calculate it every time you call the property!
    
    It only needs to be updated whenever you change the bitmap associated
    with the sprite sheet.
    IQAndreas committed Aug 23, 2013
    Configuration menu
    Copy the full SHA
    192ae31 View commit details
    Browse the repository at this point in the history
  3. Fix typo default value of numFrames

    Originally I was defaulting _numFrames to -1 until I realized it was an
    unsigned integer. Rather than change it to a signed one, I realized that
    you could never have zero frames, and let 0 be the default value.
    
    However, I forgot to change this in the actual `numFrames` getter.
    IQAndreas committed Aug 23, 2013
    Configuration menu
    Copy the full SHA
    a59e2e9 View commit details
    Browse the repository at this point in the history
  4. Change old property frames to the new numFrames

    I finally found where this property was being used! No wonder it was
    public.
    IQAndreas committed Aug 23, 2013
    Configuration menu
    Copy the full SHA
    4560193 View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2013

  1. Add depreciated property frames

    For backwards compatability, add depreciated getter `frames`.
    
    Also fix tiny typo in description of `numFrames` (no use creating a new
    commit just for that tiny thing).
    IQAndreas committed Sep 7, 2013
    Configuration menu
    Copy the full SHA
    df426ea View commit details
    Browse the repository at this point in the history