Game Development Community

[T2Di 1.3 - Resolved] Play Game on OSX, incl fix

by Marc Dreamora Schaerer · in iTorque 2D · 01/05/2010 (8:11 pm) · 10 replies

On OSX the play game functionality is still bugged. Thats related to the functions used there (also mentioned in the related comment).
The interesting fact about this problem is that it used to work in iTGB 1.1 and before.


I don't have old installs around but it wasn't hard to implement a solution that works on Windows and OSX:


in levelManagement.ed.cs in the tgb/tools/LevelEditor/scripts folder,


replace the following in function runGame()

%playerExecutable = getGameExecutableFile();


with:
if( $platform !$= "macos" ) {
	%playerExecutable = getGameExecutableFile();
} else {
	%playerExecutable = expandFilename("^project/") @ "TGBGame.app/Contents/MacOS/TGBGame";
}

Thats it. if the TGBGame.app is present in the projects folder, the play game functionality will finally work again on T2Dis home platform

#1
01/05/2010 (8:22 pm)
Edit : i always used play scene, not play game. ( i was not aware of this bug in fact :))

Its a logical fix, though. Updated in the repo, will be up along with the other fix. Thanks.

Note : I fixed your fix to use the correct platform, and also that this is a temporary fix. A proper fix will be in shortly as well.
#2
01/05/2010 (8:35 pm)
Thanks for the platform name fix. Was unsure which it was out of head as I commonly don't have platform code (I test it on the iphone and simulator only)
#3
01/05/2010 (8:44 pm)
No problem. Im making a post about the XCode projects per game now, that will affect this fix. But thanks for jumping on it.
#4
01/07/2010 (6:37 pm)
Updated your original post to use the right syntax Marc.

You had:
if( $platform != "macos" )

String comparison operations require the use of the $ symbol:

Working Code:
if( $platform !$= "macos" )
#5
01/07/2010 (6:43 pm)
Thanks.
Didn't think of that and it seems like Sven didn't too :-)

As I'm exclusively working on iPhone games on OSX I didn't see it missbehave and the corresponding warning was easy to miss without the coloring.
#6
01/07/2010 (7:23 pm)
Nice catch Mich. I copy pasted like a bandit, its my own fault - next time ill double check copy fixes. ;)

#7
01/07/2010 (7:25 pm)
@Marc - The only thing keeping me on Windows is Torsion, otherwise I'd be exclusively on OSX. I'm not even performing testing on Windows for my own projects. I just use Torsion to write the scripts, save, and run the games on OSX or device.
#8
01/07/2010 (7:53 pm)
:)
Torsion is one of the few reasons I even bought VMWare Fusion / Parallels :) (the other are LANs with friends and VS)
#9
01/07/2010 (8:14 pm)
Heh ,well i use it in OSX with crossover, and moved over to this :
www.torquepowered.com/community/forums/viewthread/108807 recently :)
#10
04/08/2010 (6:56 am)
That should be:

if( $platform !$= "macos" ) 
{
   %playerExecutable = getGameExecutableFile();
} 
   else 
{
   %playerExecutable = expandFilename("^project/") @ "Torque Game Builder.app/Contents/MacOS/Torque Game Builder";
}

Since the app is called "Torque Game Builder" not "TGBGame" in 1.3.1