fixed #1215: fixed a bug in retina support for win32.

This commit is contained in:
James Chen 2012-05-03 15:05:19 +08:00
parent b6a1e89aa5
commit 7cdb11b668
3 changed files with 7 additions and 12 deletions

View File

@ -346,8 +346,6 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
{
case kCCDirectorProjection2D:
{
kmGLMatrixMode(KM_GL_PROJECTION);
kmGLLoadIdentity();
kmMat4 orthoMatrix;

View File

@ -80,10 +80,8 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height)
(float)m_sSizeInPixel.height / m_sSizeInPoint.height);
int viewPortW = (int)(m_sSizeInPoint.width * m_fScreenScaleFactor);
int viewPortH = (int)(m_sSizeInPoint.height * m_fScreenScaleFactor);
m_rcViewPort.origin.x = (m_sSizeInPixel.width - viewPortW) / 2;
m_rcViewPort.origin.y = (m_sSizeInPixel.height - viewPortH) / 2;
m_rcViewPort.size.width = viewPortW;
m_rcViewPort.size.height = viewPortH;
m_rcViewPort.setRect((m_sSizeInPixel.width - viewPortW) / 2, (m_sSizeInPixel.height - viewPortH) / 2, viewPortW, viewPortH);
CCLOG("m_fScreenScaleFactor = %f", m_fScreenScaleFactor);
m_bNeedScale = true;

View File

@ -239,6 +239,8 @@ bool CCEGLView::Create(LPCTSTR pTitle, int w, int h)
resize(w, h);
CCEGLViewProtocol::setFrameSize(w, h);
// init egl
m_pEGL = CCEGL::create(this);
@ -266,7 +268,7 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
if (m_pDelegate && MK_LBUTTON == wParam)
{
POINT point = {(short)LOWORD(lParam), (short)HIWORD(lParam)};
CCPoint pt(point.x, point.y);
CCPoint pt(point.x/CC_CONTENT_SCALE_FACTOR(), point.y/CC_CONTENT_SCALE_FACTOR());
if (CCRect::CCRectContainsPoint(m_rcViewPort, pt))
{
m_bCaptured = true;
@ -281,7 +283,7 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
if (MK_LBUTTON == wParam && m_bCaptured)
{
POINT point = {(short)LOWORD(lParam), (short)HIWORD(lParam)};
CCPoint pt(point.x, point.y);
CCPoint pt(point.x/CC_CONTENT_SCALE_FACTOR(), point.y/CC_CONTENT_SCALE_FACTOR());
int id = 0;
handleTouchesMove(1, &id, &pt.x, &pt.y);
}
@ -291,7 +293,7 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
if (m_bCaptured)
{
POINT point = {(short)LOWORD(lParam), (short)HIWORD(lParam)};
CCPoint pt(point.x, point.y);
CCPoint pt(point.x/CC_CONTENT_SCALE_FACTOR(), point.y/CC_CONTENT_SCALE_FACTOR());
int id = 0;
handleTouchesEnd(1, &id, &pt.x, &pt.y);
@ -457,8 +459,6 @@ void CCEGLView::resize(int width, int height)
{
m_pEGL->resizeSurface();
}
CCEGLViewProtocol::setFrameSize(width, height);
}
void CCEGLView::setFrameSize(float width, float height)
@ -506,7 +506,6 @@ bool CCEGLView::canSetContentScaleFactor()
void CCEGLView::setContentScaleFactor(float contentScaleFactor)
{
CCEGLViewProtocol::setContentScaleFactor(contentScaleFactor);
resize((int)(m_sSizeInPixel.width * contentScaleFactor), (int)(m_sSizeInPixel.height * contentScaleFactor));
centerWindow();
}