@uvladus wrote:
Hello everyone. I am developing my game. All graph resources were made with resolution 1024x768 and second package 2048x1536. So I can cover ipad2 and other retinas ipad models. But when I ran it on android device 1280x800 with ExactFit I had it centered. GlView start pos was with offset.
image what I have
image what i want
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::EXACT_FIT);Sorry I am new user I can not upload screens to topic. I could not draw any preety borders out of the glview to fill black corners from left and right side of glview.
cant draw out of gliview wheh mode is ResolutionPolicy::EXACT_FIT
I decided to makestatic cocos2d::Size designResolutionSize = cocos2d::Size(1024 , 768); ... Size winSize = director->getWinSize(); glview->setFrameSize(winSize.width, winSize.height); glview->setDesignResolutionSize(winSize.width, winSize.height, ResolutionPolicy::NO_BORDER); director->setContentScaleFactor(designResolutionSize.height/winSize.height);
So in this case I have fully access to whole resolution of non standart resoulution device and I could fill any area of device resolution. All graph resouces are scaled normaly but positioning is bad. Why is ContentScaleFactor does not take affect to positioning. For example
button->setPosition(Vec2(100, 100));
here position of button takes real position 100;100. ContaintScaleFactor does not take affect on it. I have to multiple on it to see right value
button->setPosition(Vec2(100 / director->getContaintScaleFactor(), 100 / director->getContaintScaleFactor()));
Also I have many csb files which are with the wrong positioning. I understand if I set my glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); I would have normal positioning but I wont been able to fill left and right corners of glview.
Example on ios 5. designResolution set to 1136x640 glView frame is 1136x640. _contentScaleFactor is 1.2 because 768/640 = 1.2. All graph resources scales normaly, but positioning is bad. Look where are the buttons play options and info
I want to make my game scenes offset on x coordinate to set it in the center and fill black rects from the left and right with preety picture border. How can i do this?
Posts: 1
Participants: 1