mirror of https://github.com/axmolengine/axmol.git
resize metal drawable (#20074)
This commit is contained in:
parent
73ad115702
commit
48e0d7d3a6
|
@ -319,7 +319,6 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int fbWidth, fbHeight;
|
int fbWidth, fbHeight;
|
||||||
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
|
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
|
||||||
|
|
||||||
|
@ -879,6 +878,14 @@ void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow* /*window*/, int width,
|
||||||
setDesignResolutionSize(baseDesignSize.width, baseDesignSize.height, baseResolutionPolicy);
|
setDesignResolutionSize(baseDesignSize.width, baseDesignSize.height, baseResolutionPolicy);
|
||||||
Director::getInstance()->setViewport();
|
Director::getInstance()->setViewport();
|
||||||
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(GLViewImpl::EVENT_WINDOW_RESIZED, nullptr);
|
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(GLViewImpl::EVENT_WINDOW_RESIZED, nullptr);
|
||||||
|
|
||||||
|
//update metal drawable size.
|
||||||
|
int fbWidth, fbHeight;
|
||||||
|
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
|
||||||
|
CGSize size;
|
||||||
|
size.width = static_cast<CGFloat>(fbWidth);
|
||||||
|
size.height = static_cast<CGFloat>(fbHeight);
|
||||||
|
[backend::DeviceMTL::getCAMetalLayer() setDrawableSize:size];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue