• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Another best practice question: storing hotkey assignments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another best practice question: storing hotkey assignments


  • Subject: Another best practice question: storing hotkey assignments
  • From: Alex Hall <email@hidden>
  • Date: Sat, 04 Jan 2014 11:13:46 -0500

Hello list,
I'm happy to say my audio game is now working. The game itself is not written yet, but the audio menu is doing well - I can navigate it with the arrow keys and the proper selector is called when I press enter. Thanks again for all your help thus far.

As I build the map and the rest of the game engine, I'll need to detect and match up keystrokes. I want the user to be able to define these if they want to, plus I know there has to be a better way to store them than hard-coded in a bunch of if or switch statements. So, my first thought was a dictionary, with the key assignment as the dictionary key and a selector as the value. However, modifiers are tripping me up. I can get the modifiers, and compare each modifier mask to see if that modifier was pressed, but what about two or more modifiers? I'd have to detect every combination of control, option, command, shift, and numpad. Also, storing the hotkeys as strings would mean constructing a string based on which modifiers were pressed, similar to the hotkey definitions in OS10's files for handling keys. Yes, I can do it, but it seems like there must be a more efficient way than or-ing every combination of those five masks with the modifier flags each keypress contains. I can't be the first to have this question, but google is oddly quiet on the topic and I just keep ending up at the Event Handling Guide or other sites that aren't what I'm looking for. As always, any suggestions are greatly appreciated.


Have a great day,
Alex (msg sent from Mac Mini)
email@hidden




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Another best practice question: storing hotkey assignments
      • From: Steve Mills <email@hidden>
  • Prev by Date: NSHTMLTextDocumentType returns wrong font names
  • Next by Date: Re: Another best practice question: storing hotkey assignments
  • Previous by thread: Re: NSHTMLTextDocumentType returns wrong font names
  • Next by thread: Re: Another best practice question: storing hotkey assignments
  • Index(es):
    • Date
    • Thread