Created
April 22, 2015 09:15
-
-
Save zilluss/219a4c32feb59c3a0222 to your computer and use it in GitHub Desktop.
Test case for b2ParticleSystem.GetParticleCount() and b2ParticleSystem.GetPositionBuffer()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TestCreateParticle() { | |
var psd = new b2ParticleSystemDef(); | |
var particleSystem= world.CreateParticleSystem(psd); | |
var expectedParticleCount = 50; | |
for(var i = 0; i < expectedParticleCount; i++) { | |
var pd = new b2ParticleDef(); | |
pd.position = new b2Vec2(i, 0); | |
particleSystem.CreateParticle(pd); | |
} | |
var assertParticleCount = "Expected particle count: " + expectedParticleCount + " actual: " + particleSystem.GetParticleCount(); | |
var assertPositionBuffer = "Expected position buffer size: " + (expectedParticleCount * 2) + " actual: " + particleSystem.GetPositionBuffer().length; | |
console.log(assertParticleCount); | |
console.log(assertPositionBuffer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment