v2.1.1: fixed bugs with cursor capture
This commit is contained in:
@@ -179,6 +179,8 @@ public class ControllerHandler implements ControllerListener {
|
||||
if (sendEvent) {
|
||||
controllerActive = true;
|
||||
PointerEvent.addPointerEvent(new PointerEvent((int) controllerPointerPos.x, (int) controllerPointerPos.y, 10_000, PointerEvent.Type.HOVER, PointerEvent.NONE));
|
||||
} else {
|
||||
PointerEvent.setHoverPos(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,11 @@
|
||||
|
||||
package com.watabou.input;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.InputMultiplexer;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.ui.Cursor;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
public class InputHandler extends InputAdapter {
|
||||
|
||||
@@ -122,6 +122,10 @@ public class PointerEvent {
|
||||
return lastHoverPos.clone();
|
||||
}
|
||||
|
||||
public static void setHoverPos(PointF pos){
|
||||
lastHoverPos.set(pos);
|
||||
}
|
||||
|
||||
public static synchronized void addPointerEvent( PointerEvent event ){
|
||||
pointerEvents.add( event );
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.watabou.input.ControllerHandler;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.FileUtils;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
@@ -99,10 +100,9 @@ public class Cursor {
|
||||
} else {
|
||||
if (ControllerHandler.controllerPointerActive()) {
|
||||
ControllerHandler.setControllerPointer(true);
|
||||
ControllerHandler.updateControllerPointer(new PointF(Game.width/2, Game.height/2), false);
|
||||
ControllerHandler.updateControllerPointer(new PointF(Game.width/2f, Game.height/2f), false);
|
||||
} else {
|
||||
Gdx.input.setCursorCatched(false);
|
||||
Gdx.input.setCursorPosition(Game.width/2, Game.height/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user