Dragonfly Q&A

Box corner for sprite

0 like 0 dislike
How to calculate the corner for a sprite?
asked Sep 20, 2016 by linh

1 Answer

0 like 0 dislike
Well, a Sprite doesn't really have a corner.  If you mean a bounding box for an Object based on the Sprite, then you want to center the box around (0,0) (assuming the Object will be positioned at (0,0)).  Something like:

<p>width = sprite -> getWidth()

<p>height = sprite -> getHeight()

<p>corner x = -1 * width / 2

<p>corner y = -1 * height / 2
answered Sep 20, 2016 by claypool
More information about Dragonfly can be found on the Dragonfly Home Page.
...