mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 23:59:21 -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 final GamepadMapping menuMap = new GamepadMapping();
|
||||||
private GamepadMapping currentMap = menuMap;
|
private GamepadMapping currentMap = menuMap;
|
||||||
|
|
||||||
private boolean isGrabbing = false;
|
private boolean isGrabbing = true;
|
||||||
|
|
||||||
|
|
||||||
private Thread mouseThread;
|
private Thread mouseThread;
|
||||||
@ -125,6 +125,7 @@ public class Gamepad {
|
|||||||
//TODO hide the cursor
|
//TODO hide the cursor
|
||||||
currentMap = gameMap;
|
currentMap = gameMap;
|
||||||
menuMap.resetPressedState();
|
menuMap.resetPressedState();
|
||||||
|
setPointerViewVisible(false);
|
||||||
}else{
|
}else{
|
||||||
//TODO place the cursor at the center
|
//TODO place the cursor at the center
|
||||||
currentMap = menuMap;
|
currentMap = menuMap;
|
||||||
@ -135,6 +136,7 @@ public class Gamepad {
|
|||||||
gameActivity.mouse_y = CallbackBridge.windowHeight/2;
|
gameActivity.mouse_y = CallbackBridge.windowHeight/2;
|
||||||
CallbackBridge.sendCursorPos(gameActivity.mouse_x, gameActivity.mouse_y);
|
CallbackBridge.sendCursorPos(gameActivity.mouse_x, gameActivity.mouse_y);
|
||||||
placePointerView(CallbackBridge.physicalWidth/2, CallbackBridge.physicalHeight/2);
|
placePointerView(CallbackBridge.physicalWidth/2, CallbackBridge.physicalHeight/2);
|
||||||
|
setPointerViewVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -294,6 +296,11 @@ public class Gamepad {
|
|||||||
pointerView.setTranslationY(y-32);
|
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){
|
private void sendButton(KeyEvent event){
|
||||||
int keycode = event.getKeyCode();
|
int keycode = event.getKeyCode();
|
||||||
switch (keycode){
|
switch (keycode){
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/console_pointer"
|
android:id="@+id/console_pointer"
|
||||||
|
android:visibility="invisible"
|
||||||
android:layout_width="64px"
|
android:layout_width="64px"
|
||||||
android:layout_height="64px"
|
android:layout_height="64px"
|
||||||
app:srcCompat="@drawable/pointer" />
|
app:srcCompat="@drawable/pointer" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user