Merge pull request #328 from ThePlayground/master

Fix the mapping to avoid dealing with OUYA default configs
This commit is contained in:
TwistedUmbrella 2014-02-25 01:58:45 -05:00
commit da60601205
6 changed files with 44 additions and 22 deletions

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="1.0"
android:toAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="1000"
android:repeatCount="0"/>
</set>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="1000"
android:repeatCount="0"/>
</set>

View File

@ -41,4 +41,9 @@
<item name="android:shadowRadius">1</item> <item name="android:shadowRadius">1</item>
</style> </style>
<style name="Animation">
<item name="@android:windowEnterAnimation">@anim/popup_show</item>
<item name="@android:windowExitAnimation">@anim/popup_hide</item>
</style>
</resources> </resources>

View File

@ -187,10 +187,8 @@ public class GL2JNIActivity extends Activity {
setContentView(mView); setContentView(mView);
String menu_spec; String menu_spec;
if (pad.isXperiaPlay) { if (pad.isXperiaPlay || pad.isOuyaOrTV) {
menu_spec = getApplicationContext().getString(R.string.menu_button); menu_spec = getApplicationContext().getString(R.string.menu_button);
} else if (pad.isOuyaOrTV) {
menu_spec = getApplicationContext().getString(R.string.right_button);
} else { } else {
menu_spec = getApplicationContext().getString(R.string.back_button); menu_spec = getApplicationContext().getString(R.string.back_button);
} }
@ -379,6 +377,9 @@ public class GL2JNIActivity extends Activity {
public boolean handle_key(Integer playerNum, int kc, boolean down) { public boolean handle_key(Integer playerNum, int kc, boolean down) {
if (playerNum == null || playerNum == -1) if (playerNum == null || playerNum == -1)
return false; return false;
if (kc == KeyEvent.KEYCODE_BUTTON_SELECT) {
return false;
}
if (pad.isActiveMoga[playerNum]) { if (pad.isActiveMoga[playerNum]) {
return false; return false;
} }

View File

@ -97,7 +97,7 @@ public class OnScreenMenu {
public DebugPopup(Context c) { public DebugPopup(Context c) {
super(c); super(c);
setBackgroundDrawable(null); setBackgroundDrawable(null);
int p = getPixelsFromDp(60, mContext); int p = getPixelsFromDp(72, mContext);
LayoutParams debugParams = new LayoutParams(p, p); LayoutParams debugParams = new LayoutParams(p, p);
LinearLayout hlay = new LinearLayout(mContext); LinearLayout hlay = new LinearLayout(mContext);
@ -172,7 +172,7 @@ public class OnScreenMenu {
public ConfigPopup(Context c) { public ConfigPopup(Context c) {
super(c); super(c);
setBackgroundDrawable(null); setBackgroundDrawable(null);
int p = getPixelsFromDp(60, mContext); int p = getPixelsFromDp(72, mContext);
LayoutParams configParams = new LayoutParams(p, p); LayoutParams configParams = new LayoutParams(p, p);
LinearLayout hlay = new LinearLayout(mContext); LinearLayout hlay = new LinearLayout(mContext);
@ -341,8 +341,8 @@ public class OnScreenMenu {
public VmuPopup(Context c) { public VmuPopup(Context c) {
super(c); super(c);
setBackgroundDrawable(null); setBackgroundDrawable(null);
int pX = OnScreenMenu.getPixelsFromDp(80, mContext); int pX = OnScreenMenu.getPixelsFromDp(96, mContext);
int pY = OnScreenMenu.getPixelsFromDp(56, mContext); int pY = OnScreenMenu.getPixelsFromDp(68, mContext);
vparams = new LayoutParams(pX, pY); vparams = new LayoutParams(pX, pY);
vlay = new LinearLayout(mContext); vlay = new LinearLayout(mContext);
vlay.setOrientation(LinearLayout.HORIZONTAL); vlay.setOrientation(LinearLayout.HORIZONTAL);
@ -350,7 +350,7 @@ public class OnScreenMenu {
} }
public void showVmu() { public void showVmu() {
vmuLcd.configureScale(80); vmuLcd.configureScale(96);
vlay.addView(vmuLcd, vparams); vlay.addView(vmuLcd, vparams);
} }
@ -363,13 +363,13 @@ public class OnScreenMenu {
public MainPopup(Context c) { public MainPopup(Context c) {
super(c); super(c);
setBackgroundDrawable(null); setBackgroundDrawable(null);
int p = getPixelsFromDp(60, mContext); int p = getPixelsFromDp(72, mContext);
params = new LayoutParams(p, p); params = new LayoutParams(p, p);
hlay = new LinearLayout(mContext); hlay = new LinearLayout(mContext);
hlay.setOrientation(LinearLayout.HORIZONTAL); hlay.setOrientation(LinearLayout.HORIZONTAL);
int vpX = getPixelsFromDp(60, mContext); int vpX = getPixelsFromDp(72, mContext);
int vpY = getPixelsFromDp(42, mContext); int vpY = getPixelsFromDp(52, mContext);
LinearLayout.LayoutParams vmuParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams vmuParams = new LinearLayout.LayoutParams(
vpX, vpY); vpX, vpY);
vmuParams.weight = 1.0f; vmuParams.weight = 1.0f;
@ -439,10 +439,11 @@ public class OnScreenMenu {
}), params); }), params);
setContentView(hlay); setContentView(hlay);
this.setAnimationStyle(R.style.Animation);
} }
public void showVmu() { public void showVmu() {
vmuLcd.configureScale(60); vmuLcd.configureScale(72);
hlay.addView(vmuLcd, 0, params); hlay.addView(vmuLcd, 0, params);
} }
} }

View File

@ -97,9 +97,8 @@ public class Gamepad {
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT, OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT, OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
OuyaController.BUTTON_MENU, key_CONT_START,
getStartButtonCode(), key_CONT_START, getStartButtonCode(), key_CONT_START,
OuyaController.BUTTON_R3, getSelectButtonCode() OuyaController.BUTTON_R3, key_CONT_START
}; };
} }