Archived

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

beaner

My one-surface tile editor is killing me!

Recommended Posts

I have been working on a tile map editor that uses DirectDraw surfaces in a child window to show a map. At first, I had a LARGE offscreen surface that was the entire map... and to get the tiles to show up when I clicked my mouse, I had it changing the number in the array, going through the entire array to put tiles back on this surface, and then taking the rect of where the map view was and blitting that to the display surface. Needless to say, this made my program go SLOOOOOWWWWW!!! So, I changed it so that all it did was put the new tile on the surface, and re-blit the rect without having it redo the whole array... a little faster but still too slow... Now I got the bright idea to just use one surface, the display surface, and draw to it when I need to by taking the relative position in the array (upper-left) and putting only the tiles that should be within view. This would make my editor go a little faster, and eat less processes. However, it seems no matter what I do, my surface always wants to stick to the top-left corner of the screen, and not the top-left corner of my child window like it should... I use OffsetRect() and still no luck. I am fresh out of ideas... can anyone help?

Share this post


Link to post
Share on other sites
Look, all I need to do is keep the upper left hand corner of my surface at the same place on screen as the upper left of my client rect... only I don''t know how to do this...

Share this post


Link to post
Share on other sites
I''m not sure that I understand what you''re asking, but here''s how I did it.

I had a tile class that has a position and a pointer to a bitmap to use. Then each would draw itself by using it''s pointer.

--Vic--

Share this post


Link to post
Share on other sites