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 swapBuffers();
virtual void setFrameSize(float width, float height); virtual void setFrameSize(float width, float height);
virtual void setIMEKeyboardState(bool bOpen); 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: public:
//void resize(int width, int height); //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(); float getFrameZoomFactor();
//void centerWindow(); //void centerWindow();
@ -68,7 +67,10 @@ public:
/** @deprecated Use getInstance() instead */ /** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView(); CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView();
protected: 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: private:
bool _captured; bool _captured;
bool _supportTouch; bool _supportTouch;

View File

@ -158,12 +158,13 @@ EGLView::~EGLView()
s_pEglView = nullptr; 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; if(nullptr != _mainWindow) return true;
setViewName(viewName); setViewName(viewName);
setFrameSize(width, height); setFrameSize(width, height);
setFrameZoomFactor(frameZoomFactor);
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr); _mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr);