Class FlixelSignal<T>
java.lang.Object
me.stringdotjar.flixelgdx.util.signal.FlixelSignal<T>
Utility class for creating objects that can execute multiple callbacks when it is dispatched (or triggered).
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(FlixelSignal.SignalHandler<T> callback) Adds a new callback tothissignal to be executed upondispatch()being called.voidaddOnce(FlixelSignal.SignalHandler<T> callback) Adds a temporary callback that only gets ran once.voidclear()Removes all callbacks fromthissignal.voiddispatch()Triggersthissignal and executes all callbacks.voidTriggersthissignal and executes all callbacks.voidremove(FlixelSignal.SignalHandler<T> callback) Removes a specific callback fromthissignal.
-
Constructor Details
-
FlixelSignal
public FlixelSignal()
-
-
Method Details
-
add
Adds a new callback tothissignal to be executed upondispatch()being called.- Parameters:
callback- The new callback to add to the signal, with the type intended to be a Javarecord.
-
addOnce
Adds a temporary callback that only gets ran once. Whendispatch()is executed, the temporary callback is removed.- Parameters:
callback- The new temporary callback to add, with the type intended to be a Javarecord.
-
remove
Removes a specific callback fromthissignal.- Parameters:
callback- The callback to remove.
-
clear
public void clear()Removes all callbacks fromthissignal. -
dispatch
public void dispatch()Triggersthissignal and executes all callbacks. -
dispatch
Triggersthissignal and executes all callbacks.- Parameters:
data- The parameters thatthissignal takes.
-