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

元宇宙的前景及四大赛道

自定dialog 布局没有居中解决方案

For penetration testing methods where the output point is a timestamp (take Oracle database as an example)

一文速学-玩转MySQL获取时间、格式转换各类操作方法详解

Artifact SSMwar exploded Error deploying artifact.See server log for details

NFT:数字所有权的核心

How MySQL - depots table?A look at will understand
![[uiautomation] Get WeChat friend list (stored in txt)](/img/26/1f3424c5998c52c6e10ced8529012a.png)
[uiautomation] Get WeChat friend list (stored in txt)
![[Cloud native] Open source data analysis SPL easily copes with T+0](/img/89/4a96358956782ef9dacf0b700b54c3.png)
[Cloud native] Open source data analysis SPL easily copes with T+0

GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
随机推荐
[Ubuntu20.04 installs MySQL and MySQL-workbench visualization tool]
腾讯云轻量服务器删除所有防火墙规则
MySQL分页查询的5种方法
小米手机短信定位服务激活失败
Error: Cannot find module ‘D:\Application\nodejs\node_modules\npm\bin\npm-cli.js‘
Eternal blue bug reappears
SQLite 查询表中每天插入的数量
sqlite 查看表结构 android.database.sqlite.SQLiteException: table splitTable has no column named
Artifact SSMwar exploded Error deploying artifact.See server log for details
win11中利用IIS10搭建asp网站
DeFi Token in the project management
mysql password modification method in Linux (pro-test available)
[JVM Loading]---Class Loading Mechanism
Markdown 帮助文档
带你搞懂MySQL隔离级别,两个事务同时操作同一行数据会怎样?
Year-end summary - the years are quiet~
数字孪生将成为进入“元宇宙”一项重要的途径
Oracle数据库中的“limit”查询
Build vulhub vulnerability shooting range on kali
Access数据库的查询