mirror of https://github.com/axmolengine/axmol.git
fixed #946: HD image for both retina and normal
This commit is contained in:
parent
dc3599f7ae
commit
b0b6b85a79
|
@ -778,6 +778,12 @@ bool CCDirector::enableRetinaDisplay(bool enabled)
|
|||
return false;
|
||||
}
|
||||
|
||||
// SD device
|
||||
if (m_pobOpenGLView->getMainScreenScale() == 1.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float newScale = (float)(enabled ? 2 : 1);
|
||||
setContentScaleFactor(newScale);
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
CCRect getViewPort();
|
||||
float getScreenScaleFactor();
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
float getMainScreenScale() { return -1.0; }
|
||||
|
||||
// static function
|
||||
/**
|
||||
|
|
|
@ -71,6 +71,8 @@ public:
|
|||
@brief get the shared main open gl window
|
||||
*/
|
||||
static CCEGLView& sharedOpenGLView();
|
||||
|
||||
float getMainScreenScale() { return -1.0; }
|
||||
|
||||
/*
|
||||
* param
|
||||
|
|
|
@ -49,13 +49,15 @@ public:
|
|||
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||
void swapBuffers();
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
|
||||
void touchesBegan(CCSet *set);
|
||||
void touchesMoved(CCSet *set);
|
||||
void touchesEnded(CCSet *set);
|
||||
void touchesCancelled(CCSet *set);
|
||||
|
||||
float getMainScreenScale();
|
||||
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
static CCEGLView& sharedOpenGLView();
|
||||
|
|
|
@ -54,8 +54,7 @@ bool CCEGLView::isOpenGLReady()
|
|||
|
||||
bool CCEGLView::canSetContentScaleFactor()
|
||||
{
|
||||
return [[EAGLView sharedEGLView] respondsToSelector:@selector(setContentScaleFactor:)]
|
||||
&& [[UIScreen mainScreen] scale] != 1.0;
|
||||
return [[EAGLView sharedEGLView] respondsToSelector:@selector(setContentScaleFactor:)];
|
||||
}
|
||||
|
||||
void CCEGLView::setContentScaleFactor(float contentScaleFactor)
|
||||
|
@ -139,4 +138,9 @@ CCEGLView& CCEGLView::sharedOpenGLView()
|
|||
return instance;
|
||||
}
|
||||
|
||||
float CCEGLView::getMainScreenScale()
|
||||
{
|
||||
return [[UIScreen mainScreen] scale];
|
||||
}
|
||||
|
||||
} // end of namespace cocos2d;
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
int setDeviceOrientation(int eOritation);
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
|
||||
float getMainScreenScale() { return -1.0; }
|
||||
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ public:
|
|||
void setIMEKeyboardState(bool bOpen);
|
||||
CCRect getViewPort();
|
||||
float getScreenScaleFactor();
|
||||
|
||||
float getMainScreenScale() { return -1.0; }
|
||||
|
||||
// static function
|
||||
/**
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
CCRect getViewPort();
|
||||
float getScreenScaleFactor();
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
float getMainScreenScale() { return 1.0 };
|
||||
|
||||
bool HandleEvents();
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
void swapBuffers();
|
||||
bool canSetContentScaleFactor();
|
||||
void setContentScaleFactor(float contentScaleFactor);
|
||||
|
||||
float getMainScreenScale() { return -1.0; }
|
||||
|
||||
virtual bool Create(LPCTSTR pTitle, int w, int h);
|
||||
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
|
Loading…
Reference in New Issue