This code compiles fine but when ran the screen is just black. Is there anything wrong with the render function?
Note: the surfaces are valid
Thanks for any helpCode:int Render() { HRESULT r; LPDIRECT3DSURFACE8 pBackSurf = 0; if( !g_pDevice ) { SetError( "Cannot render because there is no device" ); return E_FAIL; } g_pDevice->Clear( 0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB( 0, 0, 0 ), 1.0f, 0 ); r = g_pDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pBackSurf ); if ( FAILED( r ) ) { SetError( "Couldn't get backbuffer" ); } POINT DestPoint; RECT rect; switch (GameState) { case 1: DestPoint.x = 0; DestPoint.y = 0; rect.bottom = 0; rect.left = 0; rect.right = d3dsdMenu.Width; rect.top = d3dsdMenu.Height; g_pDevice->CopyRects( pSurfaceMenu, &rect, 1, pBackSurf, &DestPoint ); break; case 2: DestPoint.x = 0; DestPoint.y = 0; rect.bottom = 0; rect.left = 0; rect.right = d3dsdRandomMap.Width; rect.top = d3dsdRandomMap.Height; g_pDevice->CopyRects( pSurfaceRandomMap, &rect, 1, pBackSurf, &DestPoint ); break; case 3: DestPoint.x = 0; DestPoint.y = 0; rect.bottom = 0; rect.left = 0; rect.right = d3dsdMultiplayer.Width; rect.top = d3dsdMultiplayer.Height; g_pDevice->CopyRects( pSurfaceMultiplayer, &rect, 1, pBackSurf, &DestPoint ); break; case 4: DestPoint.x = 0; DestPoint.y = 0; rect.bottom = 0; rect.left = 0; rect.right = d3dsdCampaign.Width; rect.top = d3dsdCampaign.Height; g_pDevice->CopyRects( pSurfaceCampaign, &rect, 1, pBackSurf, &DestPoint ); break; case 5: DestPoint.x = 0; DestPoint.y = 0; rect.bottom = 0; rect.left = 0; rect.right = d3dsdScenario.Width; rect.top = d3dsdScenario.Height; g_pDevice->CopyRects( pSurfaceScenario, &rect, 1, pBackSurf, &DestPoint ); break; case 6: DestPoint.x = 0; DestPoint.y = 0; rect.bottom = 0; rect.left = 0; rect.right = d3dsdOptions.Width; rect.top = d3dsdOptions.Height; g_pDevice->CopyRects( pSurfaceOptions, &rect, 1, pBackSurf, &DestPoint ); break; default: //note: this is unneeded as getting a gametype other then 1-6 is impossible break; } pBackSurf->Release(); pBackSurf = 0; g_pDevice->Present( NULL, NULL, NULL, NULL ); return S_OK; }



LinkBack URL
About LinkBacks


