@shipit wrote:
I started with
480x320
design resolution. I have one size for assets that I scale based onDirector::getVisibleSize()
ie I don't usecontentScaleFactor
. So far so good, the game looks good on all phones. Then my beta testers report that my HUD is off on iPads. I investigate further by drawingvisibleSize
,visibleOrigin
,winSize
on aDrawNode
across these devices. And guess what - they don't line up!Essentially my HUD layout depends on
visibleSize
' s corners and bounding box. What am I missing?On another note, doing away with design resolution entirely and setting it to
frameSize
brings super accurate positioning but now sizing is off eg scale-9 based buttons, font size etc. I created my own logical sizing with which I'm getting somewhat ok sizing but not as consistent as using cocos2d-x's design resolution. Here's my sizing code:Size ScreenUtil::sLogicalSize = Size(960, 640); Size ScreenUtil::sizeForDisplay(Size source) { auto winSize = Director::getInstance()->getWinSize(); float sx = source.width / sLogicalSize.width; float width = winSize.width * sx; float height = source.height * width / source.width; Size output = Size(width, height); return output; }
Any help greatly appreciated! Thanks a lot!!
Posts: 1
Participants: 1