我正在尝试将文本叠加到DirectX游戏中,我在互联网上找到了FontWrapper。 链接:https://fw1.codeplex.com/
我添加了头文件FW.h
并制作了Main.cpp
代码:
#include "FW.h"
void drawText(ID3D11Device *pDevice, ID3D11DeviceContext *pContext) {
IFW1Factory *pFW1Factory;
HRESULT hResult = FW1CreateFactory(FW1_VERSION, &pFW1Factory);
IFW1FontWrapper *pFontWrapper;
hResult = pFW1Factory->CreateFontWrapper(pDevice, L"Arial", &pFontWrapper);
pFontWrapper->DrawString(
pContext,
L"Hello World",// String
128.0f,// Font size
100.0f,// X position
50.0f,// Y position
0xff0099ff,// Text color, 0xAaBbGgRr
0// Flags (for example FW1_RESTORESTATE to keep context states unchanged)
);
pFontWrapper->Release();
pFW1Factory->Release();
}
之后我收到这些错误: Error that i get
PS:我正在使用Visual Studio 2012和Main.cpp中的代码,我从他们展示样本的官方网站上复制了它。 如果您不知道如何解决这个问题,那么请告诉我如何在directX游戏上叠加文本,只需要一点文字,然后我会完成剩下的工作。
提前致谢。 :)