Re: Input events - Design help
Posted by krishnak on Mar 04, 2013; 12:50pm
URL: https://forum.jogamp.org/Input-events-Design-help-tp4028400p4028467.html
I am implementing the Joystick axis using a DPAD connected to the GPIO . I have only implemented the POV_X and POV_Y for time being.
I am creating the axis like this inside my JoyInput implementation
this.povX = new DefaultJoystickAxis( getInputManager(),
this, getAxisCount(), JoystickAxis.POV_X,
"POV_x",
false, true, 0 );
I have flycam enabled in Jmonkey App.
When I press the buttons, the camera moves in the correct direction with speed.
When I release the button press, the camera stops moving with speed, but it keeps moving in the same direction at a very minimal speed. I am confused as to what is causing the minor camera motion inspite of no events being generated. What does the isAnalog variable in the DefaultJoystickConstructor do - does it have any relation to this behavior? I have set it to false.
When I press the button a JoyAxis event is created like this in the JoyInput implementation
if (name.equalsIgnoreCase(RemoteButtons.DPadL.name())||(name.equalsIgnoreCase(RemoteButtons.DPadD.name())))
{
value = -1f;
}
else
{
value = 1f;
}
if (name.equalsIgnoreCase(RemoteButtons.DPadL.name())||(name.equalsIgnoreCase(RemoteButtons.DPadR.name())))
{
laxis = vjt.getAxis("POV_x") ;
}
else
{
laxis = vjt.getAxis("POV_y") ;
}
axevt = new JoyAxisEvent(laxis,value);
listener.onJoyAxisEvent(axevt);