Event input: button fire repeat
This commit is contained in:
parent
5ffe96237f
commit
0bea6153b0
2 changed files with 11 additions and 1 deletions
|
@ -190,7 +190,7 @@ void FGAxisEvent::fire( FGEventData & eventData )
|
|||
ed.value = interpolater->interpolate(ed.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FGInputEvent::fire( ed );
|
||||
}
|
||||
|
||||
|
@ -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