Hello everyone, I’m using monogame for a long time in Windows but now I migrated to MacOS, and my code:
‘mouse.LeftButton == ButtonState.Pressed’ only is executed when I click the trackpad and not when I tap it.
My MacOS is configured to “Tap to click - Tap with one finger”.
Someone knows How I could fix it? Is it possible?
Thanks.
(Sorry if I’m using a wrong section or this question is already answered I didn’t found nothing)
Sometimes on trackpad-Tap state of left mouse button changed on ‘Pressed’ state, but it’s very unstable (1 of 10 taps) in other cases in update method we get always ‘Released’ mouse state like we don’t Tap ever.
Looks like MonoGame not catch very fast clicks (Tap-s).
public override void MouseDown (NSEvent theEvent)
{
PointF loc = theEvent.LocationInWindow;
UpdateMousePosition (loc);
switch (theEvent.Type) {
case NSEventType.LeftMouseDown:
MouseState.LeftButton = ButtonState.Pressed;
break;
}
}
public override void MouseUp (NSEvent theEvent)
{
PointF loc = theEvent.LocationInWindow;
UpdateMousePosition (loc);
switch (theEvent.Type) {
case NSEventType.LeftMouseUp:
MouseState.LeftButton = ButtonState.Released;
break;
}
}
Look on this part. If NSEventType changed very fast from LeftMouseDown to LeftMouseUp (in our case it’s trackpad touch), then in Update method we not catch this situation. And in update method we miss that Mouse state recently changed.
May be we can store PreviousLeftButtonState in Mouse.GetState? In this situation we will know that mouse change state.
I can make pullrequest that fix this issue, with this method:
bool TryGetPreviousLocation(out PointF p);
Or more usable:
bool TryGetPreviousMouseState(out MouseState state);