当前位置:网站首页>微信小程序启动优化
微信小程序启动优化
2022-07-31 05:15:00 【xuyid】
1.关闭允许分离引擎
2.CocosDashboard_1.0.7\resources\.editors\Creator\2.4.3\resources\builtin\adapters\platforms\wechat\wrapper\builtin\Canvas.js
在Canvas.js
// 修改后
let first = true
export default function Canvas() {
const canvas = first ? wx.__first__canvas ? wx.__first__canvas : wx.createCanvas() : wx.createCanvas()
first = false
3.webgl_first_render.js网上下载
4.game.js文件添加
"use strict";
const { drawImg } = require('./webgl_first_render.js');
const data = wx.getSystemInfoSync();
wx.__first__canvas = data.platform != "devtools" ? wx.createCanvas() : null;
function render() {
if (data.platform != "devtools") {
if (wx.FIRSTRENDER) {
drawImg('bg.jpg', gl);
console.log("---------------------------render-------------------------")
requestAnimationFrame(render);
}else{
GameGlobal.dycc= null;
}
}
}
wx.FIRSTRENDER = true;
GameGlobal.dycc = wx.__first__canvas; //获取绘制二维上下文
var gl = data.platform != "devtools" ? GameGlobal.dycc.getContext("webgl") : null;
requestAnimationFrame(render);
require('adapter-min.js');
__globalAdapter.init();
require('cocos/cocos2d-js-min.js');
__globalAdapter.adaptEngine();
require('./ccRequire');
require('./src/settings'); // Introduce Cocos Service here
require('./main'); // TODO: move to common
// Adjust devicePixelRatio
cc.view._maxPixelRatio = 4;
if (cc.sys.platform !== cc.sys.WECHAT_GAME_SUB) {
// Release Image objects after uploaded gl texture
cc.macro.CLEANUP_IMAGE_CACHE = true;
}
window.boot();
5.main.js在加载完成后添加wx.FIRSTRENDER = false;
cc.director.loadScene(launchScene, null, function () {
console.log('Success to load scene: ' + launchScene);
wx.FIRSTRENDER = false;
});
边栏推荐
猜你喜欢

【云原生】SQL(及存储过程)跑得太慢怎么办?

npm WARN config global `--global`, `--local` are deprecated. Use `--location solution

On the side of Ali, tell me what are the application scenarios of message middleware you know?

继承、Super,重写、抽象类、抽象方法 1(第七天)

js中的对象与函数的理解

【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】

MySQL压缩包方式安装,傻瓜式教学

阿里云中mysql数据库被攻击了,最终数据找回来了

MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案

工件SSMwar exploded 部署工件时出错。请参阅服务器日志了解详细信息
随机推荐
MySQL高级学习笔记
通信原理——纠错编码 | 汉明码(海明码)手算详解
C language tutorial (1) - preparation
Redis:简单实用
什么是 GameFi?
quick-3.6源码修改纪录
Digital twins will be an important way to enter the "metaverse"
mac10.14中安装mysqldb
Linux modify MySQL database password
【JVM加载】---类加载机制
动态规划(一)| 斐波那契数列和归递
[Elastic-Job source code analysis] - job listener
cocos2d-x 实现跨平台的目录遍历
win11中利用IIS10搭建asp网站
GUCCI, LV and other luxury giant universe how to layout yuan, other brands should keep up with?
sqlmap注入教程 常用指令
NFT与数字藏品到底有何区别?
npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
使用ps | egrep时过滤排除掉egrep自身
Object,多态 1(第八天)