mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
0a836ac458
* optimize sys info init in adapters update * update sys init update sys * fix sys access * optimize isWebIOS14OrIPadOS14Env * update * update * update QTT adapter * update sys.capacities update sys * update common && qtt * add downloadFile to job module * update engine-adapter * update DeviceMotionEvent adaption * remove legacy qtt * add link-sure adaption * fix some bug * update vivo adaption && fs-utils * remove legacy link-sure * remove dom-adapter * remove HTMLCanvas appended to document * update vivo * support COCOS_PLAY * update adapters to platforms * remove test code * add OPPO adapter * add huawei adapter * remove test code * rename folder oppo-mini-game * rename folder huawei-quick-game * rename folder vivo-mini-game
29 lines
688 B
JavaScript
29 lines
688 B
JavaScript
import style from './render/style'
|
|
import template from './render/template'
|
|
import Layout from './engine'
|
|
|
|
let __env = GameGlobal.wx || GameGlobal.tt || GameGlobal.swan;
|
|
let sharedCanvas = __env.getSharedCanvas();
|
|
let sharedContext = sharedCanvas.getContext('2d');
|
|
function draw() {
|
|
Layout.clear();
|
|
Layout.init(template, style);
|
|
Layout.layout(sharedContext);
|
|
}
|
|
|
|
function updateViewPort(data) {
|
|
Layout.updateViewPort({
|
|
x: data.x,
|
|
y: data.y,
|
|
width: data.width,
|
|
height: data.height,
|
|
});
|
|
}
|
|
|
|
__env.onMessage(data => {
|
|
if ( data.type === 'engine' && data.event === 'viewport' ) {
|
|
updateViewPort(data);
|
|
draw();
|
|
}
|
|
});
|