Jump to content
  • Advertisement

Archived

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

tyman

How to display text to a win32 API(?)...

This topic is 6939 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 can create basic windows(UI) and all but i don''t know how to print text to a window or allow input. Can anyone shed some light on this? -tyman (tron7475@hotmail.com)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Is this a console-application or just a normal Windows program?

In a Windows you´ll probably use some kind of control (editbox or whatever).

Share this post


Link to post
Share on other sites
I believe we use the Win32 API function DrawText() in our game. Not knowing what you do and do not know about Win32 Programming I''m gonna add a few pieces of information: it is a GDI function, so you must have access to a device context (DC) to use it, and if you are putting the text directly into a visible window, Windows does not do anything to prevent tearing (this is not an issue if you are rendering the text to a back buffer or off screen surface). Looking in my handy-dandy little Windows 95 API pocket reference the prototype is:

int DrawText(HDC hdc, LPCTSTR lpszStr, int cchStr, LPRECT lprc, UINT wFormat);

I believe that the ''int'' parameters are now probably some depricated and you should instead use some type defined by windows in the Platform SDK, but you will find all of this is you just look up information on the Windows API function DrawText().

Good Luck.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!