Hi there people!
I just found a problem with the latest core updates.
The Bitmap Load Listeners are not working sometimes. Although most of the time this problem happens when the dev tools are open, it also happened when it was not opened, less frequently though.
To reproduce the bug:
Where do I think the problem lies:
Before 1.5.0, the code inside the comments does not exist. Making the _image always has the _onLoad method attached to it:
But now, if the image is not encrypted and the image width is higher than 0, the onLoad will not fire as it should be.
But it will try to fire via the Bitmap instance (
But thinking only from the perspective of the problem related to the Dev Tools, I believe that the changes on the Scene Manager could maybe have some impact?
Before 1.5.0
On 1.5.0
My file is only 2,77 MB, but it is saying that is too large to upload. So here is a One Drive link:
I just found a problem with the latest core updates.
The Bitmap Load Listeners are not working sometimes. Although most of the time this problem happens when the dev tools are open, it also happened when it was not opened, less frequently though.
To reproduce the bug:
- Hit Playtest on the project sent here(or anyone without any plugins).
- Start a new game.
- On the map scene, open dev tools with F12.
- With the dev tools on focus, press F5 to restart the playtest.
- Click on the game screen again to restore focus.
- Start the new game again on the title screen.
- You will notice sometimes the character sprites and even the Menu Button is not showing on the map scene.
- But if you enter the menu and leave, they will appear.
Where do I think the problem lies:
JavaScript:
Bitmap.prototype._startLoading = function() {
this._image = new Image();
this._image.onload = this._onLoad.bind(this);
this._image.onerror = this._onError.bind(this);
this._destroyCanvas();
this._loadingState = "loading";
if (Utils.hasEncryptedImages()) {
this._startDecrypting();
} else {
this._image.src = this._url;
// BETWEEN THESE COMMENTS
if (this._image.width > 0) {
this._image.onload = null;
this._onLoad();
}
// BETWEEN THESE COMMENTS
}
};
Bitmap.prototype._onLoad = function() {
if (Utils.hasEncryptedImages()) {
URL.revokeObjectURL(this._image.src);
}
this._loadingState = "loaded";
this._createBaseTexture(this._image);
this._callLoadListeners();
};
Bitmap.prototype._callLoadListeners = function() {
while (this._loadListeners.length > 0) {
const listener = this._loadListeners.shift();
listener(this);
}
};
Before 1.5.0, the code inside the comments does not exist. Making the _image always has the _onLoad method attached to it:
this._image.onload = this._onLoad.bind(this);But now, if the image is not encrypted and the image width is higher than 0, the onLoad will not fire as it should be.
But it will try to fire via the Bitmap instance (
this._onLoad()) but not attached to the_image.onload method.But thinking only from the perspective of the problem related to the Dev Tools, I believe that the changes on the Scene Manager could maybe have some impact?
Before 1.5.0
JavaScript:
SceneManager.terminate = function() {
window.close();
};
On 1.5.0
JavaScript:
SceneManager.terminate = function() {
if (Utils.isNwjs()) {
nw.App.quit();
}
};
My file is only 2,77 MB, but it is saying that is too large to upload. So here is a One Drive link:
Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.
Store photos and docs online. Access them from any PC, Mac or phone. Create and work together on Word, Excel or PowerPoint documents.
1drv.ms