|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.golden.gamedev.object.Sprite
vooga.engine.core.BetterSprite
vooga.widget.Button
public abstract class Button
Reusable abstract Button implementation that represents a simple Sprite that allows for some action to be performed upon a mouse click Right now, you must pass each Button an instance of the game it is in, which seems bad. Ultimately we hope to find a way to call the Game methods without a specific instance of game.
Field Summary | |
---|---|
protected java.awt.image.BufferedImage |
buttonImage
|
protected Game |
myGame
Instance of the game in which the Button exists |
Constructor Summary | |
---|---|
Button()
Creates an instance of Button with a null image and a location of (0,0) |
|
Button(java.awt.image.BufferedImage image)
Creates an instance of Button with a specified image and a location of (0,0) |
|
Button(java.awt.image.BufferedImage image,
double x,
double y)
Creates an instance of Button with a specified image and location |
|
Button(double x,
double y)
Creates an instance of Button at a specified location with a null image |
Method Summary | |
---|---|
abstract void |
actionPerformed()
Specifies what should be done when the button is clicked |
boolean |
isTriggered()
Decides when button has been triggered |
void |
setSize(int width,
int height)
|
void |
setText(java.lang.String text)
|
Methods inherited from class vooga.engine.core.BetterSprite |
---|
addAnimatedImages, addHorizontalSpeed, addImage, addSprite, addVerticalSpeed, firstRun, forceX, forceY, getCurrentSprite, getDistance, getDoubleStat, getHeight, getHorizontalSpeed, getImage, getIntStat, getStat, getTimeInExistence, getVerticalSpeed, getWidth, getX, getY, isActive, isOnScreen, move, moveTo, moveX, moveY, render, setActive, setAsRenderedSprite, setBackground, setDoubleStat, setHorizontalSpeed, setImage, setImages, setIntStat, setLayer, setLocation, setMovement, setSpeed, setStat, setVerticalSpeed, setX, setY, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Game myGame
protected java.awt.image.BufferedImage buttonImage
Constructor Detail |
---|
public Button()
public Button(java.awt.image.BufferedImage image)
image
- Which represents the image of the buttonpublic Button(java.awt.image.BufferedImage image, double x, double y)
image
- Which represents the image of the buttonx
- Which represents the X-coordinate of the buttony
- Which represents the Y-coordinate of the buttonpublic Button(double x, double y)
x
- Which represents the X-coordinate of the buttony
- Which represents the Y-coordinate of the buttonMethod Detail |
---|
public void setSize(int width, int height)
public void setText(java.lang.String text)
public boolean isTriggered()
isTriggered
in interface IEventHandler
public abstract void actionPerformed()
actionPerformed
in interface IEventHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |