• ### Announcements

#### Archived

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

# One big image instead images list (DelphiX)?

## Recommended Posts

Is it absolutely necessary to use a list of images to draw sprites with DelphiX? I''m building a game, but it uses a lot (and that''s really a lot) of images, and it won''t work on old Windows (because of that GDI limitation). What I have on my mind: instead of having a lot of sepparate images for every sprite, I have one big BMP file with all the sprites drawn on it. The problem is how to draw only a specific region of that big BMP file to the screen. I tried doing that pixel by pixel, but it''s just too slow. Any ideas? Regards Fabiano ============================= Fabiano Koich Miguel fabianokm@hotmail.com http://www.teenook.hpg.com.br =============================

##### Share on other sites
If all your sprites are the same size, you can place them all in the same image, and set the PatternWidth and PatternHeight properties of the imagelist item to the width and height of the sprites.
Then when you wish to draw a sprite, use the PatternIndex parameter of the draw procedure to specify which one to draw. The sprites are numbered from 0 in the top left, then along each row:
+--+--+--+--+|0 |1 |2 |3 |+--+--+--+--+|4 |5 |6 |7 |+--+--+--+--+|8 |9 |10|11|+--+--+--+--+

If your sprites are different sizes, see here

[edited by - Useless Hacker on August 15, 2003 6:40:35 PM]