Boolsheet avatar Boolsheet committed e140b3d

Making love::Vector arguments references. Also throwing some const on top of it because it looks prettier with syntax highlighting colors.

Comments (1)

  1. Boolsheet author

    It's by default active

    I think the ParticleSystem should be off on creation, but start to emit 10 particles per second to the "right" when started. Something simple and visible.

    getParticleCount

    Or is getCount better? The other methods don't have "Particle" in their names, except setParticleLife. Perhaps putting "Particle" in everything would be a bit overkill.

    Any comments on the other method names (both C++ and Lua)?

    setLifetime

    Passing -1 for nonstop emitting seems kind of arbitrary. How about a call without arguments does that?

    Changing the lifetime of an emitter while it is active resets the lifetime timer. Maybe it should just count down from where it was.

    setImage

    The offsets do not get changed when a new Image is set. Should it center it?

    setSpin

    This needs some work. I'm not sure what the variation is supposed to do, but it doesn't look very useful. How about we let them set a start spin, an end spin, and variations for both. I would also like to include an option that makes it select the sign randomly so it can spin in both directions.

    ParticleSystem:setSpin(10, 20, 1, 4, true)

    That would mean use a start spin of 10±1 radians per second and an end spin of 20±4 radians per second. The boolean gives it a chance of being negated. It's a bit different from the other variations... could get confusing.

    Am I overthinking this? Is something simpler enough?

Files changed (2)

src/modules/graphics/opengl/ParticleSystem.cpp

 		*max = particleLifeMax;
 }
 
-void ParticleSystem::setPosition(love::Vector pos)
+void ParticleSystem::setPosition(const love::Vector &pos)
 {
 	position = pos;
 }
 	return position.getY();
 }
 
-void ParticleSystem::setAreaSpread(AreaSpreadDistribution distribution, love::Vector spread)
+void ParticleSystem::setAreaSpread(AreaSpreadDistribution distribution, const love::Vector &spread)
 {
 	areaSpread = spread;
 	areaSpreadDistribution = distribution;
 		*max = speedMax;
 }
 
-void ParticleSystem::setLinearAcceleration(love::Vector accel)
+void ParticleSystem::setLinearAcceleration(const love::Vector &accel)
 {
 	linearAccelerationMin = accel;
 	linearAccelerationMax = accel;
 }
 
-void ParticleSystem::setLinearAcceleration(love::Vector min, love::Vector max)
+void ParticleSystem::setLinearAcceleration(const love::Vector &min, const love::Vector &max)
 {
 	linearAccelerationMin = min;
 	linearAccelerationMax = max;
 	return spinVariation;
 }
 
-void ParticleSystem::setOffset(love::Vector offset)
+void ParticleSystem::setOffset(const love::Vector &offset)
 {
 	this->offset = offset;
 }

src/modules/graphics/opengl/ParticleSystem.h

 	 * Used to move the emitter without changing the position of already existing particles.
 	 * @param x The new position of the emitter.
 	 */
-	void setPosition(love::Vector pos);
+	void setPosition(const love::Vector &pos);
 
 	/**
 	 * Returns the position of the emitter.
 	 * @param distribution Distribution type
 	 * @param spread The spread around the emitter. Interpretation depends on distribution type.
 	 */
-	void setAreaSpread(AreaSpreadDistribution distribution, love::Vector spread);
+	void setAreaSpread(AreaSpreadDistribution distribution, const love::Vector &spread);
 
 	/**
 	 * Returns area spread distribution type.
 	 * Sets the linear acceleration (the acceleration along the x and y axes).
 	 * @param accel The acceleration vector.
 	 **/
-	void setLinearAcceleration(love::Vector accel);
+	void setLinearAcceleration(const love::Vector &accel);
 
 	/**
 	 * Sets the linear acceleration (the acceleration along the x and y axes).
 	 * @param min The minimum acceleration vector.
 	 * @param max The maximum acceleration vector.
 	 **/
-	void setLinearAcceleration(love::Vector min, love::Vector max);
+	void setLinearAcceleration(const love::Vector &min, const love::Vector &max);
 
 	/**
 	 * Gets the linear acceleration of the particles.
 	 * applied, the image is translated by this amount.
 	 * @param offset The offset vector.
 	 */
-	void setOffset(love::Vector offset);
+	void setOffset(const love::Vector &offset);
 
 	/**
 	 * Returns of the particle offset vector.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.