- 安卓延迟加载超过17ms后之前canvas绘制的会失效或者变黑
1、context绘制界面 2、drawRankView这个是延迟17ms后再绘制其他图文 var that = this setTimeout(function () { that.drawRankView() console.log('加载了') }, 17)[图片] 这样在安卓手机上是没问题的,但是如果延迟超过17ms后就会出现问题。如下: var that = this setTimeout(function () { that.drawRankView() console.log('加载了') }, 18)[图片] 希望官方回复下这什么情况??? 本来打算好好研究小游戏的,一大堆坑啊。发现了给你们提出来了也都没有回复,到底搞不搞小游戏了啊
2018-07-09 - 提个bug:安卓和苹果手机同样修改image.src,但是结果不一致
苹果: const image = wx.createImage(); image.src = 'aaaaa' image.src = 'bbbbbb' 打印:console.log(image) 输出结果:'aaaaa' 安卓: const image = wx.createImage(); image.src = 'aaaaa' image.src = 'bbbbbb' 打印:console.log(image) 输出结果:'bbbbbb' 模拟器: const image = wx.createImage(); image.src = 'aaaaa' image.src = 'bbbbbb' 打印:console.log(image) 输出结果:'http://127.0.0.1:53182/game/bbbb' 这是什么情况?这bug够逆天的,以什么为准?
2018-07-02 - 安卓手机fps对比苹果fps,性能问题
一个简单的页面苹果的fps一直固定时60不变,为什么在安卓手机上fps一直在40+~50+之间跳动??? 然后小游戏在苹果手机上运行很流畅,到了安卓手机上就变的卡顿,这是要怎么兼容安卓吗??? 有没官方或者大神指导下着什么情况,怎么处理?在线等。。。 这是苹果手机截图 [图片] 下面三张是安卓手机截图 [图片][图片][图片]
2018-06-22 - 安卓运行小游戏很卡是什么情况?
微信小游戏: draw(x,y)是绘制移动,我现在需求是一直移动一块canvas 但是在苹果手机上就很流畅,到了安卓手机上就很卡了,这是什么情况?安卓是要做什么兼容吗? [代码]import PictureManager from [代码][代码]"../player/PictureManager"[代码][代码];[代码] [代码]import Base from [代码][代码]"../base/Base"[代码][代码]; [代码] [代码]export [代码][代码]default[代码] [代码]class ScreenView extends Base { [代码] [代码] constructor(x = 0, y = 0, width = GameGlobal.WIDTH, height = GameGlobal.HEIGHT) { [代码] [代码] [代码][代码]super[代码][代码]() [代码] [代码] [代码][代码]this[代码][代码].showPicNum = 1 [代码][代码] [代码] [代码] this.oringX = x [代码] this.oringY = y this.width = width this.autoWidth = GameGlobal.WIDTH - this.autoX(2 * this.oringX) this.height = this.autoWidth + this.autoY(50) this.pictures = GameGlobal.showUserList //获取照片数 //一直createCanvas会在安卓上导致崩溃 this.screenCanvas = wx.createCanvas() this.screenCanvas.width = GameGlobal.WIDTH this.screenCanvas.height = GameGlobal.HEIGHT this.pageCtx = this.screenCanvas.getContext('2d') GameGlobal.currentCanvas = this.screenCanvas GameGlobal.currentCtx = this.pageCtx //先预加载首张照片,不然会导致图片读取不及时显示空白 let curUser = this.pictures[0] this.getImgBase64(curUser.photo, (dataURL) => { this.draw(x, y) }) } draw(x, y) { this.pageCtx.clearRect(0, 0, GameGlobal.WIDTH, GameGlobal.HEIGHT); //当超出屏幕后重置原点、更新数据 if (x > GameGlobal.W || x + this.width < 0) { //当前照片 let curUser = this.pictures[0] let likeCode = x > GameGlobal.W ? 1 : 0 //左右滑喜好请求接口 GameGlobal.netTool.likeRequest(curUser.id, likeCode, () => {}) x = this.oringX y = this.oringY this.pictures.shift() //当照片数只剩指定展示数时,请求接口获取后续展示照片 if (this.pictures.length == this.showPicNum) { GameGlobal.netTool.getShowUserInfoRequest((userRes) => { this.pictures = this.pictures.concat(GameGlobal.showUserList) console.log('追加后的数组数' + this.pictures.length) }) } } for (let i = this.showPicNum - 1; i >= 0; i--) { let setX = i == 0 ? x : this.oringX + 5 * i let setY = i == 0 ? y : this.oringY + 5 * i let space = i == 0 ? 0 : this.autoX(2 * 5 * i) this.picManager = new PictureManager(this.pictures[i], this.autoX(setX), this.autoY(setY), this.autoWidth - space, this.autoWidth) } GameGlobal.dataStore.ctx.drawImage(this.screenCanvas, 0, 0) } }
2018-06-14