mirror of https://github.com/axmolengine/axmol.git
CCGLView: Add createWithFullscreen overloaded method that allows passing in Size, to set video mode.
This commit is contained in:
parent
eaaab7a49f
commit
58224d9b23
|
@ -317,6 +317,18 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithFullScreen(const std::string& viewName, Size size, float frameZoomFactor)
|
||||
{
|
||||
auto ret = new GLView();
|
||||
if(ret && ret->initWithFullScreen(viewName, size, frameZoomFactor)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
setViewName(viewName);
|
||||
|
@ -374,6 +386,15 @@ bool GLView::initWithFullScreen(const std::string& viewName)
|
|||
return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f);
|
||||
}
|
||||
|
||||
bool GLView::initWithFullScreen(const std::string &viewName, cocos2d::Size size, float frameZoomFactor)
|
||||
{
|
||||
_primaryMonitor = glfwGetPrimaryMonitor();
|
||||
if (nullptr == _primaryMonitor)
|
||||
return false;
|
||||
|
||||
return initWithRect(viewName, Rect(0, 0, size.width, size.height), 1.0f);
|
||||
}
|
||||
|
||||
bool GLView::isOpenGLReady()
|
||||
{
|
||||
return nullptr != _mainWindow;
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
static GLView* create(const std::string& viewName);
|
||||
static GLView* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f);
|
||||
static GLView* createWithFullScreen(const std::string& viewName);
|
||||
static GLView* createWithFullScreen(const std::string& viewName, Size size, float frameZoomFactor = 1.0f);
|
||||
|
||||
/*
|
||||
*frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
||||
|
@ -82,6 +83,7 @@ protected:
|
|||
|
||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
||||
bool initWithFullScreen(const std::string& viewName);
|
||||
bool initWithFullScreen(const std::string& viewName, Size rect, float frameZoomFactor);
|
||||
|
||||
bool initGlew();
|
||||
|
||||
|
|
Loading…
Reference in New Issue