Results 1 to 4 of 4

Thread: DirectDraw 7 little problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Unhappy DirectDraw 7 little problem

    Can someone please look at my little attachment and perhaps mabye tell me why the background doesn't move, yet my sprite moves. It is very small code, it is actully slightly modified from DirectX4VB site tutorial. Thanks.
    Attached Files Attached Files

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    I'm assuming you're trying to move the background to the left when you press the left arrow key. If so, the problem lies in the fact that you're trying to blit offscreen. Add the following to your blt function:

    'Add this above the two lines where you set rBack
    rBack.Left = Abs(sx1)
    'or make this change in your Init function
    If GetKeyState(vbKeyLeft) < -5 Then sx1 = sx1 + 1 'background
    'and add this above the two lines where you set rBack
    rBack.Left = sx1



    'Change your first BltFast to this:
    ddrval = backbuffer.BltFast(0, 0, Mainsurf, rBack, DDBLTFAST_WAIT)

    If this isn't what you're trying to do let me know.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Smile

    Hey, that is almost what I want, the sliding part is excellent, but the background seems to get cut off to fit to screen, I actually need it to be intact and blited of screen, so I can slide it in and out of view. Sorry I didn't make myself clear in the previous post. Thanks a lot, I really appreciate your help!

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Talking

    NEVER MIND!!! I GOT IT TO WORK! YES, FULLSCREEN, DIRECTDRAW, SINGLE PICTURE SCROLLING ENGINE! HAHAHHAHA, YES!!!!!!!!!!!!!!!!!!!!!!!
    Ok it was just a matter of changing a few lines to this:

    rBack.Left = 0 - sx1
    rBack.Right = 800 - sx1

    rBack.Top = 0 - sy1
    rBack.Bottom = 600 - sy1

    Now my world scrolls up, down, left, right. All at over 120FPS! Thank you, Thank you Mircrosoft for developing the almighty DIRECTX! And thank you Machaira for getting me of to a good start.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width