【发布时间】:2016-08-01 18:06:28
【问题描述】:
我正在尝试通过 TextOut 移动文本
这里是代码
IDXGISurface1* g_pSurface1 = NULL;
HRESULT hr = pSwapChain->GetBuffer(0, __uuidof(IDXGISurface1), (void**)&g_pSurface1);
if (SUCCEEDED(hr))
{
hr = g_pSurface1->GetDC(FALSE, &hdc);
if (SUCCEEDED(hr))
{
TextOut(hdc, pos.x, pos.y, L"DXGI's GDI text output works", strlen("DXGI's GDI text output works") + 1);
g_pSurface1->ReleaseDC(NULL);
}
else
{
MessageBox(0,0,0,0);
}
g_pSurface1->Release();
}
else
{
MessageBox(0,0,0,0);
}
pDevContext->OMSetRenderTargets(1, &pRenderTarget, pDepth);
在哪里
pos.x and pos.y are mouse coordinates
当我移动文本或子窗口时GDI and DirectX rendering
【问题讨论】:
-
你为什么使用 GDI 而不是 DirectWrite?
-
因为我不能使用 DirectWrite
-
为什么不呢?您的问题不清楚为什么要使用较旧的 GDI 互操作?
-
一般我想用Qt,所以DirectWrite不是跨平台的。
-
好的,但是 GDI 也不是跨平台的。