u0u0's Offical Site - creator
type: channel
link: http://www.tyrantek.com/tag/creator/
items: cocos creator wap模式下横竖屏动态适应
items: cocos creator 加载二进制

cocos creator wap模式下横竖屏动态适应
type: item
date: 2019-09-29T10:19:00+08:00
description: 动态修改场景的canvas属性设置，需要两套布局节点坐标信息 start() { this.updateCanvasSize(); cc.view.setResizeCallback(() => { this.updateCanvasSize(); }) }, // 自由切换横竖屏，动态设置设计分辨率和适配模式。 updateCanvasSize() { let size = cc.view.getFrameSize(); if (size.width > size.height) { this.canvas.fitWidth = false; this.canvas.fitHeight = true; this.canvas.designResolution = cc.size(1920, 1080); this.showLandscape(); } else { this.canvas.fitWidth = true; this.canvas.fitHeight = false; this.canvas.designResolution = cc.size(1080, 1920); this.showPortait(); } },

cocos creator 加载二进制
type: item
date: 2019-02-15T11:29:00+08:00
description: 注意微信上必须是bin后缀的，才能以二进制模式读取文件。微信返回的是 ArrayBuffer， chrome返回的是Uint8Array。var url = cc.url.raw("resources/bin/data.bin"); cc.loader.load({ url: url, type: "binary", }, function (err, data) { if (data instanceof ArrayBuffer){ data = new Uint8Array(data); } console.log("err ===", err); console.log("data ===", data.length); });