how to adapt defferent resolution of wp8 in cocos2dx-wp8?

how to adapt defferent resolution of wp8 in cocos2dx-wp8?
0.0 0


运行cocos2dx-0.13.0-wp8-0.8中的helloworld项目,使用1280*720和1280*768调试的时候 游戏不是占满全屏,仅仅按照480*800的分辨率现在在屏幕的左下角,这是模拟器的问题还是coco2dx-wp8版本引擎的问题?

download and unlock the cocos2dx-0.13.0-wp8-0.8.rar,then run helloworld project ,update the simulator as 1280*720 or 1280*768, run it,the game just display at the leftbottom corner.wht not display on screen fully?


Looking at,

I made this change, at CCEGLView_win8_metro.cpp CCEGLView::setDesignResolution (line 209)

float resolutionScale = ((int)Windows::Graphics::Display::DisplayProperties::ResolutionScale) / 100.0f;
float winWidth = render~~>m_window~~>Bounds.Width * resolutionScale;
float winHeight = render~~>m_window~~>Bounds.Height * resolutionScale;

I didn’t check vigorously to see if cocos2d-x uses the device independent resolution in other places, but this change fixed the problem for me.

Hope this helps!


thanks for your help,i will try it later.

cocos2dx-wp8 is cludeed in my app, there are some codes like this,i think it will give a help for this silght bug
CCEGLView* mainView = new (buff) CCEGLView();
//mainView~~>setDesignResolution(480, 320);
mainView~~>setDesignResolution(320, 533);


Hi I have the same problem : I create a menu but I dont click to button in this menu with 720p. but with WVGA I can.

Please help me.


ok,i don not know your question cleayly,maybe there are some disfriendly code in your file.


okie, I try run Sample project Test of cocos2dx0.13 for WP8. I see dont click to Item of menu when run with simulator 720p. but that run good when run
with simulator WVGA. thanks


i also get the problem,so far i do not get any device runed with windows phone 8,so i am not sure whether it’s the bug of simulator or not.


Changing the design resolution breaks the coordinate transformation for touches

To Fix:

In CCEGLView_win8_metro.cpp replace all these lines:

pTouch->SetTouchInfo((point.x - m_rcViewPort.left) / m_fScreenScaleFactor / m_fWinScaleX, 
        (point.y - / m_fScreenScaleFactor / m_fWinScaleY);

With this one:

float touchScale = min(480 / m_sizeInPoints.width, 800 / m_sizeInPoints.height);
pTouch->SetTouchInfo((point.x - m_rcViewPort.left) / touchScale / m_fWinScaleX, 
        (point.y/touchScale - / m_fWinScaleY);

DISCLAIMER: This solution - while working - is a hack, because right now i am too lazy to try and understand how this actually works. Use at your own discretion


I am still struggling with the resolution of WP8.

mainView->setDesignResolution(480, 800);
This works for 400x480 WVGA and 768x1280 WXGA, but not working for 720x1280 720p. For 720p screen, there is a blank 40 pixels on top and another 40 pixels at the bottom. All touch points work correctly.

Any work around to fix the 720p top/bottom dead band ?



Im using wp8 v2.0 preview of wp8 branch, and a WXGA (768, 1280) phone.

My game is designed in Resolution(640, 1066). so i call

mainView->setDesignResolution(640, 1066);

then i have just noticed, in CCEGLView_win8metro.cpp, there is a useless factor calculation in func setViewPortInPoints, its useless because after that calculation factor variable is manually set to 1.0f! then i changed factor variable to 1.2f, since my designed has 640px width (768 / 640 = 1.2f)

void CCEGLView::setViewPortInPoints(float x, float y, float w, float h)
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
factor = 1.2f;
(int)(x * factor * m_fWinScaleX) + m_rcViewPort.left,
(int)(y * factor * m_fWinScaleY) +,
(int)(w * factor * m_fWinScaleX),
(int)(h * factor * m_fWinScaleY));