org.deken.game.sprites
Class BoundingBox
java.lang.Object
org.deken.game.sprites.BoundingBox
public class BoundingBox
- extends java.lang.Object
Title: BoundingBox
Description: Simple implementation of a bound box, that defines the edges
based on the parents starting point. Given that the parent is starting point
is X: 100 and Y: 200, then the left will be 100 + left's value. Right will be
100 + right's value.
Copyright: Copyright (c) Nov 19, 2014
- Version:
- 1.0
- Author:
- Gary Deken
Field Summary |
protected int |
bottom
|
protected int |
left
|
protected java.awt.geom.Rectangle2D.Double |
rectangle
|
protected int |
right
|
protected int |
top
|
Constructor Summary |
BoundingBox(int left,
int top,
int right,
int bottom)
The BoundingBox requires that the right and bottom are larger then the
left and top. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
left
protected int left
top
protected int top
right
protected int right
bottom
protected int bottom
rectangle
protected java.awt.geom.Rectangle2D.Double rectangle
BoundingBox
public BoundingBox(int left,
int top,
int right,
int bottom)
- The BoundingBox requires that the right and bottom are larger then the
left and top. If the Left is 4, then the right must be greater then 4.
- Parameters:
left
- top
- right
- bottom
-
contains
public boolean contains(float x,
float y)
getBottom
public int getBottom()
getLeft
public int getLeft()
getRight
public int getRight()
getTop
public int getTop()
intersects
public boolean intersects(BoundingBox b)
set
public void set(int left,
int top,
int right,
int bottom)
setOrigin
public void setOrigin(int x,
int y)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object