PDA

View Full Version : D3DEnum (9) question


Ajarn
11-03-2003, 11:12 PM
First of all, LOVE your site.
Second of all, I'm wondering how I can easily assign the m_current data to my D3DPRESENT_PARAMETERS. I see it in the code that it should be easy, but I need a line of code showing it (being me, I can't read any code more complex then adding variables). Any help on this would be just wonderful.
Third of all, LOVE your site.

bladder
11-04-2003, 02:44 AM
ok just rechecked the code. it seems like there has been a small goof up. The way to assign a D3DPRESENT_PARAMETERS structure to an sCurrentConfiguration structure would be to assign the sCurrentConfiguration structure to the D3DPRESENTPARAMETERS structure. Somehow I programmed the assignment operator backwards :blink:


CD3D d3d;

// Initialize d3d

D3DPRESENT_PARAMETERS d3dpp;

// Assign d3dpp to the current config (not current config to d3dpp)
*d3d.Current() = d3dpp;



The Current() function returns a pointer to the current configuration. It's just the the assignment operator works backwards in this case. It would probably be way better if you wrote a small method for the sCurrentConfiguration structure that takes in a D3DPRESENT_PARAMETERS structure and assigns everything to it. Just do what the assignment operator is doing

in fact, here:

void FillD3DParams( sCurrentConfiguration* pCur, D3DPRESENT_PARAMETERS* pPP )
{
if( pCur->dsFormat != D3DFMT_UNKNOWN )
{
pPP->AutoDepthStencilFormat = pCur->dsFormat;
pPP->EnableAutoDepthStencil = true;
}

pPP->BackBufferCount = 1;
pPP->BackBufferFormat = pCur->backBufferFormat;
pPP->BackBufferHeight = pCur->uiHeight;
pPP->BackBufferWidth = pCur->uiWidth;

if( !pCur->bWindowed )
{
pPP->FullScreen_RefreshRateInHz = pCur->uiRefreshRate;
}

pPP->MultiSampleQuality = pCur->msLevel;
pPP->MultiSampleType = pCur->msType;

pPP->PresentationInterval = pCur->uiPInterval;
pPP->SwapEffect = D3DSWAPEFFECT_DISCARD;

pPP->Windowed = pCur->bWindowed;
}


I think I got everything yes?

Ajarn
11-04-2003, 10:08 AM
I thought it wasn't just me :)
And yes, thanks, you covered it.