parent
0d5b6eb995
commit
2f26602d15
@ -1,19 +0,0 @@ |
||||
package mightypork.rogue.world.structs; |
||||
|
||||
|
||||
import mightypork.rogue.world.item.Item; |
||||
import mightypork.util.files.ion.templates.IonizableStack; |
||||
|
||||
|
||||
public class ItemStack extends IonizableStack<Item> { |
||||
|
||||
private static final short ION_MARK = 710; |
||||
|
||||
|
||||
@Override |
||||
public short getIonMark() |
||||
{ |
||||
return ION_MARK; |
||||
} |
||||
|
||||
} |
@ -1,19 +0,0 @@ |
||||
package mightypork.rogue.world.structs; |
||||
|
||||
|
||||
import mightypork.rogue.world.map.Level; |
||||
import mightypork.util.files.ion.templates.IonizableArrayList; |
||||
|
||||
|
||||
public class LevelList extends IonizableArrayList<Level> { |
||||
|
||||
public static final short ION_MARK = 709; |
||||
|
||||
|
||||
@Override |
||||
public short getIonMark() |
||||
{ |
||||
return ION_MARK; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,45 @@ |
||||
package mightypork.rogue.world.tile; |
||||
|
||||
|
||||
import mightypork.rogue.world.item.Item; |
||||
import mightypork.rogue.world.map.TileRenderContext; |
||||
import mightypork.util.constraints.rect.Rect; |
||||
import mightypork.util.constraints.rect.proxy.RectBoundAdapter; |
||||
import mightypork.util.control.timing.Animator; |
||||
import mightypork.util.control.timing.AnimatorBounce; |
||||
import mightypork.util.control.timing.Updateable; |
||||
import mightypork.util.math.Easing; |
||||
|
||||
|
||||
public class DroppedItemRenderer implements Updateable { |
||||
|
||||
private Animator itemAnim = new AnimatorBounce(2, Easing.SINE_BOTH); |
||||
|
||||
// prepared constraints, to avoid re-building each frame
|
||||
private final RectBoundAdapter tileRectAdapter = new RectBoundAdapter(); |
||||
private final Rect itemRect = tileRectAdapter.shrink(tileRectAdapter.height().perc(10)).moveY(itemAnim.neg()); |
||||
|
||||
|
||||
public Animator getItemAnim() |
||||
{ |
||||
if (itemAnim == null) { |
||||
itemAnim = new AnimatorBounce(2, Easing.SINE_BOTH); |
||||
} |
||||
|
||||
return itemAnim; |
||||
} |
||||
|
||||
|
||||
public void render(Item item, TileRenderContext context) |
||||
{ |
||||
tileRectAdapter.setRect(context); |
||||
item.render(itemRect); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void update(double delta) |
||||
{ |
||||
itemAnim.update(delta); |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package mightypork.util.files.ion; |
||||
|
||||
|
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.io.OutputStream; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* Saveable to a stream. |
||||
* |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface Streamable { |
||||
|
||||
/** |
||||
* Load data from the input stream. Must be compatible with the |
||||
* <code>save</code> method. |
||||
* |
||||
* @param in input stream |
||||
* @throws IOException |
||||
*/ |
||||
void load(InputStream in) throws IOException; |
||||
|
||||
|
||||
/** |
||||
* Store data to output stream. |
||||
* |
||||
* @param out Output stream |
||||
* @throws IOException |
||||
*/ |
||||
void save(OutputStream out) throws IOException; |
||||
|
||||
} |
Loading…
Reference in new issue