Loading Image from CastleDB


#1

I started using Heaps and CastleDB. It’s so great so far!

Now I try to load an Image from CastleDB. I know it’s saved in the data.img but how can I load it in Heaps as Bitmap?

Any tips?

Thanks for your help! :slight_smile:


#2

“Image” is deprecated, instead use File or Tile to reference a full image or some part of it


#3

thx @ncannasse. My question was maybe a little missunderstandable.

I make a small spacegame with a lot of ships. For the attributes of the ship i use castledb.
I added a new column in castledb with the image of the spaceship.
Now I have a data.cdb and a data.img file.
In the data.cdb is only a MD5 key and the data is in the data.img file.
so far so clear… but i have no idea how to load this image of the spaceship from the data.img file within heaps. Is there any possibillity? Through hxd.Res I can only load the data.cdb file. I could rename the data.img file but i have still no idea how to load the image from the data.img file using the md5 Key from the .cdb-File.

Is it possible? Am I overseeing something?
I hope it is now understandable what I am trying to do. :slight_smile:


#4

@gamedevbynight yes I understood correctly. But it’s not very practical to use “Image” for that, so it’s been deprecated. As I said you can use a column type of “File” and it will reference the relative path to the “res” directory, so you can use hxd.Res.load(mycdbobj.file).toTile() to load it.


#5

ohh sorry I missunderstood you. I thought you mean i should use File and Tile in heaps and was confused! :smiley:
so sorry and thanks for your help.