Event input: button fire repeat
This commit is contained in:
parent
5ffe96237f
commit
0bea6153b0
2 changed files with 11 additions and 1 deletions
|
@ -242,6 +242,15 @@ void FGButtonEvent::fire( FGEventData & eventData )
|
|||
lastState = pressed;
|
||||
}
|
||||
|
||||
void FGButtonEvent::update( double dt )
|
||||
{
|
||||
if (repeatable && lastState) {
|
||||
// interval / dt handling is done by base ::fire method
|
||||
FGEventData ed{1.0, dt, 0 /* modifiers */};
|
||||
FGInputEvent::fire( ed );
|
||||
}
|
||||
}
|
||||
|
||||
FGInputDevice::~FGInputDevice()
|
||||
{
|
||||
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
||||
|
|
|
@ -175,6 +175,7 @@ public:
|
|||
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||
virtual void fire( FGEventData & eventData );
|
||||
|
||||
void update( double dt ) override;
|
||||
protected:
|
||||
bool repeatable;
|
||||
bool lastState;
|
||||
|
|
Loading…
Reference in a new issue