Game Development Community

Calling native iPhone APIs from iTGB

by John F · in iTorque 2D · 12/11/2008 (12:25 am) · 5 replies

I would like to display my online help documentation in HTML on the iPhone. The UIWebView class does this quite nicely. However, I'm not sure the proper way to call into the iPhone APIs from within Torque. I would like to have the user click a button in Torque which causes control to transfer to my Cocoa code which would display the online help. When the user is done they would exit help and control would transfer back to iTGB. Has anyone else done anything like this?

Thanks

#1
12/11/2008 (3:04 pm)
If you already have the code in Cocoa, you could make a script function that calls it. e.g.(the params are prolly a little off, but it's close enough)

ConsoleFunction( onlineHelp, void, 1, 1, "Calls HTML help function" ) {

MyCocoaHTMLFunction();

}

then in your script, you can set the "command" field of your button to
"onlineHelp();"
and it will call your function. In theory, that ought to work, but depending on what your code does, it may interfere with Torque's events / main loop, so procede with caution.
#2
12/11/2008 (8:04 pm)
Thanks Mat. I'll give that a try. I've been wondering what console functions were all about. Do you know if they are documented somewhere? I've looked but maybe I just missed it
#3
12/11/2008 (8:07 pm)
Http://tdn.garagegames.com/wiki/TorqueScript_Quick_Reference_3
#4
12/11/2008 (8:26 pm)
Thanks Eyal!
#5
04/20/2009 (6:45 am)
thank you..