[Android] Move the instantiation of the NativeGLSurfaceView into a layout file. This will allow the addition of other components in the future, such as overlays, etc.

This commit is contained in:
Lioncash 2013-08-29 13:13:44 -04:00
parent 01764fef67
commit 335839b27f
3 changed files with 19 additions and 5 deletions

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<!-- This is what everything is rendered to during emulation -->
<org.dolphinemu.dolphinemu.NativeGLSurfaceView
android:id="@+id/emulationView"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:focusable="false"
android:focusableInTouchMode="false"/>
</RelativeLayout>

View File

@ -27,7 +27,6 @@ import org.dolphinemu.dolphinemu.settings.UserPreferences;
public final class DolphinEmulator<MainActivity> extends Activity
{
private static NativeGLSurfaceView GLview = null;
private static boolean Running = false;
private float screenWidth;
@ -154,11 +153,10 @@ public final class DolphinEmulator<MainActivity> extends Activity
screenHeight = displayMetrics.heightPixels;
String FileName = data.getStringExtra("Select");
GLview = new NativeGLSurfaceView(this);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
NativeLibrary.SetFilename(FileName);
setContentView(GLview);
setContentView(R.layout.emulation_view);
Running = true;
}
}

View File

@ -7,6 +7,7 @@
package org.dolphinemu.dolphinemu;
import android.content.Context;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@ -24,9 +25,10 @@ public final class NativeGLSurfaceView extends SurfaceView
*
* @param context The current {@link Context}.
*/
public NativeGLSurfaceView(Context context)
public NativeGLSurfaceView(Context context, AttributeSet attribs)
{
super(context);
super(context, attribs);
if (!Created)
{
myRun = new Thread()