Package game.gui.elements

Source Code of game.gui.elements.GuiItemSlot

package game.gui.elements;

import game.InputHandler.InputEvent;
import game.gui.Gui;
import game.item.Item;

public class GuiItemSlot extends GuiElement {

  private GuiContainer container;
  private int slotIndex;

  public GuiItemSlot(int elementId, Gui gui, GuiContainer container,
      int slotIndex) {
    super(elementId, gui);
    this.container = container;
    this.slotIndex = slotIndex;
  }

  @Override
  public void actionPerformed(InputEvent event) {

  }
 
  public void setSlotIndex(int i) {
    slotIndex = i;
  }

  @Override
  public void render(Gui gui, int x, int y, int color) {
    Item item = container.getItemInSlot(this.slotIndex);
    if (item != null) {
      GuiRenderer.render(gui, gui.font, x, y, item.getSpriteIndex(),
          item.getSpriteColor(), 0x00, 1);
    }
  }
}
TOP

Related Classes of game.gui.elements.GuiItemSlot

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.