コード例 #1
0
int D9Draw::TextWidth(const wchar_t* text, unsigned long font) {
	ID3DXFont* nativeFont = reinterpret_cast<ID3DXFont*>(font);

	RECT sizeRect = { 0, 0, 0, 0 };
	nativeFont->DrawTextW(NULL, text, wcslen(text), &sizeRect, DT_CALCRECT, D3DCOLOR_XRGB(0, 0, 0));
	return sizeRect.right - sizeRect.left;
}
コード例 #2
0
void D9Draw::DrawTextW(const wchar_t* text, unsigned long font, util::Color color, util::Vector2 pos) {
	RECT tpos;
	tpos.left = (long)pos.x;
	tpos.top = (long)pos.y;

	ID3DXFont* nativeFont = reinterpret_cast<ID3DXFont*>(font);
	nativeFont->DrawTextW(0, text, wcslen(text), &tpos, DT_NOCLIP, color.GetD3DColor());
}