Jump to content
  • Advertisement
Sign in to follow this  
Jim_U

Delphi DirectX: how to load files to DXImageList???

This topic is 4079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiya Folks, Quick question for you... I have a string array holding the names of many Bmps/Jpegs. I want the user to be able to select which files they want loaded into a DXImageList (I'll just use a simple checkbox group for the selection). Can you tell me how to load/add these files to the DXImageList at runtime please? Much thanks, Jim [Edited by - Jim_U on May 22, 2007 10:00:21 AM]

Share this post


Link to post
Share on other sites
Advertisement

Ok, so not the quickest question after all!..but I still can't find a way to do this. The program works great if I load files into the imagelist before running it, so it's REALLY bugging me now! Please help!

Jim

Share this post


Link to post
Share on other sites
From here: http://members.fortunecity.com/flegelsite/

2.1   Loading pictures at runtime



// Load a normal raster-image into DXImageList (BMP, DIB etc.)

// Picture becomes an item of DXImageList

procedure LoadImage (Filename, NameImage : String; PatWidth, PatHeight : Integer;

Transp : Boolean; TranspColor : TColor);

begin

DXImageList.Items.Add;

with DXImageList.Items[DXImageList.Items.Count-1] do

begin

Picture.LoadFromFile (FileName);

Name := NameImage;

PatternWidth := PatWidth;

PatternHeight := PatHeight;

SkipHeight := 0;

SkipWidth := 0;

SystemMemory := False;

Transparent := Transp;

TransparentColor := TranspColor;

Restore;

end;

end;



With this method, I can load about 200 pictures at a time with no problems. More pictures give problems, just because of the limits of my

physical memory J. Loading jpeg-pictures however, always give problems! Only BMP and DIB pictures work well.


That Restore might be the most important.

Unfortunately, it's been years since I've encountered Delphi, so I can't test it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!