★ TouchArcade needs your help. Click here to support us on Patreon.

interface builder...

06-29-2009, 02:03 PM
#1
Joined: May 2009
Posts: 41
interface builder...

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?
06-29-2009, 02:19 PM
#2
Joined: May 2009
Posts: 41
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?
06-29-2009, 04:03 PM
#3
Joined: Nov 2008
Posts: 128
Quote:
Originally Posted by cool mr croc View Post
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?
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
06-30-2009, 05:20 PM
#4
Joined: May 2009
Posts: 41
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.
07-03-2009, 06:03 AM
#5
Joined: Nov 2008
Posts: 128
Quote:
Originally Posted by cool mr croc View Post
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.
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.