当前位置:网站首页>微信小程序启动优化
微信小程序启动优化
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;
});
边栏推荐
猜你喜欢

Yuan prospect and four track of the universe

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

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

Linux modify MySQL database password

js中的全局作用域与函数作用域
![[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?

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

Using IIS10 to build an asp website in win11

场效应管 | N-mos内部结构详解

通信原理——纠错编码 | 汉明码(海明码)手算详解
随机推荐
碎片化NFT(Fractional NFT)
sql 添加 default 约束
Gradle sync failed: Uninitialized object exists on backward branch 142
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
【Elastic-Job源码分析】——作业监听器
C language tutorial (1) - preparation
Redis:安装使用
cocoscreator3.5.2打包微信小游戏发布到QQ小游戏修改
使用ps | egrep时过滤排除掉egrep自身
kotlin 插件更新到1.3.21
How to distinguish big and small endian in C language
Xiaobai learns reptiles - introduction to reptiles
C语言 | 获取字符串里逗号间隔的内容
podspec自动化升级脚本
2021美赛C题M奖思路
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'
The latest MySql installation teaching, very detailed
腾讯云轻量服务器删除所有防火墙规则
About integrating superset into your own project
Understanding SSRF, this article is enough