wawa
Junior Member
Posts: 24
|
Post by wawa on Aug 22, 2020 8:32:28 GMT -8
It seems there's a problem of memory handle if you try to load assets then jpg or vis-versa. Somebody already tried?
For example, I load assets with 2 images using handles 0 and 1, then I load 3 images to handles 2,3 and 4. This doesnt work, the assets are lost...
|
|
|
Post by jamesbowman on Aug 22, 2020 8:55:31 GMT -8
When mixing fixed-asset loading with JPG/PNG loading, you have to be careful not to clobber the memory. Here's how it works.
The gd3-asset tool locates assets starting at location 0. It sets the constant ASSETS_END to the first unused RAM location. So you can load an image at that point like this:
LOAD_ASSETS(); GD.BitmapHandle(2); cmd_loadimage(ASSETS_END, 0); GD.load("healsky3.jpg");
This loads "healsky3.jpg" into memory starting at ASSETS_END, and you can draw it using bitmap handle 2.
For the next bitmap, use the load address "-1". This tells the hardware to append the image after "healsky3.jpg":
GD.BitmapHandle(3); cmd_loadimage(-1, 0); GD.load("tree.jpg");
And so on.
Of course there is a limit on number bitmap handles (16) or video RAM (1 Mbyte).
|
|
wawa
Junior Member
Posts: 24
|
Post by wawa on Aug 23, 2020 4:02:10 GMT -8
Good idea to have integrated this constant! It works perfectly
|
|