PDA

View Full Version : using bmp from file for a sprite-image...



andyr74
02-01-2003, 12:29 PM
I recently tried delphyX. Everything i tried worked well except for a sprite with a large image. I made a gif-file with xara3D and i want to use this for an animation of a sprite. I converted it to bmp with all the frames one after the other. The bmp was a bit over 2MB. I couldn't load it in an imagelist, probably because the file was to big. Is it possible to load this file in runtime. Or to change an image in an imagelist with a bmp-file in runtime. So i could put all the images in files (and the exe file would also be smaller).

TheLion
02-01-2003, 01:19 PM
It's possible and I did it a while ago, I'll search through my archive........................................... .............................
10 minutes later.... Okay found it ! :)


With TPictureCollectionItem(DXImageList1.Items.Add()) do
Begin
Picture.LoadFromFile('image.bmp');
Name := 'MyImage';
End;

DXImageList1.Items.Restore; // Don't ask me why this is needed, but it is! :)


I tested it and it works, however I wouldn't advise this, I wrote a tutorial on my website that works with the DXDraw object, but doesn't use the DXImageList. I made a program once that uses a tiled bitmap of over 5 MB and there isn't even a slowdown noticeable, but I'm familiar with the problem that Delphi crashes (or runs very very slow) when you use big bitmaps in the DXImageList! :)

Hope this helps!