Merge pull request #3528 from natural-law/ForPlugin

Modify the method cocos_android_app_init()
This commit is contained in:
minggo 2013-09-03 22:50:40 -07:00
commit 9dedb072e6
12 changed files with 16 additions and 16 deletions

View File

@ -35,7 +35,7 @@
#define LOG_EVENTS_DEBUG(...) #define LOG_EVENTS_DEBUG(...)
// #define LOG_EVENTS_DEBUG(...) ((void)__android_log_print(ANDROID_LOG_INFO, "cocos2dx/nativeactivity.cpp", __VA_ARGS__)) // #define LOG_EVENTS_DEBUG(...) ((void)__android_log_print(ANDROID_LOG_INFO, "cocos2dx/nativeactivity.cpp", __VA_ARGS__))
void cocos_android_app_init(void); void cocos_android_app_init(struct android_app* app);
/** /**
* Our saved state data. * Our saved state data.
@ -72,19 +72,19 @@ typedef struct cocos_dimensions {
int h; int h;
} cocos_dimensions; } cocos_dimensions;
static void cocos_init(cocos_dimensions d, AAssetManager* assetmanager) { static void cocos_init(cocos_dimensions d, struct android_app* app) {
LOGI("cocos_init(...)"); LOGI("cocos_init(...)");
pthread_t thisthread = pthread_self(); pthread_t thisthread = pthread_self();
LOGI("pthread_self() = %X", thisthread); LOGI("pthread_self() = %X", thisthread);
cocos2d::FileUtilsAndroid::setassetmanager(assetmanager); cocos2d::FileUtilsAndroid::setassetmanager(app->activity->assetManager);
if (!cocos2d::Director::getInstance()->getOpenGLView()) if (!cocos2d::Director::getInstance()->getOpenGLView())
{ {
cocos2d::EGLView *view = cocos2d::EGLView::getInstance(); cocos2d::EGLView *view = cocos2d::EGLView::getInstance();
view->setFrameSize(d.w, d.h); view->setFrameSize(d.w, d.h);
cocos_android_app_init(); cocos_android_app_init(app);
cocos2d::Application::getInstance()->run(); cocos2d::Application::getInstance()->run();
} }
@ -431,7 +431,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
ccxhelperInit.methodID, ccxhelperInit.methodID,
app->activity->clazz); app->activity->clazz);
cocos_init(d, app->activity->assetManager); cocos_init(d, app);
} }
engine->animating = 1; engine->animating = 1;
engine_draw_frame(engine); engine_draw_frame(engine);

View File

@ -8,7 +8,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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -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();
} }

View File

@ -9,7 +9,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();
} }

View File

@ -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();
} }