# DirectX 7 Project

## Recommended Posts

Do I have to install the DirectX 7 SDK to compile a projecct, or can I use the DirectX 9 SDK? Missing types: LPDIRECT3D7 g_pD3D = NULL; LPDIRECT3DDEVICE7 g_pD3DDevice = NULL; D3DTLVERTEX g_Vertex[4]; //quad vertices for 3D images Undefined defines:
	//Set render state
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_CLIPPING,false);
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING,false);
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_CULLMODE,D3DCULL_NONE);
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
if (alpha != 255) //if image is alpha blended
{
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,true);
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,D3DBLEND_SRCALPHA );
g_pD3DDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND,D3DBLEND_INVSRCALPHA);
g_pD3DDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTA_TFACTOR);
}

Setting up the device.
//Query DirectDraw for access to Direct3D
hr = g_pDirectDraw->QueryInterface(IID_IDirect3D7,(VOID**)&g_pD3D);
if(FAILED(hr)) {ReleaseObjects();return 17;};

//Create the D3D device using hardware
hr = g_pD3D->CreateDevice(
IID_IDirect3DHALDevice,
g_pBackBuffer,
&g_pD3DDevice);//I'm getting a no palette attached error

//If no hardware support, create the D3D device using sofware
if(FAILED(hr))
{
hr = g_pD3D->CreateDevice(
IID_IDirect3DRGBDevice,
g_pBackBuffer,
&g_pD3DDevice);
if(FAILED(hr)) {ReleaseObjects();return 18;}
}


##### Share on other sites
As far as I know you can use the DX9 SDK. Have you tried using the DX9 SDK and it doesn't work? I have ddraw.h and ddraw.lib with the November 2007 SDK, although I haven't tried compiling a DX7 app.

##### Share on other sites
Yeah, it's not working out of the box. The first thing I changed was "d3d.h" ->
"d3d9.h" because the former wasn't available.

And I haven't even hit any potential VC6 to VC8 problems.

The program in question is A* Pathfinding for Beginners

##### Share on other sites
Hmm, it seems that the November 2007 SDK dosn't have any reference to IDirect3D7 in any of the header files, and it doesn't seem to be in the platform SDK, so it looks like you'll have to download an earlier SDK unfortunately.

##### Share on other sites
That's a bit cheeky. I thought one of COM's main principles was to allow access to older interfaces.

##### Share on other sites
Quote:
 Original post by d000hgThat's a bit cheeky. I thought one of COM's main principles was to allow access to older interfaces.
COM, yes - the header files, not necessarily. In theory, all you need is the header file - I believe you query the DirectDraw object for the D3D interface in D3D7, so you don't need to use Direct3DCreate9() or whatever.

##### Share on other sites
If anyone has the DirectX 7 SDK installed, someone could help me by posting up the header files that have the missing types and defines in the first post.

Or if someone can compile it for me, this is for a Project called the "2D Dev Learn Suite."

The changes I need are:
* compile in window mode, not fullscreen
* change window title to "2D Dev: A-Star Pathfinding"
* replace all instances of "../../Graphics/" with "media/astar/"

##### Share on other sites
The lowest version of the SDK I can get is 8.1, do you think this would work?

I guess WinProgDumb might have its uses after all.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627684
• Total Posts
2978626

• 9
• 14
• 12
• 10
• 12