Solved : iTGE Shutdown on device back button
by Sven Bergström · in iTorque 2D · 02/23/2009 (11:51 pm) · 4 replies
update : post 4 has the "meantime" solution,
This really should be a part of the engine by default
When the device's back button is pressed, the main big button on the iPhone/ipod touch - it called a function called applicationWillTerminate in the TGEAppDelegate.mm
The problem is the console spews out a huge list of memory notices from the function : Container::~Container() where it throw a whole bunhc of messages about all kinds of scene objects not being out of the bins.
The simplest idea i had was to call quit() in torque when applicationWillTerminate and try releasing the engine memory on shut down of the app (this is "the sudden" shutdown of an app), but perhaps there is a more, torque way of doing things.
Anyone else seen this?
This really should be a part of the engine by default
When the device's back button is pressed, the main big button on the iPhone/ipod touch - it called a function called applicationWillTerminate in the TGEAppDelegate.mm
The problem is the console spews out a huge list of memory notices from the function : Container::~Container() where it throw a whole bunhc of messages about all kinds of scene objects not being out of the bins.
The simplest idea i had was to call quit() in torque when applicationWillTerminate and try releasing the engine memory on shut down of the app (this is "the sudden" shutdown of an app), but perhaps there is a more, torque way of doing things.
Anyone else seen this?
#3
02/24/2009 (11:13 pm)
Thanks mat, ill take a look.
#4
To make the engine shutdown properly use the following changes (until its part of iTGE i assume)
PS : Italics dont work on forum posts inside of code tags.
In the file : platform/gameInterface.h
Line 38 : add the following line of code :
In the file : platform/gameInterface.cc
Line 38 : (weird i know)
In the file : game/main.cc
Line 532 :
In the file : game/demoGame.h
Line 24 :
In the file : TGEAppDelegate.mm (Find it in the Classes folder under the project),
At the top : import section
In the function : - (void)applicationWillTerminate
Add the following code :
Thats all there is, a handful of small changes and the application gracefully shuts down when the back button is pressed (with no apparent slowdown on the closing process)
Hope this helps.
02/25/2009 (12:37 am)
Ok well instead of posting a problem ill post a solution :) To make the engine shutdown properly use the following changes (until its part of iTGE i assume)
PS : Italics dont work on forum posts inside of code tags.
In the file : platform/gameInterface.h
Line 38 : add the following line of code :
[i]virtual int mainShutdown();[/i]
In the file : platform/gameInterface.cc
Line 38 : (weird i know)
[i]
int GameInterface::mainShutdown()
{
return(0);
}
[/i]In the file : game/main.cc
Line 532 :
[i]
int DemoGame::mainShutdown()
{
shutdownGame();
shutdownLibraries();
return 0;
}
[/i]In the file : game/demoGame.h
Line 24 :
[i]int mainShutdown();[/i]
In the file : TGEAppDelegate.mm (Find it in the Classes folder under the project),
At the top : import section
#import "platform/gameInterface.h"
In the function : - (void)applicationWillTerminate
Add the following code :
printf("Terminating application"); //existing code , new code below
[i]Game->mainShutdown();[/i]Thats all there is, a handful of small changes and the application gracefully shuts down when the back button is pressed (with no apparent slowdown on the closing process)
Hope this helps.
Torque Owner Ecliptic