码迷,mamicode.com
首页 > 其他好文 > 详细

屏幕适配

时间:2015-06-06 00:32:17      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:



.

//想了半天 还是自己解决好,资料全是没用的理论 屁话


class HeightFix :public Layer//屏幕适配 层
{
public:
	HeightFix()
	{
		Layer::init();

		auto up = Sprite::create("bg_bottom_all.png");
		auto down = Sprite::create("bg_bottom_all.png");

		this->addChild(down);
		this->addChild(up);
	
		up->setPosition(540/ 2, HEIGHT_MAX/2+810/2+197/2		);
		down->setPosition(540 / 2,HEIGHT_MAX / 2 - 810 / 2 - 197 / 2);
	}
};


/////


bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("SGZonline");
        director->setOpenGLView(glview);
		glview->setFrameSize(640, 1136);// 5S
		//glview->setFrameSize(640, 960);// 4S

		glview->setFrameZoomFactor(0.5);
    }

    director->getOpenGLView()->setDesignResolutionSize(540, 1204, ResolutionPolicy::FIXED_WIDTH);
    
    ........


屏幕适配

标签:

原文地址:http://my.oschina.net/kkkkkkkkkkkkk/blog/425552

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!