Okay, so I've been puzzling through keyboard events the last few days. I decided I wanted to do something fun, like add new levels. Once again, encountered that things like < and > are hard to generate in a properly internationalized way.
I'm using a few documents as reference:
http://www.w3.org/TR/DOM-Level-3-Events/#events-textevents
http://www.w3.org/TR/2006/WD-DOM-Level-3-Events-20060413/keyset.html#Guide
http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
There's a few things to note:
1) DOM3 isn't implemented anywhere at all yet. But keyboard stuff wasn't really formalized before this.
2) Keypress isn't documented (which does exist). Instead textInput replaces it, which isn't implemented everywhere and seems to only fire at each keystore in a textbox.
I *think* (and I'm documenting this without having actually tried it yet, so that I can come back to this and find my notes) that what I need to do is preventDefault on dead keys (ctrl, meta, alt, shift) only. This should stop those modifiers from hitting the browser. Then I think I can just watch keypress to actually just pick up the key that was hit and any modifiers.
As a side effect of this, hitting the shift key should no longer cause the monsters to move around the grid.
But it's taken me until 20 past midnight to come up with this. So, bedtime. =)
Saturday, April 23, 2011
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment