No, really. What is the proper way to handle keyboard input in a game using Cocoa?

前端 未结 2 2139
醉酒成梦
醉酒成梦 2021-02-07 07:29

Let\'s say you\'re creating a game for Mac OS X. In fact, let\'s say you\'re creating Quake, only it\'s 2011 and you\'d prefer to only use modern, non-deprecated frameworks.

2条回答
  •  醉酒成梦
    2021-02-07 08:00

    As others have said, there’s nothing wrong with using -flagsChanged:. There is another option: use the IOKit HID API. You should be using this anyway for joystick/gamepad input, and arguably mouse input; it may or may not be convenient for keyboard input too, depending on what you’re doing.

提交回复
热议问题