Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17118

Sprite::create() and high DPI/retina displays

$
0
0

@Driverman wrote:

Hi Cocos2D-x forums! I'm new here. My question is about asset sizes and how they're handled with high DPI displays (like Retina). I have a texture image with many sprites on it, and I want to create a sprite out of one of them. So, after reading the API docs, I did this:

auto testSprite = Sprite::create("testTexture.png", Rect(8, 0, 8, 12));

I wanted an 8x12 pixel sprite out of the sheet, starting at (8, 0). However, it seems to have scaled up that Rect I provided, as much more of the texture than I expected is included -- about 2x in each dimension, but not exactly -- but I couldn't find anywhere in the API docs that said how different density displays were handled in conjunction with that particular factory method. So I was hoping someone could clarify that for me.

Obviously this is the C++ API, but I believe it applies to all, and so I've filed it accordingly.

Thanks!

Posts: 18

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17118

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>