当前位置:网站首页>微信小程序启动优化
微信小程序启动优化
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;
});
边栏推荐
- mysql启动报错The server quit without updating PID file几种解决办法
- "limit" query in Oracle database
- GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
- [Elastic-Job] Overview of Distributed Scheduling Tasks
- MySQL compressed package installation, fool teaching
- For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
- sqlmap注入教程 常用指令
- 5 methods of MySQL paging query
- 【云原生】开源数据分析 SPL 轻松应对 T+0
- [Elastic-Job source code analysis] - job listener
猜你喜欢
Eternal blue bug reappears
MySQL-如何分库分表?一看就懂
利用phpstudy搭建DVWA
(Crypto essential dry goods) Detailed analysis of the current NFT trading markets
The feign call fails, JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
碎片化NFT(Fractional NFT)
On the side of Ali, tell me what are the application scenarios of message middleware you know?
Common JVM interview questions and answers
DeFi Token in the project management
Memcached :安装
随机推荐
How to distinguish big and small endian in C language
sql 添加 default 约束
Xiaobai learns reptiles - introduction to reptiles
5 methods of MySQL paging query
GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
[Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version
2021面经-拥抱变化
DeFi 项目中的治理Token
Object,多态 1(第八天)
powershell统计文件夹大小
Common JVM interview questions and answers
mysql启动报错The server quit without updating PID file几种解决办法
sqlmap注入教程 常用指令
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
C language tutorial (2) - printf and data types that come with c
代码执行漏洞
正则表达式基础知识
cocos create EditBox 输入文字被刘海屏遮挡修改
js中的函数
对于输出点是时间戳的渗透测试方法(以Oracle数据库为例)