Original Post
Hi folks! I'm having some serious compiling troubles. The code so far:
#include <iostream>
#include <windows.h>
#include <vector>
#include "d3d9.h"
#include "d3dx9.h"
using namespace std;
struct ScreenMode
{
D3DDISPLAYMODE theMode;
D3DFORMAT fmt;
int nBits;
};
int main()
{
LPDIRECT3D9 g_pD3D = NULL;
if( NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
return E_FAIL;
UINT iAmountDevices = g_pD3D->GetAdapterCount();
D3DADAPTER_IDENTIFIER9* psAdapterIdentifier=new(D3DADAPTER_IDENTIFIER9[iAmountDevices]);
for(UINT n=0;n++<iAmountDevices;)
{
g_pD3D->GetAdapterIdentifier(n, 0, &psAdapterIdentifier[n]);
cout << psAdapterIdentifier[n].DeviceName;
}
delete []psAdapterIdentifier;
system("PAUSE");
return 0;
}
void GetModes(std::vector& vModes, IDirect3D9* pD3D)
{
const D3DFORMAT fmts[] =
{
D3DFMT_A1R5G5B5,
D3DFMT_A2R10G10B10,
D3DFMT_A8R8G8B8,
D3DFMT_R5G6B5,
D3DFMT_X1R5G5B5,
D3DFMT_X8R8G8B8,
};
const int nBits[] = {16, 32, 32, 16, 16, 32};
const int nNumFormats = 6;
ScreenMode theMode;
vModes.clear();
for(int i=0; i<nNumFormats; ++i)
{
UINT nCount = pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT,fmts);
for(UINT j=0; j<nCount; ++j)
{
if(SUCCEEDED(pD3D->EnumAdapterModes(D3DADAPTER_DEFAULT,fmts,j,&theMode.theMode)))
{
theMode.fmt = fmts;
theMode.nBits = nBits;
vModes.push_back(theMode)
}
}
}
}
When I compile the "Break" window keeps popping up. I'd also like to be able to enumerate the graphics cards, screen resolutions and screen update frequencies. The user should be able to pick and the picked options should be saved in a file. Maybe this is too much to ask but I've been trying to manage this myself for so long now that I'm becoming a bit desperate. Thanks Wargrave