Sign in to follow this  
clarkm2

[SlimDX] Rendering Text Problem

Recommended Posts

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.

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();


Share this post


Link to post
Share on other sites

Thanks, I didn't setup the backbuffer width/height for the PresentParameters object. In several C# tutorials this was not defined, so for some reason I thought it was defined when I created the device given the user control handle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this