Moved some classes. Added LayoutChangeEvent class.
This commit is contained in:
@@ -5,7 +5,7 @@ import mightypork.gamecore.audio.DeferredAudio;
|
||||
import mightypork.gamecore.audio.Volume;
|
||||
import mightypork.gamecore.control.timing.Pauseable;
|
||||
import mightypork.gamecore.control.timing.Updateable;
|
||||
import mightypork.utils.math.animation.AnimDouble;
|
||||
import mightypork.utils.math.constraints.num.NumAnimated;
|
||||
|
||||
import org.lwjgl.openal.AL10;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class LoopPlayer extends BaseAudioPlayer implements Updateable, Pauseable
|
||||
private int sourceID = -1;
|
||||
|
||||
/** animator for fade in and fade out */
|
||||
private final AnimDouble fadeAnim = new AnimDouble(0);
|
||||
private final NumAnimated fadeAnim = new NumAnimated(0);
|
||||
|
||||
private double lastUpdateGain = 0;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mightypork.gamecore.control.bus;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mightypork.gamecore.control.bus.clients.DelegatingClient;
|
||||
import mightypork.gamecore.control.bus.events.Event;
|
||||
import mightypork.gamecore.control.bus.events.types.DelayedEvent;
|
||||
import mightypork.gamecore.control.bus.events.types.ImmediateEvent;
|
||||
@@ -116,7 +118,7 @@ final public class EventBus implements Destroyable {
|
||||
|
||||
|
||||
/**
|
||||
* Send based on annotation.
|
||||
* Send based on annotation.clients
|
||||
*
|
||||
* @param event event
|
||||
*/
|
||||
@@ -187,6 +189,16 @@ final public class EventBus implements Destroyable {
|
||||
}
|
||||
|
||||
|
||||
public void sendDirectToChildren(DelegatingClient delegatingClient, Event<?> event)
|
||||
{
|
||||
assertLive();
|
||||
|
||||
if (shallLog(event)) Log.f3("<bus> Di sub " + Log.str(event));
|
||||
|
||||
doDispatch(delegatingClient.getChildClients(), event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send immediately.<br>
|
||||
* Should be used for real-time events that require immediate response, such
|
||||
@@ -201,6 +213,21 @@ final public class EventBus implements Destroyable {
|
||||
channels.setBuffering(true);
|
||||
clients.setBuffering(true);
|
||||
|
||||
doDispatch(clients, event);
|
||||
|
||||
channels.setBuffering(false);
|
||||
clients.setBuffering(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send to a set of clients
|
||||
*
|
||||
* @param clients clients
|
||||
* @param event event
|
||||
*/
|
||||
private void doDispatch(Collection<Object> clients, Event<?> event)
|
||||
{
|
||||
boolean sent = false;
|
||||
boolean accepted = false;
|
||||
|
||||
@@ -218,8 +245,6 @@ final public class EventBus implements Destroyable {
|
||||
if (!accepted) Log.e("<bus> Not accepted by any channel: " + Log.str(event));
|
||||
if (!sent && shallLog(event)) Log.w("<bus> Not delivered: " + Log.str(event));
|
||||
|
||||
channels.setBuffering(false);
|
||||
clients.setBuffering(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ import java.util.Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Client containing child clients
|
||||
* Client containing child clients. According to the contract, if the collection
|
||||
* of clients is ordered, the clients will be served in that order. In any case,
|
||||
* the {@link DelegatingClient} itself will be served beforehand.
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package mightypork.gamecore.control.bus.events;
|
||||
|
||||
|
||||
import mightypork.gamecore.control.bus.events.types.ImmediateEvent;
|
||||
import mightypork.gamecore.control.timing.Pollable;
|
||||
|
||||
|
||||
/**
|
||||
* Intended use is to notify UI component sub-clients that they should poll
|
||||
* their cached constraints.
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
@ImmediateEvent
|
||||
public class LayoutChangeEvent implements Event<Pollable> {
|
||||
|
||||
public LayoutChangeEvent() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleBy(Pollable handler)
|
||||
{
|
||||
handler.poll();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.gamecore.control.bus.events;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import mightypork.gamecore.control.bus.EventBus;
|
||||
import mightypork.gamecore.control.bus.clients.ClientHub;
|
||||
import mightypork.gamecore.input.InputSystem;
|
||||
import mightypork.gamecore.render.DisplaySystem;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
|
||||
|
||||
public abstract class BusEnabledPainter extends SimplePainter implements ClientHub, Component, AppAccess {
|
||||
|
||||
@@ -4,8 +4,8 @@ package mightypork.gamecore.gui.components;
|
||||
import mightypork.gamecore.control.bus.clients.ToggleableClient;
|
||||
import mightypork.gamecore.control.interf.Enableable;
|
||||
import mightypork.gamecore.gui.Hideable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.PluggableRectBound;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.PluggableRectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.RectBoundAdapter;
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import mightypork.gamecore.gui.components.BusEnabledPainter;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.gamecore.gui.components.SimplePainter;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ package mightypork.gamecore.gui.components.layout;
|
||||
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.TiledRect;
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package mightypork.gamecore.gui.components.layout;
|
||||
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.TiledRect;
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import mightypork.gamecore.input.KeyBindingPool;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.annotations.DefaultImpl;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import mightypork.gamecore.input.KeyBinder;
|
||||
import mightypork.gamecore.input.KeyBindingPool;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.utils.annotations.DefaultImpl;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import mightypork.gamecore.control.AppModule;
|
||||
import mightypork.gamecore.control.bus.events.ScreenChangeEvent;
|
||||
import mightypork.gamecore.control.timing.FpsMeter;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBound;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
Reference in New Issue
Block a user