Re: [sdljava-users] guichan sdlinput - most key not handled
Status: Beta
Brought to you by:
ivan_ganza
From: Rainer K. <ar...@gm...> - 2005-07-26 10:42:43
|
Ivan Z. Ganza wrote: > Hi David, > > Welcome to open source ;-) > > I think you have to actually enable unicode by calling > SDLEvent.enableUNICODE(1) -- I wonder if that fixes the problem? > > The question remains if we should assume unicode or what the best thing > to do here is. We can actually query if UNICODE is enabled so maybe do > something based on if it is or isn't set. > > Rainer wrote the wonderfull guichan port. Any thoughts what the best > thing to do here is Rainer? > > -Ivan/ The demos call SDLEvent.enableUNICODE(1) explicitly, and the text input fields and areas are working there, so I assume that it is the right thing to do. I didn't have much time to work on the game for which I ported guichan originally so I don't have too much experience with it either (ironically :)). Rainer > David Lareau wrote: > > >>Hi, >> >>I've tried to use a guichan TextField but found that most of the key >>input aren't handled. The special cases like the arrows or the delete >>key work fine, but the common letters and numbers aren't recognized as >>input. The Key event generated by the keypressed has a keyvalue of 0. >> >>I believe the problem is in the sdljavax.guichan.sdl.SDLInput >>convertKeyCharacter method. The first block seems to handle those >>numbers and letters but really doesn't. >> >>private Key convertKeyCharacter(SDLKeyboardEvent keysym) { >>int value = 0; >> >>if (keysym.getUnicode() < 255) { >> value = keysym.getUnicode(); >>} >> >>switch (keysym.getSym()) { >> case SDLKey.SDLK_TAB : >> value = Key.TAB; >> break; >> >> ... >> >>} >> >>... >> >>} >> >> >>I've added the following in the switch statement, and it fixes the >>problem: >>case SDLKey.SDLK_a: >> value = (int)'a'; >> break; >>... for each letter and number >> >> >>I'm not sure if that's the best solution. Perhaps someone might know >>why the getUnicode() method returns 0. I'm using Windows XP by the >>way, I don't know if it matters. >> >>Anyhow, yay my first somewhat-contribution to an open source project! >> >>Cheers, >>David Lareau >> >> >> >> >>------------------------------------------------------- >>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies >>from IBM. Find simple to follow Roadmaps, straightforward articles, >>informative Webcasts and more! Get everything you need to get up to >>speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click >>_______________________________________________ >>sdljava-users mailing list >>sdl...@li... >>https://lists.sourceforge.net/lists/listinfo/sdljava-users > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users > > |