com.b3dgs.lionengine.game.hacknslash
Class AbstractItemHandler<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

java.lang.Object
  extended by com.b3dgs.lionengine.game.Handler<AbstractItem<TTile>>
      extended by com.b3dgs.lionengine.game.hacknslash.AbstractItemHandler<TTile,TSkill,TAttr>

public class AbstractItemHandler<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
extends Handler<AbstractItem<TTile>>

Represents the bag containing all items, and their representation on map. They can be selected and well organized, or placed on the map. The only one constraint is to fit only unsed bag location.


Field Summary
 
Fields inherited from class com.b3dgs.lionengine.game.Handler
elements
 
Constructor Summary
AbstractItemHandler(TileBasedMap<TTile> map, AbstractControlPanel<TTile,TSkill,TAttr> panel, Entity owner, int x, int y, int width, int height, int boxSize)
          Create a new item handler.
 
Method Summary
 boolean isVisible()
          Check if item panel is visible.
 void place(int x, int y)
          Set bag representation location.
 void render(java.awt.Graphics2D g)
          Render items from bag.
 void render(java.awt.Graphics2D g, StrategyCamera camera)
          Render items on map.
 void setSize(int width, int height)
          Set bag panel size.
 void setVisible(boolean state)
          Set bag representation visibility state.
 void update(Keyboard keyboard, StrategyCursor cursor)
          Update items in bag and on map.
 
Methods inherited from class com.b3dgs.lionengine.game.Handler
add, list, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractItemHandler

public AbstractItemHandler(TileBasedMap<TTile> map,
                           AbstractControlPanel<TTile,TSkill,TAttr> panel,
                           Entity owner,
                           int x,
                           int y,
                           int width,
                           int height,
                           int boxSize)
Create a new item handler.

Parameters:
map - map reference.
panel - panel reference.
owner - owner reference (entity owning items).
x - initial panel location x.
y - initial panel location y.
width - initial panel width.
height - initial panel height.
boxSize - size of a box from the bag grid (in pixel).
Method Detail

place

public void place(int x,
                  int y)
Set bag representation location.

Parameters:
x - location x.
y - location y.

setSize

public void setSize(int width,
                    int height)
Set bag panel size.

Parameters:
width - horizontal size.
height - vertical size.

update

public void update(Keyboard keyboard,
                   StrategyCursor cursor)
Update items in bag and on map.

Parameters:
cursor - cursor reference.
keyboard - keyboard reference.

render

public void render(java.awt.Graphics2D g)
Render items from bag.

Parameters:
g - graphics output.

render

public void render(java.awt.Graphics2D g,
                   StrategyCamera camera)
Render items on map.

Parameters:
g - graphics output.
camera - camera reference.

setVisible

public void setVisible(boolean state)
Set bag representation visibility state.

Parameters:
state - visibility state.

isVisible

public boolean isVisible()
Check if item panel is visible.

Returns:
visibility state.