Writing Text

Started by
5 comments, last by TomKQT 14 years, 2 months ago
Hello I'm wondering how do you write text to the screen and by that I don't mean output text like the DrawText() function but something where I can write on the screen while the program in running.
Advertisement
Quote:I don't mean output text like the DrawText() function

Are you referring to GDI DrawText or ID3DXFont::DrawText?
Quote:something where I can write on the screen while the program in running

Do you mean during rendering, between BeginScene() and EndScene()?

You can use the GDI DrawText after DirectX rendering, and ID3DXFont::DrawText during rendering.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

I want something where the window would ask me my name and I would be able to put something. The reason is I want to make a chat client and this one of the things I need.
Since you posted to the DirectX/XNA forum, I assumed your question related to that.

Are you developing a Windows application? If so, why won't (GDI) DrawText work for you?

You can also use a dialog box.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

I'm making a game with a chat client and I'm using DirectX as my wrapper that's why I wrote it here just because DirectX may have a way of doing it.

I never heard of (GDI) DrawText if that works that would be great.

I just wanted to get on the right path, I'll look it up thanks.
You can use ID3DXFont to do what you need, but I'd recommend doing the input in plain Win32 with an edit control, and not using DirectX at all - you won't gain anything from using DirectX unless you want some sort of 3D graphics or high performance 2D going on.
Just to prevent misunderstandings, JimmyRose - you want a textbox (or "editbox"), where the user of your application can type something, right?
If you'll try to make this in DirectX, for example using ID3DXFont, you'll have to program all the logic related to textboxes - text cursor and its movement via left and right keys, character deleting via backspace and delete, character adding etc etc etc. ID3DXFont will just help you to render the actual text content of the textbox, nothing more.

If you use the Win32 edit control, you'll get everything done for you "automatically".

This topic is closed to new replies.

Advertisement