Game Development Community

1.4CR2 unicode not work correct

by David Tan · in Torque Game Engine · 09/12/2005 (7:35 pm) · 45 replies

I notice that 1.4CR2 support unicode,but when I input chinese,it display both the key and the character,and the order is reverse when i input phrase .anyone has same error?
down.eptank.2288.org/disp.jpg
Unicode fix for chinese input has done!
Page«First 1 2 3 Next»
#41
09/02/2007 (12:01 am)
I am also trying to input Chinese characters into TGE 1.5.2 and I have searched all these forums and read it all very carefully for about 5 hours and I still don't know how to do this. The link to EddieTorque's solution doesn't work and I have no clue which file that big section of code just 5 posts ago is supposed to go into. Could somebody help me? (By the way, I am still very new to Torque) Thanks.
#42
09/02/2007 (12:20 am)
Something else I don't know how to do is how to use the langc tool. Would somebody tell me where to begin to use that?
#43
01/17/2008 (12:56 am)
We're using TGE1.5.2, and we can display Chinese characters well. But for text edit GUI, we can't input any chinese characters because even the IME window can't appear(press Ctrl+Space on my computer to bring up the IME window).

What's wrong? And when I copy some Chinese characters to the edit GUI, it just display some small box. I've tried the method David referred, but it doesn't work.

BTW, I can't download the files for Andy's solution(blog.csdn.net/EddieTorque/archive/2006/09/01/1152250.aspx), the files can't be downloaded. Do you have the file and please send to me? (zddong_cn@yahoo.com)

Thanks a lot,
#44
01/17/2008 (1:41 am)
You can download this file from this post:
www.torquewow.com/community/index.php?topic=103.0

Chinese Input Method
Author: Matrol/EddieTorque/Freeman-HK
#45
05/14/2008 (4:03 pm)
I've recently ran into this issue with TGB 1.7.3 beta1 and found this post very helpful, but not complete/uptodate, here are the changes that worked for me(note that it's similar to the above ones but with some slight changes):

All changes are in winWindow.cc

After the line:
Win32PlatState winState;
add:
static bool bComposingIME = false;

After
static void processKeyMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
add
if (bComposingIME)
      return;

After
case WM_IME_STARTCOMPOSITION:
      //         Con::printf("IME start comp");
add
bComposingIME = true;

After
case WM_IME_ENDCOMPOSITION:
   {
      //               Con::printf("OMG IME end comp");
add
bComposingIME = false;

Change
sgWinMessages.push_front(msg);
to
sgWinMessages.push_back(msg);

And lastly, a sneaky one that was preventing the characters from being added to textEdits:
under
static void processCharMessage( WPARAM wParam, LPARAM lParam )
after
event.action     = SI_MAKE;
add
event.modifier	= 0;

Also remember to change your fonts to something that actually has the characters you're trying to display or you will get squares instead, for example "MS PGothic" works for Japanese.



PS.: some further testing revealed that on some systems an extra character is added to textEdits when the user enters the IME composing mode, this block of code copied from a post above seems to solve it:

after
if ( !mgr || !mgr->isKeyboardActive() )
      {
         switch ( message )
         {
         case WM_KEYUP:
         case WM_SYSKEYUP:
         case WM_KEYDOWN:
         case WM_SYSKEYDOWN:
add
HKL hKL = GetKeyboardLayout( 0 );
			if(ImmIsIME( hKL ))
			{
				HIMC hIMC;
				DWORD dwSize;
				DWORD dwConversion, dwSentence;
				int nImeCursor;

				hIMC = ImmGetContext(winState.appWindow);
				ImmGetConversionStatus(hIMC, &dwConversion, &dwSentence);
				
				nImeCursor = ImmGetCompositionString( hIMC, GCS_CURSORPOS, NULL, 0 );
				ImmReleaseContext(winState.appWindow,hIMC);

				if(nImeCursor > 0)
					bComposingIME = true;

				switch(wParam)
				{				
					case VK_ESCAPE:
					case VK_RETURN:
					case VK_LEFT:
					case VK_RIGHT:
					case VK_DELETE:
					case VK_BACK:
						bComposingIME = false;
				}
			}
Page«First 1 2 3 Next»