add getSafeArea for android and iOS (#3067)

This commit is contained in:
Knox
2020-11-25 16:58:46 +08:00
committed by GitHub
parent 8afc47fcad
commit edc85f1f4c
3 changed files with 53 additions and 30 deletions
@@ -130,8 +130,8 @@ Device::NetworkType Device::getNetworkType()
cc::Vec4 Device::getSafeAreaEdge()
{
// no SafeArea concept on android, return ZERO Vec4.
return cc::Vec4();
float *data = JniHelper::callStaticFloatArrayMethod(JCLS_HELPER, "getSafeArea");
return cc::Vec4(data[0], data[1], data[2],data[3]);
}
float Device::getDevicePixelRatio()