void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height) { if (_resolutionPolicy != ResolutionPolicy::UNKNOWN) { updateDesignResolutionSize(); Director::getInstance()->setViewport(); } }
void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height) { int frameWidth = width / _frameZoomFactor; int frameHeight = height / _frameZoomFactor; setFrameSize(frameWidth, frameHeight); updateDesignResolutionSize(); Director::getInstance()->setViewport(); }
void GLView::setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy) { CCASSERT(resolutionPolicy != ResolutionPolicy::UNKNOWN, "should set resolutionPolicy"); if (width == 0.0f || height == 0.0f) { return; } _designResolutionSize.setSize(width, height); _resolutionPolicy = resolutionPolicy; updateDesignResolutionSize(); }
void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height) { if (_resolutionPolicy != ResolutionPolicy::UNKNOWN) { updateDesignResolutionSize(); Director::getInstance()->setViewport(); } if (_resizable) { cocos2d::EventCustom event("APP.WINDOW_RESIZE_EVENT"); std::stringstream buf; buf << "{\"width\":" << width; buf << ",\"height\":" << height << "}"; event.setDataString(buf.str()); Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); } }