Issue:Resolve the carsh of the simple game test sample and modify the main.cpps in the template for the android projects

This commit is contained in:
samuele3hu 2013-09-16 16:55:16 +08:00
parent ddf28deaad
commit b563c52e10
4 changed files with 21 additions and 3 deletions

View File

@ -103,7 +103,16 @@ bool HelloWorld::init()
this->setTouchEnabled(true);
_targets = new Array;
if (nullptr != _targets)
{
_targets->initWithCapacity(7);
}
_projectiles = new Array;
if (nullptr != _projectiles)
{
_projectiles->initWithCapacity(7);
}
// use updateGame instead of update, otherwise it will conflit with SelectorProtocol::update
// see http://www.cocos2d-x.org/boards/6/topics/1478
@ -240,6 +249,11 @@ void HelloWorld::ccTouchesEnded(Set* touches, Event* event)
void HelloWorld::updateGame(float dt)
{
Array *projectilesToDelete = new Array;
if (nullptr != projectilesToDelete)
{
projectilesToDelete->initWithCapacity(7);
}
Object* it = NULL;
Object* jt = NULL;
@ -254,6 +268,10 @@ void HelloWorld::updateGame(float dt)
projectile->getContentSize().height);
auto targetsToDelete =new Array;
if (nullptr != targetsToDelete)
{
targetsToDelete->initWithCapacity(7);
}
// for (jt = _targets->begin(); jt != _targets->end(); jt++)
CCARRAY_FOREACH(_targets, jt)

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (void) {
void cocos_android_app_init (struct android_app* app) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (void) {
void cocos_android_app_init (struct android_app* app) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (void) {
void cocos_android_app_init (struct android_app* app) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}