de.rico.adventure.inventory
Class BarInventory

java.lang.Object
  extended by de.rico.adventure.inventory.AbstractInventory
      extended by de.rico.adventure.inventory.BarInventory

public class BarInventory
extends AbstractInventory

This class represents an inventory that uses a bar at the top of the screen to visualize the items in the inventory.

Author:
Frank Bruns

Constructor Summary
BarInventory(int height, int space, Color4f hoverColor, InputManager input)
          Creates a new inventory system that uses a bar at the top of the screen to visualize the items in the inventory.
BarInventory(int height, int space, InputManager input)
          Creates a new inventory system that uses a bar at the top of the screen to visualize the items in the inventory.
 
Method Summary
 void draw(javax.media.opengl.GL gl)
          The method draws the inventory, when visible
 boolean isMouseOverItem(Item item)
          Determines whether or not the mouse is located over the specified inventory item.
 void update(long elapsedTime)
          This method updates the inventory.
 
Methods inherited from class de.rico.adventure.inventory.AbstractInventory
add, contains, getBGColor, getHeight, getItems, getItemUnderCursor, getSelectedInventoryItem, getTextColor, getWidth, getX, getY, isMouseInInventory, isVisible, remove, setBGColor, setHeight, setSelectedInventoryItem, setTextColor, setVisible, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarInventory

public BarInventory(int height,
                    int space,
                    InputManager input)
Creates a new inventory system that uses a bar at the top of the screen to visualize the items in the inventory.

Parameters:
height - height of the inventory bar in pixels
space - between two item pictures
input - input manager object

BarInventory

public BarInventory(int height,
                    int space,
                    Color4f hoverColor,
                    InputManager input)
Creates a new inventory system that uses a bar at the top of the screen to visualize the items in the inventory. If the mouse hovers over an item the image color will be set to the specified hover color

Parameters:
height - height of the inventory bar in pixels
space - between two item pictures
hoverColor - item imgages hover color
input - input manager object
Method Detail

isMouseOverItem

public boolean isMouseOverItem(Item item)
Description copied from class: AbstractInventory
Determines whether or not the mouse is located over the specified inventory item.

Specified by:
isMouseOverItem in class AbstractInventory
Parameters:
item - item in the inventory to check
Returns:
is mouse over item in inventory? --> true=yes, false=no

draw

public void draw(javax.media.opengl.GL gl)
Description copied from class: AbstractInventory
The method draws the inventory, when visible

Specified by:
draw in class AbstractInventory

update

public void update(long elapsedTime)
Description copied from class: AbstractInventory
This method updates the inventory.

Overrides:
update in class AbstractInventory
Parameters:
elapsedTime - time between two frames