Hei all<br><br>We were doing a very simple prototype for a cross platform python game (same code on s60, 770 and desktop) , and at least in the pygame(python + sdl) it was so simple to make the bitmap solution (even with cap and simbols) take less then a couple of hours to prototype (not clean coding etc)
<br><br>Of course I cannot assure that we supported languages like hungarian, or even our brasilian portuguese, but for the game input was ok and made in just one day.<br><br>So I agree with jacub, if you really need, go and make a simple thing for you the fits your need. It's not a problem at all.
<br><br>I had a lot more problems with the DOOM, that needed more visual controls then a keyboard : / but at least was playable in the end and showed something :<br>maybe you don't need a full keyboard =)<br><br><a href="http://www.marceloeduardo.com/blog/wp-content/uploads/2007/01/picture-8.png">
http://www.marceloeduardo.com/blog/wp-content/uploads/2007/01/picture-8.png</a><br><br><br>Together goes the keyboard for the demo in python (you can bring it easily to C)<br><br>Obs : this was a fast prototype of a non-python developer =) so do not look at with demanding eyes =)
<br><br>BR<br><br>Marcelo Oliveira<br>INdT - Recife<br><a href="http://www.marceloeduardo.com">www.marceloeduardo.com</a><br><br>---------<br>( <a href="http://www.marceloeduardo.com/blog/wp-content/uploads/2007/01/2.png">
http://www.marceloeduardo.com/blog/wp-content/uploads/2007/01/2.png</a> )<br>class KeyBoard:<br><br> # Constructor<br> def __init__(self, people):<br> self.show = 0<br> self.shift = 0<br> self.msg
= ""<br> self.whisper = ""<br> self.text = 0<br> self.people = people<br> self.lower_keys = pygame.image.load("pixmaps/keyboard-lower.png")<br> self.upper_keys
= pygame.image.load("pixmaps/keyboard-upper.png")<br> self.keymap1 = (("q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "1", "2", "3"),
<br> ("a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "`", "'", "4", "5", "6"),
<br> ("z", "x", "c", "v", "b", "n", "m", ",", ".", "?", "!", "+", "7", "8", "9"),
<br> (" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "-", "0", "="))
<br> self.keymap2 = (("Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "{", "}", "!", "@", "#"),
<br> ("A", "S", "D", "F", "G", "H", "J", "K", "L", ":", "\"", "/", "$", "%", "^"),
<br> ("Z", "X", "C", "V", "B", "N", "M", "<", ">", "?", "~", "\\", "&", "*", "("),
<br> (" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "_", ")", "+"))
<br><br> # Create text<br> def create_text(self):<br> if self.msg != "":<br> self.text = font.render(self.msg, 1, (255, 255, 255))<br> if self.text.get_width() > 484:<br>
self.text = self.text.subsurface(self.text.get_width() - 484, 0, 484, self.text.get_height())<br> else:<br> self.text = 0<br><br> def set_whisper(self, name):<br> self.show = 1<br> self.whisper
= name<br><br> # Update keyboard state<br> def update(self, event):<br> if event.type == KEYDOWN and event.key == K_RETURN:<br> self.whisper = ""<br> self.show = not self.show
<br> elif self.show and event.type == MOUSEBUTTONDOWN:<br> x, y = pygame.mouse.get_pos()<br> if x >= 7 and x < 472 and y >= 347 and y < 471:<br> x = (x - 7) / 31<br>
y = (y - 347) / 31<br> if x == 0 and y == 3:<br> self.shift = not self.shift<br> else:<br> if self.shift:<br> self.msg
+= self.keymap2[y][x]<br> else:<br> self.msg += self.keymap1[y][x]<br> self.create_text()<br> elif x >= 472 and x < 505 and y >= 347 and y < 378:
<br> self.msg = self.msg[:-1]<br> self.create_text()<br> elif x >= 472 and x < 505 and y >= 378 and y < 441 and self.msg.strip() != "":<br> self.people.msg_me
(self.msg, self.whisper)<br> self.show = 0<br> self.text = 0<br> self.msg = ""<br> self.whisper = ""<br> elif x >= 472 and x < 505 and y >= 441 and y < 471:
<br> self.whisper = ""<br> self.show = not self.show<br><br> # Draw keyboard<br> def draw(self):<br> if self.show:<br> if self.shift:<br> map.blit
(self.upper_keys, (0, 302))<br> else:<br> map.blit(self.lower_keys, (0, 302))<br> if self.text:<br> map.blit(self.text, (14, 315))<br><br><br><br><br><br><br>On Jan 26, 2007, at 6:09 PM, Kees Jongenburger wrote:
<br><br>On 1/26/07, <a href="mailto:klaus@rotters.de">klaus@rotters.de</a> <<a href="mailto:klaus@rotters.de">klaus@rotters.de</a>> wrote:<br>Kees Jongenburger wrote:<br>> I have been asking<br>> around but did not find a simple pluggable virtual keyboard for sdl.
<br><br>This is IMHO a very simple problem. Just a quick guess: You have to draw a nice keyboard,<br>export it to BMP and load it with SDL_LoadBMP(). Then you display (blit) it with<br>SDL_BlitSurface(). Don't forget to update the screen with SDL_UpdateRects(). Then you can
<br>SDL_WaitEvent() to wait for SDL_MOUSEBUTTONDOWN events. You just need a table<br>which contains the x and y coords of our virtual keyboard to decode coords to the key<br>pressed. Of course you should handle shift, delete and something else. The decoded char
<br>can now be displayed, you probably need some kind of "displaying a text"-function (sfont.c)<br>for it. And so on. This all can be packed in a function like "char *SDL_EnterText()".<br><br>An other problem would be to incoperate such a virtual SDL keyboard to the large number of
<br>different SDL-GUI toolkits.<br><br>For the most number of action games, you don't need to enter text during game play. Its<br>enough if you do this on startup, and therefor you can use a Maemo startup window.<br>
This sounds good and easy to me.The bmp can even have alpha! and<br>perhaps the code is already there?<br><br><a href="http://www.mulliner.org/nokia770/feed/fotos/n770_xkbdbthid_02.png">http://www.mulliner.org/nokia770/feed/fotos/n770_xkbdbthid_02.png
</a><br>greetings<br><br>keesj<br>_______________________________________________<br>maemo-developers mailing list<br><a href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</a><br><a href="https://maemo.org/mailman/listinfo/maemo-developers">
https://maemo.org/mailman/listinfo/maemo-developers</a><br><br><br><div><span class="gmail_quote">On 1/26/07, <b class="gmail_sendername">Kees Jongenburger</b> <<a href="mailto:kees.jongenburger@gmail.com">kees.jongenburger@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 1/26/07, <a href="mailto:klaus@rotters.de">klaus@rotters.de</a> <
<a href="mailto:klaus@rotters.de">klaus@rotters.de</a>> wrote:<br>> Kees Jongenburger wrote:<br>> > I have been asking<br>> > around but did not find a simple pluggable virtual keyboard for sdl.<br>><br>
> This is IMHO a very simple problem. Just a quick guess: You have to draw a nice keyboard,<br>> export it to BMP and load it with SDL_LoadBMP(). Then you display (blit) it with<br>> SDL_BlitSurface(). Don't forget to update the screen with SDL_UpdateRects(). Then you can
<br>> SDL_WaitEvent() to wait for SDL_MOUSEBUTTONDOWN events. You just need a table<br>> which contains the x and y coords of our virtual keyboard to decode coords to the key<br>> pressed. Of course you should handle shift, delete and something else. The decoded char
<br>> can now be displayed, you probably need some kind of "displaying a text"-function (sfont.c)<br>> for it. And so on. This all can be packed in a function like "char *SDL_EnterText()".<br>>
<br>> An other problem would be to incoperate such a virtual SDL keyboard to the large number of<br>> different SDL-GUI toolkits.<br>><br>> For the most number of action games, you don't need to enter text during game play. Its
<br>> enough if you do this on startup, and therefor you can use a Maemo startup window.<br>This sounds good and easy to me.The bmp can even have alpha! and<br>perhaps the code is already there?<br><br><a href="http://www.mulliner.org/nokia770/feed/fotos/n770_xkbdbthid_02.png">
http://www.mulliner.org/nokia770/feed/fotos/n770_xkbdbthid_02.png</a><br>greetings<br><br>keesj<br>_______________________________________________<br>maemo-developers mailing list<br><a href="mailto:maemo-developers@maemo.org">
maemo-developers@maemo.org</a><br><a href="https://maemo.org/mailman/listinfo/maemo-developers">https://maemo.org/mailman/listinfo/maemo-developers</a><br></blockquote></div><br><br clear="all"><br>-- <br>Marcelo Eduardo Moraes de Oliveira
<br>-----------------------------------------------------<br>Just Handful of nothing<br><a href="http://www.marceloeduardo.com">http://www.marceloeduardo.com</a><br>