
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(); }} 总结 以上是内存溢出为你收集整理的cocos2dx 屏幕大小全部内容,希望文章能够帮你解决cocos2dx 屏幕大小所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)