Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5096 in orxonox.OLD for trunk/src/util


Ignore:
Timestamp:
Aug 22, 2005, 12:01:04 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: The Shell now is able to be initialized by orxonox.cc, not World anymore.
The error, i was looking for laid in Element2D, where some values did not point to NULL at the beginning… this was quite stupid indeed

Location:
trunk/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/shell.cc

    r5095 r5096  
    6060
    6161  EventHandler* evh = EventHandler::getInstance();
    62   evh->subscribe(this, ES_GAME, SDLK_BACKQUOTE);
     62  evh->subscribe(this, ES_ALL, SDLK_BACKQUOTE);
    6363  for (int i = 1; i < SDLK_F15; i++)
    6464    evh->subscribe(this, ES_SHELL, i);
     
    295295  this->inputLine = removeCharLine;
    296296  this->inputLineText->setText(inputLine);
     297}
     298
     299/**
     300 * executes the command stored in the inputLine
     301 * @return true if the command was commited successfully, false otherwise
     302 */
     303bool Shell::executeCommand()
     304{
     305
     306  this->addBufferLineStatic("Execute Command: %s\n", this->inputLine);
     307  delete this->inputLine;
     308  this->inputLine = new char[1];
     309  this->inputLine[0]='\0';
     310  this->inputLineText->setText(this->inputLine);
     311  return false;
    297312}
    298313
     
    329344      this->removeCharacters(1);
    330345    }
     346    else if (event.type == SDLK_RETURN)
     347      this->executeCommand();
    331348    else if (event.type < 127)
    332349    {
     
    384401void Shell::debug() const
    385402{
    386 
    387 }
     403  if (this->pressedKey != SDLK_FIRST)
     404    printf("%s::%f %f\n", SDLKToKeyname(this->pressedKey), this->delayed, this->repeatDelay);
     405
     406}
  • trunk/src/util/shell.h

    r5095 r5096  
    5252    void addCharacters(const char* characters);
    5353    void removeCharacters(unsigned int characterCount = 1);
     54    bool executeCommand();
    5455
    5556
Note: See TracChangeset for help on using the changeset viewer.