Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: DDraw tutorial

  1. #1

    DDraw tutorial

    I've finally finished the DirectDraw tutorial. This one shows you how to use DirectDraw w/out using the VCL - i.e., the underlying setting-up-and-wrapping-around DDraw. The result is a pretty darned small exe - the example code ended up at 19K with no thoughts about size optimisation at all!

    It's a big two-parter and it's over here.

    Next, I'll finish off the timing tutorial, then completely rewrite the tiles one.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  2. #2

    DDraw tutorial

    Dang! Can't get to your site at the moment. It's not responding. Will try again later.

  3. #3

    DDraw tutorial

    The site seems to have recovered from that hiccup. Sorry about that!
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  4. #4

    DDraw tutorial

    The tutorials looks great!
    Do you give me permission to mirror the tutorials on DelphiGamer.com?


    Dom.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  5. #5

    DDraw tutorial

    Just a comment on the tutorial. Clippers are only required if running in windowed mode.

    An alternative on using clippers is the following code. This is taken straight from my own DirectDraw7 component.[pascal] { Create and attach clipper to the primary surface. }
    FDirectDraw.CreateClipper(0, FClipper, nil);
    FClipper.SetHWnd(0, FWindowHandle);
    FPrimarySurface.Surface.SetClipper(FClipper);
    [/pascal]This just creates a clipper for the entire window in three easy steps. Of course, you should check return values of those calls. To remove the clipper, the following code does the trick.[pascal] FBackSurface.ReleaseSurface;
    { Release the clipper if it exists. }
    if Assigned(FClipper) then
    begin
    FPrimarySurface.Surface.SetClipper(nil);
    FClipper := nil;
    end;
    FPrimarySurface.ReleaseSurface;
    [/pascal]

  6. #6

    DDraw tutorial

    Are you sure about only needing clippers for windowed mode? If you get rid of the clipper and display a pic that's falls even a little off the screen in fullscreen, none the pic is displayed (IME). With a clipper, the pic is displayed clipped to the screen edge :?. I tried changing the example code so that the monster pic is displayed with a right of "SCREEN_WIDTH + 25 instead of SCREEN_WIDTH - 25 - i.e., a little off the screen. It only displayed when I attached a clipper. Hmm.

    Thanks for the simpler method of adding clippers - I'll add that to the tutorial when I get home.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  7. #7

    DDraw tutorial

    I think I'm certain. It has been a while since I have played with DirectDraw7, so I've forgotten some of the details. I know from my code that I only added a clipper if it was not in fullscreen mode. I might have to give it another test over the weekend.

    Just spent a few minutes looking over my old code. It seems that I always clipped the rects myself before using BltFast. The clipper was just to handle overlapping windows.

    10:20pm on a Friday night and I'm still at work. One week to go till the next milestone and four levels to complete. Such is the life of a games developer...

  8. #8

    DDraw tutorial

    Shouldn't that be a . Or is it really too much hassle?
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  9. #9

    DDraw tutorial

    Quote Originally Posted by Sly
    I think I'm certain. It has been a while since I have played with DirectDraw7, so I've forgotten some of the details. I know from my code that I only added a clipper if it was not in fullscreen mode. I might have to give it another test over the weekend.

    Just spent a few minutes looking over my old code. It seems that I always clipped the rects myself before using BltFast. The clipper was just to handle overlapping windows.

    10:20pm on a Friday night and I'm still at work. One week to go till the next milestone and four levels to complete. Such is the life of a games developer...
    Ah, I'm not doing clipping manually - I let the clipper keep everything on screen, rather than checking the areas myself per-blit. I'll have to do some tests to see which is faster. I only ever used the clipper because it's the path of least resistance. I'll get back with the results later.

    Sorry to hear that you're still working so late. My job might be boring, but at least it's only 9-5. Btw, being nosy, what game is it you're doing at the moment?
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  10. #10

    DDraw tutorial

    Hi Ali,
    I have been trying to access your website all week-end with very little success
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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