Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

drunkentiger007

Font Problem?!?

This topic is 6206 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 &

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!