Skip to content

Commit

Permalink
invert bool
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Dec 13, 2024
1 parent 5c816d3 commit 2b97596
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flixel/sound/FlxSound.hx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class FlxSound extends FlxBasic
/**
* Helper var to prevent the sound from playing after focus was regained when it was already paused.
*/
var _alreadyPaused:Bool = false;
var _resumeOnFocus:Bool = false;

/**
* The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet.
Expand Down Expand Up @@ -697,14 +697,17 @@ class FlxSound extends FlxBasic
@:allow(flixel.system.frontEnds.SoundFrontEnd)
function onFocus():Void
{
if (!_alreadyPaused)
if (_resumeOnFocus)
{
_resumeOnFocus = false;
resume();
}
}

@:allow(flixel.system.frontEnds.SoundFrontEnd)
function onFocusLost():Void
{
_alreadyPaused = _paused;
_resumeOnFocus = !_paused;
pause();
}
#end
Expand Down

0 comments on commit 2b97596

Please sign in to comment.