Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2009, 8:41:44 PM (15 years ago)
Author:
scheusso
Message:

a small fix in IOConsole
some changes in GUI-system and preparation for keybindings menu
fix in menu handling

Location:
code/branches/presentation2/src/libraries/core/input
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/core/input/KeyBinder.cc

    r6155 r6214  
    254254        // Parse bindings and create the ConfigValueContainers if necessary
    255255        for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
     256        {
    256257            it->second->readConfigValue(this->configFile_);
     258            this->allCommands_[it->second->bindingString_] = it->second->groupName_ + " " + it->second->name_;
     259        }
    257260
    258261        COUT(3) << "KeyBinder: Loading key bindings done." << std::endl;
     
    269272                it->second->configContainer_->set(binding);
    270273            it->second->configContainer_->getValue(&(it->second->bindingString_), it->second);
     274            this->allCommands_[it->second->bindingString_] = it->second->groupName_ + " " + it->second->name_;
    271275            return true;
    272276        }
     
    276280            return false;
    277281        }
     282    }
     283   
     284    /**
     285    @brief
     286        Return the key name for a specific command
     287    */
     288    std::string KeyBinder::getBinding(std::string commandName)
     289    {
     290        COUT(0)<< commandName << endl;
     291        if( this->allCommands_.find(commandName) != this->allCommands_.end())
     292        {
     293            std::string keyname = this->allCommands_[commandName];
     294//             while(keyname.find(".")!=keyname.npos)
     295//                 keyname.replace(1, keyname.find("."), " ");
     296            COUT(0) << keyname << endl;
     297            return keyname;
     298        }
     299        else
     300            return "";
    278301    }
    279302
  • code/branches/presentation2/src/libraries/core/input/KeyBinder.h

    r6155 r6214  
    4343#include "JoyStickQuantityListener.h"
    4444
     45// tolua_begin
    4546namespace orxonox
    4647{
     48    // tolua_end
    4749    /**
    4850    @brief
     
    5456        KeyBinders. If you need to load other bindings, just create a new one.
    5557    */
    56     class _CoreExport KeyBinder : public InputHandler, public JoyStickQuantityListener
    57     {
     58    class _CoreExport KeyBinder // tolua_export
     59        : public InputHandler, public JoyStickQuantityListener
     60    { // tolua_export
    5861    public:
    5962        KeyBinder (const std::string& filename);
     
    6265        void clearBindings();
    6366        bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false);
     67        std::string getBinding(std::string commandName); //tolua_export
    6468        const std::string& getBindingsFilename()
    6569            { return this->filename_; }
     
    130134        //! Pointer list with all half axes
    131135        std::vector<HalfAxis*> allHalfAxes_;
     136        //! Maps input commands to all Button names, including half axes
     137        std::map<std::string, std::string> allCommands_;
    132138
    133139        /**
     
    174180        // Use some value at about 1000. This can be configured with mouseSensitivity_ anyway.
    175181        static const int mouseClippingSize_ = 1024;
    176     };
     182    };// tolua_export
    177183
    178184
     
    219225            mouseAxes_[i].relVal_ = 0.0f;
    220226    }
    221 }
     227}// tolua_export
    222228
    223229#endif /* _KeyBinder_H__ */
  • code/branches/presentation2/src/libraries/core/input/KeyBinderManager.h

    r6190 r6214  
    3737#include "core/OrxonoxClass.h"
    3838
    39 namespace orxonox
    40 {
     39namespace orxonox //tolua_export
     40{ //tolua_export
    4141    /**
    4242    @brief
     
    5151        will not work as expected!
    5252    */
    53     class _CoreExport KeyBinderManager : public Singleton<KeyBinderManager>, public OrxonoxClass
    54     {
     53    class _CoreExport KeyBinderManager //tolua_export
     54        : public Singleton<KeyBinderManager>, public OrxonoxClass
     55    { //tolua_export
    5556        friend class Singleton<KeyBinderManager>;
    5657    public:
     
    5960        void setConfigValues();
    6061
     62        static KeyBinderManager& getInstance() { return Singleton<KeyBinderManager>::getInstance(); } //tolua_export
    6163        //! Returns the currently selected KeyBinder
    62         KeyBinder* getCurrent()
    63             { return this->currentBinder_; }
     64        KeyBinder* getCurrent() { return this->currentBinder_; } //tolua_export
    6465        //! Like getCurrent(), but returns it as InputHandler* (so you don't have to include KeyBinder.h)
    6566        InputHandler* getCurrentAsHandler();
     
    115116
    116117        static KeyBinderManager* singletonPtr_s;
    117     };
    118 }
     118    }; //tolua_export
     119} //tolua_export
    119120
    120121#endif /* _KeyBinderManager_H__ */
Note: See TracChangeset for help on using the changeset viewer.