Skip to content

Commit

Permalink
Attach DEACTIVATE/ACTIVATE events to stage.nativeWindow. (#3260)
Browse files Browse the repository at this point in the history
* Update FlxGame.hx

* Fix for `flash` and `html5`.

* Fix compatibility with `openfl` `9.2.2`.
  • Loading branch information
MAJigsaw77 authored Oct 1, 2024
1 parent eb84248 commit 38d5323
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flixel/FlxGame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ class FlxGame extends Sprite
#if (desktop && openfl <= "4.0.0")
stage.addEventListener(FocusEvent.FOCUS_OUT, onFocusLost);
stage.addEventListener(FocusEvent.FOCUS_IN, onFocus);
#elseif (sys && openfl >= "9.3.0")
stage.nativeWindow.addEventListener(Event.DEACTIVATE, onFocusLost);
stage.nativeWindow.addEventListener(Event.ACTIVATE, onFocus);
#else
stage.addEventListener(Event.DEACTIVATE, onFocusLost);
stage.addEventListener(Event.ACTIVATE, onFocus);
Expand Down Expand Up @@ -918,4 +921,4 @@ private class FlxIntroSplash extends FlxSplash
FlxG.game._gameJustStarted = true;
super.startOutro(onOutroComplete);
}
}
}

0 comments on commit 38d5323

Please sign in to comment.