org.deken.game.sprites
Class BoundingBox

java.lang.Object
  extended by 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.
 
Method Summary
 boolean contains(float x, float y)
           
 int getBottom()
           
 int getLeft()
           
 int getRight()
           
 int getTop()
           
 boolean intersects(BoundingBox b)
           
 void set(int left, int top, int right, int bottom)
           
 void setOrigin(int x, int y)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

left

protected int left

top

protected int top

right

protected int right

bottom

protected int bottom

rectangle

protected java.awt.geom.Rectangle2D.Double rectangle
Constructor Detail

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 -
Method Detail

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