Font Problem?!?

Started by
1 comment, last by drunkentiger007 22 years, 9 months ago
I know the answer is probably very simple and Im just a moron for not knowing it but... Why does the following:
  

void CDirectX::DrawFont()
{
	char text[6] = "Hello";
	LPCSTR *my_text;
	my_text = &text

	D3DXCreateFont( g_pDevice, hFont, &ppFont );
	ppFont->DrawTextA( *my_text, -1, NULL, DT_CENTER, D3DCOLOR_XRGB(100, 100, 100) );
}
  
Give this error: error C2440: ''='' : cannot convert from ''char (*)[6]'' to ''const char ** '' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast This is the function which I created to test fonts. Thanks alot, Kevin
Advertisement
the variable name for an array is a pointer to the start of the array. so change to the following line:

my_text = text;

ie without the &
HenryLecturer in Computer Games TechnologyUniversity of Abertay DundeeScotlandUK
In your example you don't need my_text at all. Just hand text to DrawTextA.

Edited by - xstreme2000 on June 28, 2001 6:15:56 AM

This topic is closed to new replies.

Advertisement