Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.rico.adventure.inventory
Class AbstractInventory

    java.lang.Object
      de.rico.adventure.inventory.AbstractInventory

Direct Known Subclasses:
  BarInventory, BoxInventory

    public abstract class AbstractInventory

extends java.lang.Object

Abstract base class for different kinds of inventory systems.

Author:
  Frank Bruns

Constructor Summary
`AbstractInventory(InputManager input)` Creates a new inventory system.

Method Summary
`void` | `add(Item item)` Adds an item to the inventory.
`boolean` | `contains(Item item)` Determines whether the inventory contains the specified item
`abstract void` | `draw(javax.media.opengl.GL gl)` The method draws the inventory, when visible
`Color4f` | `getBGColor()` Returns the background color of the inventory area.
`int` | `getHeight()` Returns the height of the inventory area.
`java.util.LinkedList<Item>` | `getItems()` Returns a list of the items in the inventory
`Item` | `getItemUnderCursor()` Returns the item that lies beneath the mouse cursor.
`Item` | `getSelectedInventoryItem()` Returns the currently selected inventory item.
`Color4f` | `getTextColor()` Returns the text color of the inventory area.
`int` | `getWidth()` Returns the width of the inventory area.
`int` | `getX()` Returns the x coordinate of the inventory area.
`int` | `getY()` Returns the y coordinate of the inventory area.
`boolean` | `isMouseInInventory()` Helper method to figure out, if the mouse is located within the bounds of the inventory area.
`abstract boolean` | `isMouseOverItem(Item item)` Determines whether or not the mouse is located over the specified inventory item.
`boolean` | `isVisible()` Determines whether or not the inventory is currently visible.
`void` | `remove(Item item)` Removes an item from the inventory.
`void` | `setBGColor(Color4f color)` Sets the background color for the inventory area.
`void` | `setHeight(int height)` Sets the height of the inventory area
`void` | `setSelectedInventoryItem(Item item)` Sets the currently selected inventory item to the specified item.
`void` | `setTextColor(Color4f color)` Sets the text color for the inventory area.
`void` | `setVisible(boolean visible)` Sets the visibility status of the inventory.
`void` | `setWidth(int width)` Sets the width of the inventory area
`void` | `setX(int x)` Sets the x-coordinate of the inventory area.
`void` | `setY(int y)` Sets the y-coordinate of the inventory area.
`void` | `update(long elapsedTime)` This method updates the inventory.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractInventory

    public AbstractInventory(InputManager input)

  Creates a new inventory system.

  Parameters:
    `input` - input manager object

Method Detail

### getHeight

    public int getHeight()

  Returns the height of the inventory area.

  Returns:
    height of inventory area

### setHeight

    public void setHeight(int height)

  Sets the height of the inventory area

  Parameters:
    `height` - the height of the invemtory area

### getWidth

    public int getWidth()

  Returns the width of the inventory area.

  Returns:
    width of the inventory area

### setWidth

    public void setWidth(int width)

  Sets the width of the inventory area

  Parameters:
    `width` - the width of the inventory area

### getX

    public int getX()

  Returns the x coordinate of the inventory area.

  Returns:
    x-coordinate

### setX

    public void setX(int x)

  Sets the x-coordinate of the inventory area.

  Parameters:
    `x` - x-coordinate of the inventory area.

### getY

    public int getY()

  Returns the y coordinate of the inventory area.

  Returns:
    y-coordinate of the inventory area

### setY

    public void setY(int y)

  Sets the y-coordinate of the inventory area.

  Parameters:
    `y` - y-coordinate of the inventory area

### setVisible

    public void setVisible(boolean visible)

  Sets the visibility status of the inventory.

  Parameters:
    `visible` - set visible? --> true=yes, false=no

### isVisible

    public boolean isVisible()

  Determines whether or not the inventory is currently visible.

  Returns:
    is visible? --> true=yes, false=no

### isMouseInInventory

    public boolean isMouseInInventory()

  Helper method to figure out, if the mouse is located within the bounds of the inventory area.

  Returns:
    is mouse in inventory area bounds? --> true=yes, false=no

### isMouseOverItem

    public abstract boolean isMouseOverItem(Item item)

  Determines whether or not the mouse is located over the specified inventory item.

  Parameters:
    `item` - item in the inventory to check
  Returns:
    is mouse over item in inventory? --> true=yes, false=no

### getItemUnderCursor

    public Item getItemUnderCursor()

  Returns the item that lies beneath the mouse cursor.

  Returns:
    item under mouse cursor

### setBGColor

    public void setBGColor(Color4f color)

  Sets the background color for the inventory area.

  Parameters:
    `color` - background color for the inventory

### getBGColor

    public Color4f getBGColor()

  Returns the background color of the inventory area.

  Returns:
    background color of the inventory

### setTextColor

    public void setTextColor(Color4f color)

  Sets the text color for the inventory area.

  Parameters:
    `color` - text color for the inventory

### getTextColor

    public Color4f getTextColor()

  Returns the text color of the inventory area.

  Returns:
    text color of the inventory

### getItems

    public java.util.LinkedList<Item> getItems()

  Returns a list of the items in the inventory

  Returns:
    list of inventory items

### add

    public void add(Item item)

  Adds an item to the inventory.

  Parameters:
    `item` - Item that shall be added to the inventory

### remove

    public void remove(Item item)

  Removes an item from the inventory.

  Parameters:
    `item` - item to remove from the inventory

### getSelectedInventoryItem

    public Item getSelectedInventoryItem()

  Returns the currently selected inventory item.

  Returns:
    the currently selected inventory item, `null` if none is selected

### contains

    public boolean contains(Item item)

  Determines whether the inventory contains the specified item

  Parameters:
    `item` - item to check for existence in the inventory
  Returns:
    inventory contains the item? --> true=yes, false=no

### setSelectedInventoryItem

    public void setSelectedInventoryItem(Item item)

  Sets the currently selected inventory item to the specified item. Set it to null to express that no imventory item is selected

  Parameters:
    `item` - item to set to the selected inventory item

### update

    public void update(long elapsedTime)

  This method updates the inventory.

  Parameters:
    `elapsedTime` - time between two frames

### draw

    public abstract void draw(javax.media.opengl.GL gl)

  The method draws the inventory, when visible

  Parameters:
    `gl` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD