Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COBut in this example we are not working at GL level. If I want to draw a line at 1/3 of the screen in points, theorically, I only need to covert from points to Box2d coordinates dividing by PTM_RATIO because cocos2d works in points and it doesn't matter if the screen is retina or not. Why dividing by PTM_RATIO doesn't work and dividing by PTM_RATIO*CC_CONTENT_SCALE_FACTOR do work?. It is the opposite I expected to behave. PTM_RATIO is 100 for both iPad types.
      singulars
    2. COHow did you draw the line? ccDrawLine is just a convenience function wrapping OpenGL code, so that does indeed need to be fed with pixel coordinates. I'm not sure about CCDrawNode but I suppose that should not need content scale factor applied to it. Furthermore keep in mind that you're creating a box2d vector with content scale factor applied to it, which you shouldn't do because that scales the vector *inside* the box2d world. Instead when you get the vector to draw, that's when you apply PTM_RATIO and (if needed) content scale factor.
      singulars
    3. COPerhaps you need to step back for a moment. Start with a fresh project and a CCPhysicsSprite and place it at the center of the screen. You'll notice that it remains at the center regardless of Retina or iPad vs iPhone. Then try to achieve the same with a custom sprite and custom body, and apply only PTM_RATIO but no content scale factor when applying body position to sprite position. You'll notice that you get the same result on all devices. Then use -hd and -ipadhd graphics for the sprite, and you'll see other than the sprite's size nothing changes.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload