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;
|
||||
glfwSetWindowSize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
||||
CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
|
||||
}
|
||||
|
||||
float CCEGLView::getFrameZoomFactor()
|
||||
{
|
||||
return m_fFrameZoomFactor;
|
||||
}
|
||||
|
||||
void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
void setFrameZoom(float fZoomFactor);
|
||||
void setFrameZoomFactor(float fZoomFactor);
|
||||
float getFrameZoomFactor();
|
||||
virtual bool isOpenGLReady();
|
||||
virtual void end();
|
||||
virtual void swapBuffers();
|
||||
|
|
|
@ -636,7 +636,7 @@ void CCEGLView::resize(int width, int height)
|
|||
SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
}
|
||||
|
||||
void CCEGLView::setFrameZoom(float fZoomFactor)
|
||||
void CCEGLView::setFrameZoomFactor(float fZoomFactor)
|
||||
{
|
||||
m_fFrameZoomFactor = 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());
|
||||
}
|
||||
|
||||
float CCEGLView::getFrameZoomFactor()
|
||||
{
|
||||
return m_fFrameZoomFactor;
|
||||
}
|
||||
|
||||
void CCEGLView::setFrameSize(float width, float height)
|
||||
{
|
||||
CCEGLViewProtocol::setFrameSize(width, height);
|
||||
|
@ -684,12 +689,12 @@ void CCEGLView::centerWindow()
|
|||
SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
}
|
||||
|
||||
void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glViewport((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor),
|
||||
(GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor),
|
||||
(GLsizei)(w * m_fScaleX * m_fFrameZoomFactor),
|
||||
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
|
||||
void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glViewport((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor),
|
||||
(GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor),
|
||||
(GLsizei)(w * m_fScaleX * m_fFrameZoomFactor),
|
||||
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
|
||||
}
|
||||
|
||||
CCEGLView* CCEGLView::sharedOpenGLView()
|
||||
|
|
|
@ -65,7 +65,8 @@ public:
|
|||
/*
|
||||
* 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();
|
||||
|
||||
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);
|
||||
// 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.
|
||||
eglView->setFrameZoom(0.4f);
|
||||
eglView->setFrameZoomFactor(0.4f);
|
||||
return CCApplication::sharedApplication()->run();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
|||
eglView->setFrameSize(2048, 1536);
|
||||
// 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.
|
||||
eglView->setFrameZoom(0.4f);
|
||||
eglView->setFrameZoomFactor(0.4f);
|
||||
return CCApplication::sharedApplication()->run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue