Let's see if I understand what you want to do here, you have a bitmap with a lot of sprites on it and you want to copy one sprite of that bitmap to a DirectDrawSurface... If you use DelphiX and instead of a TBitmap use a TDirectDrawSurface (works the same, just easier to work with) then you can use:

DXDraw1.Surface.Draw(X : Integer; Y : Integer; SrcRect : TRect; Source : TDirectDrawSurface; [Transparent : boolean = True])

An example of this method would be, let's say our first sprite is in the top left corner and is 64 px width and 64 px heigh and we draw it at position (20, 25):

DXDraw1.Surface.Draw(20, 25, RECT(0, 0, 64, 64), SpriteSheet, True);

if your sprites all have the same size, then the second sprite would be found at:
DXDraw1.Surface.Draw(20, 25, RECT(64, 0, 2 * 64, 64), SpriteSheet, True);

Remember however that there are 2 Surface.Draw functions, one has the ability to work with Rectangles and the other has not!

For more information on how to work with TDirectDrawSurface objects and how to draw with the TDXDraw object have a look at my tutorial at: http://members.lycos.co.uk/lionprod/...dxdrawtut.html


PS. I moved this topic to the DelphiX forum, since it's a specific DelphiX question!


NOTE. I made a mistake in the calculation. If you have the tiled bitmaps standing next to eachother the previous calculation won't work, therefor I have changed the calculation in this message...