1
0
Fork 0

restore NumPad translation

This commit is contained in:
mfranz 2008-04-26 17:01:08 +00:00
parent 4c5d7bb0f9
commit 8f509ba82a
2 changed files with 4 additions and 7 deletions

View file

@ -39,8 +39,9 @@ FGManipulator::FGManipulator() :
statsHandler->setKeyEventPrintsOutStats(printStatsKey); statsHandler->setKeyEventPrintsOutStats(printStatsKey);
statsEvent->setEventType(GUIEventAdapter::KEYDOWN); statsEvent->setEventType(GUIEventAdapter::KEYDOWN);
#if 0 // OSG reports KeyPad keycodes independent of the NumLock modifier.
// We have to implement numlock too. // KP-4/KP-Left is always KEY_KP_Left (ff96), so we have to generate
// the locked keys ourselves.
numlockKeyMap[GUIEventAdapter::KEY_KP_Insert] = '0'; numlockKeyMap[GUIEventAdapter::KEY_KP_Insert] = '0';
numlockKeyMap[GUIEventAdapter::KEY_KP_End] = '1'; numlockKeyMap[GUIEventAdapter::KEY_KP_End] = '1';
numlockKeyMap[GUIEventAdapter::KEY_KP_Down] = '2'; numlockKeyMap[GUIEventAdapter::KEY_KP_Down] = '2';
@ -51,7 +52,6 @@ FGManipulator::FGManipulator() :
numlockKeyMap[GUIEventAdapter::KEY_KP_Home] = '7'; numlockKeyMap[GUIEventAdapter::KEY_KP_Home] = '7';
numlockKeyMap[GUIEventAdapter::KEY_KP_Up] = '8'; numlockKeyMap[GUIEventAdapter::KEY_KP_Up] = '8';
numlockKeyMap[GUIEventAdapter::KEY_KP_Page_Up] = '9'; numlockKeyMap[GUIEventAdapter::KEY_KP_Page_Up] = '9';
#endif
for (int i = 0; i < 128; i++) for (int i = 0; i < 128; i++)
release_keys[i] = i; release_keys[i] = i;
@ -278,7 +278,6 @@ void FGManipulator::handleKey(const osgGA::GUIEventAdapter& ea, int& key,
} }
osgGA::GUIEventAdapter::EventType eventType = ea.getEventType(); osgGA::GUIEventAdapter::EventType eventType = ea.getEventType();
#if 0
std::map<int, int>::iterator numPadIter = numlockKeyMap.find(key); std::map<int, int>::iterator numPadIter = numlockKeyMap.find(key);
if (numPadIter != numlockKeyMap.end()) { if (numPadIter != numlockKeyMap.end()) {
@ -286,7 +285,7 @@ void FGManipulator::handleKey(const osgGA::GUIEventAdapter& ea, int& key,
key = numPadIter->second; key = numPadIter->second;
} }
} }
#endif
modifiers = osgToFGModifiers(ea.getModKeyMask()); modifiers = osgToFGModifiers(ea.getModKeyMask());
currentModifiers = modifiers; currentModifiers = modifiers;
if (eventType == osgGA::GUIEventAdapter::KEYUP) if (eventType == osgGA::GUIEventAdapter::KEYUP)

View file

@ -131,9 +131,7 @@ protected:
osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent; osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent;
int statsType; int statsType;
int currentModifiers; int currentModifiers;
#if 0
std::map<int, int> numlockKeyMap; std::map<int, int> numlockKeyMap;
#endif
osg::Vec3d position; osg::Vec3d position;
osg::Quat attitude; osg::Quat attitude;
void handleKey(const osgGA::GUIEventAdapter& ea, int& key, int& modifiers); void handleKey(const osgGA::GUIEventAdapter& ea, int& key, int& modifiers);