Jump to content
  • Advertisement


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


DirectDraw question

This topic is 6656 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''ll try to make this as simple as possible, its really not that difficult of a problem but I cant seem to figure it out I have a text file, I want to display on the screen in my DirectX program (ver 6.0). I want the text to scroll, displayed one character at a time. The only way to display text on the screen in DDraw that I know of is TextOut or DrawText and they take a LPCTSTR as the parameter, so TextOut("hi this is text") works, and TextOut(letter), letter being a char I read in, doesnt. What Ive tried to do is read in one character at a time and write that, but no matter what I cant get it to work because of what the functions take and because Im not too good with this stuff Hope I made my question simple enough, Id appreciate any input Thanks

Share this post

Link to post
Share on other sites
It could be you forgot to ''\0'' terminate the string. You must give a char pointer to the TextOut function.

Maybe this will work:

char Str[2] = { 0,0 };

// read char

Str[0] = ''a''; // orso


I think the LPCTSTR type can be explained as:
LP = long pointer (long comes from 32bit)
C = constant
T = zero terminated
STR = string

Share this post

Link to post
Share on other sites
Thanks for the reply
I did just that, the call

Draw_Text_GDI((LPCTSTR)Str, x,y, RGB(0,255,0), lpddsprimary);

results in error:
error C2665: ''Draw_Text_GDI'' : none of the 2 overloads can convert parameter 1 from type ''const char *''
Error executing cl.exe.

heres the function prototype:
int Draw_Text_GDI(char *text, int x,int y,int color, LPDIRECTDRAWSURFACE4 lpdds)

thats simpler I guess, when I typed the function out it said LPCTSTR, you know how vis c++ does that for you so you can see what to put in

Share this post

Link to post
Share on other sites
I''m guessing your using Lamothe''s function, right ?
Draw_Text_GDI() doesn''t recieve an LPCTSTR parameter, you should use Draw_Text_GDI() like this:
Draw_Text_GDI((char*)Str, x,y, RGB(0,255,0), lpddsprimary);
Should also work without the (char*), but just to be safe...

The road to success is always under construction

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!