• Advertisement

Archived

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

-ve Coordinates of the screen

This topic is 5061 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 want the 2D text in DirectX pass through the left side of the screen is there any way in DirectX to solve that problem. Thing is that i am scrolling a text from right to left when the first character matches the 0 coordinate of the screen the text repeats again from the starting instead of crossing the zero value of the screen. void CGame::RenderText() { //Draw some text at the top of the screen showing stats char buffer[255]; DWORD dwDuration = (timeGetTime() - m_dwStartTime) / 1000; static float d1 = 800.00; d1 -= 3.00; sprintf(buffer, "The Contineous Scrolling Text in DirectX The Contineous Scrolling Text in DirectX"); m_pFont->DrawText(buffer, d1, 310, D3DCOLOR_XRGB(255, 255, 255)); if (d1< -100.00) d1 = 800.00; } Muhammad Ali Lodhi

Share this post


Link to post
Share on other sites
Advertisement
Can you clarify your problem a little bit? Is it that the text starts to wrap around back to the right side of the screen before it has fully moved through the left? If so, then:

quote:
Original post by alitheone10
if (d1< -100.00)
d1 = 800.00;
}


Maybe -100.0f isn''t far enough off the left side for the text. It probably isn''t, since your text string is pretty big. If you''re using a fixed-width font, you can determine how many pixels wide the string is, so that it will disapear at the correct time.
if( d1 < 0.0f - (fontWidth * numChars) )
d1 = 800.0f;




Dustin Franklin
Mircrosoft DirectX MVP

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
thanx


but u have mentioned one thing here fixed width font

can u plz tell me abt this?
and how can i get pixels wide?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Anonymous Poster
thanx


but u have mentioned one thing here fixed width font

can u plz tell me abt this?
and how can i get pixels wide?


Thing is that as soon as first character of the string
touches the 0 coordinate of the screen the whole string disappear. This is the main problem.

Share this post


Link to post
Share on other sites

  • Advertisement