Re: [Plib-devel] pwSetAutoRepeatKey...and pwMacOSX.
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-04-09 18:38:27
|
Fay John F Contr AAC/WMG wrote: > Since a tenet of windowing systems (at least of the GLUT type) is platform > independence, I guess we will want to change the Windows code to match the > Linux behavior. Either that or modify the Linux code to match Windows. I think on balance, I like the Linux way because anything that's relying on a key UP event wouldn't see any key repeat if it's done the Windows way. > Regarding the bug in the X11 version (about how if you press shift-W, > release the shift, then release the w, you don't get an up-callback for the > "W"): Windows behaves in exactly the same manner if the keys are pressed > long enough for the autorepeat to come on (whether PW passes them through or > not). If everything is done quickly, then we get a key press event for the > capital letter and a key release event for the lowercase letter. Yeah - I think Linux is the same. I wonder what GLUT and freeglut do? Maybe there is a clever fix of some kind. > By moving > the test for CTRL/SHIFT/CapsLock to above the assignment for "key = wParam" > I can remove the second key press callback invocation (with the lowercase > "w") but we still have the phenomenon of the key press callback being called > with one key and the key release with another key. It may need just to be > documented as a "feature." Well, it's very inconvenient for games. You tend to want to track which keys are down and which are up - and there really isn't an easy way to do that with the present code. (Especially when you consider non-US keyboards. Then, the relationship between a punctuation character and the character you get with the same key but with SHIFT depressed may be different from one keyboard type to another. My code might be smart enough to know that when it sees a '/' character DOWN followed by a '?' character UP that in fact it was really the '/' that went up because '?' is just SHIFT+'/'....but is that true on all keyboards. (HINT: No, it's not!) Without going back to looking at the original scan-codes, it's going to be rather hard to figure out what's going on! This sort of thing might seem unlikely - but there are plenty of games out there that use (say) 'Z' and 'X' for steering and 'SHIFT' for shooting - which could very well result in a sequence like: PLAYER STARTS TO TURN LEFT: Presses the 'z' key. We see 'z'+DOWN. PLAYER SHOOTS: Presses the SHIFT key. PLAYER STOPS TURNING: Releases the 'z' key - but we see 'Z'+UP. Now the software doesn't know whether you're still steering or not. Yuk! I'm gonna see whether GLUT or freeglut has a clever trick for avoiding this problem. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |