Tejaswin Macharla <tejaswin.m@...> writes:

> 
> 
> Hi,
> 
> I am using Agar 1.4.0 with SDL. Below is the code which displays the 
> textbox, but I am not able to enter any text. If I hold alt and then 
> press keys, some weird characters are shown in the textbox. Other 
> than that whatever key I press, nothing comes in the textbox.
> 
> AG_Textbox *textbox;
> char name[100];
> textbox = AG_TextboxNew(boxVert5,0,"Testing: "); //boxVert5 is a AG_Box
> AG_TextboxSizeHintPixels (textbox, 100, 15);
> AG_TextboxBindUTF8(textbox, name, sizeof(name));
> 
> Can anyone suggest any solution for this?
> 
> Thanks in advance,
> Tejaswin.
> 
> 
> 
> _______________________________________________
> Agar mailing list
> Agar@...
> http://libagar.org/lists.html
> 

It probably due to the inserted SDL events polluting the agar event quene.. You 
should write your custom event loop to correct a bit of agar's event 
interpretation(please refer to `agar-
x.xx.x/demos/customeventloop/customeventloop.c' for more information).
In your event loop, you have to process the `key input' event like this:
....
 case AG_DRIVER_KEY_DOWN:
 case AG_DRIVER_KEY_UP:
      dev.data.key.ucs= (int)dev.data.key.ks;
      break;
....
  AG_ProcessEvent(NULL, &dev);
....
  Where `dev' is retrieved from the agar event quene.` dev.data.key.ucs= 
(int)dev.data.key.ks;' replace the misinterpreted Unicode character with the 
correctly interpreted ks.


_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html

Reply via email to