当前位置:网站首页>微信小程序启动优化
微信小程序启动优化
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;
});
边栏推荐
- Linux修改MySQL数据库密码
- 代码块、Package,Import,封装(第六天)
- npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
- PHP中abstract(抽象)、final(最终)和static(静态)原理与用法
- quick lua加密
- Understanding SSRF, this article is enough
- 【云原生】SQL(及存储过程)跑得太慢怎么办?
- 【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了
- How MySQL - depots table?A look at will understand
- MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
猜你喜欢

【swagger关闭】生产环境关闭swagger方法

【Elastic-Job源码分析】——作业监听器

win11中利用IIS10搭建asp网站

mysql password modification method in Linux (pro-test available)

flutter arr 依赖
![[Cloud Native] What should I do if SQL (and stored procedures) run too slowly?](/img/40/be3a30743ee2bc6c82f82ab852f29c.png)
[Cloud Native] What should I do if SQL (and stored procedures) run too slowly?

What is an EVM Compatible Chain?

阿里一面,说说你知道消息中间件的应用场景有哪些?

通信原理——纠错编码 | 汉明码(海明码)手算详解

Linux中mysql密码修改方法(亲测可用)
随机推荐
Access数据库的查询
Several solutions for mysql startup error The server quit without updating PID file
kotlin 插件更新到1.3.21
MySQL压缩包方式安装,傻瓜式教学
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
Regular Expression Basics
【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
Common JVM interview questions and answers
MySQL高级语句(一)
年终总结——岁月静好~
工件SSMwar exploded 部署工件时出错。请参阅服务器日志了解详细信息
动态规划(一)| 斐波那契数列和归递
flutter 混合开发 module 依赖
对js的数组的理解
小米手机短信定位服务激活失败
configure:error no SDL library found
MySQL分页查询的5种方法
数字孪生将成为进入“元宇宙”一项重要的途径
数字取证autopsy工具用法
Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?