当前位置:网站首页>微信小程序启动优化
微信小程序启动优化
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;
});
边栏推荐
- Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?
- [Cloud native] Open source data analysis SPL easily copes with T+0
- Gradle sync failed: Uninitialized object exists on backward branch 142
- MySQL compressed package installation, fool teaching
- 局部变量成员变量、引用类型、this,static(第五天)
- 【云原生】开源数据分析 SPL 轻松应对 T+0
- 永恒之蓝漏洞复现
- 代码执行漏洞
- npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
- 代码块、Package,Import,封装(第六天)
猜你喜欢
Year-end summary - the years are quiet~
一文速学-玩转MySQL获取时间、格式转换各类操作方法详解
NFTs: The Heart of Digital Ownership
Error: Cannot find module ‘D:\Application\nodejs\node_modules\npm\bin\npm-cli.js‘
MySQL高级SQL语句(二)
DeFi Token in the project management
GUCCI, LV and other luxury giant universe how to layout yuan, other brands should keep up with?
Memcached :安装
flutter 混合开发 module 依赖
数字孪生将成为进入“元宇宙”一项重要的途径
随机推荐
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
MySQL高级语句(一)
MySQL高级学习笔记
Eternal blue bug reappears
Using IIS10 to build an asp website in win11
sql 添加 default 约束
MySQL面试题大全(陆续更新)
代码执行漏洞
configure:error no SDL library found
js中的函数
cocos2d-x-3.2 Physics
数字取证autopsy工具用法
SQL注入中数据库的判断
Several solutions for mysql startup error The server quit without updating PID file
[Cloud Native] What should I do if SQL (and stored procedures) run too slowly?
场效应管 | N-mos内部结构详解
Oracle数据库中的“limit”查询
mac10.14中安装mysqldb
js中的break与continue退出
2021美赛C题M奖思路