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&nbsp; really need, go and make a simple thing for you the fits your need. It&#39;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&#39;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>&nbsp;&nbsp;&nbsp; # Constructor<br>&nbsp;&nbsp;&nbsp; def __init__(self, people):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.show = 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.shift = 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.msg
 = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.whisper = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.text = 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.people = people<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.lower_keys = pygame.image.load(&quot;pixmaps/keyboard-lower.png&quot;)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.upper_keys
 = pygame.image.load(&quot;pixmaps/keyboard-upper.png&quot;)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.keymap1 = ((&quot;q&quot;, &quot;w&quot;, &quot;e&quot;, &quot;r&quot;, &quot;t&quot;, &quot;y&quot;, &quot;u&quot;, &quot;i&quot;, &quot;o&quot;, &quot;p&quot;, &quot;[&quot;, &quot;]&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;),
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&quot;a&quot;, &quot;s&quot;, &quot;d&quot;, &quot;f&quot;, &quot;g&quot;, &quot;h&quot;, &quot;j&quot;, &quot;k&quot;, &quot;l&quot;, &quot;;&quot;, &quot;`&quot;, &quot;&#39;&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;),
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&quot;z&quot;, &quot;x&quot;, &quot;c&quot;, &quot;v&quot;, &quot;b&quot;, &quot;n&quot;, &quot;m&quot;, &quot;,&quot;, &quot;.&quot;, &quot;?&quot;, &quot;!&quot;, &quot;+&quot;, &quot;7&quot;, &quot;8&quot;, &quot;9&quot;),
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot;-&quot;, &quot;0&quot;, &quot;=&quot;))
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.keymap2 = ((&quot;Q&quot;, &quot;W&quot;, &quot;E&quot;, &quot;R&quot;, &quot;T&quot;, &quot;Y&quot;, &quot;U&quot;, &quot;I&quot;, &quot;O&quot;, &quot;P&quot;, &quot;{&quot;, &quot;}&quot;, &quot;!&quot;, &quot;@&quot;, &quot;#&quot;),
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&quot;A&quot;, &quot;S&quot;, &quot;D&quot;, &quot;F&quot;, &quot;G&quot;, &quot;H&quot;, &quot;J&quot;, &quot;K&quot;, &quot;L&quot;, &quot;:&quot;, &quot;\&quot;&quot;, &quot;/&quot;, &quot;$&quot;, &quot;%&quot;, &quot;^&quot;),
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&quot;Z&quot;, &quot;X&quot;, &quot;C&quot;, &quot;V&quot;, &quot;B&quot;, &quot;N&quot;, &quot;M&quot;, &quot;&lt;&quot;, &quot;&gt;&quot;, &quot;?&quot;, &quot;~&quot;, &quot;\\&quot;, &quot;&amp;&quot;, &quot;*&quot;, &quot;(&quot;),
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot;_&quot;, &quot;)&quot;, &quot;+&quot;))
<br><br>&nbsp;&nbsp;&nbsp; # Create text<br>&nbsp;&nbsp;&nbsp; def create_text(self):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if self.msg != &quot;&quot;:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.text = font.render(self.msg, 1, (255, 255, 255))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if self.text.get_width() &gt; 484:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
self.text = self.text.subsurface(self.text.get_width() - 484, 0, 484, self.text.get_height())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.text = 0<br><br>&nbsp;&nbsp;&nbsp; def set_whisper(self, name):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.show = 1<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.whisper
 = name<br><br>&nbsp;&nbsp;&nbsp; # Update keyboard state<br>&nbsp;&nbsp;&nbsp; def update(self, event):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if event.type == KEYDOWN and event.key == K_RETURN:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.whisper = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.show = not self.show
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif self.show and event.type == MOUSEBUTTONDOWN:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x, y = pygame.mouse.get_pos()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if x &gt;= 7 and x &lt; 472 and y &gt;= 347 and y &lt; 471:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x = (x - 7) / 31<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; y = (y - 347) / 31<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if x == 0 and y == 3:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.shift = not self.shift<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if self.shift:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.msg
 += self.keymap2[y][x]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.msg += self.keymap1[y][x]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.create_text()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x &gt;= 472 and x &lt; 505 and y &gt;= 347 and y &lt; 378:
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.msg = self.msg[:-1]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.create_text()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x &gt;= 472 and x &lt; 505 and y &gt;= 378 and y &lt; 441 and self.msg.strip() != &quot;&quot;:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.people.msg_me
(self.msg, self.whisper)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.show = 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.text = 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.msg = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.whisper = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x &gt;= 472 and x &lt; 505 and y &gt;= 441 and y &lt; 471:
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.whisper = &quot;&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.show = not self.show<br><br>&nbsp;&nbsp;&nbsp; # Draw keyboard<br>&nbsp;&nbsp;&nbsp; def draw(self):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if self.show:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if self.shift:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; map.blit
(self.upper_keys, (0, 302))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; map.blit(self.lower_keys, (0, 302))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if self.text:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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> &lt;<a href="mailto:klaus@rotters.de">klaus@rotters.de</a>&gt; wrote:<br>Kees Jongenburger wrote:<br>&gt; I have been asking<br>&gt; 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&#39;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 &quot;displaying a text&quot;-function (sfont.c)<br>for it. And so on. This all can be packed in a function like &quot;char *SDL_EnterText()&quot;.<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&#39;t need to enter text during&nbsp; 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> &lt;<a href="mailto:kees.jongenburger@gmail.com">kees.jongenburger@gmail.com
</a>&gt; 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> &lt;
<a href="mailto:klaus@rotters.de">klaus@rotters.de</a>&gt; wrote:<br>&gt; Kees Jongenburger wrote:<br>&gt; &gt; I have been asking<br>&gt; &gt; around but did not find a simple pluggable virtual keyboard for sdl.<br>&gt;<br>
&gt; This is IMHO a very simple problem. Just a quick guess: You have to draw a nice keyboard,<br>&gt; export it to BMP and load it with SDL_LoadBMP(). Then you display (blit) it with<br>&gt; SDL_BlitSurface(). Don&#39;t forget to update the screen with SDL_UpdateRects(). Then you can
<br>&gt; SDL_WaitEvent() to wait for SDL_MOUSEBUTTONDOWN events. You just need a table<br>&gt; which contains the x and y coords of our virtual keyboard to decode coords to the key<br>&gt; pressed. Of course you should handle shift, delete and something else. The decoded char
<br>&gt; can now be displayed, you probably need some kind of &quot;displaying a text&quot;-function (sfont.c)<br>&gt; for it. And so on. This all can be packed in a function like &quot;char *SDL_EnterText()&quot;.<br>&gt;
<br>&gt; An other problem would be to incoperate such a virtual SDL keyboard to the large number of<br>&gt; different SDL-GUI toolkits.<br>&gt;<br>&gt; For the most number of action games, you don&#39;t need to enter text during&nbsp;&nbsp;game play. Its
<br>&gt; 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&nbsp;&nbsp;Handful of nothing<br><a href="http://www.marceloeduardo.com">http://www.marceloeduardo.com</a><br>