cocos2dx 屏幕大小
发布时间:2020-12-14 20:41:29 所属栏目:百科 来源:网络整理
导读:1、java端 //mScreenWidth mScreenHeight 屏幕的宽和高@Overridepublic void onSurfaceCreated(final GL10 pGL10,final EGLConfig pEGLConfig) {Cocos2dxRenderer.nativeInit(this.mScreenWidth,this.mScreenHeight);this.mLastTickInNanoSeconds = System.n
1、java端
//mScreenWidth mScreenHeight 屏幕的宽和高 @Override public void onSurfaceCreated(final GL10 pGL10,final EGLConfig pEGLConfig) { Cocos2dxRenderer.nativeInit(this.mScreenWidth,this.mScreenHeight); this.mLastTickInNanoSeconds = System.nanoTime(); } 2、C++端(proj.android/jni/main.cpp):
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env,jobject thiz,jint w,jint h) { if (!CCDirector::sharedDirector()->getOpenGLView()) { CCEGLView *view = CCEGLView::sharedOpenGLView(); view->setFrameSize(w,h); //设置屏幕大小 AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } else { ccGLInvalidateStateCache(); CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); ccDrawInit(); CCTextureCache::reloadAllTextures(); CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND,NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |