Skip to content

Commit

Permalink
[Android] Move the instantiation of the NativeGLSurfaceView into a la…
Browse files Browse the repository at this point in the history
…yout file. This will allow the addition of other components in the future, such as overlays, etc.
  • Loading branch information
lioncash committed Aug 29, 2013
1 parent 01764fe commit 335839b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Source/Android/res/layout/emulation_view.xml
@@ -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>
Expand Up @@ -27,7 +27,6 @@

public final class DolphinEmulator<MainActivity> extends Activity
{
private static NativeGLSurfaceView GLview = null;
private static boolean Running = false;

private float screenWidth;
Expand Down Expand Up @@ -154,11 +153,10 @@ public void onActivityResult(int requestCode, int resultCode, Intent data)
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;
}
}
Expand Down
Expand Up @@ -7,6 +7,7 @@
package org.dolphinemu.dolphinemu;

import android.content.Context;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

Expand All @@ -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()
Expand Down

0 comments on commit 335839b

Please sign in to comment.