Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds two constructors to ParticleSystem that accept an array of bitmaps #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,37 @@ public ParticleSystem(Activity a, int maxParticles, Bitmap bitmap, long timeToLi
}
}

/**
* Utility constructor that receives an array of Bitmaps
*
* @param a The parent activity
* @param maxParticles The maximum number of particles
* @param bitmaps An array of bitmaps which will be randomly assigned to particles
* @param timeToLive The time to live for the particles
* @param parentViewId The view Id for the parent of the particle system
*/
public ParticleSystem(Activity a, int maxParticles, Bitmap[] bitmaps, long timeToLive, int parentViewId) {
this((ViewGroup) a.findViewById(parentViewId), maxParticles, timeToLive);
for (int i=0; i<mMaxParticles; i++) {
mParticles.add (new Particle (bitmaps[mRandom.nextInt(bitmaps.length)]));
}
}

/**
* Utility constructor that receives an array of Bitmaps
*
* @param parentView The parent view group
* @param maxParticles The maximum number of particles
* @param bitmaps An array of bitmaps which will be randomly assigned to particles
* @param timeToLive The time to live for the particles
*/
public ParticleSystem(ViewGroup parentView, int maxParticles, Bitmap[] bitmaps, long timeToLive) {
this(parentView, maxParticles, timeToLive);
for (int i=0; i<mMaxParticles; i++) {
mParticles.add (new Particle (bitmaps[mRandom.nextInt(bitmaps.length)]));
}
}

/**
* Utility constructor that receives an AnimationDrawble
*
Expand Down