|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcage.graphics.Clickable
public abstract class Clickable
An abstract class which contains collision detection code with mouse input, for use with anything which has a rectangular hitbox and is intended to be clicked.
Field Summary | |
---|---|
protected java.lang.String |
actionName
The name of the action to call when clicked. |
protected Point |
botRight
The bottom right of the bounding box on this Clickable |
protected int |
height
The height of this clickable's hit box |
protected java.lang.String |
name
The name of the clickable item |
protected Point |
topLeft
The top left of the bounding box on this Clickable |
protected int |
width
The width of this clickable's hit box. |
Constructor Summary | |
---|---|
Clickable()
|
Method Summary | |
---|---|
Point |
getLocation()
Gets the X,Y location of this Sprite. |
java.lang.String |
getName()
Get the name of this Clickable. |
int |
getX()
Get the X location of the upper left corner of this clickable. |
int |
getY()
Get the Y location of the upper left corner of this clickable. |
boolean |
inputCollision(int x,
int y)
Checks to see if the given input coords are within the bounding box of this clickable. |
void |
performAction()
Perform the action of this clickable, for use with inputCollision |
void |
setLocation(int x,
int y)
Set the location of this Clickable to the specified X,Y. |
void |
setLocation(Point coord)
Set the location of this sprite to the specified point. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Point topLeft
protected Point botRight
protected int width
protected int height
protected java.lang.String actionName
protected java.lang.String name
Constructor Detail |
---|
public Clickable()
Method Detail |
---|
public boolean inputCollision(int x, int y)
x
- the x value to testy
- the y value to test
public Point getLocation()
public void setLocation(Point coord)
coord
- the X,Y location of the spritepublic void setLocation(int x, int y)
x
- the x coordy
- the y coordpublic int getX()
public int getY()
public void performAction()
public java.lang.String getName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |