mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
fix some bugs to run on native
This commit is contained in:
+3
-3
@@ -59,19 +59,19 @@ gulp.task('build-html5', ['build-html5-preview', 'build-html5-dev', 'build-html5
|
||||
|
||||
gulp.task('build-jsb-dev', function (done) {
|
||||
Engine.buildJsb([
|
||||
'./index.js',
|
||||
'./jsb/index.js',
|
||||
], './bin/jsb_polyfill.dev.js', [], done);
|
||||
});
|
||||
|
||||
gulp.task('build-jsb-min', function (done) {
|
||||
Engine.buildJsbMin([
|
||||
'./index.js',
|
||||
'./jsb/index.js',
|
||||
], './bin/jsb_polyfill.js', [], done);
|
||||
});
|
||||
|
||||
gulp.task('build-jsb-preview', function (done) {
|
||||
Engine.buildJsbPreview([
|
||||
'./index.js',
|
||||
'./jsb/index.js',
|
||||
], './bin/jsb_polyfill-for-preview.js', [], done);
|
||||
});
|
||||
|
||||
|
||||
+23
-8
@@ -62,21 +62,36 @@ cc.defineGetterSetter(_p, "count", _p.getCount);
|
||||
gfx.VertexFormat = VertexFormat;
|
||||
Object.assign(gfx, enums);
|
||||
|
||||
function convertImages(images) {
|
||||
if (images) {
|
||||
for (let i = 0, len = images.length; i < len; ++i) {
|
||||
let image = images[i];
|
||||
if (image !== null) {
|
||||
if (image instanceof window.HTMLCanvasElement) {
|
||||
if (image._data) {
|
||||
images[i] = image._data._data;
|
||||
}
|
||||
else {
|
||||
images[i] = null;
|
||||
}
|
||||
}
|
||||
else if (image instanceof window.HTMLImageElement) {
|
||||
images[i] = image._data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_p = gfx.Texture2D.prototype;
|
||||
_p._ctor = function(device, options) {
|
||||
convertImages(options.images);
|
||||
this.init(device, options);
|
||||
};
|
||||
_p.destroy = function() {
|
||||
};
|
||||
_p.update = function(options) {
|
||||
if (options.images) {
|
||||
for (let i = 0, len = options.images.length; i < len; ++i) {
|
||||
let image = options.images[i];
|
||||
if (image != null && image._data) {
|
||||
options.images[i] = image._data;
|
||||
}
|
||||
}
|
||||
}
|
||||
convertImages(options.images);
|
||||
this.updateBinding(options);
|
||||
};
|
||||
cc.defineGetterSetter(_p, "_width", _p.getWidth);
|
||||
|
||||
@@ -59,7 +59,7 @@ class VertexFormat {
|
||||
normalize: (info.normalize === undefined) ? false : info.normalize,
|
||||
bytes: info.num * attrTypeBytes(info.type),
|
||||
};
|
||||
log('info.num is:' + info.num + ' attrTypeBytes(info.type) is:' + attrTypeBytes(info.type));
|
||||
// log('info.num is:' + info.num + ' attrTypeBytes(info.type) is:' + attrTypeBytes(info.type));
|
||||
|
||||
this._attr2el[el.name] = el;
|
||||
this._elements.push(el);
|
||||
|
||||
Reference in New Issue
Block a user