Hi and thanks, this solution works for me too, I had the same problem.

 
But then I get QWERTY minus caracters in the Agar GUI (I have an AZERTY 
keyboard). The solution I found is :
    * To put "SDL_EnableUNICODE(SDL_ENABLE);" somewhere in the SDL 
initialization
    * To not use "dev.data.key.ucs= (int)dev.data.key.ks;" but 
"ag_event.data.key.ucs = (int)sdlEvent->key.keysym.unicode;" in my custom event 
loop


It seem's it works fine now :)


J-C


________________________________
 De : Newt <[email protected]>
À : [email protected] 
Envoyé le : Mercredi 16 janvier 2013 1h49
Objet : Re: [Agar] AG_Textbox is not taking any input
 
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
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html

Reply via email to