Revision 20dbec0e
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
23 | 23 |
import org.distorted.library.effect.EffectName; |
24 | 24 |
import org.distorted.library.effectqueue.EffectQueue; |
25 | 25 |
import org.distorted.library.effect.EffectType; |
26 |
import org.distorted.library.message.EffectListener; |
|
27 | 26 |
|
28 | 27 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
29 | 28 |
/** |
... | ... | |
63 | 62 |
{ |
64 | 63 |
mID = ++mNextID; |
65 | 64 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
66 |
EffectQueue.allocateQueues(mQueues,null,0,mID);
|
|
65 |
EffectQueue.allocateQueues(mQueues,null,0); |
|
67 | 66 |
} |
68 | 67 |
|
69 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
80 | 79 |
{ |
81 | 80 |
mID = ++mNextID; |
82 | 81 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
83 |
EffectQueue.allocateQueues(mQueues,dc.getQueues(),flags,mID);
|
|
82 |
EffectQueue.allocateQueues(mQueues,dc.getQueues(),flags); |
|
84 | 83 |
} |
85 | 84 |
|
86 | 85 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
94 | 93 |
return mID; |
95 | 94 |
} |
96 | 95 |
|
97 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
98 |
/** |
|
99 |
* Adds the calling class to the list of Listeners that get notified each time some event happens |
|
100 |
* to one of the Effects in our queues. Nothing will happen if 'el' is already in the list. |
|
101 |
* |
|
102 |
* @param el A class implementing the EffectListener interface that wants to get notifications. |
|
103 |
*/ |
|
104 |
public void registerForMessages(EffectListener el) |
|
105 |
{ |
|
106 |
for( int i=0; i<EffectType.LENGTH; i++) |
|
107 |
{ |
|
108 |
mQueues[i].registerForMessages(el); |
|
109 |
} |
|
110 |
} |
|
111 |
|
|
112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
113 |
/** |
|
114 |
* Removes the calling class from the list of Listeners that get notified if something happens to Effects in our queue. |
|
115 |
* |
|
116 |
* @param el A class implementing the EffectListener interface that no longer wants to get notifications. |
|
117 |
*/ |
|
118 |
public void deregisterForMessages(EffectListener el) |
|
119 |
{ |
|
120 |
for( int i=0; i<EffectType.LENGTH; i++) |
|
121 |
{ |
|
122 |
mQueues[i].deregisterForMessages(el); |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
127 | 97 |
/** |
128 | 98 |
* Aborts all Effects. |
Also available in: Unified diff
Simplify the way applications can get notifications when an effect finishes.
Now, instead of the 'DistortedEffects.(de)registerForNotifications()' 2 APIs, we call a single 'Effect.notifyWhenFinished()'.