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;
|
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()
|
FGInputDevice::~FGInputDevice()
|
||||||
{
|
{
|
||||||
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
||||||
|
|
|
@ -175,6 +175,7 @@ public:
|
||||||
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||||
virtual void fire( FGEventData & eventData );
|
virtual void fire( FGEventData & eventData );
|
||||||
|
|
||||||
|
void update( double dt ) override;
|
||||||
protected:
|
protected:
|
||||||
bool repeatable;
|
bool repeatable;
|
||||||
bool lastState;
|
bool lastState;
|
||||||
|
|
Loading…
Reference in a new issue