mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-19 21:10:11 -07:00
W.I.P dynamic pointer size according to GUI scale
This commit is contained in:
parent
a4b37a7929
commit
047a9f6043
5 changed files with 11 additions and 3 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue