we are creating a game engine which should be multi-platform. It is
practically all written in C++, except for the OSX window and OpenGL
initialization part which uses objective-c++.
I have created a 'cocoa static library', which contains the main()
function and the message loop.
The user should create an application, which would be written in c++,
and which would have to have function called NIMain() that will be
called from the 'real' main in the static library.
The problem is that I don't know how to make that user's application
behave like an application. The application menu doesn't show up,
there is no icon in the dock, etc.
I use one 'project' with many targets, one of which is the static
library 'enginemain' and one is the user's application. I have tried
making it a bsd shell tool (in which case it behaves like I've
described above, and the NIMain() gets called correctly - it also
seems to process the event loop well), and a cocoa application. In the
latter case it doesn't allow me to have a single .cpp file associated
with the project - if I do, it reports 2000-4000 errors, because the c+
+ compiler is trying to compile the cocoa headers. I have no idea why
that happens - it doesn't if I create a new cocoa application as a new
project (instead of a new target in the existing project).
The code of the enginemain goes something like this:
//Let's say we just do it like this:
NIMain(); //Returns immediately
}
return 0;
I also have the AppDelegate, which simply implements a few delegate
methos like terminate, isQuit, etc.
This same code works if I create a new 'cocoa application', but not if
I separate it into libraries. Also, is there a way for me to add the
nib file to the library itself (currently, I just put it in the same
directory as the executable)?
Sorry for the long post, I didn't know how to explain the problem
shorter...
Thanks for any help,
Ivan
_______________________________________________
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