Archived

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

IronMan

Surfaces and stuff...

Recommended Posts

hey,i was wondering how you would go about making a game with multiple graphics. What i mean is,how would you store them on surfaces,would you load all the images on to a backbuffer,and then flip the ones you need?Thanks for any help .............................

Share this post


Link to post
Share on other sites
The backbuffer is only a pre-copy of the primary surface (the screen), so whatever you blit to the backbuffer, it will appear on the screen by calling ->flip(). All your graphics should be stored in seperate surfaces which can be in system memory or video memory, then whatever you would like on the screen, you blit them to the backbuffer. See below:

Initialization
* Create the DDraw interface.
* Create the primary surface and its connected backbuffer.
* Load your BMPs to individual surfaces.


Every frame:
* Blit the graphics to the backbuffer
* Flip the backbuffer to the screen.

Destruction:
* Remove the graphics surfaces.
* Remove the backbuffer and primary surface
* Destroy the DDraw interface.

The best way to animate graphics is to create a single bitmap/surface of all your frames for a particular sprite, then specify the source rect in ->BltFast() according to its current frame.

Hope this helps



  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
Yes but it doesnt really matter, it also depends on the type of game you are creating.
If you are creating a graphically intensive game such as a Real-Time stragety game you will need around 8-16MB to store the surfaces, though this isnt a problem these days since PCI video cards can use system memory for storing surfaces. So if you have an 8MB video card and 64MB of sys mem, the game will use the 8MB of memory in the video card, and any extra surfaces will be put in system memory.

Also, make sure you limit the size of your surfaces to the screen size, some video cards can handle surfaces larger then the primary buffer, though its better to be safe than sorry.

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites