mirror of https://github.com/axmolengine/axmol.git
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:
parent
ddf28deaad
commit
b563c52e10
|
@ -103,7 +103,16 @@ bool HelloWorld::init()
|
||||||
this->setTouchEnabled(true);
|
this->setTouchEnabled(true);
|
||||||
|
|
||||||
_targets = new Array;
|
_targets = new Array;
|
||||||
|
if (nullptr != _targets)
|
||||||
|
{
|
||||||
|
_targets->initWithCapacity(7);
|
||||||
|
}
|
||||||
_projectiles = new Array;
|
_projectiles = new Array;
|
||||||
|
if (nullptr != _projectiles)
|
||||||
|
{
|
||||||
|
_projectiles->initWithCapacity(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// use updateGame instead of update, otherwise it will conflit with SelectorProtocol::update
|
// use updateGame instead of update, otherwise it will conflit with SelectorProtocol::update
|
||||||
// see http://www.cocos2d-x.org/boards/6/topics/1478
|
// 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)
|
void HelloWorld::updateGame(float dt)
|
||||||
{
|
{
|
||||||
Array *projectilesToDelete = new Array;
|
Array *projectilesToDelete = new Array;
|
||||||
|
if (nullptr != projectilesToDelete)
|
||||||
|
{
|
||||||
|
projectilesToDelete->initWithCapacity(7);
|
||||||
|
}
|
||||||
|
|
||||||
Object* it = NULL;
|
Object* it = NULL;
|
||||||
Object* jt = NULL;
|
Object* jt = NULL;
|
||||||
|
|
||||||
|
@ -254,6 +268,10 @@ void HelloWorld::updateGame(float dt)
|
||||||
projectile->getContentSize().height);
|
projectile->getContentSize().height);
|
||||||
|
|
||||||
auto targetsToDelete =new Array;
|
auto targetsToDelete =new Array;
|
||||||
|
if (nullptr != targetsToDelete)
|
||||||
|
{
|
||||||
|
targetsToDelete->initWithCapacity(7);
|
||||||
|
}
|
||||||
|
|
||||||
// for (jt = _targets->begin(); jt != _targets->end(); jt++)
|
// for (jt = _targets->begin(); jt != _targets->end(); jt++)
|
||||||
CCARRAY_FOREACH(_targets, jt)
|
CCARRAY_FOREACH(_targets, jt)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
|
||||||
void cocos_android_app_init (void) {
|
void cocos_android_app_init (struct android_app* app) {
|
||||||
LOGD("cocos_android_app_init");
|
LOGD("cocos_android_app_init");
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
|
||||||
void cocos_android_app_init (void) {
|
void cocos_android_app_init (struct android_app* app) {
|
||||||
LOGD("cocos_android_app_init");
|
LOGD("cocos_android_app_init");
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
|
||||||
void cocos_android_app_init (void) {
|
void cocos_android_app_init (struct android_app* app) {
|
||||||
LOGD("cocos_android_app_init");
|
LOGD("cocos_android_app_init");
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue