Hi, I just released my first plugin.
However I'm not certain that I'm handling the disposal of bitmaps correctly.
My plugin renders both images and text.
The text rendering works fine when I dispose of the bitmap with:
this.bitmap.destroy();
However for the image rendering, the command above alone causes images only to be displayed the first time.
I don't get errors, but the image never appears on the screen.
The main difference as far as I can see is that for the text render I'm creating a new bitmap:
this.bitmap = new Bitmap(Graphics.width, Graphics.height);
However for images its:
ImageManager.loadPicture(image_name).addLoadListener(
bmp => {
}
I've kind of got around this by doing the following:
this.bitmap = new Bitmap(1, 1);
SceneManager._scene.removeChild(this);
this.bitmap.destroy();
Which seems like a fudge, although from testing it does significantly reduce (or possibly remove) the memory leak that I was having when removing the destroy entirely.
It will likely be useful to have the plugin code to see why the destroy on it's own is causing problems for my images.
It's available here:
KOG_TextMage.js
For context, here is the post of what the plugin does:
Forum Post
Hopefully an expert here might have an idea, as currently I have no clue.
However I'm not certain that I'm handling the disposal of bitmaps correctly.
My plugin renders both images and text.
The text rendering works fine when I dispose of the bitmap with:
this.bitmap.destroy();
However for the image rendering, the command above alone causes images only to be displayed the first time.
I don't get errors, but the image never appears on the screen.
The main difference as far as I can see is that for the text render I'm creating a new bitmap:
this.bitmap = new Bitmap(Graphics.width, Graphics.height);
However for images its:
ImageManager.loadPicture(image_name).addLoadListener(
bmp => {
}
I've kind of got around this by doing the following:
this.bitmap = new Bitmap(1, 1);
SceneManager._scene.removeChild(this);
this.bitmap.destroy();
Which seems like a fudge, although from testing it does significantly reduce (or possibly remove) the memory leak that I was having when removing the destroy entirely.
It will likely be useful to have the plugin code to see why the destroy on it's own is causing problems for my images.
It's available here:
KOG_TextMage.js
For context, here is the post of what the plugin does:
Forum Post
Hopefully an expert here might have an idea, as currently I have no clue.