|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.geom.Shape org.newdawn.slick.geom.Rectangle
public class Rectangle
An axis oriented used for shape bounds
Field Summary | |
---|---|
protected float |
height
The height of the box |
protected float |
width
The width of the box |
Fields inherited from class org.newdawn.slick.geom.Shape |
---|
boundingCircleRadius, center, maxX, maxY, minX, minY, points, pointsDirty, trianglesDirty, tris, x, y |
Constructor Summary | |
---|---|
Rectangle(float x,
float y,
float width,
float height)
Create a new bounding box |
Method Summary | |
---|---|
boolean |
contains(float xp,
float yp)
Check if this rectangle contains a point |
static boolean |
contains(float xp,
float yp,
float xr,
float yr,
float widthr,
float heightr)
Check if a rectangle contains a point (static to use it everywhere) |
protected void |
createPoints()
Subclasses implement this to create the points of the shape. |
float |
getHeight()
Get the height of the box |
float |
getWidth()
Get the width of the box |
void |
grow(float h,
float v)
Grow the rectangle at all edges by the given amounts. |
boolean |
intersects(Shape shape)
Check if this box touches another |
void |
scaleGrow(float h,
float v)
Grow the rectangle based on scaling it's size |
void |
setBounds(float x,
float y,
float width,
float height)
Set the bounds of this rectangle |
void |
setBounds(Rectangle other)
Set the bounds of this rectangle based on the given rectangle |
void |
setHeight(float height)
Set the heightof this box |
void |
setSize(float width,
float height)
Set the size (widtha and height) of this rectangle |
void |
setWidth(float width)
Set the width of this box |
java.lang.String |
toString()
|
Shape |
transform(Transform transform)
Apply a transformation and return a new shape. |
Methods inherited from class org.newdawn.slick.geom.Shape |
---|
calculateRadius, calculateTriangles, checkPoints, closed, contains, findCenter, getBoundingCircleRadius, getCenter, getCenterX, getCenterY, getLocation, getMaxX, getMaxY, getMinX, getMinY, getNormal, getPoint, getPointCount, getPoints, getTriangles, getX, getY, hasVertex, includes, increaseTriangulation, indexOf, preCache, prune, setCenterX, setCenterY, setLocation, setLocation, setX, setY, subtract, union |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected float width
protected float height
Constructor Detail |
---|
public Rectangle(float x, float y, float width, float height)
x
- The x position of the boxy
- The y position of the boxwidth
- The width of the boxheight
- The hieght of the boxMethod Detail |
---|
public boolean contains(float xp, float yp)
contains
in class Shape
xp
- The x coordinate of the point to checkyp
- The y coordinate of the point to check
public void setBounds(Rectangle other)
other
- The other rectangle whose bounds should be appliedpublic void setBounds(float x, float y, float width, float height)
x
- The x coordinate of this rectangley
- The y coordinate of this rectanglewidth
- The width to set in this rectangleheight
- The height to set in this rectanglepublic void setSize(float width, float height)
width
- The width to set in this rectangleheight
- The height to set in this rectanglepublic float getWidth()
getWidth
in class Shape
public float getHeight()
getHeight
in class Shape
public void grow(float h, float v)
h
- The amount to adjust horizontallyv
- The amount to ajust verticallypublic void scaleGrow(float h, float v)
h
- The scale to apply to the horizontalv
- The scale to appy to the verticalpublic void setWidth(float width)
width
- The new width of this boxpublic void setHeight(float height)
height
- The height of this boxpublic boolean intersects(Shape shape)
intersects
in class Shape
shape
- The other shape to check against
protected void createPoints()
Shape
createPoints
in class Shape
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public static boolean contains(float xp, float yp, float xr, float yr, float widthr, float heightr)
xp
- The x coordinate of the point to checkyp
- The y coordinate of the point to checkxr
- The x coordinate of the rectangleyr
- The y coordinate of the rectanglewidthr
- The width of the rectangleheightr
- The height of the rectangle
public Shape transform(Transform transform)
transform
in class Shape
transform
- The transform to be applied
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |