openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
754 stars 370 forks source link

Lack of option to disable automatic `full-screen` mode. #1773

Closed MAJigsaw77 closed 4 months ago

MAJigsaw77 commented 6 months ago

There's this thing in the NativeWindow that makes the game go fullscreen by pressing Alt+Enter. However there's no way to prevent this action in any way.

joshtynjala commented 6 months ago

You can prevent it by cancelling Lime's onKeyDown event (or, if you're using OpenFL, you should be able to preventDefault() the KeyboardEvent.KEY_DOWN event).

window.onKeyDown.add((keyCode, keyModifier) -> {
    if (keyCode == KeyCode.RETURN && keyModifier.altKey) {
        window.onKeyDown.cancel();
    }
});