Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1066 for code


Ignore:
Timestamp:
Apr 14, 2008, 10:50:08 PM (17 years ago)
Author:
rgrieder
Message:
  • TestConsole should work now
Location:
code/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/InputBuffer.cc

    r1062 r1066  
    3838    InputBuffer::InputBuffer()
    3939    {
    40         this->bActivated_ = false;
     40        //this->bActivated_ = false;
    4141        this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"().:,;_-+*/=!?<>[|]";
    4242        this->keyboard_ = InputManager::getSingleton().getKeyboard();
    4343        this->buffer_ = "";
    4444
    45         this->keyboard_->setEventCallback(this);
     45        //this->keyboard_->setEventCallback(this);
    4646    }
    4747/*
     
    114114    }
    115115
    116     void InputBuffer::activityChanged() const
     116    /*void InputBuffer::activityChanged() const
    117117    {
    118     }
     118    }*/
    119119
    120120    bool InputBuffer::charIsAllowed(const char& input)
     
    128128    bool InputBuffer::keyPressed(const OIS::KeyEvent &e)
    129129    {
    130         if (e.key == OIS::KC_NUMPADENTER)
     130        /*if (e.key == OIS::KC_NUMPADENTER)
    131131        {
    132132            this->setActivated(!this->isActivated());
    133133            this->clear();
    134134            return true;
    135         }
     135        }*/
    136136
    137137        if (this->keyboard_->isModifierDown(OIS::Keyboard::Ctrl))
     
    169169        }
    170170
    171         if (this->bActivated_)
    172         {
    173 //std::cout << this->keyboard_->getAsString(e.key) << " / " << (char)e.text << std::endl;
    174 /*
    175             std::string input = this->keyboard_->getAsString(e.key);
    176             if (input.size() >= 1)
    177                 this->append(input[0]);
    178 */
    179             this->append((char)e.text);
    180         }
     171        //std::cout << this->keyboard_->getAsString(e.key) << " / " << (char)e.text << std::endl;
     172
     173        std::string input = this->keyboard_->getAsString(e.key);
     174        /*if (input.size() >= 1)
     175            this->append(input[0]);*/
     176
     177        this->append((char)e.text);
    181178        return true;
    182179    }
  • code/trunk/src/core/InputBuffer.h

    r1062 r1066  
    4444{
    4545    class _CoreExport InputBufferListener
    46     {
    47     };
     46    {};
    4847
    4948    class _CoreExport InputBuffer : public OIS::KeyListener
     
    9998                { return this->buffer_; }
    10099
    101             inline void activate()
     100            /*inline void activate()
    102101                { this->setActivated(true); }
    103102            inline void deactivate()
     
    108107                { return this->bActivated_; }
    109108
    110             void activityChanged() const;
     109            void activityChanged() const;*/
    111110
    112111        private:
     
    117116
    118117            OIS::Keyboard* keyboard_;
    119             bool bActivated_;
     118            //bool bActivated_;
    120119            std::string buffer_;
    121120            std::list<InputBufferListenerTuple> listeners_;
  • code/trunk/src/core/InputHandler.cc

    r1062 r1066  
    3737#include "InputEventListener.h"
    3838#include "InputEvent.h"
     39#include "InputManager.h"
    3940
    4041namespace orxonox
     
    8384      InputEvent e = {1, true, 0, 0, 0};
    8485      InputHandlerGame::callListeners(e);
     86    }
     87    else if (e.key == OIS::KC_NUMPADENTER)
     88    {
     89      InputManager::getSingleton().setInputMode(IM_KEYBOARD);
    8590    }
    8691    else
  • code/trunk/src/core/InputManager.cc

    r1062 r1066  
    3838#include "InputEventListener.h"
    3939#include "InputHandler.h"
     40#include "InputBuffer.h"
    4041
    4142namespace orxonox
    4243{
    43   /**
    44     @brief The reference to the singleton
    45   */
    46   //InputManager* InputManager::singletonRef_s = 0;
    47 
    4844  /**
    4945    @brief Constructor only resets the pointer values to 0.
     
    126122    this->handlerGUI_ = new InputHandlerGUI();
    127123    this->handlerGame_ = new InputHandlerGame();
     124    //this->handlerBuffer_ = new InputBuffer();
    128125    this->handlerGame_->loadBindings();
    129126
     
    244241  }
    245242
     243  void InputManager::feedInputBuffer(InputBuffer* buffer)
     244  {
     245    this->handlerBuffer_ = buffer;
     246  }
     247
     248
    246249}
  • code/trunk/src/core/InputManager.h

    r1062 r1066  
    7575    InputMode getInputMode();
    7676
     77    // temporary hack
     78    void feedInputBuffer(InputBuffer* buffer);
     79
    7780    // Temporary solutions. Will be removed soon!
    7881    OIS::Mouse    *getMouse()    { return this->mouse_   ; }
     
    9699    InputHandlerGUI   *handlerGUI_;     //!< Handles the input if in GUI mode
    97100    // FIXME: insert the InputBuffer once merged with core2
    98     InputHandlerGUI   *handlerBuffer_;  //!< Handles the input if in Buffer mode
     101    InputBuffer       *handlerBuffer_;  //!< Handles the input if in Buffer mode
    99102    InputHandlerGame  *handlerGame_;    //!< Handles the input if in Game mode
    100103
  • code/trunk/src/orxonox/Orxonox.cc

    r1062 r1066  
    397397  {
    398398    InputBuffer* ib = new InputBuffer();
     399    InputManager::getSingleton().feedInputBuffer(ib);
    399400    Testconsole* console = new Testconsole(ib);
    400401    ib->registerListener(console, &Testconsole::listen, true);
    401402    ib->registerListener(console, &Testconsole::execute, '\r', false);
     403    ib->registerListener(console, &Testconsole::execute, '\n', false);
    402404    ib->registerListener(console, &Testconsole::hintandcomplete, '\t', true);
    403405    ib->registerListener(console, &Testconsole::clear, '§', true);
Note: See TracChangeset for help on using the changeset viewer.