issue #1486: Removed some unused codes, made it works on WINDOWS.

This commit is contained in:
James Chen 2012-10-12 09:58:42 +08:00
parent b78e2c9130
commit e1c0ea761b
6 changed files with 4 additions and 58 deletions

View File

@ -136,7 +136,6 @@ bool CCDirector::init(void)
m_pobOpenGLView = NULL;
m_fContentScaleFactor = 1.0f;
m_bIsContentScaleSupported = false;
// scheduler
m_pScheduler = new CCScheduler();
@ -314,12 +313,7 @@ void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView)
CHECK_GL_ERROR_DEBUG();
if (m_fContentScaleFactor != 1)
{
updateContentScaleFactor();
}
m_pobOpenGLView->setTouchDelegate(m_pTouchDispatcher);
m_pobOpenGLView->setTouchDelegate(m_pTouchDispatcher);
m_pTouchDispatcher->setDispatchEvents(true);
}
}
@ -804,11 +798,6 @@ void CCDirector::createStatsLabel()
* mobile platforms specific functions
**************************************************/
void CCDirector::updateContentScaleFactor()
{
m_bIsContentScaleSupported = m_pobOpenGLView->setContentScaleFactor(m_fContentScaleFactor);
}
float CCDirector::getContentScaleFactor(void)
{
return m_fContentScaleFactor;
@ -819,15 +808,6 @@ void CCDirector::setContentScaleFactor(float scaleFactor)
if (scaleFactor != m_fContentScaleFactor)
{
m_fContentScaleFactor = scaleFactor;
m_obWinSizeInPixels = CCSizeMake(m_obWinSizeInPoints.width * scaleFactor, m_obWinSizeInPoints.height * scaleFactor);
if (m_pobOpenGLView)
{
updateContentScaleFactor();
}
// update projection
setProjection(m_eProjection);
}
}

View File

@ -328,8 +328,6 @@ protected:
void purgeDirector();
bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in end()
void updateContentScaleFactor(void);
void setNextScene(void);
void showStats();
@ -406,9 +404,6 @@ protected:
/* Projection protocol delegate */
CCDirectorDelegate *m_pProjectionDelegate;
/* contentScaleFactor could be simulated */
bool m_bIsContentScaleSupported;
// CCEGLViewProtocol will recreate stats labels to fit visible rect
friend class CCEGLViewProtocol;

View File

@ -141,12 +141,6 @@ void CCEGLViewProtocol::setTouchDelegate(EGLTouchDelegate * pDelegate)
m_pDelegate = pDelegate;
}
bool CCEGLViewProtocol::setContentScaleFactor(float contentScaleFactor)
{
m_fScaleX = m_fScaleY = contentScaleFactor;
return false;
}
void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
{
glViewport((GLint)(x * m_fScaleX + m_obViewPortRect.origin.x),

View File

@ -91,12 +91,6 @@ public:
/** Set touch delegate */
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
/**
* Set content scale factor.
* @return If the return value is true, the platform supports retina display mode.
*/
virtual bool setContentScaleFactor(float contentScaleFactor);
/**
* Set opengl view port rectangle with points.
*/

View File

@ -231,7 +231,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/CC_CONTENT_SCALE_FACTOR(), point.y/CC_CONTENT_SCALE_FACTOR());
CCPoint pt(point.x, point.y);
CCPoint tmp = ccp(pt.x, m_obScreenSize.height - pt.y);
if (m_obViewPortRect.equals(CCRectZero) || m_obViewPortRect.containsPoint(tmp))
{
@ -249,7 +249,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/CC_CONTENT_SCALE_FACTOR(), point.y/CC_CONTENT_SCALE_FACTOR());
CCPoint pt(point.x, point.y);
int id = 0;
pt.x *= m_windowTouchScaleX;
pt.y *= m_windowTouchScaleY;
@ -261,7 +261,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/CC_CONTENT_SCALE_FACTOR(), point.y/CC_CONTENT_SCALE_FACTOR());
CCPoint pt(point.x, point.y);
int id = 0;
pt.x *= m_windowTouchScaleX;
pt.y *= m_windowTouchScaleY;
@ -408,12 +408,6 @@ void CCEGLView::setIMEKeyboardState(bool /*bOpen*/)
}
bool CCEGLView::enableRetina()
{
m_bIsRetinaEnabled = true;
return true;
}
void CCEGLView::setMenuResource(LPCWSTR menu)
{
m_menu = menu;
@ -512,15 +506,6 @@ void CCEGLView::centerWindow()
SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
}
bool CCEGLView::setContentScaleFactor(float contentScaleFactor)
{
CCEGLViewProtocol::setContentScaleFactor(contentScaleFactor);
resize((int)(m_obScreenSize.width * contentScaleFactor), (int)(m_obScreenSize.height * contentScaleFactor));
centerWindow();
return true;
}
CCEGLView* CCEGLView::sharedOpenGLView()
{
static CCEGLView* s_pEglView = NULL;

View File

@ -46,10 +46,8 @@ public:
virtual bool isOpenGLReady();
virtual void end();
virtual void swapBuffers();
virtual bool setContentScaleFactor(float contentScaleFactor);
virtual void setFrameSize(float width, float height);
virtual void setIMEKeyboardState(bool bOpen);
virtual bool enableRetina();
void setMenuResource(LPCWSTR menu);
void setWndProc(CUSTOM_WND_PROC proc);