cage.graphics
Class HotSpot

java.lang.Object
  extended by cage.graphics.Clickable
      extended by cage.graphics.HotSpot

public class HotSpot
extends Clickable

A HotSpot is a rectangular region defined by a point and X,Y sizes. This region can have an associated action and should be used to sub-divide a single Sprite into several active regions calling different CARL actions. When debug mode is on, the GraphicsEngine will draw the outlines of the HotSpots using their stored image.

Author:
Seth Marinello

Field Summary
protected  boolean active
          If a HotSpot is active the MouseHandler will call the HotSpot's action when it is clicked
protected  java.lang.String name
          The name of the HotSpot
 
Fields inherited from class cage.graphics.Clickable
actionName, botRight, height, topLeft, width
 
Constructor Summary
HotSpot(java.lang.String name, java.lang.String actionName, int x, int y, int sizex, int sizey, boolean active)
          Creates a HotSpot with the given parameters.
 
Method Summary
 boolean getActive()
          Returns true if the HotSpot is active.
 org.minueto.image.MinuetoImage getImage()
          Gets the rectangle image showing the outine of the HotSpot.
 java.lang.String getName()
          Gets the name of this HotSpot
 void scale(double xScale, double yScale)
          Rescales the HotSpot's location and size by the given X and Y factors.
 void setActive(boolean active)
          Sets if this HotSpot should be considered when the mouse is clicked
 java.lang.String toXML()
          Creates an XML String representing this HotSpot
 
Methods inherited from class cage.graphics.Clickable
getLocation, getX, getY, inputCollision, performAction, setLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of the HotSpot


active

protected boolean active
If a HotSpot is active the MouseHandler will call the HotSpot's action when it is clicked

Constructor Detail

HotSpot

public HotSpot(java.lang.String name,
               java.lang.String actionName,
               int x,
               int y,
               int sizex,
               int sizey,
               boolean active)
Creates a HotSpot with the given parameters.

Parameters:
name - The name of the HotSpot
actionName - The name of the action to call when clicked.
x - The top left X location.
y - The top left Y location.
sizex - The width of the HotSpot.
sizey - The height of the HotSpot.
active - If the HotSpot is active or not.
Method Detail

getImage

public org.minueto.image.MinuetoImage getImage()
Gets the rectangle image showing the outine of the HotSpot. For debugging.

Returns:
the outline of the HotSpot as an Image.

scale

public void scale(double xScale,
                  double yScale)
Rescales the HotSpot's location and size by the given X and Y factors.

Parameters:
xScale - The ratio to scale X by.
yScale - The ratio to scale Y by.

getName

public java.lang.String getName()
Gets the name of this HotSpot

Overrides:
getName in class Clickable
Returns:
The name of the HotSpot

toXML

public java.lang.String toXML()
Creates an XML String representing this HotSpot

Returns:
XML representation of this HotSpot object.

setActive

public void setActive(boolean active)
Sets if this HotSpot should be considered when the mouse is clicked

Parameters:
active - the value to assign to the HotSpot

getActive

public boolean getActive()
Returns true if the HotSpot is active.

Returns:
True if the HotSpot is active, false if not.