使用cocos creator 1.9.1 ,微信子域绘制上屏模糊

您好 请问引擎代码在哪里修改呢?

问题解决了嘛? 哥 按照上面的方法绘制 为什么会变得特别卡呢?

在onLoad里加载代码 为什么整个项目运行会变得特别卡呢

4楼的办法很卡, 在安卓上卡的不动.

大哥,请问子域引擎在哪个引擎文件内修改

请问子域引擎在微信开发者工具中报错遇到了吗?
WAGameSubContext.js:3 Uncaught TypeError: wx.onShow is not a function
at Object._initEvents (cocos2d-js-min.js:1)
at Object.prepare (cocos2d-js-min.js:1)
at cocos2d-js-min.js:1
at n (cocos2d-js-min.js:1)
at Object.2.cc.initEngine (cocos2d-js-min.js:1)
at Object.prepare (cocos2d-js-min.js:1)
at cocos2d-js-min.js:1
at Object._loadConfig (cocos2d-js-min.js:1)
at Object.prepare (cocos2d-js-min.js:1)
at Object.run (cocos2d-js-min.js:1)
@robertchang

但这样导致很卡, 机器丢帧严重, 而且每次打包子域要改引擎代码, 希望接下来的版本能提供更好的解决办法,

this.scaleX 也少了一个_.
另外这段代码直接写在 子域场景脚本的 onLoad即可. 因为是内部函数,所以是飘红状态. 忽略顠红警告即可.

对我来说, 更重要的是严重影响主游戏的性能, 没有子域编译后很少掉帧, 带子域编译后掉帧多10+个

帧率个位数呀,引出一个更严重的问题,这根本不能算是解决啊

我的子域 10 kb,纯原生

直接使用wxapi做的吗?

使用什么做的?

h5 canvas

//===========提高子域分辨率============

主域:
if (window.sharedCanvas) {
window.sharedCanvas.width = cc.game.canvas.width * 2;
window.sharedCanvas.height = cc.game.canvas.height * 2;
}

子域:
cc.view._convertPointWithScale=function(point) {
var viewport = this._viewPortRect;
point.x = (point.x - viewport.x) / (this._scaleX / 2);
point.y = (point.y - viewport.y) / (this._scaleY / 2);
};
cc.view._convertTouchesWithScale=function(touches) {
var viewport = this._viewPortRect, scaleX = this._scaleX / 2, scaleY = this._scaleY / 2, selTouch, selPoint, selPrePoint;
for (var i = 0; i < touches.length; i++) {
selTouch = touches[i];
selPoint = selTouch._point;
selPrePoint = selTouch._prevPoint;
selPoint.x = (selPoint.x - viewport.x) / scaleX;
selPoint.y = (selPoint.y - viewport.y) / scaleY;
selPrePoint.x = (selPrePoint.x - viewport.x) / scaleX;
selPrePoint.y = (selPrePoint.y - viewport.y) / scaleY;
}
};

4楼是正确的解决方案,已验证过。

不过有些变量写错了, 完整的代码可参考 微信小游戏问题解决方案

mark下

您好。我将此段代码加在子域的onload方法中会报 can not read x of undifined [cocos creator 1.93]

根本说不到点子上,官方自己出的案例,规避了大部分的实际问题,根本毫无用处,

没用你要出一个那样的开放数据域案例干嘛呢,