issue #2808: refractor setFrameZoomFactor() access, change init() parameter

This commit is contained in:
Huabing.Xu 2013-09-13 18:21:12 +08:00
parent 86306a842d
commit 0af0951c35
2 changed files with 11 additions and 8 deletions

View File

@ -43,15 +43,14 @@ public:
virtual void swapBuffers();
virtual void setFrameSize(float width, float height);
virtual void setIMEKeyboardState(bool bOpen);
bool init(const char* viewName, float width, float height);
/*
*frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/
bool init(const char* viewName, float width, float height, float frameZoomFactor = 1.0f);
public:
//void resize(int width, int height);
/*
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/
void setFrameZoomFactor(float fZoomFactor);
float getFrameZoomFactor();
//void centerWindow();
@ -68,7 +67,10 @@ public:
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView();
protected:
/*
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/
void setFrameZoomFactor(float fZoomFactor);
private:
bool _captured;
bool _supportTouch;

View File

@ -158,12 +158,13 @@ EGLView::~EGLView()
s_pEglView = nullptr;
}
bool EGLView::init(const char *viewName, float width, float height)
bool EGLView::init(const char *viewName, float width, float height, float frameZoomFactor)
{
if(nullptr != _mainWindow) return true;
setViewName(viewName);
setFrameSize(width, height);
setFrameZoomFactor(frameZoomFactor);
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr);