Hi there,

i am taking my first steps into game programming and have chosen unDelphiX for my first attempts.

For now, my program only draws tiles from a DXImageList on the DXDraw1.Surface. My approach might not be the most ellegant one, but i am still learning, so here is my problem:


[pascal]
TileImageList.Items[i].Draw(DXDraw.Surface, XCoord, YCoord, 0);

DXDraw.Flip;
[/pascal]

Well, this way everything went fine. The program draws the playfield just as i want it to do.
Now I want to add a user interface as well but instead of rewriting the whole playfield-function and fiddling around with all those relative coordinates to place my tiles it would be much better to draw the tiles on another surface and than place the surface on the right position. This way I could use an absolut coordinate system for the playfield.

So this is how i tried to do the whole thing:
[pascal]
var
MapSurface : TDirectDrawSurface;

procedure TfrmTest.DXDrawInitialize(Sender: TObject);
begin
MapSurface := TDirectDrawSurface.Create(DXDraw.DDraw);
end;

procedure DrawPlayfield;
begin
TileImageList.Items[i].Draw(MapSurface, XCoord, YCoord, 0);

DXDraw.Surface.Draw(0,0, MapSurface, false);
end;

procedure DXTimer...
begin
DrawPlayfield;
DXDraw.Flip;
end;
[/pascal]

Unfortunaley this didn't work. I tried both Draw routines with the same result.
I also replaced the
TileImageList.Items[i].Draw(MapSurface, XCoord, YCoord, 0);
with
Mapsurface.Loadfromgraphic(TileImageList.Item..... .picture.graphic)
and it drew a lonley tile onto my screen, so i think the problem has something to do with the way I draw on my new surface.

I hope someone can help me with this.
thanks in advance
IaxFenris