Direct2D 동적변수(?) 텍스트로 그리기

|


일반적 사용법
	static const WCHAR text[] = L"some text";

	m_pRenderTarget->DrawText(
		text,
		ARRAYSIZE(text) - 1,
		m_pTextFormat,
		D2D1::RectF(
			SCREEN_WIDTH/2 - 70.0f,
			SCREEN_HEIGHT/2 - 40.0f,
			SCREEN_WIDTH/2 + 70.0f,
			SCREEN_HEIGHT/2 + 40.0f),
		m_pWhiteBrush
		);



char, float 등 다른 자료형 변수를 출력할 때
	float degree = some_value/another_value + other_value;

	char buff[BUFF_SIZE] = {'0'};
	sprintf_s(buff, "Degree: %f", degree);		// #include <sstream>

	WCHAR szText[BUFF_SIZE] = {'0'};

	MultiByteToWideChar(CP_ACP, 0, buff, -1, szText, BUFF_SIZE);

	m_pRenderTarget->DrawText(
		szText,
		ARRAYSIZE(szText) -1,
		m_pTextFormat,
		rect,
		m_pTextBrush
		);


참고>MultiByteToWideChar
And
prev | 1 | 2 | 3 | 4 | ··· | 47 | next