mirror of https://github.com/stenzek/duckstation
Android: Add analog touchscreen controls
parent
4f0007dd55
commit
897f2dadf8
@ -0,0 +1,179 @@
|
||||
package com.github.stenzek.duckstation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
public class TouchscreenControllerAxisView extends View {
|
||||
private Drawable mBaseDrawable;
|
||||
private Drawable mStickUnpressedDrawable;
|
||||
private Drawable mStickPressedDrawable;
|
||||
private boolean mPressed = false;
|
||||
private int mPointerId = 0;
|
||||
private float mXValue = 0.0f;
|
||||
private float mYValue = 0.0f;
|
||||
private int mDrawXPos = 0;
|
||||
private int mDrawYPos = 0;
|
||||
|
||||
private int mControllerIndex = -1;
|
||||
private int mXAxisCode = -1;
|
||||
private int mYAxisCode = -1;
|
||||
private int mLeftButtonCode = -1;
|
||||
private int mRightButtonCode = -1;
|
||||
private int mUpButtonCode = -1;
|
||||
private int mDownButtonCode = -1;
|
||||
|
||||
public TouchscreenControllerAxisView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public TouchscreenControllerAxisView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public TouchscreenControllerAxisView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mBaseDrawable = getContext().getDrawable(R.drawable.ic_controller_analog_base);
|
||||
mBaseDrawable.setCallback(this);
|
||||
mStickUnpressedDrawable = getContext().getDrawable(R.drawable.ic_controller_analog_stick_unpressed);
|
||||
mStickUnpressedDrawable.setCallback(this);
|
||||
mStickPressedDrawable = getContext().getDrawable(R.drawable.ic_controller_analog_stick_pressed);
|
||||
mStickPressedDrawable.setCallback(this);
|
||||
}
|
||||
|
||||
public void setControllerAxis(int controllerIndex, int xCode, int yCode) {
|
||||
mControllerIndex = controllerIndex;
|
||||
mXAxisCode = xCode;
|
||||
mYAxisCode = yCode;
|
||||
mLeftButtonCode = -1;
|
||||
mRightButtonCode = -1;
|
||||
mUpButtonCode = -1;
|
||||
mDownButtonCode = -1;
|
||||
}
|
||||
|
||||
public void setControllerButtons(int controllerIndex, int leftCode, int rightCode, int upCode, int downCode) {
|
||||
mControllerIndex = controllerIndex;
|
||||
mXAxisCode = -1;
|
||||
mYAxisCode = -1;
|
||||
mLeftButtonCode = leftCode;
|
||||
mRightButtonCode = rightCode;
|
||||
mUpButtonCode = upCode;
|
||||
mDownButtonCode = downCode;
|
||||
}
|
||||
|
||||
public void setUnpressed() {
|
||||
if (!mPressed && mXValue == 0.0f && mYValue == 0.0f)
|
||||
return;
|
||||
|
||||
mPressed = false;
|
||||
mXValue = 0.0f;
|
||||
mYValue = 0.0f;
|
||||
mDrawXPos = 0;
|
||||
mDrawYPos = 0;
|
||||
invalidate();
|
||||
updateControllerState();
|
||||
}
|
||||
|
||||
public void setPressed(int pointerId, float pointerX, float pointerY) {
|
||||
final float dx = pointerX - (float)(getX() + (float)(getWidth() / 2));
|
||||
final float dy = pointerY - (float)(getY() + (float)(getHeight() / 2));
|
||||
// Log.i("SetPressed", String.format("px=%f,py=%f dx=%f,dy=%f", pointerX, pointerY, dx, dy));
|
||||
|
||||
final float pointerDistance = Math.max(Math.abs(dx), Math.abs(dy));
|
||||
final float angle = (float)Math.atan2((double)dy, (double)dx);
|
||||
|
||||
final float maxDistance = (float)Math.min((getWidth() - getPaddingLeft() - getPaddingRight()) / 2, (getHeight() - getPaddingTop() - getPaddingBottom()) / 2);
|
||||
final float length = Math.min(pointerDistance / maxDistance, 1.0f);
|
||||
// Log.i("SetPressed", String.format("pointerDist=%f,angle=%f,w=%d,h=%d,maxDist=%f,length=%f", pointerDistance, angle, getWidth(), getHeight(), maxDistance, length));
|
||||
|
||||
final float xValue = (float)Math.cos((double)angle) * length;
|
||||
final float yValue = (float)Math.sin((double)angle) * length;
|
||||
mDrawXPos = (int)(xValue * maxDistance);
|
||||
mDrawYPos = (int)(yValue * maxDistance);
|
||||
|
||||
boolean doUpdate = (pointerId != mPointerId || !mPressed || (xValue != mXValue || yValue != mYValue));
|
||||
mPointerId = pointerId;
|
||||
mPressed = true;
|
||||
mXValue = xValue;
|
||||
mYValue = yValue;
|
||||
// Log.i("SetPressed", String.format("xval=%f,yval=%f,drawX=%d,drawY=%d", mXValue, mYValue, mDrawXPos, mDrawYPos));
|
||||
|
||||
if (doUpdate) {
|
||||
invalidate();
|
||||
updateControllerState();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateControllerState() {
|
||||
final float BUTTON_THRESHOLD = 0.33f;
|
||||
|
||||
AndroidHostInterface hostInterface = AndroidHostInterface.getInstance();
|
||||
if (mXAxisCode >= 0)
|
||||
hostInterface.setControllerAxisState(mControllerIndex, mXAxisCode, mXValue);
|
||||
if (mYAxisCode >= 0)
|
||||
hostInterface.setControllerAxisState(mControllerIndex, mYAxisCode, mYValue);
|
||||
|
||||
if (mLeftButtonCode >= 0)
|
||||
hostInterface.setControllerButtonState(mControllerIndex, mLeftButtonCode, (mXValue <= -BUTTON_THRESHOLD));
|
||||
if (mRightButtonCode >= 0)
|
||||
hostInterface.setControllerButtonState(mControllerIndex, mRightButtonCode, (mXValue >= BUTTON_THRESHOLD));
|
||||
if (mUpButtonCode >= 0)
|
||||
hostInterface.setControllerButtonState(mControllerIndex, mUpButtonCode, (mYValue <= -BUTTON_THRESHOLD));
|
||||
if (mDownButtonCode >= 0)
|
||||
hostInterface.setControllerButtonState(mControllerIndex, mDownButtonCode, (mYValue >= BUTTON_THRESHOLD));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
final int paddingLeft = getPaddingLeft();
|
||||
final int paddingTop = getPaddingTop();
|
||||
final int paddingRight = getPaddingRight();
|
||||
final int paddingBottom = getPaddingBottom();
|
||||
final int contentWidth = getWidth() - paddingLeft - paddingRight;
|
||||
final int contentHeight = getHeight() - paddingTop - paddingBottom;
|
||||
|
||||
mBaseDrawable.setBounds(paddingLeft, paddingTop,
|
||||
paddingLeft + contentWidth, paddingTop + contentHeight);
|
||||
mBaseDrawable.draw(canvas);
|
||||
|
||||
final int stickWidth = contentWidth / 3;
|
||||
final int stickHeight = contentHeight / 3;
|
||||
final int halfStickWidth = stickWidth / 2;
|
||||
final int halfStickHeight = stickHeight / 2;
|
||||
final int centerX = getWidth() / 2;
|
||||
final int centerY = getHeight() / 2;
|
||||
final int drawX = centerX + mDrawXPos;
|
||||
final int drawY = centerY + mDrawYPos;
|
||||
|
||||
Drawable stickDrawable = mPressed ? mStickPressedDrawable : mStickUnpressedDrawable;
|
||||
stickDrawable.setBounds(drawX - halfStickWidth, drawY - halfStickHeight, drawX + halfStickWidth, drawY + halfStickHeight);
|
||||
stickDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
public boolean isPressed() {
|
||||
return mPressed;
|
||||
}
|
||||
|
||||
public boolean hasPointerId() {
|
||||
return mPointerId >= 0;
|
||||
}
|
||||
|
||||
public int getPointerId() {
|
||||
return mPointerId;
|
||||
}
|
||||
|
||||
public void setPointerId(int mPointerId) {
|
||||
this.mPointerId = mPointerId;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="194.89dp"
|
||||
android:height="194.89dp"
|
||||
android:viewportWidth="194.89"
|
||||
android:viewportHeight="194.89">
|
||||
<path
|
||||
android:pathData="M194.89,97.445A97.445,97.445 0,0 1,97.445 194.89,97.445 97.445,0 0,1 0,97.445 97.445,97.445 0,0 1,97.445 0,97.445 97.445,0 0,1 194.89,97.445Z"
|
||||
android:strokeAlpha="0.50645"
|
||||
android:fillColor="#1a1a1a"
|
||||
android:fillAlpha="0.504414"/>
|
||||
<path
|
||||
android:pathData="M178.82,97.445A81.381,81.381 0,0 1,97.439 178.826,81.381 81.381,0 0,1 16.058,97.445 81.381,81.381 0,0 1,97.439 16.064,81.381 81.381,0 0,1 178.82,97.445Z"
|
||||
android:strokeAlpha="0.50645"
|
||||
android:fillColor="#333333"
|
||||
android:fillAlpha="0.504414"/>
|
||||
<path
|
||||
android:pathData="M159.05,97.445A61.609,61.609 0,0 1,97.441 159.054,61.609 61.609,0 0,1 35.832,97.445 61.609,61.609 0,0 1,97.441 35.836,61.609 61.609,0 0,1 159.05,97.445Z"
|
||||
android:strokeAlpha="0.50645"
|
||||
android:fillColor="#1a1a1a"
|
||||
android:fillAlpha="0.504414"/>
|
||||
</vector>
|
||||
@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="191.756dp"
|
||||
android:height="191.756dp"
|
||||
android:viewportWidth="191.756"
|
||||
android:viewportHeight="191.756">
|
||||
<path
|
||||
android:pathData="M191.756,95.878A95.878,95.878 0,0 1,95.878 191.756,95.878 95.878,0 0,1 0,95.878 95.878,95.878 0,0 1,95.878 0,95.878 95.878,0 0,1 191.756,95.878Z"
|
||||
android:strokeAlpha="0.8"
|
||||
android:fillColor="#666666"
|
||||
android:fillAlpha="0.796784"/>
|
||||
</vector>
|
||||
@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="191.756dp"
|
||||
android:height="191.756dp"
|
||||
android:viewportWidth="191.756"
|
||||
android:viewportHeight="191.756">
|
||||
<path
|
||||
android:pathData="M191.756,95.878A95.878,95.878 0,0 1,95.878 191.756,95.878 95.878,0 0,1 0,95.878 95.878,95.878 0,0 1,95.878 0,95.878 95.878,0 0,1 191.756,95.878Z"
|
||||
android:strokeAlpha="0.50645"
|
||||
android:fillColor="#666666"
|
||||
android:fillAlpha="0.504414"/>
|
||||
</vector>
|
||||
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_r2"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:layout_marginBottom="280dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_r2_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_r2_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_r1"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:layout_marginBottom="220dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_r1_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_r1_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_l1"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginBottom="220dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_l1_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_l1_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_l2"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginBottom="280dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_l2_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_l2_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_start"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_start_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_start_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_select"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_select_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_select_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_cross"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_cross_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_cross_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_square"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="120dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_square_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_square_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_triangle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
android:layout_marginBottom="130dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_triangle_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_triangle_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_circle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_circle_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_circle_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerAxisView
|
||||
android:id="@+id/controller_axis_left"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_r2"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:layout_marginBottom="260dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_r2_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_r2_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_r1"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:layout_marginBottom="200dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_r1_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_r1_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_l1"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginBottom="200dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_l1_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_l1_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_l2"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginBottom="260dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_l2_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_l2_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_start"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_start_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_start_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_select"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_select_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_select_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_cross"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_cross_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_cross_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_square"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="120dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_square_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_square_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_triangle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
android:layout_marginBottom="130dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_triangle_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_triangle_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_circle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_circle_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_circle_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerAxisView
|
||||
android:id="@+id/controller_axis_left"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerAxisView
|
||||
android:id="@+id/controller_axis_right"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="300dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_left"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="300dp"
|
||||
android:paddingTop="50dp"
|
||||
android:paddingBottom="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_left_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_left_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_down"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="300dp"
|
||||
android:paddingStart="50dp"
|
||||
android:paddingEnd="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_down_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_down_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_right"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginStart="120dp"
|
||||
android:layout_marginBottom="300dp"
|
||||
android:paddingTop="50dp"
|
||||
android:paddingBottom="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_right_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_right_button" />
|
||||
|
||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||
android:id="@+id/controller_button_up"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="400dp"
|
||||
android:paddingStart="50dp"
|
||||
android:paddingEnd="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:pressedDrawable="@drawable/ic_controller_up_button_pressed"
|
||||
app:unpressedDrawable="@drawable/ic_controller_up_button" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Reference in New Issue