博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cocos2dx 屏幕大小
阅读量:4214 次
发布时间:2019-05-26

本文共 1005 字,大约阅读时间需要 3 分钟。

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

转载地址:http://btsmi.baihongyu.com/

你可能感兴趣的文章
Python学习笔记——排序与搜索
查看>>
Python学习笔记——爬虫之BeautifulSoup4数据提取
查看>>
Python学习笔记——爬虫的思路总结
查看>>
Python学习笔记——爬虫之动态HTML处理和机器图像识别
查看>>
Python学习笔记——爬虫之执行JavaScript语句与训练Tesseract
查看>>
Python学习笔记——爬虫之Scrapy框架
查看>>
Python学习笔记——爬虫之Scrapy项目实战
查看>>
Python学习笔记——爬虫之通过Fiddler进行手机抓包
查看>>
Python学习笔记——爬虫之Scrapy-Redis分布式组件
查看>>
Python学习笔记——爬虫之Scrapy-Redis实战
查看>>
Python学习笔记——大数据之Spark简介与环境搭建
查看>>
Python学习笔记——大数据之SPARK核心
查看>>
Python学习笔记——大数据之Pyspark与notebook使用matplotlib
查看>>
Python学习笔记——云计算
查看>>
Python学习笔记——运维和Shell
查看>>
Python学习笔记——nginx
查看>>
Python学习笔记——自动化部署
查看>>
Python学习笔记——多任务-协程
查看>>
Python学习笔记——WSGI、mini-web框架
查看>>
Python学习笔记——闭包、装饰器
查看>>