mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
fix digital button revoke event, update colors
This commit is contained in:
parent
4e29f2ae8b
commit
1c9458d056
58
app/app.iml
58
app/app.iml
@ -8,12 +8,10 @@
|
|||||||
</facet>
|
</facet>
|
||||||
<facet type="android" name="Android">
|
<facet type="android" name="Android">
|
||||||
<configuration>
|
<configuration>
|
||||||
<option name="SELECTED_BUILD_VARIANT" value="nonRootDebug" />
|
<option name="SELECTED_BUILD_VARIANT" value="nonRootRelease" />
|
||||||
<option name="ASSEMBLE_TASK_NAME" value="assembleNonRootDebug" />
|
<option name="ASSEMBLE_TASK_NAME" value="assembleNonRootRelease" />
|
||||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileNonRootDebugSources" />
|
<option name="COMPILE_JAVA_TASK_NAME" value="compileNonRootReleaseSources" />
|
||||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleNonRootDebugTest" />
|
<option name="SOURCE_GEN_TASK_NAME" value="generateNonRootReleaseSources" />
|
||||||
<option name="SOURCE_GEN_TASK_NAME" value="generateNonRootDebugSources" />
|
|
||||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateNonRootDebugTestSources" />
|
|
||||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||||
@ -23,28 +21,22 @@
|
|||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/nonRoot/debug" />
|
<output url="file://$MODULE_DIR$/build/intermediates/classes/nonRoot/release" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/nonRoot/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/nonRoot/release" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/nonRoot/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/nonRoot/release" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/nonRoot/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/nonRoot/release" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/nonRoot/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/nonRoot/release" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/nonRoot/debug" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/nonRoot/release" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/nonRoot/debug" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/nonRoot/release" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/assets" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/aidl" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/aidl" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRootDebug/rs" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRootRelease/rs" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/nonRoot/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/nonRoot/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/nonRoot/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/nonRoot/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/nonRoot/debug" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/nonRoot/debug" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRoot/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRoot/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRoot/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRoot/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/nonRoot/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/nonRoot/assets" type="java-resource" />
|
||||||
@ -59,13 +51,13 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNonRoot/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNonRoot/java" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNonRoot/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNonRoot/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNonRoot/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNonRoot/rs" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/assets" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||||
|
@ -21,7 +21,7 @@ public class AnalogStick extends View
|
|||||||
MOVED
|
MOVED
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean _PRINT_DEBUG_INFORMATION = true;
|
private static final boolean _PRINT_DEBUG_INFORMATION = false;
|
||||||
|
|
||||||
public interface AnalogStickListener
|
public interface AnalogStickListener
|
||||||
{
|
{
|
||||||
@ -46,8 +46,8 @@ public class AnalogStick extends View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int normalColor = 0x88888888;
|
private int normalColor = 0xF0888888;
|
||||||
private int pressedColor = 0x880000FF;
|
private int pressedColor = 0xF00000FF;
|
||||||
|
|
||||||
float radius_complete = 0;
|
float radius_complete = 0;
|
||||||
float radius_dead_zone = 0;
|
float radius_dead_zone = 0;
|
||||||
@ -74,6 +74,12 @@ public class AnalogStick extends View
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setColors(int normalColor, int pressedColor)
|
||||||
|
{
|
||||||
|
this.normalColor = normalColor;
|
||||||
|
this.pressedColor = pressedColor;
|
||||||
|
}
|
||||||
|
|
||||||
private float getPercent(float value, int percent)
|
private float getPercent(float value, int percent)
|
||||||
{
|
{
|
||||||
return value / 100 * percent;
|
return value / 100 * percent;
|
||||||
|
@ -15,10 +15,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class DigitalButton extends View
|
public class DigitalButton extends View
|
||||||
{
|
{
|
||||||
private static final boolean _PRINT_DEBUG_INFORMATION = true;
|
private static final boolean _PRINT_DEBUG_INFORMATION = false;
|
||||||
|
|
||||||
private int normalColor = 0x88888888;
|
private int normalColor = 0xF0888888;
|
||||||
private int pressedColor = 0x880000FF;
|
private int pressedColor = 0xF00000FF;
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +34,12 @@ public class DigitalButton extends View
|
|||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setColors(int normalColor, int pressedColor)
|
||||||
|
{
|
||||||
|
this.normalColor = normalColor;
|
||||||
|
this.pressedColor = pressedColor;
|
||||||
|
}
|
||||||
|
|
||||||
public void setOnTouchListener(OnTouchListener listener)
|
public void setOnTouchListener(OnTouchListener listener)
|
||||||
{
|
{
|
||||||
onTouchListener = listener;
|
onTouchListener = listener;
|
||||||
|
@ -21,10 +21,10 @@ public class DigitalPad extends View
|
|||||||
public final static int DIGITAL_PAD_DIRECTION_RIGHT = 4;
|
public final static int DIGITAL_PAD_DIRECTION_RIGHT = 4;
|
||||||
public final static int DIGITAL_PAD_DIRECTION_DOWN = 8;
|
public final static int DIGITAL_PAD_DIRECTION_DOWN = 8;
|
||||||
|
|
||||||
private int normalColor = 0x88888888;
|
private int normalColor = 0xF0888888;
|
||||||
private int pressedColor = 0x880000FF;
|
private int pressedColor = 0xF00000FF;
|
||||||
|
|
||||||
private static final boolean _PRINT_DEBUG_INFORMATION = true;
|
private static final boolean _PRINT_DEBUG_INFORMATION = false;
|
||||||
|
|
||||||
public interface DigitalPadListener
|
public interface DigitalPadListener
|
||||||
{
|
{
|
||||||
@ -71,6 +71,12 @@ public class DigitalPad extends View
|
|||||||
return getWidth() > getHeight() ? getHeight() : getWidth();
|
return getWidth() > getHeight() ? getHeight() : getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setColors(int normalColor, int pressedColor)
|
||||||
|
{
|
||||||
|
this.normalColor = normalColor;
|
||||||
|
this.pressedColor = pressedColor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas)
|
protected void onDraw(Canvas canvas)
|
||||||
{
|
{
|
||||||
@ -83,14 +89,17 @@ public class DigitalPad extends View
|
|||||||
paint.setTextAlign(Paint.Align.CENTER);
|
paint.setTextAlign(Paint.Align.CENTER);
|
||||||
paint.setStrokeWidth(3);
|
paint.setStrokeWidth(3);
|
||||||
|
|
||||||
// draw no direction rect
|
if (direction == DIGITAL_PAD_DIRECTION_NO_DIRECTION)
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
{
|
||||||
paint.setColor(direction == DIGITAL_PAD_DIRECTION_NO_DIRECTION ? pressedColor : normalColor);
|
// draw no direction rect
|
||||||
canvas.drawRect(
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
getPercent(getWidth(), 36), getPercent(getHeight(), 36),
|
paint.setColor(normalColor);
|
||||||
getPercent(getWidth(), 63), getPercent(getHeight(), 63),
|
canvas.drawRect(
|
||||||
paint
|
getPercent(getWidth(), 36), getPercent(getHeight(), 36),
|
||||||
);
|
getPercent(getWidth(), 63), getPercent(getHeight(), 63),
|
||||||
|
paint
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// draw left rect
|
// draw left rect
|
||||||
paint.setColor((direction & DIGITAL_PAD_DIRECTION_LEFT) > 0 ? pressedColor : normalColor);
|
paint.setColor((direction & DIGITAL_PAD_DIRECTION_LEFT) > 0 ? pressedColor : normalColor);
|
||||||
|
@ -25,6 +25,7 @@ public class VirtualController
|
|||||||
System.out.println("VirtualController: " + text);
|
System.out.println("VirtualController: " + text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private short inputMap = 0x0000;
|
private short inputMap = 0x0000;
|
||||||
private byte leftTrigger = 0x00;
|
private byte leftTrigger = 0x00;
|
||||||
private byte rightTrigger = 0x00;
|
private byte rightTrigger = 0x00;
|
||||||
@ -50,7 +51,11 @@ public class VirtualController
|
|||||||
private RelativeLayout.LayoutParams layoutParamsParamsStick = null;
|
private RelativeLayout.LayoutParams layoutParamsParamsStick = null;
|
||||||
private RelativeLayout.LayoutParams layoutParamsParamsStick2 = null;
|
private RelativeLayout.LayoutParams layoutParamsParamsStick2 = null;
|
||||||
|
|
||||||
private Button buttonStart = null;
|
// configuration
|
||||||
|
private RelativeLayout.LayoutParams layoutParamsButtonOpenColorPickerNormal = null;
|
||||||
|
private RelativeLayout.LayoutParams layoutParamsButtonOpenColorPickerPressed = null;
|
||||||
|
|
||||||
|
private Button buttonStart = null;
|
||||||
private Button buttonSelect = null;
|
private Button buttonSelect = null;
|
||||||
private Button buttonESC = null;
|
private Button buttonESC = null;
|
||||||
|
|
||||||
@ -65,7 +70,6 @@ public class VirtualController
|
|||||||
private DigitalButton buttonLB = null;
|
private DigitalButton buttonLB = null;
|
||||||
private DigitalButton buttonRB = null;
|
private DigitalButton buttonRB = null;
|
||||||
|
|
||||||
|
|
||||||
private AnalogStick stick = null;
|
private AnalogStick stick = null;
|
||||||
private AnalogStick stick2 = null;
|
private AnalogStick stick2 = null;
|
||||||
|
|
||||||
@ -93,35 +97,6 @@ public class VirtualController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onButtonTouchEvent(View v, MotionEvent event, short key)
|
|
||||||
{
|
|
||||||
// get masked (not specific to a pointer) action
|
|
||||||
int action = event.getActionMasked();
|
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
{
|
|
||||||
inputMap |= key;
|
|
||||||
|
|
||||||
sendControllerInputPacket();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
|
||||||
{
|
|
||||||
inputMap &= ~key;
|
|
||||||
|
|
||||||
sendControllerInputPacket();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void refreshLayout()
|
void refreshLayout()
|
||||||
{
|
{
|
||||||
relative_layout.removeAllViews();
|
relative_layout.removeAllViews();
|
||||||
@ -172,6 +147,27 @@ public class VirtualController
|
|||||||
relative_layout.addView(buttonRB, layoutParamsButtonRB);
|
relative_layout.addView(buttonRB, layoutParamsButtonRB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DigitalButton createDigitalButton(String text, final int key, Context context)
|
||||||
|
{
|
||||||
|
DigitalButton button = new DigitalButton(context);
|
||||||
|
button.setText(text);
|
||||||
|
button.addDigitalButtonListener(new DigitalButton.DigitalButtonListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick() {
|
||||||
|
inputMap |= key;
|
||||||
|
sendControllerInputPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRelease() {
|
||||||
|
inputMap &= ~key;
|
||||||
|
sendControllerInputPacket();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
public VirtualController(final NvConnection conn, FrameLayout layout, Context context, WindowManager window_manager)
|
public VirtualController(final NvConnection conn, FrameLayout layout, Context context, WindowManager window_manager)
|
||||||
{
|
{
|
||||||
this.connection = conn;
|
this.connection = conn;
|
||||||
@ -234,72 +230,10 @@ public class VirtualController
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonX = new DigitalButton(context);
|
buttonX = createDigitalButton("X", ControllerPacket.X_FLAG ,context);
|
||||||
buttonX.setText("X");
|
buttonY = createDigitalButton("Y", ControllerPacket.Y_FLAG ,context);
|
||||||
buttonX.addDigitalButtonListener(new DigitalButton.DigitalButtonListener() {
|
buttonA = createDigitalButton("A", ControllerPacket.A_FLAG ,context);
|
||||||
@Override
|
buttonB = createDigitalButton("B", ControllerPacket.B_FLAG ,context);
|
||||||
public void onClick() {
|
|
||||||
inputMap |= ControllerPacket.X_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRelease() {
|
|
||||||
inputMap &= ControllerPacket.X_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonY = new DigitalButton(context);
|
|
||||||
buttonY.setText("Y");
|
|
||||||
buttonY.addDigitalButtonListener(new DigitalButton.DigitalButtonListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick()
|
|
||||||
{
|
|
||||||
inputMap |= ControllerPacket.Y_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRelease()
|
|
||||||
{
|
|
||||||
inputMap &= ControllerPacket.Y_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonA = new DigitalButton(context);
|
|
||||||
buttonA.setText("A");
|
|
||||||
buttonA.addDigitalButtonListener(new DigitalButton.DigitalButtonListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
inputMap |= ControllerPacket.A_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRelease() {
|
|
||||||
inputMap &= ControllerPacket.A_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonB = new DigitalButton(context);
|
|
||||||
buttonB.setText("B");
|
|
||||||
buttonB.addDigitalButtonListener(new DigitalButton.DigitalButtonListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
inputMap |= ControllerPacket.B_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRelease() {
|
|
||||||
inputMap &= ControllerPacket.B_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonLT = new DigitalButton(context);
|
buttonLT = new DigitalButton(context);
|
||||||
buttonLT.setText("LT");
|
buttonLT.setText("LT");
|
||||||
@ -343,38 +277,8 @@ public class VirtualController
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonLB = new DigitalButton(context);
|
buttonLB = createDigitalButton("LB", ControllerPacket.LB_FLAG ,context);
|
||||||
buttonLB.setText("LB");
|
buttonRB = createDigitalButton("RB", ControllerPacket.RB_FLAG ,context);
|
||||||
buttonLB.addDigitalButtonListener(new DigitalButton.DigitalButtonListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
inputMap |= ControllerPacket.LB_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRelease() {
|
|
||||||
inputMap &= ControllerPacket.LB_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonRB = new DigitalButton(context);
|
|
||||||
buttonRB.setText("RB");
|
|
||||||
buttonRB.addDigitalButtonListener(new DigitalButton.DigitalButtonListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
inputMap |= ControllerPacket.RB_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRelease() {
|
|
||||||
inputMap &= ControllerPacket.RB_FLAG;
|
|
||||||
sendControllerInputPacket();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
stick = new AnalogStick(context);
|
stick = new AnalogStick(context);
|
||||||
|
|
||||||
@ -405,7 +309,6 @@ public class VirtualController
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
refreshLayout();
|
refreshLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,8 +359,8 @@ public class VirtualController
|
|||||||
stick = new AnalogStick(context);
|
stick = new AnalogStick(context);
|
||||||
stick2 = new AnalogStick(context);
|
stick2 = new AnalogStick(context);
|
||||||
|
|
||||||
configuration = true;
|
|
||||||
|
|
||||||
|
configuration = true;
|
||||||
|
|
||||||
// receive touch events
|
// receive touch events
|
||||||
frame_layout.setOnTouchListener(new View.OnTouchListener()
|
frame_layout.setOnTouchListener(new View.OnTouchListener()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user