v5stable
ondra 11 years ago
parent e4e908ad75
commit 1796c2858c
  1. 11
      src/mightypork/rogue/world/item/ItemRenderer.java
  2. 22
      src/mightypork/rogue/world/item/items/ItemMeat.java
  3. 32
      src/mightypork/rogue/world/item/rendr/QuadItemRenderer.java

@ -0,0 +1,11 @@
package mightypork.rogue.world.item;
import mightypork.gamecore.util.math.constraints.rect.Rect;
public abstract class ItemRenderer {
public abstract void render(Rect r);
}

@ -0,0 +1,22 @@
package mightypork.rogue.world.item.items;
import mightypork.rogue.Res;
import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.item.ItemModel;
import mightypork.rogue.world.item.ItemRenderer;
import mightypork.rogue.world.item.rendr.QuadItemRenderer;
public class ItemMeat extends Item {
public ItemMeat(ItemModel model) {
super(model);
}
@Override
protected ItemRenderer makeRenderer()
{
return new QuadItemRenderer(Res.getTxQuad("item.meat"));
}
}

@ -0,0 +1,32 @@
package mightypork.rogue.world.item.rendr;
import mightypork.gamecore.render.Render;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.util.math.constraints.rect.Rect;
import mightypork.rogue.world.item.ItemRenderer;
public class QuadItemRenderer extends ItemRenderer {
private final TxQuad txq;
public QuadItemRenderer(TxQuad txq) {
this.txq = txq;
}
public QuadItemRenderer(TxSheet txs) {
this.txq = txs.getQuad(0);
}
@Override
public void render(Rect r)
{
Render.quadTextured(r, txq);
}
}
Loading…
Cancel
Save