diff --git a/cocos2dx/platform/mac/CCEGLView.h b/cocos2dx/platform/mac/CCEGLView.h index 4430a67c6b..d115f42023 100644 --- a/cocos2dx/platform/mac/CCEGLView.h +++ b/cocos2dx/platform/mac/CCEGLView.h @@ -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; diff --git a/cocos2dx/platform/mac/CCEGLView.mm b/cocos2dx/platform/mac/CCEGLView.mm index 3fa0d4df84..4dc8724468 100644 --- a/cocos2dx/platform/mac/CCEGLView.mm +++ b/cocos2dx/platform/mac/CCEGLView.mm @@ -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);