Solved

if(FAILED(IDirectDrawSurface4->Blt(,,,,))), FAILS, but returns DD_OK

Posted on 2003-11-18
3
344 Views
Last Modified: 2013-12-08
int SGE_RenderFrame()
{
      DDBLTFX      ddbltfx;
      RECT      dest_rect;
      
      //Init structures
      _DDRAW_INIT_STRUCT(ddbltfx);

      ddbltfx.dwFillColor = rand()%255;
      
      int x1 = rand()%SCREEN_WIDTH;
      int x2 = rand()%SCREEN_WIDTH;
      int y1 = rand()%SCREEN_HEIGHT;
      int y2 = rand()%SCREEN_HEIGHT;

      dest_rect.left = x1;
      dest_rect.right = x2;
      dest_rect.top = y1;
      dest_rect.bottom = y2;

      if(FAILED(lpddsprimary->Blt(&dest_rect, NULL, NULL, DDBLT_WAIT |
                                                                                             DDBLT_COLORFILL,
                                                                                             &ddbltfx)))
            return(1);
      

      return(0);
}



This function fails, and i checked the return value, it seems to be equal to DD_OK.
0
Comment
Question by:cmaduro
3 Comments
 
LVL 4

Accepted Solution

by:
joachimc earned 500 total points
ID: 9837346
Are you checking with the macros provided by MS ?

You should always check the return values with
if (SUCCEDED) or if(FAILED)

Otherwise you might not get the expected result.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Suggestions for technologies to use when developing a web-based game 4 619
Python and Network Datagrams 7 403
Will Java Webstart launch my game? 6 130
triangle challenge 4 121
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now