Unloading an image created by Grid_DrawImage
Duodecimus
20 Oct 2015, 01:39Trying to make a Visual novel style character portrait, where the character's expression changes(loads a new image in the same location) as the conversation goes on.
How do I remove old images to free up memory/drawing space? The solution I'm currently using is to move the image to somewhere far away in the drawing area.
Also, how do I draw on different levels of the Z axis?
How do I remove old images to free up memory/drawing space? The solution I'm currently using is to move the image to somewhere far away in the drawing area.
Also, how do I draw on different levels of the Z axis?

jaynabonne
31 Oct 2015, 16:51Sometimes, answering a question requires taking a step back. You have two postings with questions related to the custom drawing area, and I'll try to answer them both. But the answers might be more broad-looking - as in, maybe you might not want to use the approach you're using.
First, if you just want to display an image that changes over time, you could use the "frame picture" APIs to set and clear the frame picture (it is typically associated with a room picture, but you should be able to set it yourself via script.) If you need more than that, read on...
One approach to customizing the grid APIs is to download the Quest source from github. There is a file in there called "grid.js" in PlayerController, and it houses the glue functions between the CoreGrid.aslx APIs and the paper.js library. You could create your own variants of the functions to do what you want, and if you name things the same in your own .js file (added to your game), you might be able to replace the built-in ones with your own. I did something similar long ago, except I made parallel APIs, and you can see the result here:
viewtopic.php?f=18&t=3886
A second approach (and the one I would probably recommend if you're not using the grid stuff as a grid per se, and also if you know something about HTML or can get your head around it, especially if you want to do fancy stuff) is to take over the custom drawing pane and then just put your own arbitrary HTML there. I have also done that in the past, with a project that never saw the light of day. There is a JS function called "setPanelContents", which draws on the game panel ("#gamePanel"). You could set that panel's HTML to be what you want, even a skeleton of div's (if this all makes sense - sorry if not), and then you can just update the div contents with whatever images or content you want, formatted with all the power of HTML.
It might not be the answers you were looking for, but if you go this route it might be easier for you in the long run.
Singly, with regards to the question of removing old images, I don't see a way to do that, but when you create an image, you give it an id. You might be able to set the image for that id to an empty image when you no longer wish to use it to make it disappear from view.
First, if you just want to display an image that changes over time, you could use the "frame picture" APIs to set and clear the frame picture (it is typically associated with a room picture, but you should be able to set it yourself via script.) If you need more than that, read on...
One approach to customizing the grid APIs is to download the Quest source from github. There is a file in there called "grid.js" in PlayerController, and it houses the glue functions between the CoreGrid.aslx APIs and the paper.js library. You could create your own variants of the functions to do what you want, and if you name things the same in your own .js file (added to your game), you might be able to replace the built-in ones with your own. I did something similar long ago, except I made parallel APIs, and you can see the result here:
viewtopic.php?f=18&t=3886
A second approach (and the one I would probably recommend if you're not using the grid stuff as a grid per se, and also if you know something about HTML or can get your head around it, especially if you want to do fancy stuff) is to take over the custom drawing pane and then just put your own arbitrary HTML there. I have also done that in the past, with a project that never saw the light of day. There is a JS function called "setPanelContents", which draws on the game panel ("#gamePanel"). You could set that panel's HTML to be what you want, even a skeleton of div's (if this all makes sense - sorry if not), and then you can just update the div contents with whatever images or content you want, formatted with all the power of HTML.
It might not be the answers you were looking for, but if you go this route it might be easier for you in the long run.
Singly, with regards to the question of removing old images, I don't see a way to do that, but when you create an image, you give it an id. You might be able to set the image for that id to an empty image when you no longer wish to use it to make it disappear from view.
Duodecimus
01 Nov 2015, 02:54Yeah I can see where you're coming from. In the long run I would absolutely just rewrite and/or replace the custom drawing layer you quest uses here.
Unfortunately, I'm using Quest for a class project and thus only have another month or so to work on it. I might come back to a more serious project later.
But fortunately(?) our artist hasn't done any work for a month and I can consider this feature scrapped, so I no longer need to care about this part. Yay?
Unfortunately, I'm using Quest for a class project and thus only have another month or so to work on it. I might come back to a more serious project later.
But fortunately(?) our artist hasn't done any work for a month and I can consider this feature scrapped, so I no longer need to care about this part. Yay?

jaynabonne
01 Nov 2015, 09:54Sometimes problems solve themselves... 
