summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/assets/GCPadNew.ini4
-rw-r--r--Source/Android/res/drawable/button_a.pngbin5178 -> 0 bytes
-rw-r--r--Source/Android/res/drawable/button_b.pngbin4971 -> 0 bytes
-rw-r--r--Source/Android/res/drawable/button_start.pngbin1511 -> 0 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_a.pngbin0 -> 170200 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_a_pressed.pngbin0 -> 127729 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_b.pngbin0 -> 171702 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_b_pressed.pngbin0 -> 126035 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_c.pngbin0 -> 171841 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_c_pressed.pngbin0 -> 130763 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad.pngbin0 -> 100422 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_down.pngbin0 -> 93187 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_downleft.pngbin0 -> 98656 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_downright.pngbin0 -> 97518 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_left.pngbin0 -> 93574 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_right.pngbin0 -> 93954 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_up.pngbin0 -> 93133 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_pressed_upleft.pngbin0 -> 96620 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_dpad_upright.pngbin0 -> 97579 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_joystick.pngbin0 -> 178852 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_joystick_pressed.pngbin0 -> 150018 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_joystick_range.pngbin0 -> 70537 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_l.pngbin0 -> 100769 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_l_pressed.pngbin0 -> 80900 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_r.pngbin0 -> 103351 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_r_pressed.pngbin0 -> 83819 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_start.pngbin0 -> 175622 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_start_pressed.pngbin0 -> 133783 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_x.pngbin0 -> 106229 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_x_pressed.pngbin0 -> 84332 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_y.pngbin0 -> 97383 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_y_pressed.pngbin0 -> 77398 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_z.pngbin0 -> 75310 bytes
-rw-r--r--Source/Android/res/drawable/gcpad_z_pressed.pngbin0 -> 60839 bytes
-rw-r--r--Source/Android/res/drawable/joy_inner.pngbin1125 -> 0 bytes
-rw-r--r--Source/Android/res/drawable/joy_outer.pngbin1690 -> 0 bytes
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java3
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java66
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java15
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigActivity.java19
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigButton.java24
41 files changed, 78 insertions, 53 deletions
diff --git a/Source/Android/assets/GCPadNew.ini b/Source/Android/assets/GCPadNew.ini
index 77e790d0fa..eb0c807771 100644
--- a/Source/Android/assets/GCPadNew.ini
+++ b/Source/Android/assets/GCPadNew.ini
@@ -18,8 +18,8 @@ C-Stick/Left = `Axis 17`
C-Stick/Right = `Axis 18`
C-Stick/Modifier = Control_L
C-Stick/Modifier/Range = 50.000000
-Triggers/L = `Axis 18`
-Triggers/R = `Axis 19`
+Triggers/L = `Button 18`
+Triggers/R = `Button 19`
D-Pad/Up = `Button 6`
D-Pad/Down = `Button 7`
D-Pad/Left = `Button 8`
diff --git a/Source/Android/res/drawable/button_a.png b/Source/Android/res/drawable/button_a.png
deleted file mode 100644
index 7e685324ae..0000000000
--- a/Source/Android/res/drawable/button_a.png
+++ /dev/null
Binary files differ
diff --git a/Source/Android/res/drawable/button_b.png b/Source/Android/res/drawable/button_b.png
deleted file mode 100644
index 21da4c20f1..0000000000
--- a/Source/Android/res/drawable/button_b.png
+++ /dev/null
Binary files differ
diff --git a/Source/Android/res/drawable/button_start.png b/Source/Android/res/drawable/button_start.png
deleted file mode 100644
index e79a9269ee..0000000000
--- a/Source/Android/res/drawable/button_start.png
+++ /dev/null
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_a.png b/Source/Android/res/drawable/gcpad_a.png
new file mode 100644
index 0000000000..7229b7bcb2
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_a.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_a_pressed.png b/Source/Android/res/drawable/gcpad_a_pressed.png
new file mode 100644
index 0000000000..d1012a7692
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_a_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_b.png b/Source/Android/res/drawable/gcpad_b.png
new file mode 100644
index 0000000000..7445a3cb34
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_b.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_b_pressed.png b/Source/Android/res/drawable/gcpad_b_pressed.png
new file mode 100644
index 0000000000..bcd1097253
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_b_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_c.png b/Source/Android/res/drawable/gcpad_c.png
new file mode 100644
index 0000000000..918ac0efe7
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_c.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_c_pressed.png b/Source/Android/res/drawable/gcpad_c_pressed.png
new file mode 100644
index 0000000000..83f2272fe1
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_c_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad.png b/Source/Android/res/drawable/gcpad_dpad.png
new file mode 100644
index 0000000000..ae2262f786
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_down.png b/Source/Android/res/drawable/gcpad_dpad_pressed_down.png
new file mode 100644
index 0000000000..b992c33f42
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_down.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_downleft.png b/Source/Android/res/drawable/gcpad_dpad_pressed_downleft.png
new file mode 100644
index 0000000000..1875c08811
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_downleft.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_downright.png b/Source/Android/res/drawable/gcpad_dpad_pressed_downright.png
new file mode 100644
index 0000000000..01cd286234
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_downright.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_left.png b/Source/Android/res/drawable/gcpad_dpad_pressed_left.png
new file mode 100644
index 0000000000..30c25b944b
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_left.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_right.png b/Source/Android/res/drawable/gcpad_dpad_pressed_right.png
new file mode 100644
index 0000000000..2249c3240e
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_right.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_up.png b/Source/Android/res/drawable/gcpad_dpad_pressed_up.png
new file mode 100644
index 0000000000..fa01bb9c2d
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_up.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_pressed_upleft.png b/Source/Android/res/drawable/gcpad_dpad_pressed_upleft.png
new file mode 100644
index 0000000000..6b69dc10ab
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_pressed_upleft.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_dpad_upright.png b/Source/Android/res/drawable/gcpad_dpad_upright.png
new file mode 100644
index 0000000000..b386bc6f47
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_dpad_upright.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_joystick.png b/Source/Android/res/drawable/gcpad_joystick.png
new file mode 100644
index 0000000000..5e065adfcd
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_joystick.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_joystick_pressed.png b/Source/Android/res/drawable/gcpad_joystick_pressed.png
new file mode 100644
index 0000000000..97238ac989
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_joystick_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_joystick_range.png b/Source/Android/res/drawable/gcpad_joystick_range.png
new file mode 100644
index 0000000000..57417a1c4b
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_joystick_range.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_l.png b/Source/Android/res/drawable/gcpad_l.png
new file mode 100644
index 0000000000..7a883fc012
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_l.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_l_pressed.png b/Source/Android/res/drawable/gcpad_l_pressed.png
new file mode 100644
index 0000000000..71e673de23
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_l_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_r.png b/Source/Android/res/drawable/gcpad_r.png
new file mode 100644
index 0000000000..0f619c8d0d
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_r.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_r_pressed.png b/Source/Android/res/drawable/gcpad_r_pressed.png
new file mode 100644
index 0000000000..b3c83d5289
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_r_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_start.png b/Source/Android/res/drawable/gcpad_start.png
new file mode 100644
index 0000000000..819dece06e
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_start.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_start_pressed.png b/Source/Android/res/drawable/gcpad_start_pressed.png
new file mode 100644
index 0000000000..135375c803
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_start_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_x.png b/Source/Android/res/drawable/gcpad_x.png
new file mode 100644
index 0000000000..2f2e2db89a
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_x.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_x_pressed.png b/Source/Android/res/drawable/gcpad_x_pressed.png
new file mode 100644
index 0000000000..a636227f77
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_x_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_y.png b/Source/Android/res/drawable/gcpad_y.png
new file mode 100644
index 0000000000..bd9a13cdf0
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_y.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_y_pressed.png b/Source/Android/res/drawable/gcpad_y_pressed.png
new file mode 100644
index 0000000000..28588af109
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_y_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_z.png b/Source/Android/res/drawable/gcpad_z.png
new file mode 100644
index 0000000000..f00a80d6e4
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_z.png
Binary files differ
diff --git a/Source/Android/res/drawable/gcpad_z_pressed.png b/Source/Android/res/drawable/gcpad_z_pressed.png
new file mode 100644
index 0000000000..d4912af7f7
--- /dev/null
+++ b/Source/Android/res/drawable/gcpad_z_pressed.png
Binary files differ
diff --git a/Source/Android/res/drawable/joy_inner.png b/Source/Android/res/drawable/joy_inner.png
deleted file mode 100644
index 04e3bb975b..0000000000
--- a/Source/Android/res/drawable/joy_inner.png
+++ /dev/null
Binary files differ
diff --git a/Source/Android/res/drawable/joy_outer.png b/Source/Android/res/drawable/joy_outer.png
deleted file mode 100644
index 7238bdbd29..0000000000
--- a/Source/Android/res/drawable/joy_outer.png
+++ /dev/null
Binary files differ
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java
index 9232cfe5fa..bb737a0b7e 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java
@@ -37,6 +37,7 @@ public final class EmulationActivity extends Activity
private float screenWidth;
private float screenHeight;
private SharedPreferences sharedPrefs;
+ public static WindowManager wm;
@Override
public void onCreate(Bundle savedInstanceState)
@@ -45,7 +46,7 @@ public final class EmulationActivity extends Activity
// Retrieve screen dimensions.
DisplayMetrics displayMetrics = new DisplayMetrics();
- WindowManager wm = getWindowManager();
+ wm = getWindowManager();
wm.getDefaultDisplay().getMetrics(displayMetrics);
this.screenHeight = displayMetrics.heightPixels;
this.screenWidth = displayMetrics.widthPixels;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java
index 4f34df7dc6..efee6216d0 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java
@@ -9,18 +9,25 @@ package org.dolphinemu.dolphinemu.emulation.overlay;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
-import android.graphics.*;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnTouchListener;
+import android.view.WindowManager;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.NativeLibrary.ButtonState;
import org.dolphinemu.dolphinemu.NativeLibrary.ButtonType;
import org.dolphinemu.dolphinemu.R;
+import org.dolphinemu.dolphinemu.emulation.EmulationActivity;
import java.util.HashSet;
import java.util.Set;
@@ -34,6 +41,18 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
private final Set<InputOverlayDrawableButton> overlayButtons = new HashSet<InputOverlayDrawableButton>();
private final Set<InputOverlayDrawableJoystick> overlayJoysticks = new HashSet<InputOverlayDrawableJoystick>();
+ public static Bitmap resizeBitmap(WindowManager wm, Context context, Bitmap bitmap, float scale) {
+ // Retrieve screen dimensions.
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ wm.getDefaultDisplay().getMetrics(displayMetrics);
+
+ Bitmap bitmapResized = Bitmap.createScaledBitmap(bitmap,
+ (int)(displayMetrics.heightPixels * scale),
+ (int)(displayMetrics.heightPixels * scale),
+ false);
+ return bitmapResized;
+ }
+
/**
* Constructor
*
@@ -45,11 +64,15 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
super(context, attrs);
// Add all the overlay items to the HashSet.
- overlayButtons.add(initializeOverlayButton(context, R.drawable.button_a, ButtonType.BUTTON_A));
- overlayButtons.add(initializeOverlayButton(context, R.drawable.button_b, ButtonType.BUTTON_B));
- overlayButtons.add(initializeOverlayButton(context, R.drawable.button_start, ButtonType.BUTTON_START));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_a, ButtonType.BUTTON_A));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_b, ButtonType.BUTTON_B));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_x, ButtonType.BUTTON_X));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_y, ButtonType.BUTTON_Y));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_start, ButtonType.BUTTON_START));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_l, ButtonType.TRIGGER_L));
+ overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_r, ButtonType.TRIGGER_R));
overlayJoysticks.add(initializeOverlayJoystick(context,
- R.drawable.joy_outer, R.drawable.joy_inner,
+ R.drawable.gcpad_joystick_range, R.drawable.gcpad_joystick,
ButtonType.STICK_MAIN));
// Set the on touch listener.
@@ -88,30 +111,11 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// TODO: Refactor this so we detect either Axis movements or button presses so we don't run two loops all the time.
//
int buttonState = (event.getAction() == MotionEvent.ACTION_DOWN) ? ButtonState.PRESSED : ButtonState.RELEASED;
+ // Check if there was a touch within the bounds of a drawable.
for (InputOverlayDrawableButton button : overlayButtons)
- {
- // Check if there was a touch within the bounds of a drawable.
if (button.getBounds().contains((int)event.getX(), (int)event.getY()))
- {
- switch (button.getId())
- {
- case ButtonType.BUTTON_A:
- NativeLibrary.onTouchEvent(0, ButtonType.BUTTON_A, buttonState);
- break;
-
- case ButtonType.BUTTON_B:
- NativeLibrary.onTouchEvent(0, ButtonType.BUTTON_B, buttonState);
- break;
-
- case ButtonType.BUTTON_START:
- NativeLibrary.onTouchEvent(0, ButtonType.BUTTON_START, buttonState);
- break;
-
- default:
- break;
- }
- }
- }
+ NativeLibrary.onTouchEvent(0, button.getId(), buttonState);
+
for (InputOverlayDrawableJoystick joystick : overlayJoysticks)
{
@@ -120,9 +124,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
float[] axises = joystick.getAxisValues();
for (int a = 0; a < 4; ++a)
- {
NativeLibrary.onTouchAxisEvent(0, axisIDs[a], axises[a]);
- }
}
return true;
@@ -168,7 +170,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context);
// Initialize the InputOverlayDrawableButton.
- final Bitmap bitmap = BitmapFactory.decodeResource(res, resId);
+ final Bitmap bitmap = resizeBitmap(EmulationActivity.wm, context, BitmapFactory.decodeResource(res, resId), 0.20f);
final InputOverlayDrawableButton overlayDrawable = new InputOverlayDrawableButton(res, bitmap, buttonId);
// String ID of the Drawable. This is what is passed into SharedPreferences
@@ -212,7 +214,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context);
// Initialize the InputOverlayDrawableJoystick.
- final Bitmap bitmapOuter = BitmapFactory.decodeResource(res, resOuter);
+ final Bitmap bitmapOuter = resizeBitmap(EmulationActivity.wm, context, BitmapFactory.decodeResource(res, resOuter), 0.30f);
final Bitmap bitmapInner = BitmapFactory.decodeResource(res, resInner);
// String ID of the Drawable. This is what is passed into SharedPreferences
@@ -226,7 +228,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// Now set the bounds for the InputOverlayDrawableJoystick.
// This will dictate where on the screen (and the what the size) the InputOverlayDrawableJoystick will be.
- int outerSize = bitmapOuter.getWidth() + 256;
+ int outerSize = bitmapOuter.getWidth();
Rect outerRect = new Rect(drawableX, drawableY, drawableX + outerSize, drawableY + outerSize);
Rect innerRect = new Rect(0, 0, outerSize / 4, outerSize / 4);
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java
index 582a8c3f80..791e5812e9 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java
@@ -80,6 +80,7 @@ public final class InputOverlayDrawableJoystick extends BitmapDrawable
}
}
}
+
if (trackid == -1)
return;
float touchX = event.getX();
@@ -101,27 +102,15 @@ public final class InputOverlayDrawableJoystick extends BitmapDrawable
public float[] getAxisValues()
{
- float[] joyaxises = new float[4];
+ float[] joyaxises = {0f, 0f, 0f, 0f};
if (axises[0] >= 0.0f)
- {
- joyaxises[0] = 0.0f;
joyaxises[1] = Math.min(axises[0], 1.0f);
- }
else
- {
joyaxises[0] = Math.min(Math.abs(axises[0]), 1.0f);
- joyaxises[1] = 0.0f;
- }
if (axises[1] >= 0.0)
- {
- joyaxises[2] = 0.0f;
joyaxises[3] = Math.min(axises[1], 1.0f);
- }
else
- {
joyaxises[2] = Math.min(Math.abs(axises[1]), 1.0f);
- joyaxises[3] = 0.0f;
- }
return joyaxises;
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigActivity.java
index aaed9a74a7..5158fd683f 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigActivity.java
@@ -6,6 +6,7 @@
package org.dolphinemu.dolphinemu.settings.input.overlayconfig;
+import android.view.WindowManager;
import org.dolphinemu.dolphinemu.R;
import android.app.Activity;
@@ -22,16 +23,28 @@ public final class OverlayConfigActivity extends Activity
{
super.onCreate(savedInstanceState);
+ WindowManager wm = getWindowManager();
+
// Initialize all of the buttons to add.
- final OverlayConfigButton buttonA = new OverlayConfigButton(this, "button_a", R.drawable.button_a);
- final OverlayConfigButton buttonB = new OverlayConfigButton(this, "button_b", R.drawable.button_b);
- final OverlayConfigButton buttonS = new OverlayConfigButton(this, "button_start", R.drawable.button_start);
+ final OverlayConfigButton buttonA = new OverlayConfigButton(wm, this, "gcpad_a", R.drawable.gcpad_a);
+ final OverlayConfigButton buttonB = new OverlayConfigButton(wm, this, "gcpad_b", R.drawable.gcpad_b);
+ final OverlayConfigButton buttonX = new OverlayConfigButton(wm, this, "gcpad_x", R.drawable.gcpad_x);
+ final OverlayConfigButton buttonY = new OverlayConfigButton(wm, this, "gcpad_y", R.drawable.gcpad_y);
+ final OverlayConfigButton buttonS = new OverlayConfigButton(wm, this, "gcpad_start", R.drawable.gcpad_start);
+ final OverlayConfigButton buttonL = new OverlayConfigButton(wm, this, "gcpad_l", R.drawable.gcpad_l);
+ final OverlayConfigButton buttonR = new OverlayConfigButton(wm, this, "gcpad_r", R.drawable.gcpad_r);
+ final OverlayConfigButton joystick = new OverlayConfigButton(wm, this, "gcpad_joystick_range", R.drawable.gcpad_joystick_range);
// Add the buttons to the layout
final RelativeLayout configLayout = new RelativeLayout(this);
configLayout.addView(buttonA);
configLayout.addView(buttonB);
+ configLayout.addView(buttonX);
+ configLayout.addView(buttonY);
configLayout.addView(buttonS);
+ configLayout.addView(buttonL);
+ configLayout.addView(buttonR);
+ configLayout.addView(joystick);
// Now set the layout
setContentView(configLayout);
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigButton.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigButton.java
index 3592664cbd..380369014d 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigButton.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/overlayconfig/OverlayConfigButton.java
@@ -8,11 +8,17 @@ package org.dolphinemu.dolphinemu.settings.input.overlayconfig;
import android.content.Context;
import android.content.SharedPreferences;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
+import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
+import android.view.WindowManager;
import android.widget.Button;
+import org.dolphinemu.dolphinemu.R;
/**
* A movable {@link Button} for use within the
@@ -36,6 +42,18 @@ public final class OverlayConfigButton extends Button implements OnTouchListener
// float buttonY = sPrefs.getFloat(buttonId+"-Y", -1f);
//
private final String buttonId;
+ private Drawable resizeDrawable(WindowManager wm, Context context, Drawable image, float scale) {
+ // Retrieve screen dimensions.
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ wm.getDefaultDisplay().getMetrics(displayMetrics);
+
+ Bitmap b = ((BitmapDrawable)image).getBitmap();
+ Bitmap bitmapResized = Bitmap.createScaledBitmap(b,
+ (int)(displayMetrics.heightPixels * scale),
+ (int)(displayMetrics.heightPixels * scale),
+ false);
+ return new BitmapDrawable(context.getResources(), bitmapResized);
+ }
/**
* Constructor
@@ -44,7 +62,7 @@ public final class OverlayConfigButton extends Button implements OnTouchListener
* @param buttonId the String ID for this button.
* @param drawableId the Drawable ID for the image to represent this OverlayConfigButton.
*/
- public OverlayConfigButton(Context context, String buttonId, int drawableId)
+ public OverlayConfigButton(WindowManager wm, Context context, String buttonId, int drawableId)
{
super(context);
@@ -55,7 +73,9 @@ public final class OverlayConfigButton extends Button implements OnTouchListener
setOnTouchListener(this);
// Set the button's icon that represents it.
- setBackground(context.getResources().getDrawable(drawableId));
+ setBackground(resizeDrawable(wm, context,
+ context.getResources().getDrawable(drawableId),
+ drawableId == R.drawable.gcpad_joystick_range ? 0.30f : 0.20f));
// Get the SharedPreferences instance.
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);