ImageEntity

org.homebrew.engine

## Class ImageEntity

- java.lang.Object
- - org.homebrew.engine.BaseGameEntity
  - - org.homebrew.engine.ImageEntity

-     public class ImageEntity
      extends BaseGameEntity

  This class contains all the methods for displaying an image on screen. It is an extends the BaseGameObject class.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.awt.Graphics` | `g`
    `protected org.havi.ui.HScene` | `hscene`
    `protected java.awt.Image` | `img`

    - ### Fields inherited from class org.homebrew.engine.BaseGameEntity

      `alive, velX, velY, x, y`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageEntity(org.havi.ui.HScene hscene)` class constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw(java.awt.Graphics g)` Draws the image on the screen on its x and y coordinate
    `java.awt.Rectangle` | `getBounds()` Returns the bounding rectangle for the image
    `int` | `getCenterX()` returns the x coordinate of the center of the image
    `int` | `getCenterY()` returns the y coordinate of the center of the image
    `java.awt.Image` | `getImage()` Returns the image to display
    `int` | `height()` returns the height of the image
    `void` | `load(java.lang.String filename)` loads an image to display
    `void` | `setGraphics(java.awt.Graphics g)` Sets the graphic context for the image
    `void` | `setImage(java.awt.Image img)` Sets the image to display
    `int` | `width()` returns the width of the image

    - ### Methods inherited from class org.homebrew.engine.BaseGameEntity

      `getVelX, getVelY, getX, getY, isAlive, setAlive, setVelX, setVelY, setX, setY`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### img

          protected java.awt.Image img

    - #### hscene

          protected org.havi.ui.HScene hscene

    - #### g

          protected java.awt.Graphics g

  - ### Constructor Detail

    - #### ImageEntity

          public ImageEntity(org.havi.ui.HScene hscene)

      class constructor
      Parameters:
        `hscene` - scene to add to for drawing purposes

  - ### Method Detail

    - #### getImage

          public final java.awt.Image getImage()

      Returns the image to display
      Returns:
        Image Image to display

    - #### setImage

          public final void setImage(java.awt.Image img)

      Sets the image to display
      Parameters:
        `img` - Image to display

    - #### width

          public final int width()

      returns the width of the image
      Returns:
        int images width

    - #### height

          public final int height()

      returns the height of the image
      Returns:
        int images height

    - #### getCenterX

          public final int getCenterX()

      returns the x coordinate of the center of the image
      Returns:
        int x coordinate of the center of the image

    - #### getCenterY

          public final int getCenterY()

      returns the y coordinate of the center of the image
      Returns:
        int y coordinate of the center of the image

    - #### setGraphics

          public final void setGraphics(java.awt.Graphics g)

      Sets the graphic context for the image
      Parameters:
        `g` - new graphic context to use

    - #### load

          public final void load(java.lang.String filename)

      loads an image to display
      Parameters:
        `filename` - filename of image to load

    - #### draw

          public final void draw(java.awt.Graphics g)

      Draws the image on the screen on its x and y coordinate
      Parameters:
        `g` - graphics context to use for drawing

    - #### getBounds

          public final java.awt.Rectangle getBounds()

      Returns the bounding rectangle for the image
      Returns:
        Rectangle bounding rectangle of image