cocos2d-x多分辨率适配
发布时间:2020-12-14 16:48:30 所属栏目:百科 来源:网络整理
导读:好好上面这张理解图片 director - getOpenGLView() - setDesignResolutionSize( 960 , 640 ,ResolutionPolicy ::NO_BORDER ); //1.SHOW_ALL不变 //2.NO_BORDER剪裁(高度显示不完整) //3.EXACT_FIT拉伸 //4.FIXED_HEIGHT高度不变,宽度剪裁或者留黑边 //5.F
好好上面这张理解图片 director->getOpenGLView()->setDesignResolutionSize(960,640,ResolutionPolicy::NO_BORDER);
//1.SHOW_ALL不变
//2.NO_BORDER剪裁(高度显示不完整)
//3.EXACT_FIT拉伸
//4.FIXED_HEIGHT高度不变,宽度剪裁或者留黑边
//5.FIXED_WIDTH宽度不变,高度度剪裁或者留黑边
Vec2 winSize = director->getWinSize();//ABCD
Vec2 visiableSize = director->getVisibleSize();//HIJK
Vec2 visiableOrigin = director->getVisibleOrigin();//K点
Rect vidiableRect = director->getOpenGLView()->getVisibleRect();//真机可视区域
//=====在屏幕左上角放置一张图片
auto director = Director::getInstance();
Rect vidiableRect = director->getOpenGLView()->getVisibleRect();//真机可视区域
ImageView* packImg = ImageView::create("Login/pack1.png");
this->addChild(packImg);
packImg->setAnchorPoint(Vec2(0,1));//左上角
packImg>setPosition(Vec2(vidiableRect.origin.x,vidiableRect.origin.y+ vidiableRect.size.height));
//=====在屏幕左上角放置一张图片
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |