Can't catch keyboard events in Mac OS X

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Caspian
Posts: 15
Joined: Sun Mar 18, 2007 2:38 am

Can't catch keyboard events in Mac OS X

Post by Caspian »

My program compiles and runs fine in Mac OS X, but my event receiver can't catch events from the keyboard. If the program was launched from a terminal, the terminal catches my keystrokes. If I don't launch it using a terminal (i.e., just double-clicking in Finder), the keystrokes are caught by whatever program is underneath mine. In other words, my program never receives focus... so I can't enter keyboard input.

Has anyone else experienced this problem? Has anyone found a solution?

I've done quite a bit of searching, and found that this was a bug in older versions of irrlicht... does it still exist in 1.4?

I'm compiling using gcc.
varmint
Posts: 46
Joined: Fri Oct 06, 2006 4:33 pm

Post by varmint »

Being using irrlicht on OSX for a year and never had that happen. Couple things to make sure, your using a Cocoa app frame work and not Carbon. Look at how the examples are setup in the irrlicht project. MeshViewer for example.

Also try building some of the examples that come with irrlicht and see if they have the same problem.
Caspian
Posts: 15
Joined: Sun Mar 18, 2007 2:38 am

Post by Caspian »

Do the Irrlicht examples work out-of-the-box for you on a Mac?

After looking around a bit, I found that I had to edit "LDFLAGS" like this:

Code: Select all

LDFLAGS = -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -framework Cocoa -framework OpenGL -framework Carbon
(I got this from http://www.irrlicht3d.org/wiki/index.ph ... ngOnMacOSX)

Note that I'm using both Carbon and Cocoa... but I don't notice any difference when removing the Carbon framework.

I compiled and ran a couple of the examples, bot just got blank windows (Including the HelloWorld example). Somehow, my program runs better than the examples...

Is there something else I need to #include, or add to the Makefile? I couldn't compile the Irrlicht engine, so I just used the pre-compiled libIrrlicht.a... would this be a problem?

Thanks.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The Makefiles are not designed for OSX, there's no support for the necessary flags, yet. You have to use the XCode project (or define your own projects).
Caspian
Posts: 15
Joined: Sun Mar 18, 2007 2:38 am

Post by Caspian »

I only have command line access to a Mac (via ssh)... is there no way to compile Irrlicht projects for Mac using the command line? :(
varmint
Posts: 46
Joined: Fri Oct 06, 2006 4:33 pm

Post by varmint »

yes. go into source/Irrlicht/MacOSX and use xcodebuild not make ... Corse I'm not sure how you plan to test any 3D as you can not export a 3D visual session back over ssh. :P

As for carbon apple does not support it anymore and hasn't for a few years. Carbon is PPC only. Are you including both in your project? If so then it will definitely not link. :D

As for that tutorial to build an X11 application under OSX, you will need all the GNU libraries install. I use fink ( http://www.finkproject.org/ ) myself. This would also mean anyone running it on OSX would need the GNU libraries installed and X11 which does not come preinstalled on OSX. :D

Also that tutorial isn't very good
You'll notice the last line. This is required because libIrrlicht.a was built against the Cocoa, Carbon, and OpenGL frameworks. If you don't add this then you will end up with a slew of undefined symbols.
As an apple developer of 17 years the above quote is not true and doesn't make any sense. :P
1) There is no Carbon includes anywhere in Irrlicht
2) Source files are text and have not being bult against anything at download time

As a side not 3D rendering using X11 under OSX is a little slow. 8) :D But if thats your goal then you do not need to link to Cocoa or Carbon only OpenGL
http://developer.apple.com/qa/qa2007/qa1567.html
Last edited by varmint on Fri Jan 04, 2008 7:49 pm, edited 1 time in total.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

varmint wrote:yes. go into source/Irrlicht/MacOSX and use xcodebuild not make ... Corse I'm not sure how you plan to test any 3D as you can not export a 3D visual session back over ssh. :P
Irrlicht needs an aalib device! :D
I'm not promising to make one of course, but I'd weep with joy if someone made one.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
varmint
Posts: 46
Joined: Fri Oct 06, 2006 4:33 pm

Post by varmint »

bitplane wrote:
varmint wrote:yes. go into source/Irrlicht/MacOSX and use xcodebuild not make ... Corse I'm not sure how you plan to test any 3D as you can not export a 3D visual session back over ssh. :P
Irrlicht needs an aalib device! :D
I'm not promising to make one of course, but I'd weep with joy if someone made one.
http://pdb.finkproject.org/pdb/browse.php?summary=aalib

xcodebuild is the same as opening XCode GUI and compiling, so xcodebuild does not need or use aalib. And as far as I know the linux irrlicht build doesn't use aalib either. :D
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

bitplane suggested an ascii arts based render device (or driver?), which would work over ssh :wink:
varmint
Posts: 46
Joined: Fri Oct 06, 2006 4:33 pm

Post by varmint »

hybrid wrote:bitplane suggested an ascii arts based render device (or driver?), which would work over ssh :wink:
hmm very true.. I forgot I had SDL compiled for X11 on my system. hmmm :D might beable to do it.. I'm tempted ;)
Post Reply