Results 1 to 11 of 11

Thread: Clippers!

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2003
    Posts
    33

    Question Clippers!

    How do i use clippers in direct draw i cannot find a tutorial on it ne wer, ne1 know how to use or know tutorials?

    Thnx
    "Microsoft isn't evil, they just make really crappy operating systems."
    -Linus Torvalds

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Clippers does actually not do anything else then changing the source rect. You can easily do that your self. And clippers dosn't work as they should in Windowed mode anyway.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2003
    Posts
    33
    So if i change the source in blt that will work, can u giv me an example Plz

    thnx
    "Microsoft isn't evil, they just make really crappy operating systems."
    -Linus Torvalds

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Never done any 2D in DX with C++ sorry....but if you have the code to Blt it to the screen, I can see if I can do something with it...

  5. #5
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Give me a sec I'll have a look, I should have an example.....



    BTW if you are using scaling then it makes things easier when using a clipper .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  6. #6
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Here you go, ScreenX is the XResolution and ScreenY is the YResolution.

    This will trim off the src and dest RECTs so that they fit on the backbuffer and therefore the normal blt call will not fail .
    Code:
    // Top
    if (dest.Top < 0)
    {
        src.Top = -dest.Top;
        dest.Top = 0;
    }
    
    // Left
    if (dest.Left < 0)
    {
        src.Left = -dest.Left;
        dest.Left = 0;
    }
    
    // Right
    if (dest.Right > ScreenX)
    {
        src.Right = src.Right - (dest.Right - ScreenX);
        dest.Right = ScreenX;
    }
    
    // Bottom
    if (dest.Bottom > ScreenY)
    {
        src.Bottom = src.Bottom - (dest.Bottom - ScreenY);
        dest.Bottom = ScreenY;
    }
    BTW you do know the games section on this site is also for C++, not just VB (even though its in the VB section )

    Last edited by Electroman; Jun 6th, 2004 at 06:45 PM.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  7. #7
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    He probably ment:

    Code:
    //Top
    If (dest.Top < 0){
        src.Top = -dest.Top;
        dest.Top = 0;
    }
    
    //Left
    If (dest.Left < 0){
        src.Left = -dest.Left;
        dest.Left = 0;
    }
    
    //Right
    If (dest.Right > ScreenX){
        src.Right = src.Right - (dest.Right - ScreenX);
        dest.Right = ScreenX;
    }
    
    //Bottom
    If (dest.Bottom > ScreenY){
        src.Bottom = src.Bottom - (dest.Bottom - ScreenY);
        dest.Bottom = ScreenY;
    }
    Last edited by NoteMe; Jun 6th, 2004 at 06:49 PM.

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Posted by NoteMe
    He probably ment:

    Code:
    ....
    I was lost for a minute there .

    BTW Note you are using VB comments in your code .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Electroman
    I was lost for a minute there .

    BTW Note you are using VB comments in your code .

    At least I remembered all the ;;;;;;;s...

  10. #10
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Its an easy mistake
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  11. #11

    Thread Starter
    Member
    Join Date
    Apr 2003
    Posts
    33
    Thnx alot its workin fine now.
    "Microsoft isn't evil, they just make really crappy operating systems."
    -Linus Torvalds

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