mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
The pointer now appears only when needed.
This commit is contained in:
parent
1b605d0548
commit
087eadb1e5
@ -47,7 +47,7 @@ public class Gamepad {
|
||||
private final GamepadMapping menuMap = new GamepadMapping();
|
||||
private GamepadMapping currentMap = menuMap;
|
||||
|
||||
private boolean isGrabbing = false;
|
||||
private boolean isGrabbing = true;
|
||||
|
||||
|
||||
private Thread mouseThread;
|
||||
@ -125,6 +125,7 @@ public class Gamepad {
|
||||
//TODO hide the cursor
|
||||
currentMap = gameMap;
|
||||
menuMap.resetPressedState();
|
||||
setPointerViewVisible(false);
|
||||
}else{
|
||||
//TODO place the cursor at the center
|
||||
currentMap = menuMap;
|
||||
@ -135,6 +136,7 @@ public class Gamepad {
|
||||
gameActivity.mouse_y = CallbackBridge.windowHeight/2;
|
||||
CallbackBridge.sendCursorPos(gameActivity.mouse_x, gameActivity.mouse_y);
|
||||
placePointerView(CallbackBridge.physicalWidth/2, CallbackBridge.physicalHeight/2);
|
||||
setPointerViewVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -294,6 +296,11 @@ public class Gamepad {
|
||||
pointerView.setTranslationY(y-32);
|
||||
}
|
||||
|
||||
private void setPointerViewVisible(boolean state){
|
||||
new Handler(Looper.getMainLooper()).post(() -> pointerView.setVisibility( state ? View.VISIBLE : View.INVISIBLE));
|
||||
|
||||
}
|
||||
|
||||
private void sendButton(KeyEvent event){
|
||||
int keycode = event.getKeyCode();
|
||||
switch (keycode){
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/console_pointer"
|
||||
android:visibility="invisible"
|
||||
android:layout_width="64px"
|
||||
android:layout_height="64px"
|
||||
app:srcCompat="@drawable/pointer" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user