wollte jetzt mal Texte in DIRECT X schreiben und habe das wie folgt gelöst
#fixed
Code:
Style muss FW1_RESTORESTATE nicht FW1_CENTER | FW1_VCENTER!
Code:
pFontWrapper->DrawString( d3dContext_, L"MOUSE",// String 50.0f,// Font size 10.0f,// X offset 10.0f,// Y offset 0xff0099ff,// Text color, 0xAaBbGgRr FW1_CENTER | FW1_VCENTER// Flags );
Render funktion:
Code:
void GraphicsEngine::Render( )
{
if( d3dContext_ == 0 )
return;
//float clearColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
//
float clearColor[4] = { GREYYY ,GREYYY, GREYYY, GREYYY };
d3dContext_->ClearRenderTargetView( backBufferTarget_, clearColor );
d3dContext_->ClearDepthStencilView( depthStencilView_, D3D11_CLEAR_DEPTH, 1.0f, 0 );
pFontWrapper->DrawString(
d3dContext_,
pwcsName,// String
20.0f,// Font size
10.0f,// X offset
10.0f,// Y offset
0xff0099ff,// Text color, 0xAaBbGgRr
FW1_CENTER | FW1_VCENTER// Flags
);
unsigned int stride = sizeof( VertexPos );
unsigned int offset = 0;
d3dContext_->IASetInputLayout( inputLayout_ );
d3dContext_->IASetVertexBuffers( 0, 1, &vertexBuffer_, &stride, &offset );
d3dContext_->IASetIndexBuffer( indexBuffer_, DXGI_FORMAT_R16_UINT, 0 );
d3dContext_->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
d3dContext_->VSSetShader( textureMapVS_, 0, 0 );
d3dContext_->PSSetShader( textureMapPS_, 0, 0 );
d3dContext_->PSSetShaderResources( 0, 1, &colorMap_ );
d3dContext_->PSSetSamplers( 0, 1, &colorMapSampler_ );
d3dContext_->PSSetShaderResources( 0, 1, &colorMap_LoadScreen );
d3dContext_->PSSetSamplers( 0, 1, &colorMapSampler_LoadScreen );
XMMATRIX worldMat = XMMatrixIdentity( );
worldMat = XMMatrixTranspose( worldMat );
XMMATRIX viewMat = camera_.GetViewMatrix( );
viewMat = XMMatrixTranspose( viewMat );
d3dContext_->UpdateSubresource( worldCB_, 0, 0, &worldMat, 0, 0 );
d3dContext_->UpdateSubresource( viewCB_, 0, 0, &viewMat, 0, 0 );
d3dContext_->UpdateSubresource( projCB_, 0, 0, &projMatrix_, 0, 0 );
d3dContext_->VSSetConstantBuffers( 0, 1, &worldCB_ );
d3dContext_->VSSetConstantBuffers( 1, 1, &viewCB_ );
d3dContext_->VSSetConstantBuffers( 2, 1, &projCB_ );
FW1_RECTF rect = {1.0f, 1.0f, 1.0f, 1.0f};
//pFontWrapper->DrawString(d3dContext_, L"FPS:", NULL, 9.0f, &rect, 0xffffffff, NULL, NULL, FW1_NOFLUSH | FW1_ALIASED);
d3dContext_->DrawIndexed( 36, 0, 0 );
swapChain_->Present( 0, 0 );
}






