mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1479 from dumganhar/gles20
Renamed "setFrameZoom" to "setFrameZoomFactor", added 'getFrameZoomFactor
This commit is contained in:
commit
aa818f3b54
|
@ -241,13 +241,18 @@ void CCEGLView::setFrameSize(float width, float height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLView::setFrameZoom(float fZoomFactor)
|
void CCEGLView::setFrameZoomFactor(float fZoomFactor)
|
||||||
{
|
{
|
||||||
m_fFrameZoomFactor = fZoomFactor;
|
m_fFrameZoomFactor = fZoomFactor;
|
||||||
glfwSetWindowSize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
glfwSetWindowSize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
||||||
CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
|
CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CCEGLView::getFrameZoomFactor()
|
||||||
|
{
|
||||||
|
return m_fFrameZoomFactor;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||||
{
|
{
|
||||||
glViewport((GLint)(x * m_fScaleX * m_fFrameZoomFactor+ m_obViewPortRect.origin.x * m_fFrameZoomFactor),
|
glViewport((GLint)(x * m_fScaleX * m_fFrameZoomFactor+ m_obViewPortRect.origin.x * m_fFrameZoomFactor),
|
||||||
|
|
|
@ -36,7 +36,8 @@ public:
|
||||||
/*
|
/*
|
||||||
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
||||||
*/
|
*/
|
||||||
void setFrameZoom(float fZoomFactor);
|
void setFrameZoomFactor(float fZoomFactor);
|
||||||
|
float getFrameZoomFactor();
|
||||||
virtual bool isOpenGLReady();
|
virtual bool isOpenGLReady();
|
||||||
virtual void end();
|
virtual void end();
|
||||||
virtual void swapBuffers();
|
virtual void swapBuffers();
|
||||||
|
|
|
@ -636,7 +636,7 @@ void CCEGLView::resize(int width, int height)
|
||||||
SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLView::setFrameZoom(float fZoomFactor)
|
void CCEGLView::setFrameZoomFactor(float fZoomFactor)
|
||||||
{
|
{
|
||||||
m_fFrameZoomFactor = fZoomFactor;
|
m_fFrameZoomFactor = fZoomFactor;
|
||||||
resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
||||||
|
@ -644,6 +644,11 @@ void CCEGLView::setFrameZoom(float fZoomFactor)
|
||||||
CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
|
CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CCEGLView::getFrameZoomFactor()
|
||||||
|
{
|
||||||
|
return m_fFrameZoomFactor;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::setFrameSize(float width, float height)
|
void CCEGLView::setFrameSize(float width, float height)
|
||||||
{
|
{
|
||||||
CCEGLViewProtocol::setFrameSize(width, height);
|
CCEGLViewProtocol::setFrameSize(width, height);
|
||||||
|
|
|
@ -65,7 +65,8 @@ public:
|
||||||
/*
|
/*
|
||||||
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
||||||
*/
|
*/
|
||||||
void setFrameZoom(float fZoomFactor);
|
void setFrameZoomFactor(float fZoomFactor);
|
||||||
|
float getFrameZoomFactor();
|
||||||
void centerWindow();
|
void centerWindow();
|
||||||
|
|
||||||
typedef void (*LPFN_ACCELEROMETER_KEYHOOK)( UINT message,WPARAM wParam, LPARAM lParam );
|
typedef void (*LPFN_ACCELEROMETER_KEYHOOK)( UINT message,WPARAM wParam, LPARAM lParam );
|
||||||
|
|
|
@ -32,6 +32,6 @@ int main(int argc, char **argv)
|
||||||
eglView->setFrameSize(2048, 1536);
|
eglView->setFrameSize(2048, 1536);
|
||||||
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
|
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
|
||||||
// So we need to invoke 'setFrameZoom'(only valid on desktop(win32, mac, linux)) to make the window smaller.
|
// So we need to invoke 'setFrameZoom'(only valid on desktop(win32, mac, linux)) to make the window smaller.
|
||||||
eglView->setFrameZoom(0.4f);
|
eglView->setFrameZoomFactor(0.4f);
|
||||||
return CCApplication::sharedApplication()->run();
|
return CCApplication::sharedApplication()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
eglView->setFrameSize(2048, 1536);
|
eglView->setFrameSize(2048, 1536);
|
||||||
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
|
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
|
||||||
// So we need to invoke 'setFrameZoom'(only valid on desktop(win32, mac, linux)) to make the window smaller.
|
// So we need to invoke 'setFrameZoom'(only valid on desktop(win32, mac, linux)) to make the window smaller.
|
||||||
eglView->setFrameZoom(0.4f);
|
eglView->setFrameZoomFactor(0.4f);
|
||||||
return CCApplication::sharedApplication()->run();
|
return CCApplication::sharedApplication()->run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue