com.TeamHEC.LocomotionCommotion.UI_Elements
Class Sprite

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Actor
      extended by com.TeamHEC.LocomotionCommotion.UI_Elements.Sprite
Direct Known Subclasses:
SpriteButton, TrainInfoUI

public class Sprite
extends com.badlogic.gdx.scenes.scene2d.Actor

Author:
Matthew Taylor , Rob

Field Summary
 boolean started
           
 
Constructor Summary
Sprite(float x, float y, com.badlogic.gdx.graphics.Texture texture)
          Creates a Sprite which can be drawn to a stage
 
Method Summary
 void act(float delta)
          Can be overridden as an annoymous class to be used like a thread
 void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float alpha)
          Draws a texture at specific coordinates:
 com.badlogic.gdx.math.Vector2 getPosition()
          get a vector for the x and y coords
 com.badlogic.gdx.graphics.Texture getTexture()
           
 float getX()
          Get the X coordinate for the Sprte
 float getY()
          Get the Y coordinate for the sprite
 void increaseX(float amount)
          Increase the x coordinate
 void increaseY(float amount)
          Increase the y coordinate
 void refreshBounds()
          Sets the touchable region for clicking on a Sprite to it's position
 void setPosition(float x, float y)
          set the position of the sprite
 void setTexture(com.badlogic.gdx.graphics.Texture t)
           
 void setX(float actorX)
          Set the X coordinate for the sprite
 void setY(float actorY)
          Set the Y coordinate for the sprite
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, fire, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getY, getZIndex, hasParent, hit, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotateBy, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

started

public boolean started
Constructor Detail

Sprite

public Sprite(float x,
              float y,
              com.badlogic.gdx.graphics.Texture texture)
Creates a Sprite which can be drawn to a stage

Parameters:
x - xPosition on screen
y - yPosition on screen
texture - The image texture used
Method Detail

getTexture

public com.badlogic.gdx.graphics.Texture getTexture()
Returns:
the "actorTexture" for that sprite

setTexture

public void setTexture(com.badlogic.gdx.graphics.Texture t)
Parameters:
t - the new texture for the sprite

act

public void act(float delta)
Can be overridden as an annoymous class to be used like a thread

Overrides:
act in class com.badlogic.gdx.scenes.scene2d.Actor

draw

public void draw(com.badlogic.gdx.graphics.g2d.Batch batch,
                 float alpha)
Draws a texture at specific coordinates:

Overrides:
draw in class com.badlogic.gdx.scenes.scene2d.Actor

refreshBounds

public void refreshBounds()
Sets the touchable region for clicking on a Sprite to it's position


getX

public float getX()
Get the X coordinate for the Sprte

Overrides:
getX in class com.badlogic.gdx.scenes.scene2d.Actor
Returns:
x the x-coordinate for the sprite on the screen

setX

public void setX(float actorX)
Set the X coordinate for the sprite

Overrides:
setX in class com.badlogic.gdx.scenes.scene2d.Actor
Parameters:
actorX - the x-coordinate for the sprite on the screen

getY

public float getY()
Get the Y coordinate for the sprite

Overrides:
getY in class com.badlogic.gdx.scenes.scene2d.Actor
Returns:
y the y-coordinate for the sprite on the screen

setY

public void setY(float actorY)
Set the Y coordinate for the sprite

Overrides:
setY in class com.badlogic.gdx.scenes.scene2d.Actor
Parameters:
actorY - the y-coordinate for the sprite on the screen

increaseY

public void increaseY(float amount)
Increase the y coordinate

Parameters:
amount -

increaseX

public void increaseX(float amount)
Increase the x coordinate

Parameters:
amount -

getPosition

public com.badlogic.gdx.math.Vector2 getPosition()
get a vector for the x and y coords

Returns:
vector(x, y)

setPosition

public void setPosition(float x,
                        float y)
set the position of the sprite

Overrides:
setPosition in class com.badlogic.gdx.scenes.scene2d.Actor
Parameters:
x - the x-coordinate for the sprite on the screen
y - the y-coordinate for the sprite on the screen