From 9f36081a8f84cbef302a210a4c779250133ec5ba Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 25 Oct 2013 16:52:46 -0400 Subject: [PATCH] [Android] Implement a very basic version of the input overlay configuration screen. Still a bit of a mess, but this will get cleaned up during finalizations. --- Source/Android/AndroidManifest.xml | 2 + Source/Android/res/drawable/button_a.png | Bin 0 -> 5178 bytes Source/Android/res/drawable/button_b.png | Bin 0 -> 4971 bytes Source/Android/res/drawable/button_start.png | Bin 0 -> 1511 bytes Source/Android/res/layout/emulation_view.xml | 8 + .../layout/input_overlay_config_layout.xml | 32 ++++ Source/Android/res/xml/input_prefs.xml | 164 +++++++++--------- .../dolphinemu/dolphinemu/AboutFragment.java | 2 +- .../emulation/EmulationActivity.java | 4 +- .../emulation/overlay/InputOverlay.java | 64 +++++++ .../emulation/overlay/InputOverlayItem.java | 107 ++++++++++++ .../dolphinemu/settings/PrefsActivity.java | 3 + .../{ => cpu}/CPUSettingsFragment.java | 2 +- .../{ => input}/InputConfigFragment.java | 13 +- .../input/InputOverlayConfigActivity.java | 27 +++ .../input/InputOverlayConfigButton.java | 52 ++++++ .../{ => video}/VideoSettingsFragment.java | 2 +- 17 files changed, 395 insertions(+), 87 deletions(-) create mode 100644 Source/Android/res/drawable/button_a.png create mode 100644 Source/Android/res/drawable/button_b.png create mode 100644 Source/Android/res/drawable/button_start.png create mode 100644 Source/Android/res/layout/input_overlay_config_layout.xml create mode 100644 Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java create mode 100644 Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayItem.java rename Source/Android/src/org/dolphinemu/dolphinemu/settings/{ => cpu}/CPUSettingsFragment.java (96%) rename Source/Android/src/org/dolphinemu/dolphinemu/settings/{ => input}/InputConfigFragment.java (95%) create mode 100644 Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigActivity.java create mode 100644 Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigButton.java rename Source/Android/src/org/dolphinemu/dolphinemu/settings/{ => video}/VideoSettingsFragment.java (99%) diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml index 2e3964c65f..5b2a3cfee9 100644 --- a/Source/Android/AndroidManifest.xml +++ b/Source/Android/AndroidManifest.xml @@ -38,6 +38,8 @@ + + diff --git a/Source/Android/res/drawable/button_a.png b/Source/Android/res/drawable/button_a.png new file mode 100644 index 0000000000000000000000000000000000000000..7e685324ae8a4ad016eb1033d64b659966cfcd0c GIT binary patch literal 5178 zcmV-A6vgX_P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv000xINkl3->0*ld463ly0(2j;w8-0-JBOSm`oJPffy!0nG4`<)C z(Qguh{~`P>aNd>*R~6Mnw?`+VmifSqgA|}^97wg%Zv&yd@Sm7@ou*yB{pK@ver+U( z1bZPN_#XpC-$m$LGj#Ca!Ggyhf4tzpfdh{C4y6t*4Z|6lV@x$GK)ztwK&TQkzs%Tp zZS-*f#Jf1aq#*nE?=RT9cW=R-J$njv?b=nabLY;29Xobp5%+jT8`|XX+@eAo)aj{yeJkP zmG_}eo>&g3L)f{WZ3IVXFYx;H>zl1xx31aRwQGx^HEY&nk-twH+5!^q(g)fC5cJ)^ zENY`oX<_%gX#&ng19(->XaG(w$qchDH7K5hY%!ZeqFExfQRR;*|%YA5QjeEIT=L*kx2Ya4*lLSQtfFZwjoNCm-6 zv>t?5TR%9b=pbZY$=H~wy+Y2WB&Y}<&b$|1g13@TZ6s(r5khwoT~bz7cB!6SCP6QU z_|84iCDsOT0ICgrh|mb94FC+#jF%QAvV20EG@U#vB`AI)n(srM(EU&A_;|827=a;X z$ImF|=2;V*s zo>?C#L5GXRsLce??V{-d><**p`aPLvv=NO!BTO3r0l(2+AY8;4-V{s|QnkP$L%kMg zBJ)~BYWDxqkn^j%Q)!D0@Aa7p0AOYa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zsOP-8?J+B%^{^yyBI ziNds(1D5UxovZ(c2P0zMPo4EKd+X32e*Vxv_@G5i;V?V-N%<-3JfPH(ZEFXJQ43ui zFe$_$CPM%RCED@6J6j0YM4{yQL5}CKxN$4K`oog0%5=`hXA4h63ja}0jXWFZ_9h?11b{GMgBOgz%OJ>PNZ@i*ZmDg z!iW2Rj?b{@kvsc2^OI)P(T1S&kKCznnFC>kL(TpWbZ{=1^S;S*!A^*LNP;44kyN|L z&JMf&P;f3fCs=pa4PGM%=_;M=LPh~<#`Wb{r?HF*d)bG z9F*qYDaPB;&qR37fK1^54HW(>B(t;Q*4dxsADiO8=WI&m_n8BoIZm`RVUF`_YIgU2 zSY!xJlb?3~AxdaOem$qRvOj55NpQb)SAP;T@JHt|M$_Mo>uldj{yQxElN6rWva&4m z$Y(Hw=C5*@qi$(`qKZ#@y!|Kr!==l-YNMYe{~e~^A1A>vVU7bz8cA!8x*VQ=prn+? z+`W1rPUXG0$p`UsZDYq!-h;s$f0b+ezl6C2j`NPNR(Q(&i8Akn&ACd}#P{v5vhh)v z#{N9nn84W;93O5u^||EFR`3QmDH@no94B+ksnWTCh|Qpy*>2KF?UG|K|h!ADl_LSGuB8N&o-=07*qoM6N<$g0#@{_y7O^ literal 0 HcmV?d00001 diff --git a/Source/Android/res/drawable/button_b.png b/Source/Android/res/drawable/button_b.png new file mode 100644 index 0000000000000000000000000000000000000000..21da4c20f123fe6409b57cc6d837fd0f60786098 GIT binary patch literal 4971 zcmV-x6O`Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv000u&Nkl#ha<5{UH9txuIOkZs809n`&%Ts0+5dL7Mp+hx=8#iZN56lus~=G z^GCTaaPJYVwOL@?*!;U~#ueG%;YhSLCE<7mhNB0Na5}l)^@HUA@@`!uHsv#ADq?zo zpYg=zwNdDhX!8d-c_aTCE$TUE&YT=*_Uzdn@p|suxjFOZ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Q;^^4kHEBY5eu zYZ3`<@E^iSuKL>}CKPLOGkyO@v6(24fz0W$)KsO$kSdnC>0S0w5=UjJ2o1 zsjqC9IhK1fsb;`eQ1-UJ2V6vw6{JMzI%(UEpNYHXwl8RE$Flck{VqV5pR=UZ_=6?y zhWq*JPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv000G6Nkl897v-$ zsHv&>er#;)+VSymtF%2HK6X@2 zP+bQrKO*W zaffF`Ma6AbSJ$J&#Kil^A&(yV*ukD!qS7w_{uO?5MoGbHh(&JO+uKJ)dEW5%_y098 zFwk67RCHGmYF>1^FL?4^US4h>BFG_+9{Sk9p2`JDMh!qgLBSJ!_^E4h2)kL0Am~SR zb#*smV`IN11%7^hzePt!uf@m5e@!}aa&i^`L1d6a9zFE2gFQ73lsmpP0ELBxJ1PJ= z8|0zB2_rdeX=#}dJo%V#hlhthAlv|9czSy7hlYl3h-fVE9XaIDLmxZX!>;rrqP1ZY z0PPh8@<*LhYR%2f6NHzX6ZV9Jg!=&T_4R$??(Y7#tOnA79P;R)j~(n`*C_ywB7hUZ z9v2t45)%`%%2T9c6%dg0)Dg(e&i>0;4v=GVP0j(4l$5k2IY4g^-1yxY4#2yU6!6Dv zHlKvYRu$l!Rf=8np0z5V7eq!z{^(2<$P*MK{6pV{?e&3(h=`xOy}kbgL~(KPT{v;( z%$d)47hE_H<4y^_;-;ry`9DY!dpT_p3M&5qimd5&8{V=R&PN zbMa95Kt%q_nGomlt{`kbwRu^wT*0(U1w`RAt3RTh_Eb#RIqX=XdkE?69?dNv%#stF zURGCEdtT;#U?H5Ab1|Mdbgm*3!gCS?ykPgTcP*0uNga0z(x~YF@=|w1Vc@J7JBlIr zame-!Aa#hY_*e + + + \ No newline at end of file diff --git a/Source/Android/res/layout/input_overlay_config_layout.xml b/Source/Android/res/layout/input_overlay_config_layout.xml new file mode 100644 index 0000000000..868f0b3166 --- /dev/null +++ b/Source/Android/res/layout/input_overlay_config_layout.xml @@ -0,0 +1,32 @@ + + + + + + + + + \ No newline at end of file diff --git a/Source/Android/res/xml/input_prefs.xml b/Source/Android/res/xml/input_prefs.xml index 899e559480..5dc15ac75e 100644 --- a/Source/Android/res/xml/input_prefs.xml +++ b/Source/Android/res/xml/input_prefs.xml @@ -2,86 +2,90 @@ + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 8b29e607d7..3695bfa40b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -20,7 +20,7 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.List; -import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment; +import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment; /** * Represents the about screen. diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java index 912fc021c5..8b8f4e0551 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java @@ -21,8 +21,8 @@ import android.view.WindowManager.LayoutParams; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; -import org.dolphinemu.dolphinemu.settings.InputConfigFragment; -import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment; +import org.dolphinemu.dolphinemu.settings.input.InputConfigFragment; +import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment; import java.util.List; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java new file mode 100644 index 0000000000..c2272fdc5f --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java @@ -0,0 +1,64 @@ +package org.dolphinemu.dolphinemu.emulation.overlay; + +import java.util.HashSet; +import java.util.Set; + +import android.content.Context; +import android.graphics.Canvas; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.SurfaceView; +import android.view.View; +import android.view.View.OnTouchListener; + +/** + * Draws the interactive input overlay on top of the + * {@link NativeGLSurfaceView} that is rendering emulation. + */ +public final class InputOverlay extends SurfaceView implements OnTouchListener +{ + private final Set overlayItems = new HashSet(); + + /** + * Constructor + * + * @param context The current {@link Context}. + * @param attrs {@link AttributeSet} for parsing XML attributes. + */ + public InputOverlay(Context context, AttributeSet attrs) + { + super(context, attrs); + + // Force draw + setWillNotDraw(false); + + // Request focus for the overlay so it has priority on presses. + requestFocus(); + } + + @Override + public boolean onTouch(View v, MotionEvent event) + { + switch (event.getAction()) + { + case MotionEvent.ACTION_DOWN: + { + // TODO: Handle down presses. + return true; + } + } + + return false; + } + + @Override + public void onDraw(Canvas canvas) + { + super.onDraw(canvas); + + for (InputOverlayItem item : overlayItems) + { + item.draw(canvas); + } + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayItem.java new file mode 100644 index 0000000000..a45578b263 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayItem.java @@ -0,0 +1,107 @@ +package org.dolphinemu.dolphinemu.emulation.overlay; + +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.BitmapDrawable; + +/** + * Represents a drawable image for the {@link InputOverlay} + */ +public final class InputOverlayItem +{ + // The image as a BitmapDrawable + private BitmapDrawable drawable; + + // Width and height of the underlying image. + private int width; + private int height; + + // X and Y coordinates to display this item at. + private int x; + private int y; + + // Image scale factor. + private float scaleFactor = 1.0f; + + // Rectangle that we draw this item to. + private Rect drawRect; + + /** + * Constructor. + * + * @param res Reference to the app resources for fetching display metrics. + * @param resId Resource ID of the {@link BitmapDrawable} to encapsulate. + */ + public InputOverlayItem(Resources res, int resId) + { + // Idiot-proof the constructor. + if (res == null) + throw new IllegalArgumentException("res cannot be null"); + + // Everything is valid, decode the filename as a bitmap. + drawable = (BitmapDrawable) res.getDrawable(resId); + Bitmap image = drawable.getBitmap(); + + // Set width/height + width = image.getWidth(); + height = image.getHeight(); + + // Initialize rectangle to zero width, height, x, and y. + drawRect = new Rect(); + } + + /** + * Constructor + * + * @param res Reference to the app resources for fetching display metrics. + * @param resId Resource ID of the {@link BitmapDrawable} to encapsulate. + * @param x X coordinate on the screen to place the control. + * @param y Y coordinate on the screen to place the control. + */ + public InputOverlayItem(Resources res, int resId, int x, int y) + { + this(res, resId); + + setPosition(x, y); + } + + /** + * Sets the position of this item on the screen. + * + * @param x New x-coordinate for this image. + * @param y New y-coordinate for this image. + */ + public void setPosition(int x, int y) + { + this.x = x; + this.y = y; + + drawRect.set(x, y, x + (int)(width * scaleFactor), y + (int)(height * scaleFactor)); + drawable.setBounds(drawRect); + } + + /** + * Sets a new scaling factor for the current image. + * + * @param scaleFactor The new scaling factor. Note that 1.0 is normal size. + */ + public void setScaleFactor(float scaleFactor) + { + this.scaleFactor = scaleFactor; + + // Adjust for the new scale factor. + setPosition(x, y); + } + + /** + * Draws this item to a given canvas. + * + * @param canvas The canvas to draw this item to. + */ + public void draw(Canvas canvas) + { + drawable.draw(canvas); + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java index 51153866e1..5368475319 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java @@ -7,6 +7,9 @@ package org.dolphinemu.dolphinemu.settings; import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.settings.cpu.CPUSettingsFragment; +import org.dolphinemu.dolphinemu.settings.input.InputConfigFragment; +import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment; import android.app.ActionBar; import android.app.ActionBar.Tab; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/cpu/CPUSettingsFragment.java similarity index 96% rename from Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java rename to Source/Android/src/org/dolphinemu/dolphinemu/settings/cpu/CPUSettingsFragment.java index 47f0cb7d35..77caec2b83 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/cpu/CPUSettingsFragment.java @@ -4,7 +4,7 @@ * Refer to the license.txt file included. */ -package org.dolphinemu.dolphinemu.settings; +package org.dolphinemu.dolphinemu.settings.cpu; import org.dolphinemu.dolphinemu.R; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputConfigFragment.java similarity index 95% rename from Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java rename to Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputConfigFragment.java index a23f1b4a3f..2ada44ccff 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputConfigFragment.java @@ -4,12 +4,13 @@ * Refer to the license.txt file included. */ -package org.dolphinemu.dolphinemu.settings; +package org.dolphinemu.dolphinemu.settings.input; import android.app.AlertDialog; import android.app.Fragment; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.preference.Preference; @@ -115,9 +116,17 @@ public final class InputConfigFragment extends PreferenceFragment // Everything is set, show the dialog. dialog.show(); + return true; } - return true; + if (pref.getKey().equals("inputOverlayConfigPref")) + { + Intent inputOverlayConfig = new Intent(getActivity(), InputOverlayConfigActivity.class); + startActivity(inputOverlayConfig); + return true; + } + + return false; } /** diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigActivity.java new file mode 100644 index 0000000000..3084c181d1 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigActivity.java @@ -0,0 +1,27 @@ +/** + * Copyright 2013 Dolphin Emulator Project + * Licensed under GPLv2 + * Refer to the license.txt file included. + */ + +package org.dolphinemu.dolphinemu.settings.input; + +import org.dolphinemu.dolphinemu.R; + +import android.app.Activity; +import android.os.Bundle; + +/** + * {@link Activity} used for configuring the input overlay. + */ +public final class InputOverlayConfigActivity extends Activity +{ + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + // Set the initial layout. + setContentView(R.layout.input_overlay_config_layout); + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigButton.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigButton.java new file mode 100644 index 0000000000..cca596e85c --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/input/InputOverlayConfigButton.java @@ -0,0 +1,52 @@ +/** + * Copyright 2013 Dolphin Emulator Project + * Licensed under GPLv2 + * Refer to the license.txt file included. + */ + +package org.dolphinemu.dolphinemu.settings.input; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnTouchListener; +import android.widget.Button; + +/** + * A movable {@link Button} for use within the + * input overlay configuration screen. + */ +public final class InputOverlayConfigButton extends Button implements OnTouchListener +{ + /** + * Constructor + * + * @param context The current {@link Context}. + * @param attribs {@link AttributeSet} for parsing XML attributes. + */ + public InputOverlayConfigButton(Context context, AttributeSet attribs) + { + super(context, attribs); + + // Set the button as its own OnTouchListener. + setOnTouchListener(this); + } + + @Override + public boolean onTouch(View v, MotionEvent event) + { + switch(event.getAction()) + { + // Only change the X/Y coordinates when we move the button. + case MotionEvent.ACTION_MOVE: + { + setX(getX() + event.getX()); + setY(getY() + event.getY()); + return true; + } + } + + return false; + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java similarity index 99% rename from Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java rename to Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java index fffea888a7..47f9ef475f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java @@ -4,7 +4,7 @@ * Refer to the license.txt file included. */ -package org.dolphinemu.dolphinemu.settings; +package org.dolphinemu.dolphinemu.settings.video; import android.app.Activity; import android.content.SharedPreferences;