FlixelSignal
View sourceclass
org.flixelgdx.util.signal.FlixelSignal
public class FlixelSignal<T>
Utility class for creating objects that can execute multiple callbacks when it is dispatched (or triggered).
Constructors
FlixelSignal()
public FlixelSignal()
Methods
add(SignalHandler<T>)
public void add(SignalHandler<T> callback)
Adds a new callback to this signal to be executed upon dispatch() being called.
Parameters:
| Name | Description |
|---|---|
callback | The new callback to add to the signal, with the type intended to be a Java record. |
addOnce(SignalHandler<T>)
public void addOnce(SignalHandler<T> callback)
Adds a temporary callback that only gets ran once. When dispatch() is executed, the temporary callback is removed.
Parameters:
| Name | Description |
|---|---|
callback | The new temporary callback to add, with the type intended to be a Java record. |
remove(SignalHandler<T>)
public void remove(SignalHandler<T> callback)
Removes a specific callback from this signal.
Parameters:
| Name | Description |
|---|---|
callback | The callback to remove. |
clear()
public void clear()
Removes all callbacks from this signal.
dispatch()
public void dispatch()
Triggers this signal and executes all callbacks.
dispatch(T)
public void dispatch(T data)
Triggers this signal and executes all callbacks.
Parameters:
| Name | Description |
|---|---|
data | The parameters that this signal takes. |
SignalHandler
interface
org.flixelgdx.util.signal.FlixelSignal.SignalHandler
public static interface SignalHandler<T>
Methods
execute(T)
public void execute(T data)