Remade item and tile basic system.
Still not funcitonal but the shape is final. Sort of.
This commit is contained in:
@@ -24,7 +24,8 @@ public class BufferedHashSet<E> extends HashSet<E> {
|
||||
/**
|
||||
* make empty
|
||||
*/
|
||||
public BufferedHashSet() {
|
||||
public BufferedHashSet()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -34,7 +35,8 @@ public class BufferedHashSet<E> extends HashSet<E> {
|
||||
*
|
||||
* @param c
|
||||
*/
|
||||
public BufferedHashSet(Collection<? extends E> c) {
|
||||
public BufferedHashSet(Collection<? extends E> c)
|
||||
{
|
||||
super(c);
|
||||
}
|
||||
|
||||
@@ -45,7 +47,8 @@ public class BufferedHashSet<E> extends HashSet<E> {
|
||||
* @param initialCapacity
|
||||
* @param loadFactor
|
||||
*/
|
||||
public BufferedHashSet(int initialCapacity, float loadFactor) {
|
||||
public BufferedHashSet(int initialCapacity, float loadFactor)
|
||||
{
|
||||
super(initialCapacity, loadFactor);
|
||||
}
|
||||
|
||||
@@ -55,7 +58,8 @@ public class BufferedHashSet<E> extends HashSet<E> {
|
||||
*
|
||||
* @param initialCapacity
|
||||
*/
|
||||
public BufferedHashSet(int initialCapacity) {
|
||||
public BufferedHashSet(int initialCapacity)
|
||||
{
|
||||
super(initialCapacity);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ final public class EventBus implements Destroyable {
|
||||
private final Event<?> evt;
|
||||
|
||||
|
||||
public DelayQueueEntry(double seconds, Event<?> event) {
|
||||
public DelayQueueEntry(double seconds, Event<?> event)
|
||||
{
|
||||
super();
|
||||
this.due = System.currentTimeMillis() + (long) (seconds * 1000);
|
||||
this.evt = event;
|
||||
@@ -71,7 +72,8 @@ final public class EventBus implements Destroyable {
|
||||
public volatile boolean stopped = false;
|
||||
|
||||
|
||||
public QueuePollingThread() {
|
||||
public QueuePollingThread()
|
||||
{
|
||||
super("Queue Polling Thread");
|
||||
}
|
||||
|
||||
@@ -141,7 +143,8 @@ final public class EventBus implements Destroyable {
|
||||
/**
|
||||
* Make a new bus and start it's queue thread.
|
||||
*/
|
||||
public EventBus() {
|
||||
public EventBus()
|
||||
{
|
||||
busThread = new QueuePollingThread();
|
||||
busThread.setDaemon(true);
|
||||
busThread.start();
|
||||
|
||||
@@ -30,7 +30,8 @@ class EventChannel<EVENT extends Event<CLIENT>, CLIENT> {
|
||||
* @param eventClass event class
|
||||
* @param clientClass client class
|
||||
*/
|
||||
public EventChannel(Class<EVENT> eventClass, Class<CLIENT> clientClass) {
|
||||
public EventChannel(Class<EVENT> eventClass, Class<CLIENT> clientClass)
|
||||
{
|
||||
|
||||
if (eventClass == null || clientClass == null) {
|
||||
throw new NullPointerException("Null Event or Client class.");
|
||||
|
||||
@@ -27,7 +27,8 @@ public abstract class BusNode implements BusAccess, ClientHub {
|
||||
/**
|
||||
* @param busAccess access to bus
|
||||
*/
|
||||
public BusNode(BusAccess busAccess) {
|
||||
public BusNode(BusAccess busAccess)
|
||||
{
|
||||
this.busAccess = busAccess;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ public abstract class RootBusNode extends BusNode implements Destroyable {
|
||||
/**
|
||||
* @param busAccess access to bus
|
||||
*/
|
||||
public RootBusNode(BusAccess busAccess) {
|
||||
public RootBusNode(BusAccess busAccess)
|
||||
{
|
||||
super(busAccess);
|
||||
|
||||
getEventBus().subscribe(this);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package mightypork.util.control.timing;
|
||||
|
||||
|
||||
import mightypork.util.annotations.DefaultImpl;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.constraints.num.proxy.NumBound;
|
||||
import mightypork.util.math.Easing;
|
||||
|
||||
|
||||
public abstract class Animator implements Updateable, Pauseable, NumBound {
|
||||
|
||||
private final NumAnimated animator;
|
||||
private final Num num;
|
||||
|
||||
|
||||
public Animator(double period)
|
||||
{
|
||||
this(0, 1, period, Easing.LINEAR);
|
||||
}
|
||||
|
||||
|
||||
public Animator(double start, double end, double period)
|
||||
{
|
||||
this(start, end, period, Easing.LINEAR);
|
||||
}
|
||||
|
||||
|
||||
public Animator(double period, Easing easing)
|
||||
{
|
||||
this(0, 1, period, easing);
|
||||
}
|
||||
|
||||
|
||||
public Animator(double start, double end, double period, Easing easing)
|
||||
{
|
||||
animator = new NumAnimated(0, easing);
|
||||
animator.setDefaultDuration(period);
|
||||
|
||||
this.num = animator.mul(end - start).add(start);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void pause()
|
||||
{
|
||||
animator.pause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void resume()
|
||||
{
|
||||
animator.resume();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final boolean isPaused()
|
||||
{
|
||||
return animator.isPaused();
|
||||
}
|
||||
|
||||
|
||||
public final void reset()
|
||||
{
|
||||
animator.reset();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void update(double delta)
|
||||
{
|
||||
animator.update(delta);
|
||||
if (animator.isFinished()) nextCycle(animator);
|
||||
}
|
||||
|
||||
|
||||
@DefaultImpl
|
||||
protected abstract void nextCycle(NumAnimated anim);
|
||||
|
||||
|
||||
@Override
|
||||
public final Num getNum()
|
||||
{
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
public final double value()
|
||||
{
|
||||
return num.value();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package mightypork.util.control.timing;
|
||||
|
||||
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.math.Easing;
|
||||
|
||||
|
||||
/**
|
||||
* Animator that upon reaching max, animates back down and then up again
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public class AnimatorBounce extends Animator {
|
||||
|
||||
private final boolean wasUp = false;
|
||||
|
||||
|
||||
public AnimatorBounce(double start, double end, double period, Easing easing)
|
||||
{
|
||||
super(start, end, period, easing);
|
||||
}
|
||||
|
||||
|
||||
public AnimatorBounce(double start, double end, double period)
|
||||
{
|
||||
super(start, end, period);
|
||||
}
|
||||
|
||||
|
||||
public AnimatorBounce(double period, Easing easing)
|
||||
{
|
||||
super(period, easing);
|
||||
}
|
||||
|
||||
|
||||
public AnimatorBounce(double period)
|
||||
{
|
||||
super(period);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void nextCycle(NumAnimated anim)
|
||||
{
|
||||
if (wasUp) {
|
||||
anim.fadeOut();
|
||||
} else {
|
||||
anim.fadeIn();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package mightypork.util.control.timing;
|
||||
|
||||
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.math.Easing;
|
||||
|
||||
|
||||
/**
|
||||
* Animator that upon reaching top, jumps straight to zero and continues another
|
||||
* cycle.
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public class AnimatorRewind extends Animator {
|
||||
|
||||
public AnimatorRewind(double start, double end, double period, Easing easing)
|
||||
{
|
||||
super(start, end, period, easing);
|
||||
}
|
||||
|
||||
|
||||
public AnimatorRewind(double start, double end, double period)
|
||||
{
|
||||
super(start, end, period);
|
||||
}
|
||||
|
||||
|
||||
public AnimatorRewind(double period, Easing easing)
|
||||
{
|
||||
super(period, easing);
|
||||
}
|
||||
|
||||
|
||||
public AnimatorRewind(double period)
|
||||
{
|
||||
super(period);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void nextCycle(NumAnimated anim)
|
||||
{
|
||||
anim.reset();
|
||||
anim.fadeIn();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,8 @@ public class TimerDelta {
|
||||
/**
|
||||
* New delta timer
|
||||
*/
|
||||
public TimerDelta() {
|
||||
public TimerDelta()
|
||||
{
|
||||
lastFrame = System.nanoTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ public class TimerFps {
|
||||
*
|
||||
* @param fps target FPS
|
||||
*/
|
||||
public TimerFps(long fps) {
|
||||
public TimerFps(long fps)
|
||||
{
|
||||
FRAME = Math.round(SECOND / (double) fps);
|
||||
|
||||
lastFrame = System.nanoTime();
|
||||
|
||||
Reference in New Issue
Block a user