Hi Melchior (I get confused as to whether Franz or Melchior is your
first name... sorry :-) ),
You mean, because the OS will start to send key-presses for
auto-repeating keys then? While that's true, I wouldn't want to rely
on the OS doing that. You can configure per key if it should be
auto-repeating, and an OSG app could for that reason just prefer
to ignore auto-repeating and do the repeating on its own. It wouldn't
get the key-press event then on entering. But maybe I misunderstood.
Hmm, you're right. Darn :-)
In Windows, the keys are defined as VK_* constants (#define) and I don't
know how many there are. The values seem to go from 0x0 to 0xFF (so 0 to
256), but I'm kind of wary to do code that just loops from 0 to 256 and
checks the keys when focus comes back to the app. I don't want to assume
there will *never* *ever* be key constants over 256... What do you think?
The solution I had done before was to add methods that return
const_iterators to the Win32KeyboardMap's KeyMap map...
class Win32KeyboardMap
{
public:
typedef std::map<int, int> KeyMap;
Win32KeyboardMap()
{
_keymap[VK_ESCAPE ] =
osgGA::GUIEventAdapter::KEY_Escape;
// ...
}
// ...
KeyMap::const_iterator begin() const
{ return _keymap.begin(); }
KeyMap::const_iterator end() const
{ return _keymap.end(); }
protected:
KeyMap _keymap;
};
That way we can iterate through the actual key values we know exist, and
it's still opaque since we can only get a const_iterator.
Which solution do you prefer? (I can see what you've done in the X11
case, but perhaps your preference would be different in this case...)
Or perhaps someone could point out some Windows documentation that says
without a doubt that there will only *ever* be 256 key constants... That
would make my point moot.
Thanks,
J-S
--
______________________________________________________
Jean-Sebastien Guay [EMAIL PROTECTED]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org