displaying text

Started by
14 comments, last by phil67rpg 11 years, 5 months ago
I am trying to display some text using dx 9 and c++.here is the code I am using.
void DisplaySomeText()

{
D3DCOLOR fontColor = D3DCOLOR_XRGB(255,0,0);
RECT rct;
rct.left=200;
rct.right=600;
rct.top=20;
rct.bottom =40;
g_Font-> DrawText(NULL,"Hello World",-1,&rct,0,fontColor);
}
Advertisement
Do you have a question?
yes in the following code, I am trying to pass in a string to be displayed on the screen.

void DisplaySomeText(string text)
{
D3DCOLOR fontColor = D3DCOLOR_XRGB(255,0,0);
RECT rct;
rct.left=200;
rct.right=600;
rct.top=20;
rct.bottom =40;
g_Font-> DrawText(NULL,text,-1,&rct,0,fontColor);
}

the text field in the drawtext line is giving me an error.
It's funny, but error messages often tell you what the problem is. While I can probably guess what your problem is from the code, you should probably examine the error message carefully and try to understand what it means. Try to break it down into pieces and see what parts you can understand and what parts you don't understand. And then ask a specific question about the parts you don't understand.
well I did some research and found the field I am working on is a pointer to a string to draw.I will do more research.
where is a good tutorial for displaying text on the screen using dx9 and c++
I am getting a runtime error with this line of code.
g_font-> DrawText(NULL,"HelloWorld",-1,&rct,0,fontColor);
everything else appears ok
let me know if you need more code.

I am getting a runtime error with this line of code.
g_font-> DrawText(NULL,"HelloWorld",-1,&rct,0,fontColor);
everything else appears ok
let me know if you need more code.


POST THE FRIGGING ERROR PHIL.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

I am SORRY beer let me get back to you.
here is the error I am getting Unhandled exception at 0x00C93488 in pong.exe: 0xC0000005: Access violation reading location 0x00000000.

This topic is closed to new replies.

Advertisement