|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlocation.Hotspot
public class Hotspot
This class represents a hotspot in the game. Hotspots are areas of special interest on the screen. This could be items, characters or just an interesting place. Hotspots are represented by an invisible rectangle defining the area of the hotspot
Constructor Summary | |
---|---|
Hotspot(java.lang.String name,
double x,
double y,
int width,
int height,
com.golden.gamedev.engine.BaseInput bsInput)
Creates a new hotspot with the specified parameters |
Method Summary | |
---|---|
int |
getHeight()
Returns the height of the hotspot area |
java.lang.String |
getName()
Returns the name of the hotspot area |
int |
getWidth()
Returns the width of the hotspot area |
double |
getX()
Returns the x-coordinate of the hotspot area |
double |
getY()
Returns the y-coordinate of the hotspot area |
boolean |
isMouseOverHotspot()
Determines whether the mouse is currently over the hotspot |
boolean |
isMouseOverInventHotspot()
Determines whether the mouse is currently over an inventory hotspot |
boolean |
isPointInHotspot(double x,
double y)
Determines whethter the specified coordinates are within the hotspot bounds |
boolean |
isPointInInventHotspot(double x,
double y)
Determines whethter the specified coordinates are within the hotspot of the item in the inventory |
void |
render(java.awt.Graphics2D g)
Renders hotspot things |
void |
setHeight(int height)
Sets the height of the hotspot area to the specified height |
void |
setName(java.lang.String name)
Sets the name of the hotspot area |
void |
setWidth(int width)
Sets the width of the hotspot area to the specified width |
void |
setX(double x)
Sets the x-coordinate of the hotspot area |
void |
setY(double y)
Sets the y-coordinate of the hotspot area |
void |
showName(java.awt.Graphics2D g,
boolean below)
Shows the name of the hotspot below or above it. |
void |
update(double x,
double y,
int width,
int height)
Updates the hotspot parameters in order to be always consistent with the scene, if the hotspot area can move |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Hotspot(java.lang.String name, double x, double y, int width, int height, com.golden.gamedev.engine.BaseInput bsInput)
name
- name that is to be shown on the screen for the hotspotx
- x-coordinatey
- y-coordinatewidth
- width of the hotspotheight
- height of the hotspotbsInput
- Method Detail |
---|
public int getHeight()
public void setHeight(int height)
height
- height of the hotspot areapublic java.lang.String getName()
public void setName(java.lang.String name)
name
- name of the hotspot areapublic int getWidth()
public void setWidth(int width)
width
- width of the hotspot areapublic double getX()
public void setX(double x)
x
- x-coordinate of the hotspot areapublic double getY()
public void setY(double y)
y
- y-coordinate of the hotspot areapublic void update(double x, double y, int width, int height)
x
- x-coordinatey
- y-coordinatewidth
- width of the hotspot areaheight
- height of the hotspot areapublic void render(java.awt.Graphics2D g)
g
- public boolean isMouseOverHotspot()
public boolean isMouseOverInventHotspot()
public boolean isPointInHotspot(double x, double y)
x
- x-coordinate of the mousey
- y-coordinate of the mouse
public boolean isPointInInventHotspot(double x, double y)
x
- x-coordinate of the mousey
- y-coordinate of the mouse
public void showName(java.awt.Graphics2D g, boolean below)
g
- below
- show name below game object? -->true=yes, false=no
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |