Revision 71887484
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/library/EffectQueue.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
protected static int[] mMax = new int[EffectTypes.LENGTH]; |
25 | 25 |
protected int mMaxIndex; |
26 |
protected static boolean mCreated; |
|
27 |
|
|
26 |
|
|
28 | 27 |
protected Vector<EffectListener> mListeners =null; |
29 | 28 |
protected int mNumListeners=0; // ==mListeners.length(), but we only create mListeners if the first one gets added |
30 | 29 |
protected long mBitmapID; |
31 |
|
|
30 |
|
|
31 |
private static boolean mCreated; |
|
32 |
|
|
32 | 33 |
static |
33 | 34 |
{ |
34 | 35 |
reset(); |
... | ... | |
75 | 76 |
return mNumEffects; |
76 | 77 |
} |
77 | 78 |
|
79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
80 |
// Only max Byte.MAX_VALUE concurrent effects per DistortedObject. |
|
81 |
// If you want more, change type of the mNumEffects, mIDIndex and mFreeIndexes variables to shorts. |
|
82 |
|
|
83 |
static boolean setMax(int index, int m) |
|
84 |
{ |
|
85 |
if( (mCreated==false && !Distorted.isInitialized()) || m<=mMax[index] ) |
|
86 |
{ |
|
87 |
if( m<0 ) m = 0; |
|
88 |
else if( m>Byte.MAX_VALUE ) m = Byte.MAX_VALUE; |
|
89 |
|
|
90 |
mMax[index] = m; |
|
91 |
return true; |
|
92 |
} |
|
93 |
|
|
94 |
return false; |
|
95 |
} |
|
96 |
|
|
97 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
98 |
|
|
99 |
static int getMax(int index) |
|
100 |
{ |
|
101 |
return mMax[index]; |
|
102 |
} |
|
103 |
|
|
78 | 104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
79 | 105 |
|
80 | 106 |
void addListener(EffectListener el) |
Also available in: Unified diff
abstract setMax and getMax to EffectQueue.