D1kiy
28.05.2011, 00:02
Этот кусок кода работает не корректно, что приводит к крешу игры.. Можете подсказать в чем моя ошибка ? Заранее благодарен..
void PreReset(pD3DdeviceX pDevice)
{
if (pFont) {
pFont->InvalidateDeviceObjects();
pFont->DeleteDeviceObjects();
pFont = NULL;
}
}
void PostReset(pD3DdeviceX pDevice)
{
pFont = new CD3DFont("Arial", 8, D3DFONT_BOLD);
if (pFont) {
pFont->InitDeviceObjects(pDevice);
pFont->RestoreDeviceObjects();
}
}
HRESULT WINAPI myReset ( pD3DdeviceX pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
if (pFont){
PreReset(pDevice);
return pReset(pDevice, pPresentationParameters);
}
}
HRESULT WINAPI myEndScene (pD3DdeviceX pDevice)
{
if (pFont==NULL)
PostReset(pDevice); // Create font
else
DoMenu(pDevice);
return pEndScene(pDevice);
}
void PreReset(pD3DdeviceX pDevice)
{
if (pFont) {
pFont->InvalidateDeviceObjects();
pFont->DeleteDeviceObjects();
pFont = NULL;
}
}
void PostReset(pD3DdeviceX pDevice)
{
pFont = new CD3DFont("Arial", 8, D3DFONT_BOLD);
if (pFont) {
pFont->InitDeviceObjects(pDevice);
pFont->RestoreDeviceObjects();
}
}
HRESULT WINAPI myReset ( pD3DdeviceX pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
if (pFont){
PreReset(pDevice);
return pReset(pDevice, pPresentationParameters);
}
}
HRESULT WINAPI myEndScene (pD3DdeviceX pDevice)
{
if (pFont==NULL)
PostReset(pDevice); // Create font
else
DoMenu(pDevice);
return pEndScene(pDevice);
}