Document that animated NobleSprites need setSize(), and that NobleSprite:draw() is a render callback - #97
Open
ericlewis wants to merge 1 commit into
Open
Conversation
…ite:draw() is a render callback. Sprites whose view is a spritesheet/imagetable or a Noble.Animation do not get their size set automatically (unlike image-based sprites, which are auto-sized via setImage()), so they must call setSize() with the frame dimensions or they will never be drawn. The spritesheet usage examples now include the setSize() call, and Noble.Animation.new() notes it as well. (upstream issue NobleRobot#83) NobleSprite:draw() is now documented as the sprite draw callback invoked by Graphics.sprite.update() in sprite-local coordinates, which must not be called manually; use myNobleSprite.animation:draw(x, y) for immediate-mode drawing, or setSize() plus add(x, y) for scene placement. (upstream issue NobleRobot#91) The generated HTML docs were hand-patched to match, since ldoc is not available in this environment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for cheery-choux-736619 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #83; should also prevent confusion like #91.
Two documentation gaps that bite users of animated NobleSprites:
Sprites sourced from a spritesheet or
Noble.AnimationneedsetSize()(Note in the documentation that NobleSprites sourced from imagetables need to have their size set manually #83). Unlike image-based sprites, which are auto-sized viasetImage(), animated sprites never get a size, so withoutsetSize()they are never drawn. TheNobleSpriteusage examples now include thesetSize()call, andNoble.Animation.new()notes it as well.NobleSprite:draw()is a render callback, not an immediate-mode draw (Animated NobleSprite renders at incorrect location. #91). It's the sprite draw callback invoked byGraphics.sprite.update()in sprite-local coordinates, so calling it manually draws the animation at the wrong location — which is what happened in Animated NobleSprite renders at incorrect location. #91. It's now documented as such, pointing users tomyNobleSprite.animation:draw(x, y)for immediate-mode drawing, orsetSize()+add(x, y)for scene placement.The generated HTML pages are hand-patched to match (no LDoc in my environment) — happy to regenerate if you'd rather.
🤖 Generated with Claude Code