Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 26, 2010, 12:09:12 AM (14 years ago)
Author:
landauf
Message:

adapted all console commands to the new interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc

    r7207 r7219  
    4343    ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false);
    4444
     45    static const std::string __CC_keybind_name = "keybind";
     46    static const std::string __CC_tkeybind_name = "tkeybind";
     47    static const std::string __CC_unbind_name = "unbind";
     48    static const std::string __CC_tunbind_name = "tunbind";
     49
     50    _SetConsoleCommand(__CC_keybind_name,  &KeyBinderManager::keybind).defaultValues("");
     51    _SetConsoleCommand(__CC_tkeybind_name, &KeyBinderManager::tkeybind).defaultValues("");
     52    _SetConsoleCommand(__CC_unbind_name,   &KeyBinderManager::unbind).defaultValues("");
     53    _SetConsoleCommand(__CC_tunbind_name,  &KeyBinderManager::tunbind).defaultValues("");
     54
    4555    KeyBinderManager::KeyBinderManager()
    4656        : currentBinder_(NULL)
     
    5262
    5363        // keybind console commands
    54         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::keybind,  this), "keybind" ))
    55             .defaultValues("");
    56         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tkeybind, this), "tkeybind"))
    57             .defaultValues("");
    58         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::unbind, this), "unbind"))
    59             .defaultValues("");
    60         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tunbind, this), "tunbind"))
    61             .defaultValues("");
     64        _ModifyConsoleCommand(__CC_keybind_name ).setObject(this);
     65        _ModifyConsoleCommand(__CC_tkeybind_name).setObject(this);
     66        _ModifyConsoleCommand(__CC_unbind_name  ).setObject(this);
     67        _ModifyConsoleCommand(__CC_tunbind_name ).setObject(this);
    6268
    6369        // Load default key binder
     
    7076        for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)
    7177            delete it->second;
     78
     79        // Reset console commands
     80        _ModifyConsoleCommand(__CC_keybind_name ).setObject(0);
     81        _ModifyConsoleCommand(__CC_tkeybind_name).setObject(0);
     82        _ModifyConsoleCommand(__CC_unbind_name  ).setObject(0);
     83        _ModifyConsoleCommand(__CC_tunbind_name ).setObject(0);
    7284    }
    7385
Note: See TracChangeset for help on using the changeset viewer.