How do I erase the font once it's done it's purpose? I've checked the web and it only shows how to put up font but not how to erase it so I can put up new font in it's place. Also if you have an easier way to do what I am doing I would love to hear it. NOTE: I am using C++ visual Studio 2008 with the March 2009 Direct x sdk.

here's what I got.

// Set up story screen display
			// Text color (red)
			D3DCOLOR fontColor = D3DCOLOR_XRGB(0,0,255); 

			// story string
			string game_story = "Welcome brave traveler.";
			string story2 = "The kingdom of Thorinhold is in great peril!";
			string story3 = "Monsters roam the land and the lovely Princess Sara has been kidnapped";
			string story4 = "by the evil Vampire Lord Radu.";
			string story5 = "You must help the brave Knight Sir Delrin rescue her";
			string story6 = "and end the Vampire Lord's reign of terror!";
			string story7 = "Press space or the left mouse button to continue!";
	   
 
			// Rectangle for where it will be
			RECT story;
			story.left = 180;
			story.right = 640;
			story.top = 70;
			story.bottom = story.top + 20;	

			// Draw the text
			m_font->DrawText(NULL, game_story.c_str(), -1, &story, 0, fontColor);


 
			story.left = 140;
			story.top = 90;
			story.bottom = story.top + 20;
			m_font->DrawText(NULL, story2.c_str(), -1, &story, 0, fontColor);

			story.left = 40;
			story.top = 110;
			story.bottom = story.top + 20;
			m_font->DrawText(NULL, story3.c_str(), -1, &story, 0, fontColor);

			story.left = 140;
			story.top = 130;
			story.bottom = story.top + 20;
			m_font->DrawText(NULL, story4.c_str(), -1, &story, 0, fontColor);

			story.left = 140;
			story.top = 150;
			story.bottom = story.top + 20;
			m_font->DrawText(NULL, story5.c_str(), -1, &story, 0, fontColor);


			story.left = 140;
			story.top = 170;
			story.bottom = story.top + 20;
			m_font->DrawText(NULL, story6.c_str(), -1, &story, 0, fontColor);




			story.left = 140;
			story.top = 190;
			story.bottom = story.top + 20;
			m_font->DrawText(NULL, story7.c_str(), -1, &story, 0, fontColor);







//When I press space I want to the font to disappear.
if (Key_Down(DIK_SPACE) || Mouse_Button(0))
							{
		   Hero.x = 300;
		   Hero.y = 50;
		   StoryScreen = NULL;  
		  
		   game_story.erase(NULL);
		   story2.erase(NULL);
		   story3.erase(NULL);
		   story4.erase(NULL);
		   story5.erase(NULL);
		   story6.erase(NULL);
		   story7.erase(NULL);

			 
            
}

Recommended Answers

All 2 Replies

If I understood you correctly,
if you want to change font of text, just use global variable of font color.
And when you press the space bar, change your font to default and call repaint method, or send WM_PAINT message to the main window.

Thanks I didn't think of that before. But I would still like a method of deleting font. For now I am just changing Game states to get rid of the font. But I would like a way to actually deleting the text so when I have dialog between the hero and NPCs the text doesn't stay around on the screen even though it's painted over. Just a pet peeve of mine I guess. I think for now I will try Game state for the NPC dialog and that doesn't work I'll do your WM_Paint suggestion. Thanx for replying!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.