Developing a Direct Draw 7 class

Started by
6 comments, last by Ertai 21 years, 7 months ago
Hello all, I''m making a DirectDraw 7 class for developing a 2D game, before doing something stupid I''d like to get you advice on certain aspects that aren''t clear to me. 1) Direct Draw provides functions to enumerate display modes, how usefull is this and how should this be used to perhaps select a certain mode? 2) Does Direct Draw provide for alpha blending? I see capability flags that should have some connection to this but i can''t fund any tutorial or documentation on how to inplement this 3) It learned that it is possible to loose surfaces while using Direct Draw. When can this happen and how do I know when to restore Surfaces? Is it for example usefull to keep a copy of Surface memory in System Memory for quick restoring or is it better to keep track of wich image is loaded in wich Surface and load the image all over when a surface is lost ? 4) For easy developing and debugging I want my DirectDraw class to be able to run DirectDraw graphics in a window instead of in fullscreen but I''d like to be this as easy as chaning a boolean. Any tips on how to use DirectDraw in a window? Thx in advance for any tips, Stefan
Stefan
Advertisement
quote:Original post by Ertai

4) For easy developing and debugging I want my DirectDraw class to be able to run DirectDraw graphics in a window instead of in fullscreen but I''d like to be this as easy as chaning a boolean. Any tips on how to use DirectDraw in a window?



Hi there,

this tutorial is showing you the necessary changes to
switch between exclusive and windowed mode:

http://www.gamedev.net/reference/articles/article960.asp
quote:Original post by Ertai

4) For easy developing and debugging I want my DirectDraw class to be able to run DirectDraw graphics in a window instead of in fullscreen but I''d like to be this as easy as chaning a boolean. Any tips on how to use DirectDraw in a window?



Hi there,

this tutorial is showing you the necessary changes to
switch between exclusive and windowed mode:

http://www.gamedev.net/reference/articles/article960.asp
Thanks very much for that, to the looks of it, this should contain exactly the information i need to solve problems concerning point 4.

Just a little note: I did look through the gamedev articles and resources but it didn''t occur to me that this article was in there.

thx,

Stefan
Stefan
I dont know if DD supports Alpha Blend at its own,but D3D does.So additionally to DD also init Direct3D,so you can use alpha blending.
greez,Neo
Chat|Games|Tools|Morehttp://neochat.de.vu
DD does not support alpha blending. You have to make you''re own alpha blending routine. Which means you have to make you''re own blitting function where you have to plot each individual pixel yourself, blending them with the destination pixel as you go. Here''s a nice article on it. Good luck with your wrapper

***********************
          
1.) It can be useful depending on what you are doing. You should program your game so that it can run in more than one format. usually these include 1024x768, 800x600, 640x480 all at 16 and/or 8 bit. You can the 1.) test it each mode using enumeration or 2.) test the return values from SetDisplayMode. I prefer the latter for something as simple as that but certain programs can run in any mode supported although it is rare. Honestly, I wouldn''t use enumeration usually but if you want to, go ahead.

2.) Not without D3D and not without writing your own blitting functions.

3.) Yes but it''s easy to restore surface. Just call the RestoreAllSurfaces member of the IDirectDraw7 interface to restore all the created surfaces. Then for any that were loaded from file, reload those without createing the surfaces again.

4.) I do it fairly easily in my wrapper. Just create two loading functions. The only problem is the blitting location for windowed mode. Either you can test for WM_MOVE messages in your handler for optomimum speed or you can get the new window position every frame. Either way, you need to modify the blit location when the window moves.

---
My Site-My Tetris Clone w/Source
Come join us on IRC in #directxdev @ irc.afternet.org
thx .. you guys have been very hepfull .. i think i know everything i need to know now ...
Stefan

This topic is closed to new replies.

Advertisement