Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (14 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/input/KeyBinderManager.h

    r5929 r6417  
    3434#include <map>
    3535#include <string>
     36#include <boost/shared_ptr.hpp>
     37
    3638#include "util/Singleton.h"
    3739#include "core/OrxonoxClass.h"
    3840
    39 namespace orxonox
    40 {
     41namespace orxonox //tolua_export
     42{ //tolua_export
    4143    /**
    4244    @brief
     
    4648        maps to the currently active KeyBinder. You can set that with setCurrent().
    4749        There is also a default one, retrieved with getDefault(). The idea is that
    48         mostly the default KeyBinder is active except for special situtations (mini-game for inst).
     50        mostly the default KeyBinder is active except for special situations (mini-game for inst).
    4951    @remarks
    5052        You are not forced to use the KeyBinder imposed by getCurrent(). But be aware that "keybind"
    5153        will not work as expected!
    5254    */
    53     class _CoreExport KeyBinderManager : public Singleton<KeyBinderManager>, public OrxonoxClass
    54     {
     55    class _CoreExport KeyBinderManager //tolua_export
     56        : public Singleton<KeyBinderManager>, public OrxonoxClass
     57    { //tolua_export
    5558        friend class Singleton<KeyBinderManager>;
    5659    public:
     
    5962        void setConfigValues();
    6063
     64        static KeyBinderManager& getInstance() { return Singleton<KeyBinderManager>::getInstance(); } //tolua_export
    6165        //! Returns the currently selected KeyBinder
    62         KeyBinder*    getCurrent()
    63             { return this->currentBinder_; }
     66        KeyBinder* getCurrent() { return this->currentBinder_; } //tolua_export
    6467        //! Like getCurrent(), but returns it as InputHandler* (so you don't have to include KeyBinder.h)
    6568        InputHandler* getCurrentAsHandler();
     
    6871
    6972        //! Returns the default KeyBinder
    70         KeyBinder*    getDefault()
     73        KeyBinder* getDefault()
    7174            { return binders_[this->defaultFilename_]; }
    7275        //! Returns the default KeyBinder as InputHandler* (so you don't have to include KeyBinder.h)
     
    8083
    8184        //! Returns a pointer to a KeyBinder (creates it if not yet loaded)
    82         KeyBinder*    get(const std::string& name);
     85        KeyBinder* get(const std::string& name);
    8386        //! Like get() but return value is of type InputHandler* (so you don't have to include KeyBinder.h)
    8487        InputHandler* getAsHandler(const std::string& name);
    8588
    8689        //! Loads a KeyBinder by creating it (no different from get() except for the return value)
    87         void load  (const std::string& filename);
     90        void load(const std::string& filename);
    8891        //! Destroys a KeyBinder completely (does nothing if not yet loaded)
    8992        void unload(const std::string& filename);
    9093
    9194        //! Bind 'command' to any key pressed after this call (use with care!)
    92         inline void keybind(const std::string& command)
    93             { this->keybindInternal(command, false); }
     95        inline void keybind(const std::string& command) { this->keybindInternal(command, false); } //tolua_export
    9496        //! Bind 'command' to any key pressed after this call (use with care!), but temporarily (no file save)
    9597        inline void tkeybind(const std::string& command)
    9698            { this->keybindInternal(command, true); }
     99        void unbind(const std::string& binding); //tolua_export
     100        void tunbind(const std::string& binding);
     101        inline void registerKeybindCallback(Functor* function) { this->callbackFunction_.reset(function); } // tolua_export
    97102
    98103    private:
    99104        KeyBinderManager(const KeyBinderManager&);
    100105        void keybindInternal(const std::string& command, bool bTemporary);
    101         void callback(const std::string& keyName);
     106        void keybindKeyPressed(const std::string& keyName);
    102107        void defaultFilenameChanged();
    103108
     
    109114
    110115        // keybind command related
    111         Functor* callbackFunction_;                  //! Function to be called when key was pressed after "keybind" command
     116        shared_ptr<Functor> callbackFunction_;       //! Function to be called when key was pressed after "keybind" command
    112117        bool bBinding_;                              //! Tells whether a key binding process is active
    113118        bool bTemporary_;                            //! Stores tkeybind/keybind value
     
    115120
    116121        static KeyBinderManager* singletonPtr_s;
    117     };
    118 }
     122    }; //tolua_export
     123} //tolua_export
    119124
    120125#endif /* _KeyBinderManager_H__ */
Note: See TracChangeset for help on using the changeset viewer.