[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:
parent
01764fef67
commit
335839b27f
|
@ -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>
|
|
@ -27,7 +27,6 @@ import org.dolphinemu.dolphinemu.settings.UserPreferences;
|
||||||
|
|
||||||
public final class DolphinEmulator<MainActivity> extends Activity
|
public final class DolphinEmulator<MainActivity> extends Activity
|
||||||
{
|
{
|
||||||
private static NativeGLSurfaceView GLview = null;
|
|
||||||
private static boolean Running = false;
|
private static boolean Running = false;
|
||||||
|
|
||||||
private float screenWidth;
|
private float screenWidth;
|
||||||
|
@ -154,11 +153,10 @@ public final class DolphinEmulator<MainActivity> extends Activity
|
||||||
screenHeight = displayMetrics.heightPixels;
|
screenHeight = displayMetrics.heightPixels;
|
||||||
|
|
||||||
String FileName = data.getStringExtra("Select");
|
String FileName = data.getStringExtra("Select");
|
||||||
GLview = new NativeGLSurfaceView(this);
|
|
||||||
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
|
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
|
||||||
NativeLibrary.SetFilename(FileName);
|
NativeLibrary.SetFilename(FileName);
|
||||||
setContentView(GLview);
|
setContentView(R.layout.emulation_view);
|
||||||
Running = true;
|
Running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.dolphinemu.dolphinemu;
|
package org.dolphinemu.dolphinemu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
|
|
||||||
|
@ -24,9 +25,10 @@ public final class NativeGLSurfaceView extends SurfaceView
|
||||||
*
|
*
|
||||||
* @param context The current {@link Context}.
|
* @param context The current {@link Context}.
|
||||||
*/
|
*/
|
||||||
public NativeGLSurfaceView(Context context)
|
public NativeGLSurfaceView(Context context, AttributeSet attribs)
|
||||||
{
|
{
|
||||||
super(context);
|
super(context, attribs);
|
||||||
|
|
||||||
if (!Created)
|
if (!Created)
|
||||||
{
|
{
|
||||||
myRun = new Thread()
|
myRun = new Thread()
|
||||||
|
|
Loading…
Reference in New Issue