#include <uInput.h>
Public Member Functions | |
uBind (uAction *a) | |
uBind (std::istream &s) | |
virtual | ~uBind () |
virtual void | Write (std::ostream &s) |
virtual bool | CheckPlayer (int p)=0 |
bool | Activate (REAL x, bool delayed) |
void | HanldeDelayed () |
bool | IsDoubleBind (uInput const *input) |
checks if the sym is used for double binding, return true | |
Public Attributes | |
uAction * | act |
the time of the last usage | |
Private Member Functions | |
virtual bool | Delayable ()=0 |
virtual bool | DoActivate (REAL x)=0 |
Private Attributes | |
REAL | lastValue_ |
REAL | delayedValue_ |
uInput const * | lastInput_ |
double | lastTime_ |
the last input used to activate this | |
Friends | |
class | uMenuItemInput |
Definition at line 142 of file uInput.h.
uBind::uBind | ( | uAction * | a | ) |
Definition at line 678 of file uInput.cpp.
uBind::uBind | ( | std::istream & | s | ) |
Definition at line 680 of file uInput.cpp.
References act, and uAction::Find().
00681 : lastValue_(0), delayedValue_(0), lastInput_(0), lastTime_(-1), act(NULL) 00682 { 00683 std::string name; 00684 s >> name; 00685 act = uAction::Find( name.c_str() );
uBind::~uBind | ( | ) | [virtual] |
Definition at line 676 of file uInput.cpp.
virtual bool uBind::Delayable | ( | ) | [private, pure virtual] |
virtual bool uBind::DoActivate | ( | REAL | x | ) | [private, pure virtual] |
Implemented in uBindPlayer.
Referenced by Activate(), and HanldeDelayed().
void uBind::Write | ( | std::ostream & | s | ) | [virtual] |
Reimplemented in uBindPlayer.
Definition at line 687 of file uInput.cpp.
References act, and uAction::internalName.
Referenced by uBindPlayer::Write().
00688 { 00689 s << act->internalName << '\t';
virtual bool uBind::CheckPlayer | ( | int | p | ) | [pure virtual] |
Implemented in uBindPlayer.
Referenced by uMenuItemInput::Event(), and uMenuItemInput::Render().
bool uBind::Activate | ( | REAL | x, | |
bool | delayed | |||
) |
Definition at line 695 of file uInput.cpp.
References Delayable(), delayedValue_, DoActivate(), and lastValue_.
Referenced by su_ClearKeys(), su_HandleEvent(), and su_InputSync().
00697 { 00698 delayedValue_ = x; 00699 00700 if ( !delayed || !Delayable() ) 00701 { 00702 lastValue_ = x; 00703 return this->DoActivate( x ); 00704 } 00705 00706 return true;
void uBind::HanldeDelayed | ( | ) |
Definition at line 708 of file uInput.cpp.
References delayedValue_, DoActivate(), and lastValue_.
Referenced by su_HandleDelayedEvents().
00710 { 00711 if ( lastValue_ != delayedValue_ ) 00712 { 00713 lastValue_ = delayedValue_; 00714 this->DoActivate( delayedValue_ ); 00715 }
bool uBind::IsDoubleBind | ( | uInput const * | input | ) |
checks if the sym is used for double binding, return true
Definition at line 719 of file uInput.cpp.
References lastInput_, lastTime_, su_doubleBindTimeout, and tSysTimeFloat().
Referenced by su_HandleEvent().
00721 { 00722 double currentTime = tSysTimeFloat(); 00723 00724 // if a different key was used for this action a short while ago, give alarm. 00725 bool ret = ( su_doubleBindTimeout > 0 && input != lastInput_ && currentTime - lastTime_ < su_doubleBindTimeout ); 00726 00727 // store last usage 00728 lastInput_ = input; 00729 lastTime_ = currentTime; 00730 00731 // return result 00732 return ret;
friend class uMenuItemInput [friend] |
REAL uBind::lastValue_ [private] |
REAL uBind::delayedValue_ [private] |
uInput const* uBind::lastInput_ [private] |
double uBind::lastTime_ [private] |
the last input used to activate this
Definition at line 152 of file uInput.h.
Referenced by IsDoubleBind().
the time of the last usage
Definition at line 155 of file uInput.h.
Referenced by uBindPlayer::DoActivate(), uMenuItemInput::Event(), uActionGlobal::IsBreakingGlobalBind(), uBindPlayer::NewBind(), uMenuItemInput::Render(), su_HandleEvent(), su_InputSync(), uBind(), and Write().