4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cocos2d-xモバイルデバイスのマルチ解像度対応を実現するための setDesignResolutionSize の注意点

Last updated at Posted at 2014-12-09

#モバイル環境の罠

AppDelegae.cpp

    if(!glview) {
        glview = GLViewImpl::create("My Game");

        //モバイルだとココに書いても通らないので設定されない
        //glview->setDesignResolutionSize(2048,1536, ResolutionPolicy::SHOW_ALL);

        director->setOpenGLView(glview);
    }
    
    //Set Design Resolution
    glview->setDesignResolutionSize(2048,1536, ResolutionPolicy::SHOW_ALL);

iOSアプリで何故かDesignResolution効いてないなと困っていたのですが・・・モバイル環境だとif文の中を通らないようなので、setDesignResolutionSizeする場所に注意です。

##DesignResolution使い方

Scene.cpp
    auto size = Director::getInstance()->getOpenGLView()->getDesignResolutionSize();

DesignResolutionに設定した解像度をシーンの中で取得できます。

##ご参考
setDesignResolutionSize() is being ignored?

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?