//获取视图的大小,以点为单位。
let winSize=cc.director.getWinSize();
console.log('winSize',winSize.width,winSize.height);
//获取运行场景的可见大小。
let visiSize=cc.director.getVisibleSize();
console.log('visiSize',visiSize.width,visiSize.height);
经过web与原生测试,两个size是一样的。
看源码:
/**
* !#en
* Returns the size of the WebGL view in points.
* It takes into account any possible rotation (device orientation) of the window.
* !#zh 获取视图的大小,以点为单位。
* @method getWinSize
* @return {Size}
*/
getWinSize: function () {
return cc.size(this._winSizeInPoints);
},
/**
* !#en Returns the visible size of the running scene.
* !#zh 获取运行场景的可见大小。
* @method getVisibleSize
* @return {Size}
*/
getVisibleSize: null,
也没有接收到有用的信息。
就是想问有这两个函数有什么区别?