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
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/core/CMakeLists.txt

    r6194 r6214  
    9191    LuaState.h
    9292    input/InputManager.h
     93    input/KeyBinder.h
     94    input/KeyBinderManager.h
    9395  DEFINE_SYMBOL
    9496    "CORE_SHARED_BUILD"
  • code/branches/presentation2/src/libraries/core/GUIManager.cc

    r6190 r6214  
    6262namespace orxonox
    6363{
     64    static void key_esc()
     65        { GUIManager::getInstance().keyESC(); }
     66    SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");
     67   
    6468    class CEGUILogger : public CEGUI::DefaultLogger
    6569    {
  • code/branches/presentation2/src/libraries/core/Game.cc

    r6175 r6214  
    5858        { Game::getInstance().stop(); }
    5959    SetConsoleCommandShortcutExternAlias(stop_game, "exit");
    60     static void key_esc()
    61         { Game::getInstance().keyESC(); }
    62     SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");
    6360    static void printFPS()
    6461        { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
     
    331328    }
    332329
    333     void Game::keyESC()
    334     {
    335         if( this->getState("mainMenu") && this->getState("mainMenu")->getActivity().active==true )
    336             this->stop();
    337         else
    338             GUIManager::getInstance().keyESC();
    339     }
    340 
    341330    void Game::stop()
    342331    {
  • code/branches/presentation2/src/libraries/core/Game.h

    r6150 r6214  
    100100        void run();
    101101        void stop();
    102         void keyESC();
    103102
    104103        static Game& getInstance(){ return Singleton<Game>::getInstance(); } // tolua_export
  • code/branches/presentation2/src/libraries/core/IOConsole.cc

    r6196 r6214  
    260260
    261261        // Process output written to std::cout
     262        std::cout.flush();
    262263        if (!this->origCout_.str().empty())
    263264        {
  • 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.