Solved

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

Posted on 2003-11-18
3
349 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Software to create cartoons/animations 2 361
word search puzzle 2 1,169
Why does this site's Python example code not work? 8 248
Compile GLUT with Visual Studio 2015 1 174
What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…

829 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