Thread: Looking for help on DirectDraw operations

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Looking for help on DirectDraw operations

    Hi, I need some directions on two things I'm trying to achieve in DirectDraw (DD7):

    1) Fading
    I'm working on a game with several layers, and I want to be able to fade the background (Normal -> Black, and Black -> Normal). This without the other layers being affected. I looked up some gamma functions but it seems like that affects the whole screen, not just the parts I want. Can someone give a suggestion what I should use?

    2) Hot air
    I also want to make some "Hot air" meaning that the background is making some kind of "waving" animation. Suggestion?


    Both of these could be some kind of functions that works on DirectDraw surfaces since I draw the background first, apply the effect then draw the rest (making the effect only apply on the background). If someone could give me a direction how I could do these things I would be grateful.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Wow RoD, you are soooo helpful. Posting a link to a google search isn't exactly helpful. This person was obviously looking for a good tutorial, not the generic STFW.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: Looking for help on DirectDraw operations

    Originally posted by Magos
    Hi, I need some directions on two things I'm trying to achieve in DirectDraw (DD7):

    1) Fading
    I'm working on a game with several layers, and I want to be able to fade the background (Normal -> Black, and Black -> Normal). This without the other layers being affected. I looked up some gamma functions but it seems like that affects the whole screen, not just the parts I want. Can someone give a suggestion what I should use?

    2) Hot air
    I also want to make some "Hot air" meaning that the background is making some kind of "waving" animation. Suggestion?


    Both of these could be some kind of functions that works on DirectDraw surfaces since I draw the background first, apply the effect then draw the rest (making the effect only apply on the background). If someone could give me a direction how I could do these things I would be grateful.
    Fading in / out is very easy. All you need to do is lock the surface with your background image and then manipulate the bits ( i.e. increment / decrement them ). Then unlock the surface. You might want to keep 2 surfaces for the background one for unmanipulated and the other for the fading.

    As for the waving animation I'm not exactly sure what you mean. You might want to try alpha blending some animated texture over the image. This will give you a foggy effect if done properly. Good luck.

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    i think he means like when u have a screensaver of the windows logo "flapping" or like when u see riplle effects and such....

  6. #6
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I checked out the Lock and Unlock functions. Manipulating each pixel may work but I believe it will be slow doing it on the whole screen (640x480) especially if you need to add some space geometry to get a better fading. I'll try it though.

    As for the second request. Often in old SNES games, to simulate a hot environment they made the background 'wave' a little. Are there any functions for adding effects to surfaces apart from mirroring and rotating?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. doing floating operations using integer operations
    By ammalik in forum C Programming
    Replies: 10
    Last Post: 08-15-2006, 04:30 AM
  2. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM
  3. Replies: 3
    Last Post: 08-14-2003, 01:37 PM
  4. Windowed DirectDraw problems
    By Magos in forum Windows Programming
    Replies: 0
    Last Post: 01-20-2003, 01:00 PM
  5. DirectDraw Tutorials
    By Robert602 in forum Game Programming
    Replies: 3
    Last Post: 12-14-2001, 10:29 AM