Skip to main content
GameDev.net gamedev.net
🔒 Locked

Crash

Started by Newbie00 Dec 29, 2003 at 3:21 PM 2 replies 300+ views
Original Post
Newbie00
Newbie00
I am attempting to make a bitmap show on top of another game. Here is the code I am using but all it does is crash the game.
	if(Menu) {

		LPDIRECT3DSURFACE8 g_pBackSurface = 0;
		LPDIRECT3DSURFACE8 g_pD3DBitmapSurf = 0;

		f_pDirect3DDevice->CreateImageSurface( 128, 128, D3DFMT_X8R8G8B8, &g_pD3DBitmapSurf );

		D3DXLoadSurfaceFromFile( g_pD3DBitmapSurf, NULL, NULL, "Pic.bmp", NULL, D3DX_FILTER_NONE, 0, NULL );

		RECT D3DSrcRect = { 0, 0, 128, 128 };
		POINT D3DDestPoint = { rand() % (g_DeviceWidth - 128), rand() % (g_DeviceHeight - 128 ) };

		pD3DDevice->CopyRects( g_pD3DBitmapSurf, &D3DSrcRect, 1, g_pBackSurface, &D3DDestPoint );
	}
 
Any ideas on what I am doing wrong?
Sir Valeq
Sir Valeq
I think that if you want to draw anything on top of another application, you must do it through device->Present(), just like any other drawing. You have appriopriate arguments in that method.

--------------
"We cannot all be masters." - William Shakespeare
--------------"We cannot all be masters." - William Shakespeare
__Daedalus__
__Daedalus__
It appears that you are doing nothing with the variable "g_pBackSurface". You either need to call CreateImageSurface() on it too or get access to your backbuffer with "f_pDirect3DDevice->GetBackBuffer()". I suspect you''re trying to do the latter.

Newbie00
Newbie00
I also have


f_pDirect3DDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &g_pBackSurface );




When I add


f_pDirect3DDevice->Present( NULL, NULL, NULL, NULL );


The screen flickers white adn then back to the game really fast.


[edited by - Newbie00 on December 29, 2003 5:12:11 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.