mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
44 lines
950 B
C++
44 lines
950 B
C++
|
|
#include "main.h"
|
|
|
|
CUnkClass13::CUnkClass13(IDirect3DDevice9 *pD3DDevice)
|
|
{
|
|
field_20 = 0;
|
|
m_pD3DSurface = NULL;
|
|
m_pD3DTexture = NULL;
|
|
m_pD3DRenderToSurface = NULL;
|
|
m_pD3DDevice = pD3DDevice;
|
|
|
|
RestoreDeviceObjects();
|
|
}
|
|
|
|
CUnkClass13::~CUnkClass13()
|
|
{
|
|
DeleteDeviceObjects();
|
|
}
|
|
|
|
void CUnkClass13::DeleteDeviceObjects()
|
|
{
|
|
SAFE_RELEASE(m_pD3DSurface);
|
|
SAFE_RELEASE(m_pD3DTexture);
|
|
SAFE_RELEASE(m_pD3DRenderToSurface);
|
|
SAFE_RELEASE(field_20);
|
|
}
|
|
|
|
void CUnkClass13::RestoreDeviceObjects()
|
|
{
|
|
m_pD3DDevice->GetDisplayMode(0, &m_DisplayMode);
|
|
|
|
HRESULT hr = D3DXCreateTexture(m_pD3DDevice, 128, 32, 1,
|
|
D3DUSAGE_RENDERTARGET, m_DisplayMode.Format, D3DPOOL_DEFAULT, &m_pD3DTexture);
|
|
if(SUCCEEDED(hr))
|
|
{
|
|
D3DSURFACE_DESC desc;
|
|
|
|
m_pD3DTexture->GetSurfaceLevel(0, &m_pD3DSurface);
|
|
m_pD3DSurface->GetDesc(&desc);
|
|
|
|
D3DXCreateRenderToSurface(m_pD3DDevice, desc.Width, desc.Height,
|
|
desc.Format, TRUE, D3DFMT_D16, &m_pD3DRenderToSurface);
|
|
}
|
|
} |