Home > other >  Its HOOK the present problems
Its HOOK the present problems

Time:09-20

A game is its I HOOK it after the present to draw my own want to graphics,
Under normal play, it has the graphic drawn but if interface can be more of a team after the game to a group of teammates information leading to my graphics are not shows the
But if out in the game menu bar or in-game his words remind, I draw graphics again. Really strange help solve

Normal mode


Team mode, the upper left corner of the game is more than a group box out at that time my drawings are not


If I breathe out in game menu or the words remind output in the game when the canvas, I draw again


Drawing graphics code
The Renderer: : the Renderer (ID3D11Device * direct3DDevice, const STD: : wstring & amp; DefaultFontFamily) :
Direct3DDevice (direct3DDevice),
ImmediateContext (nullptr),
InputLayout (nullptr),
VertexShader (nullptr),
PixelShader (nullptr),
FontFactory (nullptr),
FontWrapper (nullptr),
DefaultFontFamily (defaultFontFamily),
MaxVertices (1024 * 4 * 3)
{
D3D11_INPUT_ELEMENT_DESC layout []=
{
{DXGI_FORMAT_R32G32B32_FLOAT "POSITION", 0, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{DXGI_FORMAT_R32G32B32A32_FLOAT "COLOR", 0, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},
};

ID3DBlob * vsBlob=nullptr;
ID3DBlob * psBlob=nullptr;

Direct3DDevice - & gt; GetImmediateContext (& amp; ImmediateContext);

ThrowIfFailed (FW1CreateFactory (FW1_VERSION, & amp; FontFactory));

RenderList=STD: : make_unique & lt; RenderList> (fontFactory maxVertices);

ThrowIfFailed (fontFactory - & gt; CreateFontWrapper (direct3DDevice, defaultFontFamily c_str (), & amp; FontWrapper));


HMODULE hD3DCompiler=LoadLibraryA (" D3DCompiler_43. DLL ");
If (hD3DCompiler==NULL) {
ExitProcess (0);
}

M_pfnD3DCompile=reinterpret_cast & lt; PD3DCompile & gt; (GetProcAddress call (hD3DCompiler, "D3DCompile"));
If (m_pfnD3DCompile==NULL) {
ExitProcess (0);
}

ThrowIfFailed (m_pfnD3DCompile (shader, STD: : size (shader) that nullptr, nullptr, nullptr, "v", "vs_4_0", 0, 0, & amp; VsBlob nullptr));
ThrowIfFailed (m_pfnD3DCompile (shader, STD: : size (shader) that nullptr, nullptr, nullptr, "PS", "ps_4_0", 0, 0, & amp; PsBlob nullptr));

ThrowIfFailed (direct3DDevice - & gt; CreateVertexShader (vsBlob - & gt; GetBufferPointer (), vsBlob - & gt; GetBufferSize (), nullptr, & amp; VertexShader));
ThrowIfFailed (direct3DDevice - & gt; CreatePixelShader (psBlob - & gt; GetBufferPointer (), psBlob - & gt; GetBufferSize (), nullptr, & amp; PixelShader));

ThrowIfFailed (direct3DDevice - & gt; CreateInputLayout (layout, static_cast & lt; UINT> (STD: : size (layout), vsBlob - & gt; GetBufferPointer (), vsBlob - & gt; GetBufferSize (), & amp; InputLayout));

SafeRelease (vsBlob);
SafeRelease (psBlob);


D3D11_BLEND_DESC blendDesc {};

BlendDesc. RenderTarget - & gt; BlendEnable=TRUE;
BlendDesc. RenderTarget - & gt; SrcBlend=D3D11_BLEND_SRC_ALPHA;
BlendDesc. RenderTarget - & gt; DestBlend=D3D11_BLEND_INV_SRC_ALPHA;
BlendDesc. RenderTarget - & gt; SrcBlendAlpha=D3D11_BLEND_ONE;
BlendDesc. RenderTarget - & gt; DestBlendAlpha=D3D11_BLEND_ZERO;
BlendDesc. RenderTarget - & gt; BlendOp=D3D11_BLEND_OP_ADD;
BlendDesc. RenderTarget - & gt; BlendOpAlpha=D3D11_BLEND_OP_ADD;
BlendDesc. RenderTarget - & gt; RenderTargetWriteMask=D3D11_COLOR_WRITE_ENABLE_ALL;

ThrowIfFailed (direct3DDevice - & gt; CreateBlendState (& amp; BlendDesc, & amp; BlendState));

D3D11_BUFFER_DESC bufferDesc {};

BufferDesc. Usage=D3D11_USAGE_DYNAMIC;
BufferDesc. ByteWidth=sizeof (Vertex) * static_cast & lt; UINT> (maxVertices);
BufferDesc. BindFlags=D3D11_BIND_VERTEX_BUFFER;
BufferDesc. CPUAccessFlags=D3D11_CPU_ACCESS_WRITE;
BufferDesc. MiscFlags=0;

ThrowIfFailed (direct3DDevice - & gt; CreateBuffer (& amp; BufferDesc nullptr, & amp; VertexBuffer));

BufferDesc={};

BufferDesc. Usage=D3D11_USAGE_DYNAMIC;
BufferDesc. ByteWidth=sizeof (XMMATRIX);
BufferDesc. BindFlags=D3D11_BIND_CONSTANT_BUFFER;
BufferDesc. CPUAccessFlags=D3D11_CPU_ACCESS_WRITE;
BufferDesc. MiscFlags=0;

ThrowIfFailed (direct3DDevice - & gt; CreateBuffer (& amp; BufferDesc nullptr, & amp; ScreenProjectionBuffer));

D3D11_VIEWPORT viewport {};
UINT numViewports=1;

ImmediateContext - & gt; RSGetViewports (& amp; NumViewports, & amp; Viewport);

//DbgPrintA (" % f, % f, % f, % f, % f, % f ", viewport. TopLeftX, viewport. The Width of the viewport. The Height of the viewport. The TopLeftY, viewport. MinDepth, viewport. MaxDepth);

The projection=XMMatrixOrthographicOffCenterLH (viewport. TopLeftX viewport. The Width of the viewport. The Height of the viewport. The TopLeftY, viewport. MinDepth, viewport. MaxDepth);

D3D11_MAPPED_SUBRESOURCE mappedResource;
ThrowIfFailed (immediateContext - & gt; The Map (D3D11_MAP_WRITE_DISCARD screenProjectionBuffer, 0, 0, & amp; MappedResource));
{
STD: : memcpy (mappedResource pData, & amp; The projection, sizeof (XMMATRIX));
}
ImmediateContext - & gt; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related