Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5097 in orxonox.OLD for trunk/src


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

orxonox/trunk: delay now is defined, as it should be, and as all OS's do it

Location:
trunk/src/util
Files:
2 edited

Legend:

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

    r5096 r5097  
    4747  this->setBufferDisplaySize(10);
    4848  this->setAbsCoor2D(3, GraphicsEngine::getInstance()->getResolutionY());
    49   this->repeatDelay = .15;
    5049  this->delayed = 0;
     50  this->setRepeatDelay(.3, .05);
    5151  this->pressedKey = SDLK_FIRST;
    5252
     
    311311  return false;
    312312}
     313
     314/**
     315 * sets the Repeate-delay and rate
     316 * @param repeatDelay the Delay it takes, to repeate a key
     317 * @param repeatRate the rate to repeate a pressed key
     318 */
     319void Shell::setRepeatDelay(float repeatDelay, float repeatRate)
     320{
     321  this->repeatDelay = repeatDelay;
     322  this->repeatRate = repeatRate;
     323
     324}
     325
    313326
    314327#include "key_names.h"
     
    346359    else if (event.type == SDLK_RETURN)
    347360      this->executeCommand();
    348     else if (event.type < 127)
     361    else if (likely(event.type < 127))
    349362    {
    350363      this->delayed = this->repeatDelay;
     
    371384  else if (this->pressedKey != SDLK_FIRST )
    372385  {
    373     this->delayed = this->repeatDelay;
     386    this->delayed = this->repeatRate;
    374387    if (this->pressedKey == SDLK_BACKSPACE)
    375388      this->removeCharacters(1);
  • trunk/src/util/shell.h

    r5096 r5097  
    5454    bool executeCommand();
    5555
     56    void setRepeatDelay(float repeatDelay, float repeatRate);
    5657
    5758    // EventListener
     
    7778    Text*                  inputLineText;          //!< The inputLine of the Shell
    7879    char*                  inputLine;              //!< the Char-Array of the Buffer
    79     float                  repeatDelay;            //!< The Repeat-Delay.
     80    float                  repeatRate;             //!< The Repeat-Delay.
     81    float                  repeatDelay;            //!< The delay of the first Character of a given Character.
    8082    float                  delayed;                //!< how much of the delay is remaining.
    8183    int                    pressedKey;             //!< the pressed key that will be repeated.
Note: See TracChangeset for help on using the changeset viewer.