Capturing key events from macos terminal app?


#1

Hi,

I am compiling the cinder samples on macos using a simple Makefile and it turns out that no keyboard key events are passed through to the app (opengl rendering context). The Makefile is super simple. Mouse inputs work with cameraUI, but not keys. Also, the Params input isn’t working properly when launched from the command line. It is like Terminal is getting the keyboard input and I can’t figure out how to get the cinder app to receive the inputs.

One other thing which ]may not be relevant is that when running glut samples (for example) from the command line a new dock icon is added for the running app and keys/mouse work. When running the command line cinder binary I don’t get an icon added to the dock.

Wondering if anyone knows what dumb thing I have done/missed? Thanks!

Regards,

j


#2

Hi,

Sorry, I don’t really know the answer for your questions. But I have always built cinder from the command line. Used scons for years, but recently I moved to Cinder’s new CMake system. It can save you a lot of headaches in my opinion.

-Gabor


#3

Cocoa is weird about events unless you create a properly formed application bundle. You could probably grab a template one and copy your executable into Contents/MacOS as part of your build step. You may even be able to compile as objective-c++ and do some bad ju-ju with the CinderViewMac returned by getWindow()->getNative(), but really your best bet is to generate a properly formed project up front with tinderbox or cmake and save yourself the trouble. You can then build the resultant project with xcodebuild in your makefile if you want to keep the same (rough) workflow.

A.


#4

Thanks - I figured it was something I was missing from the build environment. The makefile I wrotewas really basic and works for everything except keys. Will look into cmake. :slight_smile:


#5

I will investigate further - thanks for the great suggestions! Definitely some things I can learn more about. I will post back if I make any progress.