Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Paul Wren

Modifying DXImageList at runtime...

This topic is 5851 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

Hi everyone. I am a bit of newbie with DelphiX. I have a scrolling tiled background using TBackground sprite which references a bitmap stored in a DXImageList component. My problem is this. I want to change the tiles graphics during the game (depending on game level etc) but I am having difficulty doing this. If I try something like.. (from memory here...) DXimagelist.items.find(''tiles'').picture.bitmap.canvas.pixels[5,5]:=cllime; for example, just placing a pixel somewhere, it doesn''t have any effect on the tiles. Sometimes the background sprite stops working completely and freezes. What am I doing wrong here? I''m assuming this has something to do with how DelphiX "creates" the dximagelist. Because if I modify the image before DXdraw starts then my modifications take effect. But how do I do it once the background is up and running? Thanks for any help in advance... Paul

Share this post


Link to post
Share on other sites
Advertisement
it doesn''t work because DelphiX creates a DirectDraw surface for every image in your imagelist. If you modify the picture, you don''t modify the surface but the surface is what is actually drawn.
There''s an example for dynamically created image lists that ships with DelphiX.
I think deleting the items in an image list and adding them again with new pictures does the job.

Share this post


Link to post
Share on other sites
In order to modify it at run time you'll need to access the image surface:


with DXImageList.Items.Find('tiles').PatternSurfaces[0].Canvas do
begin
Pixels[5,5]:=clLime;
Release;//You must include this at the end of your canvas manipulation
end;


EDIT: Of course if all you intend to do is load a totally new set of tiles then I suggest using the Delete and Add methods, or use the LoadFromFile along with ImageLIB to create a DXG ImageList file for each level.


[edited by - michalson on September 12, 2002 8:55:14 AM]

Share this post


Link to post
Share on other sites

  • 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!