title: Asset sizes for cocos2dx application
body: <p>As per my knowledge, to make a application in cocos2dx, I need three sets of resources <strong>ipad</strong>, <strong>ipadhd</strong> and <strong>iphone</strong></p>
  
  <p>From one example of an application, I saw that in order to support devices of all resolutions, the asset sizes (background image) that my friend had used were:</p>
  
  <p>ipadhd: 2272 X 1536</p>
  
  <p>ipad: 1136 X 768</p>
  
  <p>iphone: 568 X 384</p>
  
  <p>These dimensions work fine for a landscape mode game.
  Here are my questions:
  1. Why do we need these sizes in particular??
  2. I am trying to make a portrait mode game for which I took the same asset size (but since I am working in portrait mode, I took image sizes as 1536 X 2272, 768 X 1136 and 384 X 568). But, for some reason, the BG image is enlarged when it shows up on simulator/device. I am attaching screen shots here.</p>
  
  <p>Original Image:
  <img src="https://i.stack.imgur.com/u7k6m.png" alt="enter image description here"></p>
  
  <p>Image showing up in simulator:</p>
  
  <p><img src="https://i.stack.imgur.com/aw1ua.png" alt="enter image description here"></p>
  
  <p>For reference, here is the code to set device resolution size and content scale factor:</p>
  
  <pre><code>#define TARGET_DESIGN_RESOLUTION_SIZE  DESIGN_RESOLUTION_480X320
  
  typedef struct tagResource
  {
      cocos2d::CCSize size;
      char directory[100];
  }Resource;
  
  static Resource smallResource = { cocos2d::CCSizeMake(320, 480), "iphone" };
  static Resource mediumResource = { cocos2d::CCSizeMake(768,1024), "iPad" };
  static Resource largeResource = { cocos2d::CCSizeMake(1536,2048), "ipadhd" };
  
  #if (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_480X320)
  static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(320, 480);
  #elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_1024X768)
  static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(768,1024);
  #elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_2048X1536)
  static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(1536,2048);
  #elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_NONE)
  static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(320, 480);
  #else
  #error unknown target design resolution!
  #endif
  
  
  bool AppDelegate::applicationDidFinishLaunching() {
  // initialize director
  CCDirector* pDirector = CCDirector::sharedDirector();
  CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
  
  pDirector-&gt;setOpenGLView(pEGLView);
  
  // Set the design resolution
  pEGLView-&gt;setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height,kResolutionNoBorder);
  CCSize frameSize = pEGLView-&gt;getFrameSize();
  
  std::vector&lt;std::string&gt; resDirOrders;
  
  // if the frame's height is larger than the height of medium resource size, select large resource.
  if (frameSize.width &gt; mediumResource.size.width)
  {
      resDirOrders.push_back(largeResource.directory);
      pDirector-&gt;setContentScaleFactor(largeResource.size.width/designResolutionSize.width);
  }
  // if the frame's height is larger than the height of small resource size, select medium resource.
  else if (frameSize.width &gt; smallResource.size.width)
  {
      resDirOrders.push_back(mediumResource.directory);
      pDirector-&gt;setContentScaleFactor(mediumResource.size.width/designResolutionSize.width);
  
  }
  // if the frame's height is smaller than the height of medium resource size, select small resource.
  else
  {
      resDirOrders.push_back(smallResource.directory);
      pDirector-&gt;setContentScaleFactor(smallResource.size.width/designResolutionSize.width);
  }
  CCFileUtils::sharedFileUtils()-&gt;setSearchPaths(resDirOrders);
  
  // turn on display FPS
  pDirector-&gt;setDisplayStats(false);
  
  // set FPS. the default value is 1.0/60 if you don't call this
  pDirector-&gt;setAnimationInterval(1.0 / 60);
  
  // create a scene. it's an autorelease object
  CCScene *pScene = GameLayer::scene();
  
  // run
  pDirector-&gt;runWithScene(pScene);
  
  return true;
  }
  </code></pre>