Sign in to follow this  
voducvinh

GUI-Textbox in DirectX

Recommended Posts

voducvinh    100
Hi everyone,

I am constructing the GUI system for my game. I code by C++ and DirectX9.

I have the problem that my textbox can not handle the other languages except English.

Could you please explain for me how can i solve it ?

Here is the Handle Keyboard function's code of My Textbox control.

[color="#0000ff"]bool UITextBox::HandleKeyboard( UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int len;
switch(uMsg)
{
case WM_KEYDOWN:
len = wcslen(m_strText);
if(wParam == VK_RETURN)
{
if(m_pCallbackEvent != NULL)
m_pCallbackEvent();
}
else if(wParam == VK_BACK)
{
if(len > 0)
m_strText[len - 1] = NULL;
}
else
{
if((wParam >= 'A' && wParam <= 'Z') || (wParam >= 'a' && wParam <= 'z'))
{
if((GetKeyState(VK_CAPITAL) & 0x01) || GetAsyncKeyState(VK_SHIFT))
m_strText[len] = wParam;
else
m_strText[len] = wParam - ('A' - 'a');
}
else if(wParam >= 32 && wParam <= 126)
{
m_strText[len] = wParam;
}
m_strText[len + 1] = NULL;
}

break;
}

return true;
}[/color]


I am just the beginner. So the more specific you explain, the more easier and grateful i feel.

Best Regards.

Share this post


Link to post
Share on other sites
IvicaKolic    325
One question:
How are you displaying text on a screen?
If you are using D3DX font class than supporting different languages makes sense because all the special letters can be displayed.
On the other hand, if you have custom font textures and you're "gluing" letters together before displaying it on the screen, then I suggest sticking with plain English and be happy with what you have now.

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