<br><br><div class="gmail_quote">On Thu, Jan 26, 2012 at 6:39 PM, Andreas Raab <span dir="ltr"><<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<div bgcolor="#FFFFFF" text="#000000">
<br>
On 1/26/2012 22:29, Guillermo Polito wrote:
<blockquote type="cite">
<pre> </pre>
<br>
<fieldset></fieldset>
<br>
Hi!<br>
<br>
<div class="gmail_quote">On Thu, Jan 26, 2012 at 4:41 PM, Andreas
Raab <span dir="ltr"><<a href="mailto:andreas.raab@gmx.de" target="_blank">andreas.raab@gmx.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<div> <br>
<br>
On 1/26/2012 15:43, Guillermo Polito wrote:
<blockquote type="cite">
<pre> </pre>
<br>
<fieldset></fieldset>
<br>
<div>The question is:</div>
<div><br>
</div>
<div>Should KeyDown, KeyUp and KeyChar events for the same
key produce the same keyCode? I think yes. Because the
keyCode indicates the key pressed in the keyboard.
Doesn't it?</div>
</blockquote>
It does. Which is precisely the reason why it *can't*
produce different values when you press the shift key with
it.<br>
</div>
</blockquote>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> The KEY you are
pressing does not change depending on the modifier; your OS
decides that the combination of the Shift key and the P key
produces an uppercase P character. Similarly to the OS
deciding that (when using dead keys for example) pressing
the accent key followed by the a key produces an accented a.
Would you expect the keyDown value for the accented a to
change as well? This way lies complete madness.<br>
</div>
</blockquote>
<div><br>
But you're talking about the keychar event and I've not
modified at all it's behavior :/. And yes, I agree I should
not do any conversion on KeyUp and KeyDown :).<br>
</div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <br>
Maybe you don't understand what these events are used for.
Consider you are writing a game and you're using shift and
control key for primary and secondary weapon action. Would
you expect that the person writing the game needs to handle
all of the various control and shift key combos in order to
find out that the user pressed the a key to move forward?<br>
</div>
</blockquote>
<div><br>
Oh, yes I do understand. Maybe I didn't explain me fine,
sorry.<br>
<br>
The main problem is that I want keycodes to be the same
through the three platforms (unix, mac and windows). And for
that, I have to do a mapping somewhere (this piece of code I
wrote today was to play and see how it behaves, because the
codes are to be defined :) ).<br>
<br>
So, I thought those conversions could be done through the <b>keymap</b>
array.<br>
Maybe that's not the way to do the mapping, but <i>the</i>
mapping should be done somewhere.<br>
</div>
</div>
</blockquote>
<br>
The simplest place to do the mapping is inside the image.<br></div></blockquote><div><br>But it's not about the simplest, it's about the better. The Vm should abstract the image from these things :/. Tomorrow Dimitry adds support for android specific keys, or I do it for Gtk and etc... and polluting the image with all that seems unnecesary.<br>
<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
Cheers,<br>
- Andreas<br></div></blockquote><div><br>Cheers,<br>Guille <br></div></div>