154
edits
Changes
→This Week
*:: APITexture::SetSamplerState()
<syntaxhighlight lang="cpp">
// mipmap filtering
if (flags & TEX_MIPMAP)
d3dd->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
else
d3dd->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
</syntaxhighlight>
* DirectX Errors
*: APIDisplay::restore() example
<syntaxhighlight lang="cpp">
bool APIDisplay::restore() {
bool rc = false;
if (d3dd) {
HRESULT hr;
hr = d3dd->TestCooperativeLevel();
if (hr == D3DERR_DEVICENOTRESET)
// reset the APIDisplay device
rc = d3dd->Reset(&d3dpp) == D3D_OK;
else if (hr == S_OK)
rc = true;
}
if (rc) {
// reacquire sprite manager references to video memory
if (manager)
manager->OnResetDevice();
}
// complete the restoration
if (rc) {
setupLighting();
setupBlending();
}
return rc;
}
</syntaxhighlight>