示例#1
0
void startConsole()
{	
	//intptr_t serverId = _spawnl(_P_NOWAIT, "TiGaServ.exe", "TiGaServ.exe", "15600" ); 
	//intptr_t clientId = _spawnl(_P_NOWAIT, "TiGaClient.exe", "TiGaServ.exe", "localhost", "15600" );
	bool exit = false;
	KeyMap keyMap;

	MENU_BEGIN('1',"Print menu")
		printMenu(keyMap);
	MENU_END();
	MENU_BEGIN('2',"Start server")
		system("start TiGaServ.exe 15600" ); 
		//if( serverId == 0 )
		//	serverId = _spawnl(_P_NOWAITO, "TiGaServ.exe", "TiGaServ.exe", "15600" ); 
	MENU_END();

	MENU_BEGIN('3',"Start client")
		system("start TiGaClient.exe 127.0.0.1 15600" ); 
		//size_t id = spawnClient();
		//printf("Client %d spawned\n",id);
	MENU_END();

	MENU_BEGIN(' ',"Exit")
		exit = true;
	MENU_END();
	printMenu(keyMap);
	while(exit != true)
	{
		int ch = getch();		
		KeyMap::iterator it = keyMap.find(ch);
		if( it != keyMap.end() )
			it->second.second();
	}
}
示例#2
0
Penjin::ERRORS KeyMapper::mapMouse(CRuchar id)
{
    Penjin::ERRORS result = PENJIN_OK;
    string device = "Mouse";
    vector<string> keyList = getKeys(device);
    for(uint i = 0; i < keyList.size(); ++i)
    {
        KeyMap* t = NULL;
        if(keyList.at(i).find("Button") != keyList.at(i).npos)
        {
            t = new KeyMapMouseButton(Penjin::StringUtility::stringToInt(getValue(device,keyList.at(i))), keyList.at(i), id);
        }
        else
        {
            t = new KeyMapMouseAxis(Penjin::StringUtility::stringToInt(getValue(device,keyList.at(i))), keyList.at(i), id);
        }
        if(t == NULL)
            result = PENJIN_ERROR;
        else if(t->isMapValid())
        {
           keys.push_back(t);
        }
        else
        {
            ErrorMan::getInstance()->print(PENJIN_ERROR, "KeyMapper::mapMouse(): ");
            delete t;
            result = PENJIN_ERROR;  // We have to show that something went wrong with the config
        }
    }
    return result;
}
示例#3
0
void printMenu(KeyMap & keyMap)
{
	for( auto it = keyMap.begin(); it != keyMap.end(); ++it)
	{
		printf("%c.\t%s\n",it->first, it->second.first);
	}
}
示例#4
0
static String keyIdentifierForEvasKeyName(String& keyName)
{
    if (gKeyMap.isEmpty())
        createKeyMap();

    if (gKeyMap.contains(keyName))
        return gKeyMap.get(keyName);

    return keyName;
}
示例#5
0
  static rinteger make_key(Env* env, Method* meth, KeyMap& keys) {
    KeyMap::iterator iter = keys.find(meth);

    if(iter == keys.end()) {
      rinteger key = env->integer_new(keys.size());
      keys[meth] = key;
      return key;
    }

    return iter->second;
  }
示例#6
0
文件: viewer.cpp 项目: PNCG/neuron
void Viewer::MomentaryUseTool (const char* keyCode, Event& e) {
    Tool* curTool= _editor->GetCurTool();
    const char* origCode = curTool->GetControlInfo()->GetKeyCode();
    KeyMap* keymap = _editor->GetKeyMap();
    
    if (strcmp(origCode, keyCode) == 0) {
	UseTool(CurTool(), e);		/* already using this tool */
    } else {
	keymap->Execute(keyCode);	/* engage tool momentarily */
	UseTool(CurTool(), e);
	keymap->Execute(origCode);	/* revert to original tool */
    }
}
void DirectInputRegistry::updateState( osgGA::EventQueue* eventQueue )
{
    HRESULT hr;
    if ( !_supportDirectInput || !eventQueue ) return;
    
    if ( _keyboard )
    {
        pollDevice( _keyboard );
        
        char buffer[256] = {0};
        hr = _keyboard->GetDeviceState( sizeof(buffer), &buffer );
        if ( SUCCEEDED(hr) )
        {
            for ( KeyMap::iterator itr=g_keyMap.begin(); itr!=g_keyMap.end(); ++itr )
            {
                KeyValue& key = itr->second;
                char value = buffer[itr->first];
                if ( key.second==value ) continue;
                
                key.second = value;
                if ( value&0x80 )
                    eventQueue->keyPress( key.first );
                else
                    eventQueue->keyRelease( key.first );
            }
        }
    }
    
    if ( _mouse )
    {
        pollDevice( _mouse );
        
        DIMOUSESTATE2 mouseState;
        hr = _mouse->GetDeviceState( sizeof(DIMOUSESTATE2), &mouseState );
        
        // TODO: add mouse handlers
    }
    
    if ( _joystick )
    {
        pollDevice( _joystick );
        
        osg::ref_ptr<JoystickEvent> event = new JoystickEvent;
        hr = _joystick->GetDeviceState( sizeof(DIJOYSTATE2), &(event->_js) );
        if ( SUCCEEDED(hr) ) eventQueue->userEvent( event.get() );
    }
}
status_t Session::provideKeyResponse(const Vector<uint8_t>& response) {
    String8 responseString(
            reinterpret_cast<const char*>(response.array()), response.size());
    KeyMap keys;

    Mutex::Autolock lock(mMapLock);
    JsonWebKey parser;
    if (parser.extractKeysFromJsonWebKeySet(responseString, &keys)) {
        for (size_t i = 0; i < keys.size(); ++i) {
            const KeyMap::key_type& keyId = keys.keyAt(i);
            const KeyMap::value_type& key = keys.valueAt(i);
            mKeyMap.add(keyId, key);
        }
        return android::OK;
    } else {
        return android::ERROR_DRM_UNKNOWN;
    }
}
示例#9
0
void MidiInstrument::write(int level, Xml& xml)
{
    xml.header();
    xml.tag(level, "los version=\"1.0\"");
    level++;
    xml.nput(level, "<MidiInstrument name=\"%s\" panValue=\"%f\"",
            Xml::xmlString(iname()).toLatin1().constData(), m_panValue);

    if (_nullvalue != -1)
    {
        QString nv;
        nv.setNum(_nullvalue);
        xml.nput(" nullparam=\"%s\"", nv.toLatin1().constData());
    }
    xml.put(">");

    // -------------
    // What about Init, Reset, State, and InitScript ?
    // -------------

    level++;
    for (ciPatchGroup g = pg.begin(); g != pg.end(); ++g)
    {
        PatchGroup* pgp = *g;
        const PatchList& pl = pgp->patches;
        xml.tag(level, "PatchGroup name=\"%s\"", Xml::xmlString(pgp->name).toLatin1().constData());
        level++;
        for (ciPatch p = pl.begin(); p != pl.end(); ++p)
            (*p)->write(level, xml);
        level--;
        xml.etag(level, "PatchGroup");
    }
    for (iMidiController ic = _controller->begin(); ic != _controller->end(); ++ic)
        ic->second->write(level, xml);
    for(QHash<int, KeyMap*>::const_iterator km = m_keymaps.begin(); km != m_keymaps.end(); ++km)
    {
        KeyMap *m = km.value();
        m->write(level, xml);
    }
    level--;
    xml.etag(level, "MidiInstrument");
    level--;
    xml.etag(level, "los");
}
示例#10
0
// Only for debug
void
ClefKeyContext::dumpKeyContext()
{
    KeyMaps::iterator i;
    KeyMap::iterator j;

    std::cout << "Begin of key context dump =================" << std::endl;

    for (i = m_keyMaps.begin(); i != m_keyMaps.end(); ++i) {
        std::cout << "    Track = " << (*i).first << std::endl;
        KeyMap *m = (*i).second;

        for (j = m->begin(); j != m->end(); ++j) {
            std::cout << "        Time = " << (*j).first
                      << " Key = " << (*j).second.getName() << std::endl;
        }
    }

    std::cout << "End of key context dump =================" << std::endl;
}
示例#11
0
bool init()
{

    glfwInit();
    
    renderer->init("Pyzzlix", 1280, 720, false);

    glfwDisable(GLFW_AUTO_POLL_EVENTS);
    glfwSetKeyCallback(&keyCallback);

    KeyMap* keymap = KeyMap::getInstance();

    keymap->setKey(GLFW_KEY_RIGHT, KEY_RIGHT);
    keymap->setKey(GLFW_KEY_LEFT, KEY_LEFT);
    keymap->setKey(GLFW_KEY_DOWN, KEY_DOWN);
    keymap->setKey(GLFW_KEY_UP, KEY_UP);
    keymap->setKey('X', KEY_ROTATE_RIGHT);
    keymap->setKey('Z', KEY_ROTATE_LEFT);
    
    sceneHandler->pushScene(scene_maingame);
    
    scene_maingame->startGame();
    
    return true;
}
示例#12
0
void KeyMapTest::test() {
    IUNIT_FALSE(KeyCode::KEY_UP_ARROW == KeyCode::KEY_DOWN_ARROW);
    IUNIT_NOT_NULL(keyMap.getKeyEntry(1));
    IUNIT_NULL(keyMap.getKeyEntry(2));
    const KeySequenceEntry* entry = keyMap.getKeyEntry(1);
    IUNIT_EQ(true, entry->isEntry());
    entry = keyMap.getKeyEntry(27);
    IUNIT_EQ(false, entry->isEntry());
    entry = entry->getKeySequenceEntry(91);
    IUNIT_NOT_NULL( entry );
    IUNIT_EQ(false, entry->isEntry());
    const KeySequenceEntry* tmp = entry->getKeySequenceEntry(65);
    IUNIT_NOT_NULL( tmp );
    IUNIT_EQ(true, tmp->isEntry());
    tmp = entry->getKeySequenceEntry(66);
    IUNIT_NOT_NULL( tmp );
    IUNIT_EQ(true, tmp->isEntry());
    keyMap.deleteKeyCodeSeq(KeyCode::KEY_CTRL_A);
    IUNIT_NOT_NULL(keyMap.getKeyEntry(27));
    IUNIT_NULL(keyMap.getKeyEntry(1));
}
示例#13
0
static void createKeyMap()
{
    for (unsigned int i = 1; i < 25; i++) {
        String key = String::format("F%d", i);
        gKeyMap.set(key, key);
    }
    gKeyMap.set("Alt_L", "Alt");
    gKeyMap.set("ISO_Level3_Shift", "Alt");
    gKeyMap.set("Menu", "Alt");
    gKeyMap.set("Shift_L", "Shift");
    gKeyMap.set("Shift_R", "Shift");
    gKeyMap.set("Down", "Down");
    gKeyMap.set("End", "End");
    gKeyMap.set("Return", "Enter");
    gKeyMap.set("KP_Enter", "Enter");
    gKeyMap.set("Home", "Home");
    gKeyMap.set("Insert", "Insert");
    gKeyMap.set("Left", "Left");
    gKeyMap.set("Down", "Down");
    gKeyMap.set("Next", "PageDown");
    gKeyMap.set("Prior", "PageUp");
    gKeyMap.set("Right", "Right");
    gKeyMap.set("Up", "Up");
    gKeyMap.set("Delete", "U+007F");
    gKeyMap.set("Tab", "U+0009");
    gKeyMap.set("ISO_Left_Tab", "U+0009");
}
示例#14
0
namespace WebCore {

typedef HashMap<String, String> KeyMap;
typedef HashMap<String, int> WindowsKeyMap;

static KeyMap gKeyMap;
static WindowsKeyMap gWindowsKeyMap;

static void createKeyMap()
{
    for (unsigned int i = 1; i < 25; i++) {
        String key = String::format("F%d", i);
        gKeyMap.set(key, key);
    }
    gKeyMap.set("Alt_L", "Alt");
    gKeyMap.set("ISO_Level3_Shift", "Alt");
    gKeyMap.set("Menu", "Alt");
    gKeyMap.set("Shift_L", "Shift");
    gKeyMap.set("Shift_R", "Shift");
    gKeyMap.set("Down", "Down");
    gKeyMap.set("End", "End");
    gKeyMap.set("Return", "Enter");
    gKeyMap.set("KP_Enter", "Enter");
    gKeyMap.set("Home", "Home");
    gKeyMap.set("Insert", "Insert");
    gKeyMap.set("Left", "Left");
    gKeyMap.set("Down", "Down");
    gKeyMap.set("Next", "PageDown");
    gKeyMap.set("Prior", "PageUp");
    gKeyMap.set("Right", "Right");
    gKeyMap.set("Up", "Up");
    gKeyMap.set("Delete", "U+007F");
    gKeyMap.set("Tab", "U+0009");
    gKeyMap.set("ISO_Left_Tab", "U+0009");
}

static void createWindowsKeyMap()
{
    gWindowsKeyMap.set("Return",     VK_RETURN);
    gWindowsKeyMap.set("KP_Return",  VK_RETURN);
    gWindowsKeyMap.set("Alt_L",      VK_MENU);
    gWindowsKeyMap.set("ISO_Level3_Shift", VK_MENU);
    gWindowsKeyMap.set("Menu",       VK_MENU);
    gWindowsKeyMap.set("Shift_L",    VK_SHIFT);
    gWindowsKeyMap.set("Shift_R",    VK_SHIFT);
    gWindowsKeyMap.set("Control_L",  VK_CONTROL);
    gWindowsKeyMap.set("Control_R",  VK_CONTROL);
    gWindowsKeyMap.set("Pause",      VK_PAUSE);
    gWindowsKeyMap.set("Break",      VK_PAUSE);
    gWindowsKeyMap.set("Caps_Lock",  VK_CAPITAL);
    gWindowsKeyMap.set("Scroll_Lock", VK_SCROLL);
    gWindowsKeyMap.set("Num_Lock",   VK_NUMLOCK);
    gWindowsKeyMap.set("Escape",     VK_ESCAPE);
    gWindowsKeyMap.set("Tab",        VK_TAB);
    gWindowsKeyMap.set("ISO_Left_Tab", VK_TAB);
    gWindowsKeyMap.set("BackSpace",  VK_BACK);
    gWindowsKeyMap.set("Space",      VK_SPACE);
    gWindowsKeyMap.set("Next",       VK_NEXT);
    gWindowsKeyMap.set("Prior",      VK_PRIOR);
    gWindowsKeyMap.set("Home",       VK_HOME);
    gWindowsKeyMap.set("End",        VK_END);
    gWindowsKeyMap.set("Right",      VK_RIGHT);
    gWindowsKeyMap.set("Left",       VK_LEFT);
    gWindowsKeyMap.set("Up",         VK_UP);
    gWindowsKeyMap.set("Down",       VK_DOWN);
    gWindowsKeyMap.set("Print",      VK_PRINT);
    gWindowsKeyMap.set("Insert",     VK_INSERT);
    gWindowsKeyMap.set("Delete",     VK_DELETE);

    gWindowsKeyMap.set("comma",        VK_OEM_COMMA);
    gWindowsKeyMap.set("less",         VK_OEM_COMMA);
    gWindowsKeyMap.set("period",       VK_OEM_PERIOD);
    gWindowsKeyMap.set("greater",      VK_OEM_PERIOD);
    gWindowsKeyMap.set("semicolon",    VK_OEM_1);
    gWindowsKeyMap.set("colon",        VK_OEM_1);
    gWindowsKeyMap.set("slash",        VK_OEM_2);
    gWindowsKeyMap.set("question",     VK_OEM_2);
    gWindowsKeyMap.set("grave",        VK_OEM_3);
    gWindowsKeyMap.set("asciitilde",   VK_OEM_3);
    gWindowsKeyMap.set("bracketleft",  VK_OEM_4);
    gWindowsKeyMap.set("braceleft",    VK_OEM_4);
    gWindowsKeyMap.set("backslash",    VK_OEM_5);
    gWindowsKeyMap.set("bar",          VK_OEM_5);
    gWindowsKeyMap.set("bracketright", VK_OEM_6);
    gWindowsKeyMap.set("braceright",   VK_OEM_6);
    gWindowsKeyMap.set("apostrophe",   VK_OEM_7);
    gWindowsKeyMap.set("quotedbl",     VK_OEM_7);

    // Alphabet
    String alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (unsigned int i = 0; i < 26; i++) {
        String key = String::format("%c", alphabet[i]);
        gWindowsKeyMap.set(key, VK_A + i);
    }

    // Digits
    for (unsigned int i = 0; i < 10; i++) {
        String key = String::format("%d", i);
        gWindowsKeyMap.set(key, VK_0 + i);
    }

    // Shifted digits
    gWindowsKeyMap.set("exclam",    VK_1);
    gWindowsKeyMap.set("at",        VK_2);
    gWindowsKeyMap.set("numbersign", VK_3);
    gWindowsKeyMap.set("dollar",    VK_4);
    gWindowsKeyMap.set("percent",   VK_5);
    gWindowsKeyMap.set("asciicircum", VK_6);
    gWindowsKeyMap.set("ampersand", VK_7);
    gWindowsKeyMap.set("asterisk",  VK_8);
    gWindowsKeyMap.set("parenleft", VK_9);
    gWindowsKeyMap.set("parenright", VK_0);
    gWindowsKeyMap.set("minus",     VK_OEM_MINUS);
    gWindowsKeyMap.set("underscore", VK_OEM_MINUS);
    gWindowsKeyMap.set("equal",     VK_OEM_PLUS);
    gWindowsKeyMap.set("plus",      VK_OEM_PLUS);

    // F_XX
    for (unsigned int i = 1; i < 25; i++) {
        String key = String::format("F%d", i);
        gWindowsKeyMap.set(key, VK_F1 + i);
    }
}

static String keyIdentifierForEvasKeyName(String& keyName)
{
    if (gKeyMap.isEmpty())
        createKeyMap();

    if (gKeyMap.contains(keyName))
        return gKeyMap.get(keyName);

    return keyName;
}

static int windowsKeyCodeForEvasKeyName(String& keyName)
{
    if (gWindowsKeyMap.isEmpty())
        createWindowsKeyMap();

    if (gWindowsKeyMap.contains(keyName))
        return gWindowsKeyMap.get(keyName);

    return 0;
}

PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Down* ev)
    : m_type(KeyDown)
    , m_text(String::fromUTF8(ev->string))
    , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift"))
    , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control"))
    , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt"))
    , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta"))
{
    String keyName = String(ev->key);
    m_keyIdentifier = keyIdentifierForEvasKeyName(keyName);
    m_windowsVirtualKeyCode = windowsKeyCodeForEvasKeyName(keyName);

    // FIXME:
    m_isKeypad = false;
    m_autoRepeat = false;
}

PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Up* ev)
    : m_type(KeyUp)
    , m_text(String::fromUTF8(ev->string))
    , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift"))
    , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control"))
    , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt"))
    , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta"))
{
    String keyName = String(ev->key);
    m_keyIdentifier = keyIdentifierForEvasKeyName(keyName);
    m_windowsVirtualKeyCode = windowsKeyCodeForEvasKeyName(keyName);

    // FIXME:
    m_isKeypad = false;
    m_autoRepeat = false;
}

void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
{
    ASSERT(m_type == KeyDown);
    m_type = type;

    if (type == RawKeyDown) {
        m_text = String();
        m_unmodifiedText = String();
    } else {
        m_keyIdentifier = String();
        m_windowsVirtualKeyCode = 0;
    }
}

bool PlatformKeyboardEvent::currentCapsLockState()
{
    notImplemented();
    return false;
}

void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
{
    notImplemented();
    shiftKey = false;
    ctrlKey = false;
    altKey = false;
    metaKey = false;
}

}
示例#15
0
inline bool mReturnKey(const KeyMap& km)     { return km.get(Keys::RETURN); }
示例#16
0
inline bool mEscKey(const KeyMap& km)        { return km.get(Keys::ESCAPE); }
示例#17
0
inline bool mQKey(const KeyMap& km)          { return km.get(Keys::Q); }
示例#18
0
inline bool mCommandKey(const KeyMap& km)    { return km.get(Keys::COMMAND); }
示例#19
0
inline bool mLeftArrowKey(const KeyMap& km)  { return km.get(Keys::LEFT_ARROW); }
示例#20
0
inline bool mCheckKeyMap(const KeyMap& mKeyMap, int mki) {
    return mKeyMap.get(Preferences::preferences()->key(mki) - 1);
}
示例#21
0
 virtual void teardown() {
     keyMap.deleteKeyCodeSeq(KeyCode::KEY_UP_ARROW);
     keyMap.deleteKeyCodeSeq(KeyCode::KEY_CTRL_A);
 }
示例#22
0
void MidiInstrument::read(Xml& xml)
{
    bool ok;
    int base = 10;
    _nullvalue = -1;
    m_keymaps.clear();
    for (;;)
    {
        Xml::Token token = xml.parse();
        const QString& tag = xml.s1();
        switch (token)
        {
            case Xml::Error:
            case Xml::End:
                return;
            case Xml::TagStart:
                if (tag == "Patch")
                {
                    Patch* patch = new Patch;
                    patch->read(xml);
                    if (pg.empty())
                    {
                        PatchGroup* p = new PatchGroup;
                        p->patches.push_back(patch);
                        pg.push_back(p);
                    }
                    else
                        pg[0]->patches.push_back(patch);
                }
                else if (tag == "PatchGroup")
                {
                    PatchGroup* p = new PatchGroup;
                    p->read(xml);
                    pg.push_back(p);
                }
                else if (tag == "Controller")
                {
                    MidiController* mc = new MidiController();
                    mc->read(xml);
                    // Added by Tim. Copied from los 2.
                    //
                    // HACK: make predefined "Program" controller overloadable
                    //
                    if (mc->name() == "Program")
                    {
                        for (iMidiController i = _controller->begin(); i != _controller->end(); ++i)
                        {
                            if (i->second->name() == mc->name())
                            {
                                delete i->second;
                                _controller->erase(i);
                                break;
                            }
                        }
                    }

                    _controller->add(mc);
                }
                else if (tag == "Init")
                    readEventList(xml, _midiInit, "Init");
                else if (tag == "Reset")
                    readEventList(xml, _midiReset, "Reset");
                else if (tag == "State")
                    readEventList(xml, _midiState, "State");
                else if (tag == "InitScript")
                {
                    if (_initScript)
                        delete _initScript;
                    QByteArray ba = xml.parse1().toLatin1();
                    const char* istr = ba.constData();
                    int len = strlen(istr) + 1;
                    if (len > 1)
                    {
                        _initScript = new char[len];
                        memcpy(_initScript, istr, len);
                    }
                }
                else if(tag == "KeyMap")
                {
                    KeyMap *km = new KeyMap;
                    km->read(xml);
                    m_keymaps.insert(km->key, km);
                }
                else
                    xml.unknown("MidiInstrument");
                break;
            case Xml::Attribut:
                if (tag == "name")
                    setIName(xml.s2());
                else if (tag == "nullparam")
                {
                    _nullvalue = xml.s2().toInt(&ok, base);
                }
                else if(tag == "panValue")
                    m_panValue = xml.s2().toDouble();
                break;
            case Xml::TagEnd:
                if (tag == "MidiInstrument")
                    return;
            default:
                break;
        }
    }
}
示例#23
0
inline bool mCapsLockKey(const KeyMap& km)   { return km.get(Keys::CAPS_LOCK); }
示例#24
0
	// *******************************************************	
	// init_keys():  Define any extra keyboard shortcuts here
	virtual	void init_keys() 
	{
		keys.addHandler		( 'w', 0,					Callback<Animation>( &Animation::forward , this ) );
		keys.addHandler		( 'a', 0,					Callback<Animation>( &Animation::left    , this ) );
		keys.addHandler		( 's', 0,					Callback<Animation>( &Animation::back    , this ) );
		keys.addHandler		( 'd', 0,					Callback<Animation>( &Animation::right   , this ) );
		keys.addHandler		( ' ', 0,					Callback<Animation>( &Animation::up      , this ) );
		keys.addHandler		( 'z', 0,					Callback<Animation>( &Animation::down    , this ) );
		
		keys.addHandler		( 'w', GLUT_Port::RELEASE,  Callback<Animation>( &Animation::stopZ , this ) );
		keys.addHandler		( 'a', GLUT_Port::RELEASE,  Callback<Animation>( &Animation::stopX , this ) );
		keys.addHandler		( 's', GLUT_Port::RELEASE,  Callback<Animation>( &Animation::stopZ , this ) );
		keys.addHandler		( 'd', GLUT_Port::RELEASE,  Callback<Animation>( &Animation::stopX , this ) );
		keys.addHandler		( ' ', GLUT_Port::RELEASE,  Callback<Animation>( &Animation::stopY , this ) );
		keys.addHandler		( 'z', GLUT_Port::RELEASE,  Callback<Animation>( &Animation::stopY , this ) );
		
		keys.addHandler		( '.', 0,                   Callback<Animation>( &Animation::roll_left , this ) );
		keys.addHandler		( ',', 0,                   Callback<Animation>( &Animation::roll_right , this ) );
		keys.addHandler		( 'r', 0,                   Callback<Animation>( &Animation::reset , this ) );
		keys.addHandler		( 'f', 0,                   Callback<Animation>( &Animation::toggleLooking , this ) );
		
		keys.addHandler		( 'n', GLUT_Port::ALT,      Callback<Animation>( &Animation::toggleColorNormals , this ) );
		keys.addHandler		( 'g', GLUT_Port::ALT,      Callback<Animation>( &Animation::toggleGouraud , this ) );
		keys.addHandler		( 's', GLUT_Port::ALT,      Callback<Animation>( &Animation::toggleSolid , this ) );
		keys.addHandler		( 'a', GLUT_Port::ALT,      Callback<Animation>( &Animation::toggleAnimate , this ) );

		update_controls< Animation >( keys );
	}
示例#25
0
	// This must go in every class that has its own KeyMap and keyboard shortcuts
	virtual void handle_key( unsigned char key, unsigned char mods )	{	if( keys.hasHandler( key, mods ) )		keys.getHandler( key, mods )	();		}
示例#26
0
inline bool mDeleteKey(const KeyMap& km)     { return km.get(Keys::BACKSPACE); }