void MASOSApp::update() { if (mAngle != oldAngle) { scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y); } oldAngle = mAngle; if (scale != oldScale) { scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y); } oldScale = scale; if (mTerminalVelocity != oldTerminalVelocity) { scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y); } oldTerminalVelocity = mTerminalVelocity; if (mInitialVelocity != oldInitialVelocity) { scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y); } oldInitialVelocity =mInitialVelocity; float tmp = mProjectileUnderTest.mPosition.y; mProjectileUnderTest.update(mInitialVelocity, mAngle, mCurrentTime, mTerminalVelocity); if (mProjectileUnderTest.mPosition.y > 0) { mProjectileUnderTest.mPosition.y = 0; mIsPlaying = false; } if (tmp >= 0 && mProjectileUnderTest.mPosition.y >= 0) { mProjectileUnderTest.mPosition.y = 0; mIsPlaying = false; mCurrentTime = oldTime; } if (mProjectileUnderTest.mPosition.x < 0) { mProjectileUnderTest.mPosition.x = 0.f; } oldTime = mCurrentTime; currX = mProjectileUnderTest.mPosition.x; currY = -(mProjectileUnderTest.mPosition.y); if (currY == -0) currY = 0; mParams->setPosition(ivec2(0,0)); }
void MASOSApp::buttonStart() { scale = mProjectileUnderTest.calculateScale(mInitialVelocity, mAngle, mTerminalVelocity, getWindowCenter().x, getWindowCenter().y); oldScale = scale; mIsPlaying = true; }