Thread: Cocoa Question

  1. #1
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259

    Cocoa Question

    First of, not sure this is the right forum, but I couldn't come up with which other I should post in if it wasn't.

    I downloaded the source code to BZFlag from sourceforge and had a look at it to see if I could understand anything of it and also to see how they solved the part of making it run under Mac OS X using Cocoa when they say that the programming language is C/C++ and Cocoa is objectiv C or java.

    I was only able to find one file containing anything with objective C or java in it, it simply conisted of
    Code:
    #import <Cocoa/Cocoa.h>
    
    int main(int argc, const char *argv[])
    {
       return NSApplicationMain(argc, argv);
    }
    which is simply what you get as if you create an empty work space with java or objectv C in Cocoa.

    What I wonder is, is this enough to create a application which
    will run with Cocoa and if it is, how do they move the controll to the code which actually do what the application does when they do not add any other headers then Cocoa or call any
    other functions. Since NSApplicationMain is what you get when you make a basic
    new Java, Objectiv C workspace - Cocoa?

    This is what the help in Xcode says:
    Code:
    NSApplicationMain
    
    Called by the main function to create and run the application.
    
    int NSApplicationMain(int argc, const char *argv[])
    
    Discussion
    
    Creates the application, loads the main nib file from the application’s
    main bundle, and runs the application. You typically only call this
    function once, from your application’s main function, which is usually
    generated automatically by Xcode.
    But I am still not sure how it gives controll to the rest of the app since all it says that it does is start everything up, or did I missunderstand it?

    Ops, Read the Guidelince for the forum, sorry, trying to figure out how to delite a post now..
    Last edited by Shogun; 10-22-2004 at 08:10 AM. Reason: Fixing the stuff in the code tags, the second one made the post really long.
    They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Macintosh Cocoa Question
    By OSDever in forum C++ Programming
    Replies: 0
    Last Post: 05-06-2005, 03:26 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM