Archived

This topic is now archived and is closed to further replies.

accessing pixels in LPDIRECTDRAWSURFACE7

This topic is 5117 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im using VC++ 6.0 with DirectDraw 7.0. When my game is paused or the game is over, I would like to fade the screen to gray using 2 for loops to average each R, G, B component. 1)How do I access individual pixels? 2)Is the for loop method the best/ easiest way to do this? I am not especially concerned about performance, seeing as the game will be either over or paused. 3)Assuming I want to restore the original image before the game was paused, I intend to create a temporary LPDIRECTDRRAWSURFACE7 and blit the old image to it. Is there a better way to do so? here''s some relevant code: if (DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)!=DD_OK) Error("DirectDrawCreate Fail"); // set cooperation level to windowed mode normal if (lpdd->SetCooperativeLevel(main_window_handle, DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)!=DD_OK) Error("CooperativeLabel Fail"); // set the display mode if (lpdd->SetDisplayMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,0,0)!=DD_OK) Error("SetDisplayMode Fail"); // Create the primary surface memset(&ddsd,0,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; // we need to let dd know that we want a complex // flippable surface structure, set flags for that ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; // set the backbuffer count to 1 ddsd.dwBackBufferCount = 1; // create the primary surface lpdd->CreateSurface(&ddsd,&lpddsprimary,NULL); // query for the backbuffer i.e the secondary surface ddscaps.dwCaps = DDSCAPS_BACKBUFFER; lpddsprimary->GetAttachedSurface(&ddscaps,&lpddsback);

Share this post


Link to post
Share on other sites