Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl cmd q macos #674

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Num0Programmer
Copy link

Adds Cmd+Q functionality for MacOS - issue #649.

…en a key is pressed in conjuction with the Command key (LeftSuper or RightSuper) on macOS. Also added a filed to Input called 'quit' which gets set when the player pressed LeftSuper or RightSuper key and Q. The 'quit' filed is set to true, and this is used to update the context by setting 'quit_requested' to true which closes the window ending the program.
… set, it is verified one of the super keys is pressed along with Q being pressed.
ui.key_down(megaui::KeyCode::Control, shift, ctrl, cmd);
}
if ui.input.quit {
get_context().quit_requested = true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macroquad::ui is a module about drawing game UI, I am not quite sure if handling platform quit request belongs here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am inclined to agree. Would this be better moved to something like begin_frame() in src/lib.rs, or could you make a suggestion where a platform quit request would be better handled?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begin_frame looks like a right place to me.

Justa side question, but is manual handling Cmd-Q a common practice on MacOs? Isnt there some sort of a system-level hotkeys for this kind of things?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only thought about that after I last commented. I can do some research; I bet I can find something. I will get back to this in a day or two with relevant changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants