Skip to main content
gamedev.net
🔒 Locked

Bitmaps and DDraw

Started by Lethian Jul 11, 2000 at 1:47 PM 6 replies 300+ views
Original Post
Lethian
Lethian
Im new to Directx and im haveing a hard time trying to figure out how surface and bitmaps relate to each other. Im trying to map of multiple tiles. Does each tile need to have its own surface or can i load multiple bmps onto a signle surface? How would one go about doing this? Lethian
Buster
Buster
A surface is the way DirectDraw holds onto a bitmap.

As for execution... I like to do this:

Put all of your tiles onto one large surface, arranged whichever way makes the most sense. Then blit rects from it onto your back buffer.


Lethian
Lethian
But how do i add multiple bitmaps to a surface. I can only see CreateSurfaceFromFile and that looks like you are creating a single surface from a single bitmap.
omegasyphon
omegasyphon
how do u put all your bitmaps onto one surface? also do u use any of the functions in ddutil.h?
Lethian
Lethian
Im trying to make a tile engine. I would assume that each "layer" (ie. landscape, objects, etc.) should be a surface my question is if my tiles are 32x32pxs and i want to have a screen that is 640x480 therefore a surface of 20x15 tiles. How create and add multiple tile (ie bitmaps to the main landscape surface?
POINT
POINT
quote:

But how do i add multiple bitmaps to a surface. I can only see CreateSurfaceFromFile and that looks like you are creating a single surface from a single bitmap.



blit to the composite surface just like you would your back buffer!

simple as that really
TheTwistedOne
TheTwistedOne
Or, to point out the obvious - once you understand the correspondance between a 'bitmap' and a 'surface' - you could put together tile 'sets' in your paint package of choice.

That is, put a bunch of tiles onto a single bitmap, load that single bitmap onto a single DDraw surface, then blit off 32x32 (or whatever size you use) rectangles to the backbuffer for displaying, according to the map you're using.

(Edited to correct what could easily be misread as an insult to Lethian)

TheTwistedOne
http://www.angrycake.com

Edited by - TheTwistedOne on July 12, 2000 9:41:29 AM
TheTwistedOnehttp://www.angrycake.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.