m_Font = new SlimDX.Direct3D9.Font(m_Device, 12, 0, FontWeight.Normal, 0, false, CharacterSet.Default,
Precision.Default, FontQuality.Antialiased | FontQuality.ClearTypeNatural | FontQuality.Proof, PitchAndFamily.DontCare,
"Arial");
//
BeginRender();
//
m_Font.DrawString(null, "Hello", 300, 300, Color.Red);
//
EndRender();
[SlimDX] Rendering Text Problem
I created a C# user control to render my DirectX screen, and I'm try to get the position of the text aligned with a 2D texture and the mouse position. So far, the texture and mouse position are correct, but the text is not getting positioned correctly.
After a few tests, I got the following results:
Expected (0,0), (100,100), (300,300)
Actual (0,0), (125,125), (375,375)
Adding a sprite interface to the DrawString function didn't seem to fix the problem, so I just left it out.
Any suggestions would be helpful.
Your back buffer is probably a different size to the client area of the window (about 25% smaller from the look of those numbers), which will cause D3D to stretch it to fit.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement