Merge pull request #494 from LLK/stop-all-gfx-reset

Stop all gfx reset
This commit is contained in:
Paul Kaplan 2017-03-07 13:56:32 -05:00 committed by GitHub
commit c0aacdc39b
2 changed files with 12 additions and 1 deletions

View file

@ -706,9 +706,10 @@ RenderedTarget.prototype.onGreenFlag = function () {
/**
* Called when the project receives a "stop all"
* Stop all sounds
* Stop all sounds and clear graphic effects.
*/
RenderedTarget.prototype.onStopAll = function () {
this.clearEffects();
if (this.audioPlayer) {
this.audioPlayer.stopAllSounds();
this.audioPlayer.clearEffects();

View file

@ -11,3 +11,13 @@ test('clone effects', function (t) {
t.ok(a.effects !== b.effects);
t.end();
});
test('#stopAll clears graphics effects', function (t) {
var spr = new Sprite();
var a = new RenderedTarget(spr, null);
var effectName = 'brightness';
a.setEffect(effectName, 100);
a.onStopAll();
t.equals(a.effects[effectName], 0);
t.end();
});