mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Add remaining Controls to Android for Testing
This commit is contained in:
parent
5d0ec59ea3
commit
8f2275c6ab
4 changed files with 141 additions and 5 deletions
|
@ -25,7 +25,7 @@
|
|||
#include <oboe/Oboe.h>
|
||||
|
||||
#define BUFFER_CHUNK_SIZE 512
|
||||
#define BUFFER_CHUNKS_COUNT 128
|
||||
#define BUFFER_CHUNKS_COUNT 32
|
||||
|
||||
using AudioBuffer = CircularBuffer<BUFFER_CHUNKS_COUNT, BUFFER_CHUNK_SIZE>;
|
||||
|
||||
|
|
|
@ -51,7 +51,41 @@ class TouchControlsFragment : Fragment()
|
|||
moonButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_MOON)
|
||||
pyramidButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_PYRAMID)
|
||||
boxButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_BOX)
|
||||
l1ButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_L1)
|
||||
r1ButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_R1)
|
||||
optionsButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_OPTIONS)
|
||||
shareButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_SHARE)
|
||||
psButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_PS)
|
||||
touchpadButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_TOUCHPAD)
|
||||
|
||||
l2ButtonView.buttonPressedCallback = { controllerState = controllerState.copy().apply { l2State = if(it) 255U else 0U } }
|
||||
r2ButtonView.buttonPressedCallback = { controllerState = controllerState.copy().apply { r2State = if(it) 255U else 0U } }
|
||||
|
||||
leftDpadView.stateChangeCallback = { controllerState = controllerState.copy().apply {
|
||||
val pos: Pair<Short, Short> = when(it)
|
||||
{
|
||||
DPadView.Direction.UP -> Pair(0, Short.MIN_VALUE)
|
||||
DPadView.Direction.DOWN -> Pair(0, Short.MAX_VALUE)
|
||||
DPadView.Direction.LEFT -> Pair(Short.MIN_VALUE, 0)
|
||||
DPadView.Direction.RIGHT -> Pair(Short.MAX_VALUE, 0)
|
||||
null -> Pair(0, 0)
|
||||
}
|
||||
leftX = pos.first
|
||||
leftY = pos.second
|
||||
}}
|
||||
|
||||
rightDpadView.stateChangeCallback = { controllerState = controllerState.copy().apply {
|
||||
val pos: Pair<Short, Short> = when(it)
|
||||
{
|
||||
DPadView.Direction.UP -> Pair(0, Short.MIN_VALUE)
|
||||
DPadView.Direction.DOWN -> Pair(0, Short.MAX_VALUE)
|
||||
DPadView.Direction.LEFT -> Pair(Short.MIN_VALUE, 0)
|
||||
DPadView.Direction.RIGHT -> Pair(Short.MAX_VALUE, 0)
|
||||
null -> Pair(0, 0)
|
||||
}
|
||||
rightX = pos.first
|
||||
rightY = pos.second
|
||||
}}
|
||||
}
|
||||
|
||||
private fun dpadStateChanged(direction: DPadView.Direction?)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
@ -22,7 +23,8 @@
|
|||
android:layout_height="144dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="32dp">
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/crossButtonView"
|
||||
|
@ -73,8 +75,8 @@
|
|||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/psButtonView"
|
||||
android:layout_width="@dimen/control_face_button_size"
|
||||
android:layout_height="@dimen/control_face_button_size"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
|
@ -83,4 +85,104 @@
|
|||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/touchpadButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintLeft_toRightOf="@id/psButtonView"
|
||||
app:layout_constraintRight_toLeftOf="@id/optionsButtonView"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/l2ButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/l1ButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/l2ButtonView"/>
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/shareButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintLeft_toRightOf="@id/l2ButtonView"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/r2ButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/r1ButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/r2ButtonView"/>
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.ButtonView
|
||||
android:id="@+id/optionsButtonView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:drawableIdle="@drawable/control_button_pyramid"
|
||||
app:drawablePressed="@drawable/control_button_pyramid_pressed"
|
||||
app:layout_constraintRight_toLeftOf="@id/r2ButtonView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.DPadView
|
||||
android:id="@+id/leftDpadView"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<com.metallic.chiaki.touchcontrols.DPadView
|
||||
android:id="@+id/rightDpadView"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -7,6 +7,6 @@
|
|||
<color name="stream_text">@android:color/white</color>
|
||||
<color name="stream_background">@android:color/black</color>
|
||||
|
||||
<color name="control_primary">#44ffffff</color>
|
||||
<color name="control_primary">#22ffffff</color>
|
||||
<color name="control_pressed">#88ffffff</color>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue