HaxeFlixel / HaxeFlixel/flixel
FlxKeys CONTROL vs. WINDOWS vs. CTRL vs. COMMAND (vs. META?)
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 2.2k
- Forks
- 522
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
On Mac, there is SEEMINGLY no key for the COMMAND key... after some investigation, it seems to be the same keycode as the FlxKeys.WINDOWS keycode, which is 15.
Digging a bit further, the OpenFL class KeyboardEvent has some interesting bools available
/**
Indicates whether the Command key is active (`true`) or inactive
(`false`). Supported for Mac OS only. On Mac OS, the `commandKey`
property has the same value as the `ctrlKey` property.
**/
public var commandKey:Bool;
/**
Indicates whether the Control key is active (`true`) or inactive
(`false`). On Windows and Linux, this is also true when the Ctrl key
is active.
**/
public var controlKey:Bool;
/**
On Windows and Linux, indicates whether the Ctrl key is active
(`true`) or inactive(`false`); On Mac OS, indicates
whether either the Ctrl key or the Command key is active.
**/
public var ctrlKey:Bool;
I'm wondering if there's a nice way to incorporate cleanly a way to get COMMAND off Mac, without some fussyness from trying to just use FlxKeys.WINDOWS.
Thoughts/ideas
- Renaming
FlxKeys.WINDOWSto something likeFlxKeys.META, and having a proper comment around it describing that it's Windows key on Windows, and the COMMAND key on Mac - Incorporating something around
KeyboardEvent.ctrlKey, in cases where you might want to use CTRL on Windows, AND have it sorta "auto" use COMMAND on Mac. Something like having bothFlxKey.CONTROLfor when you want CTRL on Win, and CONTROL on mac, AND THEN havingFlxKey.CTRLfor when you want to have CTRL on Win, and then uses COMMAND on mac. - Having a
FlxKey.COMMAND, that only is true/properly resolves on Mac, and when compiled to windows, doesn't return?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FlxKeys definitions and the referenced OpenFL KeyboardEvent properties. Compare how CONTROL, WINDOWS, CTRL, COMMAND, and META should behave across Mac, Windows, and Linux, then check existing keyboard-input usage. Done means the project has an agreed cross-platform API and corresponding documented behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100