Game Development Community

OS X and -game

by Tim Doty · in Torque Game Builder · 04/22/2006 (9:02 am) · 4 replies

I just expanded my develoment to include OS X and have an issue. In Windows I used .bat files to load a project via the -game parameter. On OS X the application is a regular mac app bundle, though, and doesn't seem to take commandline arguments. Looking through the documentation and searching the forums hasn't come up with anything so I'm hoping someone has some insight.

Tim Doty

#1
04/22/2006 (9:10 am)
You just feed the arguments to the executable inside the package using a conventional shell script, or a Terminal ".command" file.

The Mac OSX SDK download includes a couple of these. Here's the contents of one:

#!/bin/bash

# if launched from the finder, we'll not be in the correct directory.
# get to the directory where this script file lives
dir='dirname "[[62818ce81c2b4]]"'
echo 'started in directory:' 'pwd'
if [ -e "$dir" ]; then
   cd "$dir"
fi

Torque\ Demo\ OSX.app/Contents/MacOS/Torque\ Demo\ OSX -game starter.fps

echo ""
echo ""
echo "Thanks for using the Torque Game Engine!"
echo "The Torque FPS Example has finished running."
echo "You may close this Terminal window at any time."
#2
04/22/2006 (9:21 am)
Whoops, that was a TGE startup script. Didn't notice what forum this was in.

Here's one from the T2D SDK:
#!/bin/bash

cd 'dirname "[[62818ce831336]]"'

./T2D-OSX.app/Contents/MacOS/T2D-OSX -game fishdemo

echo "You may now close this window."
echo ""
#3
04/22/2006 (10:02 am)
Ah. I did a "command" file, but that didn't work because I didn't know to launch it from that point in the bundle. Thanks!
#4
04/23/2006 (10:09 am)
There is also the "maccmdline.txt" alternative :

Just create a file with that name on your game root folder ( where the .app is ) and put the parameters inside it :
-game fishdemo



The engine will load this file as the command line parameters.