Advertisement Jump to content
Sign in to follow this  
voducvinh

GUI-Textbox in DirectX

This topic is 2713 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

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;
}


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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!