mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-10 03:25:23 +00:00
[adapters] 增加小游戏适配部分源码
This commit is contained in:
24
adapters/platforms/baidu/wrapper/engine/Texture2D.js
Normal file
24
adapters/platforms/baidu/wrapper/engine/Texture2D.js
Normal file
@@ -0,0 +1,24 @@
|
||||
if (cc.Texture2D) {
|
||||
cc.Texture2D.prototype._checkPackable = function () {
|
||||
let dynamicAtlas = cc.dynamicAtlasManager;
|
||||
if (!dynamicAtlas) return;
|
||||
|
||||
if (this._isCompressed()) {
|
||||
this._packable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
let w = this.width, h = this.height;
|
||||
if (!this._image ||
|
||||
w > dynamicAtlas.maxFrameSize || h > dynamicAtlas.maxFrameSize ||
|
||||
this._getHash() !== dynamicAtlas.Atlas.DEFAULT_HASH) {
|
||||
this._packable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// HACK: Can't tell if it's a Canvas or an Image by instanceof on Baidu.
|
||||
if (this._image && this._image.getContext) {
|
||||
this._packable = true;
|
||||
}
|
||||
};
|
||||
}
|
1
adapters/platforms/baidu/wrapper/engine/index.js
Normal file
1
adapters/platforms/baidu/wrapper/engine/index.js
Normal file
@@ -0,0 +1 @@
|
||||
require('./Texture2D');
|
Reference in New Issue
Block a user