This site requires JavaScript, please enable it in your browser!
Greenfoot back
hector
hector wrote ...

2014/1/5

Problem with German Umlauts

hector hector

2014/1/5

#
Hello, I followed the book's piano example which uses the Greenfoot.isKeyDown(String) method. This works fine for e.g. Greenfoot.isKeyDown("a") but fails completely when testing for non-ascii characters like Greenfoot.isKeyDown("ß") (I hope you can see the German ß). I've tried to understand the source code with limited success. Is there a workaround or possibly a prospective patch? BTW: Google directs me towards and . Unfortunately both articles are in German and have not yet received any reply. Regards, Martin
erdelf erdelf

2014/1/5

#
can u work with the getKey method`? I just tested it and the getKey method returns the right german characters
hector hector

2014/1/5

#
Maybe I don't understand Greenfoot.getKey() completely. Issuing
System.out.println("key=" + Greenfoot.getKey());
yields null. I've added a while loop to wait for changes an can see the right character indeed. But I do not have any clue how to use this method testing for a key pressed state inside act(). The method
boolean isKeyDown(int keycode)
in greenfoot.gui.input.KeyboardManager might do the trick but this is an instance method and using
WorldHandler.getInstance().getKeyboardManager().isKeyDown(...);
is rather clumsy if it works at all.
erdelf erdelf

2014/1/5

#
the getKey method returns the last key pressed since the last method call, so in a while loop might not return something regularily
You need to login to post a reply.