allow remapping of fire button for trackball and light gun games

This commit is contained in:
Thomas Jentzsch 2020-03-03 11:27:15 +01:00
parent c98629892d
commit 1ee718332a
2 changed files with 14 additions and 6 deletions

View File

@ -115,7 +115,11 @@ bool Lightgun::read(DigitalPin pin)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Lightgun::update()
{
// we allow left and right mouse buttons for fire button
setPin(DigitalPin::One, myEvent.get(Event::MouseButtonLeftValue)
|| myEvent.get(Event::MouseButtonRightValue));
// Digital events (from keyboard or joystick hats & buttons)
setPin(DigitalPin::One, myEvent.get(Event::JoystickZeroFire) == 0);
// We allow left and right mouse buttons for fire button
if(myEvent.get(Event::MouseButtonLeftValue) ||
myEvent.get(Event::MouseButtonRightValue))
setPin(DigitalPin::One, false);
}

View File

@ -86,9 +86,13 @@ void PointingDevice::update()
updateDirection(-myEvent.get(Event::MouseAxisYMove), myVCounterRemainder,
myTrackBallDown, myTrackBallLinesV, myScanCountV, myFirstScanOffsetV);
// Get mouse button state
setPin(DigitalPin::Six, (myEvent.get(Event::MouseButtonLeftValue) == 0) &&
(myEvent.get(Event::MouseButtonRightValue) == 0));
// Digital events (from keyboard or joystick hats & buttons)
setPin(DigitalPin::Six, myEvent.get(Event::JoystickZeroFire) == 0);
// We allow left and right mouse buttons for fire button
if(myEvent.get(Event::MouseButtonLeftValue) ||
myEvent.get(Event::MouseButtonRightValue))
setPin(DigitalPin::Six, false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -