• Advertisement

Archived

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

DX8 Bitmaps and DDUtil.h HELP!!!!!!

This topic is 6215 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to use the CSurface and CDisplay that are used in the DX8 ddutil.h file. But i was wondering how to create a surface and use the same surface over and over to draw bitmaps. Here is the code i know the question is confusing. CSurface* MainMap = NULL; switch(Map[y][x]) { MainMap = NULL; (I need to be able to use MainMap evey time) case 0: DD->CreateSurfaceFromBitmap (&MainMap,MAKEINTRESOURCE(IDB_GRASS),32,32); DD->Blt (a,b,MainMap,NULL); a+=32; break; case 1: DD->CreateSurfaceFromBitmap (&MainMap,MAKEINTRESOURCE(IDB_TREES),32,32); DD->Blt (a,b,MainMap,NULL); a+=32; break;

Share this post


Link to post
Share on other sites
Advertisement
I see what you''re trying to do, but you shouldn''t do that
Just use seperate surfaces for seperate textures.
What you''re doing over there (Recreating the surface each time and load the texture to it) is not only slow (In terms of computer games) but is also a giant memory leak
CreateSurfaceFromBitmap() creates the surface, and then loads the bitmap to it.
You''re actually creating the same surface over and over and over again without releasing the last one you used.
Again, use seperate surfaces



- Goblineye Entertainment
The road to success is always under construction

Share this post


Link to post
Share on other sites
I see what your saying but I have around 150 bitmaps total in the game. Isn''t it too much to use a different surface everytime?
Is there any other way to do it?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What I do is simply make one large bitmap that contains all of my sprites, and blit from a different source RECT depending on which one I want.

Of course, I still have multiple surfaces. I have one full of map tiles, one for each unit (it''s an RTS game) full of animation frames, and one for interface things (icons, etc.).

If you want individual bitmaps for each thing, just use a seperate surface for each one.

Share this post


Link to post
Share on other sites

  • Advertisement