PDA

View Full Version : One big image instead images list?



fabianokm
15-08-2003, 03:19 PM
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

Traveler
15-08-2003, 04:09 PM
Drawing only a portion from an image can be done like this:

DXDraw1.surface.Draw(10,10,rect(10,10,50,50),yourS urface,false);

I've tried using large (800x600) images in the past as well. However, when using them in combination with a DXImagelist, it made my game go much much slower. So, the only way it works is when you don't use the DXimagelist, and load the images during runtime.

Useless Hacker
15-08-2003, 10:35 PM
As I said on GameDev, if your sprites are all the same size, you can use the PatternWidth and PatternHeight properties and use the PatternIndex parameter of the ImageListItem's draw function.

fabianokm
16-08-2003, 10:14 PM
Thanks for the suggestions, both of them were really useful. :D

Sofus
21-08-2003, 04:42 PM
How do you load a large image during runtime. :?

BigKnockers
21-08-2003, 09:03 PM
var
BigImage: TDirectDrawSurface;
begin
BigImage := TDirectDrawSurface.Create(Form1.DXDraw1.DDraw);
BigImage.LoadFromFile('C:\BigImage.bmp');
end;


That should do the trick,

fabianokm
21-08-2003, 10:55 PM
For some unknow and strange reason, when I use images larger than 3000 pixels, the Draw procedure only draws noise. So I split my image into 3 smaller images and created 3 surfaces. It's still much much faster than using the images list (I can see that difference in DXTimer1.FrameRate). :)

Avatar
22-08-2003, 12:31 AM
I guess you graphic card support textures up to 1024x1024 ... But more than 3000 px is really huge ...