interface builder...

Discussion in 'Public Game Developers Forum' started by cool mr croc, Jun 29, 2009.

  1. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    is confusing me a great deal with regards to control. am i right in assuming that xcode will start control at main(), main() then sends control to the nib (.xib) which contains all the objects which then send control to each respective class when the object gets called by the touch screen?

    all the tutorials im going through make use of the interface builder and say "you could alternatively use code", but dont show it. are there any tutorials youve seen which demonstrate how to take a .png file, stick it in a class, blit it to the screen and have it respond to the touch screen?
     
  2. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    i think what im asking is where is the game loop? is it drawRect in the UIView class and if so where is it called?
     
  3. drunknbass

    drunknbass Well-Known Member

    Nov 8, 2008
    128
    0
    0
    thats not usually how you do it. i mean thats kind of the opengl way, sure you can render in draw rect but its more code and its not going to give you amazing frame rates for a game.

    ib is generally for interfaces.
    if you are more detailed w your question i can give you a better answer
     
  4. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    well, when im programming on windows in c++ in the engine i use, wincode.cpp has WinMain() which instantiates gameInit() in gamecode.cpp where i initialise all objects, control goes back to winmain() which then instantiates gameMain() (also in gamecode.cpp)which is the game loop that has all the objects doing stuff, it only terminates when the game is over, which sends control back to WinMain() which then instantiates gameshutdown(), this deletes any objects in dynamic memory and closes the program.

    as i dont have my handy engine where i can see where control goes easily, id like to know where the control goes from the main file in xcode, and where i can suitably set up my gameloop. as xcode sets up project files i was wondering if there was a class with a method that is set up for this already. the interface is confusing me with this.
     
  5. drunknbass

    drunknbass Well-Known Member

    Nov 8, 2008
    128
    0
    0
    if you want, you can start a runloop, detatch a thread etc, and run your loop there and call back to the main thread to render. that way you do not block. you can get as detailed and oo as youd like, but thats the simplest way to explain it.
    this is obviously just for your game loop, and does not take into account how you plan to render your game.
     

Share This Page