使用chrome调试,canvas 的 design resolution设置的是1920*1080 ,长宽自适配,背景是白色(如图),此时出现一个问题,FPS等调试信息挤在左下角,完全看不清,有没有办法修改调试信息的显示?
你就不能把你的背景先改个颜色吗 没问题了再改回来 会死吗?
1赞
看不清+1
有些界面就是这个颜色的 难道每次都改写背景
新版坑爹 调试信息随视图大小改变。 选默认自然可以看清
改成别的颜色,还是很小的一坨,根本看不清,你以为我没试过
这个问题解决方案如下:
在引擎的 CCProfiler.js 脚本的 cc.profiler 对象中加入如下脚本
/**
* !#en Set the color of debug information text.
* !#zh 设置调试信息文本的颜色
* @method setFpsLabelColor
* @param {Boolean} setAll - Whether to set up left and right text uniformly.
* @example
* cc.profiler.setFpsLabelColor(true, { r: 255, g: 0, b: 0, a: 255 });
* cc.profiler.setFpsLabelColor(false, { r: 255, g: 0, b: 0, a: 255 }, { r: 0, g: 0, b: 0, a: 255 });
*/
setFpsLabelColor(setAll, fisColor, secColor) {
if (!_rootNode && !_rootNode.isValid) return;
if (typeof fisColor === "object" || typeof secColor === "object") {
let leftNode = _rootNode.getChildByName("LEFT-PANEL");
let rightNode = _rootNode.getChildByName("RIGHT-PANEL");
if (leftNode && rightNode) {
if (setAll) {
leftNode.color = rightNode.color = new cc.Color(fisColor);
}
else {
leftNode.color = new cc.Color(fisColor);
rightNode.color = new cc.Color(secColor);
}
}
}
}
然后编译引擎。
之后你就可以在项目中动态修改调试信息文本颜色了。
5赞