0

I'm creating a 2-D platformer game in C that will run in the terminal. I need a way to register "KEY_DOWN" and "KEY_RELEASE" events. As far as I know getchar() reads from stdin and thus can not be used for registering "KEY_RELEASE" events. Neither can it be used for registering if multiple keys are being pressed down at the same time.

Is there a Mac OSX 10.10.5 C library that I can use to solve this problem? Maybe a library which reads input directly from the keyboard instead of the terminal?

Klas. S
  • 650
  • 9
  • 21

1 Answers1

1

None of the potential answers are likely to be simple:

  • if you are running an application in the terminal, and lacking (as OSX does) a set of system calls for reading the keyboard state directly, it won't work.
  • the available sources describe non-terminal applications (mostly using Cocoa, the OSX GUI, and mostly using ObjectiveC).

Here are a few:

For reference (Cocoa Event Handling Guide):

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105