public class Button extends InterfaceObject implements org.newdawn.slick.MouseListener
Constructor and Description |
---|
Button(org.newdawn.slick.Image texture,
java.lang.String label,
org.newdawn.slick.GameContainer gc)
Create an button based on existing image
|
Button(org.newdawn.slick.Image texture,
java.lang.String label,
org.newdawn.slick.GameContainer gc,
java.lang.String textForInfo)
Create an button with info window based on existing image
|
Button(java.io.InputStream fileInput,
java.lang.String ref,
boolean flipped,
java.lang.String label,
org.newdawn.slick.GameContainer gc)
Create an button based on input stream(for zip arch)
|
Button(java.io.InputStream fileInput,
java.lang.String ref,
boolean flipped,
java.lang.String label,
org.newdawn.slick.GameContainer gc,
java.lang.String textForInfo)
Create an button with info window based on input stream(for zip arch)
|
Button(java.lang.String pathToImg,
java.lang.String label,
org.newdawn.slick.GameContainer gc)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
clicked() |
void |
draw(float x,
float y)
Draws button (position is scaled)
|
void |
draw(float x,
float y,
boolean scaledPos)
Draws button
|
void |
draw(float x,
float y,
org.newdawn.slick.Color color,
boolean scaledPos)
Draws object with specified color
|
void |
inputEnded() |
void |
inputStarted() |
boolean |
isAcceptingInput() |
boolean |
isActive() |
boolean |
isMouseOver()
Checks if mouse is over object
|
void |
mouseClicked(int button,
int x,
int y,
int clickCount) |
void |
mouseDragged(int oldx,
int oldy,
int newx,
int newy) |
void |
mouseMoved(int oldx,
int oldy,
int newx,
int newy) |
void |
mousePressed(int button,
int x,
int y) |
void |
mouseReleased(int button,
int x,
int y) |
void |
mouseWheelMoved(int change) |
void |
setActive(boolean bool)
Sets button active or inactive
|
void |
setInput(org.newdawn.slick.Input input) |
void |
setLabel(java.lang.String text)
Sets text as button label
|
atCenter, draw, draw, draw, draw, draw, getDis, getPos, getScale, getScaledHeight, getScaledWidth, getSize, setInfo, setPosition, setSize
bind, clampTexture, copy, destroy, draw, draw, draw, draw, draw, draw, drawCentered, drawEmbedded, drawEmbedded, drawEmbedded, drawFlash, drawFlash, drawFlash, drawSheared, drawSheared, drawWarped, endUse, ensureInverted, flushPixelData, getAlpha, getCenterOfRotationX, getCenterOfRotationY, getColor, getFilter, getFlippedCopy, getGraphics, getHeight, getName, getResourceReference, getRotation, getScaledCopy, getScaledCopy, getSubImage, getTexture, getTextureHeight, getTextureOffsetX, getTextureOffsetY, getTextureWidth, getWidth, isDestroyed, rotate, setAlpha, setCenterOfRotation, setColor, setColor, setFilter, setImageColor, setImageColor, setName, setRotation, setTexture, startUse, toString
@Deprecated public Button(java.lang.String pathToImg, java.lang.String label, org.newdawn.slick.GameContainer gc) throws org.newdawn.slick.SlickException, java.awt.FontFormatException, java.io.IOException
pathToImg
- String with path to filebuttText
- String with text for buttongc
- Game container for click detectorg.newdawn.slick.SlickException
java.awt.FontFormatException
java.io.IOException
public Button(java.io.InputStream fileInput, java.lang.String ref, boolean flipped, java.lang.String label, org.newdawn.slick.GameContainer gc) throws org.newdawn.slick.SlickException, java.awt.FontFormatException, java.io.IOException
fileInput
- Input Stream to imageref
- Name for imageflipped
- If file suppose to be flippedlabel
- String with text for buttongc
- Game container for click detectorg.newdawn.slick.SlickException
java.awt.FontFormatException
java.io.IOException
public Button(java.io.InputStream fileInput, java.lang.String ref, boolean flipped, java.lang.String label, org.newdawn.slick.GameContainer gc, java.lang.String textForInfo) throws org.newdawn.slick.SlickException, java.awt.FontFormatException, java.io.IOException
fileInput
- Input Stream to imageref
- Name for imageflipped
- If file suppose to be flippedlabel
- String with text for buttongc
- Game container for click detecttextForWindow
- Text for info windoworg.newdawn.slick.SlickException
java.awt.FontFormatException
java.io.IOException
public Button(org.newdawn.slick.Image texture, java.lang.String label, org.newdawn.slick.GameContainer gc) throws org.newdawn.slick.SlickException, java.awt.FontFormatException, java.io.IOException
texture
- Slick imagelabel
- String with text for buttongc
- Game container for click detectorg.newdawn.slick.SlickException
java.awt.FontFormatException
java.io.IOException
public Button(org.newdawn.slick.Image texture, java.lang.String label, org.newdawn.slick.GameContainer gc, java.lang.String textForInfo) throws org.newdawn.slick.SlickException, java.awt.FontFormatException, java.io.IOException
texture
- Slick imagelabel
- String with text for buttongc
- Game container for click detecttextForInfo
- Text for info windoworg.newdawn.slick.SlickException
java.awt.FontFormatException
java.io.IOException
public void draw(float x, float y)
draw
in interface org.newdawn.slick.Renderable
draw
in class InterfaceObject
x
- Position on x axisy
- Position on y axispublic void draw(float x, float y, boolean scaledPos)
draw
in class InterfaceObject
x
- Position on x axisy
- Position on y axisscaledPos
- True if object position should be scaledpublic void draw(float x, float y, org.newdawn.slick.Color color, boolean scaledPos)
InterfaceObject
draw
in class InterfaceObject
x
- Position on x axisy
- Position on y axiscolor
- Color for objectscaledPos
- True if object position should be scaledpublic boolean clicked()
public boolean isMouseOver()
InterfaceObject
isMouseOver
in class InterfaceObject
public boolean isActive()
public void setActive(boolean bool)
bool
- True to set button as active, false to set as inactivepublic void setLabel(java.lang.String text)
text
- String with textpublic void inputEnded()
inputEnded
in interface org.newdawn.slick.ControlledInputReciever
public void inputStarted()
inputStarted
in interface org.newdawn.slick.ControlledInputReciever
public boolean isAcceptingInput()
isAcceptingInput
in interface org.newdawn.slick.ControlledInputReciever
public void setInput(org.newdawn.slick.Input input)
setInput
in interface org.newdawn.slick.ControlledInputReciever
public void mouseClicked(int button, int x, int y, int clickCount)
mouseClicked
in interface org.newdawn.slick.MouseListener
public void mouseDragged(int oldx, int oldy, int newx, int newy)
mouseDragged
in interface org.newdawn.slick.MouseListener
public void mouseMoved(int oldx, int oldy, int newx, int newy)
mouseMoved
in interface org.newdawn.slick.MouseListener
public void mousePressed(int button, int x, int y)
mousePressed
in interface org.newdawn.slick.MouseListener
public void mouseReleased(int button, int x, int y)
mouseReleased
in interface org.newdawn.slick.MouseListener
public void mouseWheelMoved(int change)
mouseWheelMoved
in interface org.newdawn.slick.MouseListener