2012-11-22 16:11:47 +08:00
|
|
|
#include "AppDelegate.h"
|
|
|
|
#include "cocos2d.h"
|
|
|
|
#include "platform/android/jni/JniHelper.h"
|
|
|
|
#include "CCEventType.h"
|
|
|
|
#include <jni.h>
|
|
|
|
#include <android/log.h>
|
|
|
|
|
|
|
|
#define LOG_TAG "main"
|
|
|
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
|
|
|
|
jint JNI_OnLoad(JavaVM *vm, void *reserved)
|
|
|
|
{
|
|
|
|
JniHelper::setJavaVM(vm);
|
|
|
|
|
|
|
|
return JNI_VERSION_1_4;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h)
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
if (!Director::sharedDirector()->getOpenGLView())
|
2012-11-22 16:11:47 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
EGLView *view = EGLView::sharedOpenGLView();
|
2012-11-22 16:11:47 +08:00
|
|
|
view->setFrameSize(w, h);
|
|
|
|
|
|
|
|
AppDelegate *pAppDelegate = new AppDelegate();
|
2013-06-20 14:17:10 +08:00
|
|
|
Application::sharedApplication()->run();
|
2012-11-22 16:11:47 +08:00
|
|
|
}
|
2013-04-17 15:34:57 +08:00
|
|
|
/*
|
2012-11-22 16:11:47 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ccDrawInit();
|
|
|
|
ccGLInvalidateStateCache();
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
ShaderCache::sharedShaderCache()->reloadDefaultShaders();
|
|
|
|
TextureCache::reloadAllTextures();
|
|
|
|
NotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
|
|
|
|
Director::sharedDirector()->setGLDefaultValues();
|
2012-11-22 16:11:47 +08:00
|
|
|
}
|
2013-04-17 15:34:57 +08:00
|
|
|
*/
|
2012-11-22 16:11:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|