MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / getBounds

Method getBounds

CodenameOne/src/com/codename1/gaming/Sprite.java:102–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 /// Returns the axis aligned bounding box of the (scaled) sprite, ignoring
101 /// rotation. Useful for broad phase collision checks.
102 public Rectangle getBounds() {
103 float sw = getRenderWidth() * scaleX;
104 float sh = getRenderHeight() * scaleY;
105 int bx = (int) Math.round(x - anchorX * sw);
106 int by = (int) Math.round(y - anchorY * sh);
107 return new Rectangle(bx, by, Math.round(sw), Math.round(sh));
108 }
109
110 /// Returns true if this sprite's bounding box intersects the other's.
111 public boolean intersects(Sprite other) {

Callers 3

intersectsMethod · 0.95
boundsCenterOnAnchorMethod · 0.95

Calls 3

getRenderWidthMethod · 0.95
getRenderHeightMethod · 0.95
roundMethod · 0.95

Tested by 2

boundsCenterOnAnchorMethod · 0.76