mhamon1992 / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

Properly scaling sprites to screensize #67

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Create sprite from asset image
2. Add sprite to scene/layer
3. Observe resulting sprite size relative to screen size

What is the expected output? What do you see instead?

Expected: A sprite of equal size relative to screensize. 
Actual: Sprite size is the same regardless of screensize or dpi.

What version of the product are you using? On what operating system?

Latest from git, working in eclipse on Windows 7.

Please provide any additional information below.

I'm just wondering if there is a preferred method to handle scaling. Currently 
I am manually scaling sprites using two constants based on current screensize 
and it seems to work ok except round objects will be slightly scewed due to 
different aspect ratios. Also, I need my box2d bodies to scale as well so I 
apply the same scale constants to those. Is this the proper way to scale 
sprites in cocos2d-android? Curious how others are handling this.

Original issue reported on code.google.com by dcasloc...@gmail.com on 11 May 2011 at 1:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
A workaround that worked for me was to explicitly set the width and height to 
my actual screen dimensions.  CCDirector.sharedDirector().setScreenSize(width, 
height);

Original comment by gun...@gmail.com on 21 May 2011 at 3:30

GoogleCodeExporter commented 8 years ago
I started to use cocos2d-android and the classe CCDirector doesn't have the 
setScreenSize method. Is there any way of definining the screen size?

Original comment by denise.v...@gmail.com on 22 Aug 2013 at 8:41