mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-20 17:47:03 -04:00
W.I.P dynamic pointer size according to GUI scale
This commit is contained in:
@@ -934,6 +934,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
if(scale < this.guiScale || guiScale == 0){
|
||||
this.guiScale = scale;
|
||||
}
|
||||
|
||||
if(gamepad != null) gamepad.notifyGUISizeChange(this.guiScale);
|
||||
}
|
||||
|
||||
public int handleGuiBar(int x, int y) {
|
||||
|
||||
@@ -276,6 +276,12 @@ public class Gamepad {
|
||||
getCurrentMap().TRIGGER_RIGHT.update(event.getAxisValue(MotionEvent.AXIS_RTRIGGER) > 0.5);
|
||||
}
|
||||
|
||||
public void notifyGUISizeChange(int newSize){
|
||||
//Change the pointer size to match UI
|
||||
int size = (int) ((22 * newSize) / gameActivity.scaleFactor);
|
||||
gameActivity.runOnUiThread(() -> pointerView.setLayoutParams(new FrameLayout.LayoutParams(size, size)));
|
||||
}
|
||||
|
||||
private GamepadMap getCurrentMap(){
|
||||
return currentMap;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 861 B |
BIN
app_pojavlauncher/src/main/res/drawable/pointer.png
Normal file
BIN
app_pojavlauncher/src/main/res/drawable/pointer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 258 B |
@@ -41,9 +41,9 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/console_pointer"
|
||||
android:visibility="invisible"
|
||||
android:layout_width="64px"
|
||||
android:layout_height="64px"
|
||||
android:visibility="visible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/pointer" />
|
||||
|
||||
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
|
||||
|
||||
Reference in New Issue
Block a user