add a new create method to create resizable window

This commit is contained in:
minggo 2016-06-02 15:46:22 +08:00
parent 66217b7bd1
commit 7243b00cad
2 changed files with 7 additions and 1 deletions

View File

@ -299,9 +299,14 @@ GLViewImpl::~GLViewImpl()
} }
GLViewImpl* GLViewImpl::create(const std::string& viewName) GLViewImpl* GLViewImpl::create(const std::string& viewName)
{
return GLViewImpl::create(viewName, false);
}
GLViewImpl* GLViewImpl::create(const std::string& viewName, bool resizable)
{ {
auto ret = new (std::nothrow) GLViewImpl; auto ret = new (std::nothrow) GLViewImpl;
if(ret && ret->initWithRect(viewName, Rect(0, 0, 960, 640), 1.0f, false)) { if(ret && ret->initWithRect(viewName, Rect(0, 0, 960, 640), 1.0f, resizable)) {
ret->autorelease(); ret->autorelease();
return ret; return ret;
} }

View File

@ -57,6 +57,7 @@ class CC_DLL GLViewImpl : public GLView
{ {
public: public:
static GLViewImpl* create(const std::string& viewName); static GLViewImpl* create(const std::string& viewName);
static GLViewImpl* create(const std::string& viewName, bool resizable);
static GLViewImpl* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f, bool resizable = false); static GLViewImpl* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f, bool resizable = false);
static GLViewImpl* createWithFullScreen(const std::string& viewName); static GLViewImpl* createWithFullScreen(const std::string& viewName);
static GLViewImpl* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor); static GLViewImpl* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor);